This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH][AArch64] update libm-test-ulps


* Joseph Myers <joseph@codesourcery.com> [2015-04-10 17:42:23 +0000]:
> On Fri, 10 Apr 2015, Szabolcs Nagy wrote:
> 
> > shm_open does not work with static linking because __shm_directory
> > depends on dynamic linking (fails at link time), sem_open likewise
> > (except it segfaults at runtime)
> 
> Why does it depend on dynamic linking?  That looks rather like a bug to 
> me.  Functions should work for static linking unless there are strong 
> reasons it can't be supported.
> 

ok i was wrong (probably)

shm_open is in librt which references __shm_directory in libpthread
and i got the link error because the test system used -lrt -lpthread
in the wrong order

then __shm_directory segfaults because it uses __libc_once which
uses weakref __pthread_once for whatever reason

so the way to statically link something with shm_open is

cc foo.o -lrt -Wl,--whole-archive -lpthread -Wl,--no-whole-archive

but i find this solution unsatisfying


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]