Bug 25936 - libgomp needs to link against rt on HPUX
Summary: libgomp needs to link against rt on HPUX
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: libgomp (show other bugs)
Version: 4.2.0
: P3 normal
Target Milestone: 4.2.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-01-24 00:03 UTC by John David Anglin
Modified: 2006-02-13 19:02 UTC (History)
2 users (show)

See Also:
Host:
Target: hppa64-hp-hpux11.11
Build:
Known to work:
Known to fail:
Last reconfirmed: 2006-01-29 20:26:54


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John David Anglin 2006-01-24 00:03:16 UTC
Executing on host: /mnt/gnu/gcc-3.3/objdir/gcc/xgcc -B/mnt/gnu/gcc-3.3/objdir/gc
c/ /mnt/gnu/gcc-3.3/gcc/libgomp/testsuite/libgomp.c/appendix-a/a.15.1.c  -B/mnt/
gnu/gcc-3.3/objdir/hppa64-hp-hpux11.11/./libgomp/ -I/mnt/gnu/gcc-3.3/objdir/hppa
64-hp-hpux11.11/./libgomp -I/mnt/gnu/gcc-3.3/gcc/libgomp/testsuite/.. -fmessage-
length=0 -fopenmp  -O2 -fopenmp   -L/mnt/gnu/gcc-3.3/objdir/hppa64-hp-hpux11.11/
./libgomp/.libs -lgomp -lm   -o ./a.15.1.exe    (timeout = 300)
ld: (Warning) Unsatisfied symbol "sem_init" in file /mnt/gnu/gcc-3.3/objdir/hppa
64-hp-hpux11.11/./libgomp/.libs/libgomp.sl
ld: (Warning) Unsatisfied symbol "sem_post" in file /mnt/gnu/gcc-3.3/objdir/hppa
64-hp-hpux11.11/./libgomp/.libs/libgomp.sl
ld: (Warning) Unsatisfied symbol "sem_wait" in file /mnt/gnu/gcc-3.3/objdir/hppa
64-hp-hpux11.11/./libgomp/.libs/libgomp.sl
ld: (Warning) Unsatisfied symbol "sem_destroy" in file /mnt/gnu/gcc-3.3/objdir/h
ppa64-hp-hpux11.11/./libgomp/.libs/libgomp.sl
4 warnings.
output is:
ld: (Warning) Unsatisfied symbol "sem_init" in file /mnt/gnu/gcc-3.3/objdir/hppa
64-hp-hpux11.11/./libgomp/.libs/libgomp.sl
ld: (Warning) Unsatisfied symbol "sem_post" in file /mnt/gnu/gcc-3.3/objdir/hppa
64-hp-hpux11.11/./libgomp/.libs/libgomp.sl
ld: (Warning) Unsatisfied symbol "sem_wait" in file /mnt/gnu/gcc-3.3/objdir/hppa
64-hp-hpux11.11/./libgomp/.libs/libgomp.sl
ld: (Warning) Unsatisfied symbol "sem_destroy" in file /mnt/gnu/gcc-3.3/objdir/h
ppa64-hp-hpux11.11/./libgomp/.libs/libgomp.sl
4 warnings.

FAIL: libgomp.c/appendix-a/a.15.1.c (test for excess errors)

I'm not sure what's going on here.  While the header files and manpages seem
to indicate the presence of POSIX semaphores, they seem missing from the libraries.
Comment 1 Andrew Pinski 2006-01-24 00:59:31 UTC
I bet -lrt has to be linked in as sem_* are part of the real time extensions of POSIX.
Comment 2 dave 2006-01-24 02:12:08 UTC
Subject: Re:  FAIL: libgomp.c/appendix-a/a.15.1.c (test for excess errors)

> I bet -lrt has to be linked in as sem_* are part of the real time extensions of
> POSIX.

I believe that you would win that bet:

-bash-2.05b$ nm librt.2|less
Symbols from librt.2:

[Index]    Value                  Size    Type  Bind  O Shndx    Name
...
[98]     |   4611686018427395792|     100|FUNC |GLOB |0|   .text|sem_close
[119]    |   4611686018427395280|     164|FUNC |GLOB |0|   .text|sem_destroy
[60]     |   4611686018427396688|     160|FUNC |GLOB |0|   .text|sem_getvalue
[88]     |   4611686018427395072|     208|FUNC |GLOB |0|   .text|sem_init
[96]     |   4611686018427395464|     308|FUNC |GLOB |0|   .text|sem_open
[102]    |   4611686018427396512|     172|FUNC |GLOB |0|   .text|sem_post
[72]     |   4611686018427396208|     300|FUNC |GLOB |0|   .text|sem_trywait
[67]     |   4611686018427395896|     132|FUNC |GLOB |0|   .text|sem_unlink
[109]    |   4611686018427396032|     172|FUNC |GLOB |0|   .text|sem_wait

Dave
Comment 3 Andrew Pinski 2006-01-29 20:26:54 UTC
Confirmed.
Comment 4 roger 2006-02-08 17:46:26 UTC
This problem affects both hppa*-hp-hpux* and ia64-hp-hpux*.  It appears that
the required sem_init, sem_wait, sem_post, etc... symbols are defined both in
the -lrt libraries on HPUX and in the -lc_r libraries.  The fix is to update
LIB_SPEC, perhaps in the -pthread clause, for HPUX, but I'm not sure if it
requires adding -lrt or changing -lc to -lc_r, or adding -lc_r?  I notice that config/pa/pa-hpux10.h does mention -lc_r, but for use with -threads.

Should -pthread pull in the required symbols?  i.e. is this a libgomp problem
or a target problem?
Comment 5 dave 2006-02-08 18:17:55 UTC
Subject: Re:  libgomp needs to link against rt on HPUX

> This problem affects both hppa*-hp-hpux* and ia64-hp-hpux*.  It appears that
> the required sem_init, sem_wait, sem_post, etc... symbols are defined both in
> the -lrt libraries on HPUX and in the -lc_r libraries.  The fix is to update
> LIB_SPEC, perhaps in the -pthread clause, for HPUX, but I'm not sure if it
> requires adding -lrt or changing -lc to -lc_r, or adding -lc_r?  I notice that
> config/pa/pa-hpux10.h does mention -lc_r, but for use with -threads.

I'm not 100% certain but I believe libc_r needs to be used with dce
threads, and librt with posix threads.  HP-UX 10 doesn't have the latter.
We only support posix threads on hppa*-hp-hpux11*.

> Should -pthread pull in the required symbols?  i.e. is this a libgomp problem
> or a target problem?

Although it's relatively easy to change LIB_SPEC, I'd like to keep the
number of libraries that are linked against to a minimum.

Dave
Comment 6 Roger Sayle 2006-02-13 02:33:41 UTC
Subject: Bug 25936

Author: sayle
Date: Mon Feb 13 02:33:37 2006
New Revision: 110908

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=110908
Log:
2006-02-12  Roger Sayle  <roger@eyesopen.com>
	    John David Anglin  <dave@hiauly1.hia.nrc.ca>

	PR libgomp/25936
	* configure.tgt: Link against -lrt for sem_init on HPUX v11 systems.
 

Modified:
    trunk/libgomp/ChangeLog
    trunk/libgomp/configure.tgt

Comment 7 roger 2006-02-13 19:02:01 UTC
This has now been fixed on mainline.