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: assertion fails in elf/get-dynamic-info.h


On Jun 3, 2018, at 6:40 AM, Florian Weimer <fw@deneb.enyo.de> wrote:
> 
> * Chris Aoki:
> 
>> The glibc wiki includes helpful instructions for
>> testing a prototype glibc build.   The instructions are
>> found under the heading “Compile against glibc in an
>> installed location” at the following URL:
>> 
>> https://sourceware.org/glibc/wiki/Testing/Builds#Compile_against_glibc_in_an_installed_location
>> 
>> However, when I have followed these instructions, the
>> prototype glibc fails an assertion early in process startup.
>> In the file get-dynamic-info.h:
>> 
>>  /* Flags must not be set for ld.so.  */
>>  assert (info[DT_RUNPATH] == NULL);
>>  assert (info[DT_RPATH] == NULL);
>> 
>> As far as I can determine, the above assertions defeat the use
>> of the following flags given in the aforementioned instructions:
>> 
>>> SYSROOT=<path to the GLIBC install directory>
>>> ...
>>>  -Wl,-rpath=${SYSROOT}/lib64 \
>>>  -Wl,--dynamic-linker=${SYSROOT}/lib64/ld-<version>.so \
> 
> Do you specify those flags when building glibc itself?  That's not
> correct.  You should use them only when building against a
> built-but-not-installed glibc.

Thanks for the clue.   I only use the above flags when linking the
application against the prototype glibc, as opposed to the glibc
installed on the system.

However, the compiler I have used to build glibc (gcc7.3.0) is newer than
the one that is installed on my system (gcc4.8.5).   Though I do not specify
-Wl,-rpath as an argument to ‘configure’ or ‘make’, it appears that gcc7.3.0
may be doing so:

% readelf -d ../proto/lib64/libc.so.6 | grep rpath
 0x000000000000000f (RPATH)              Library rpath: [/lib64/gcc7:/usr/lib64/gcc7]
% 

So please allow me to retry my original questions:

1.  Do the assertions intentionally defeat the purpose of the
     -Wl,-rpath and -Wl,—dynamic-linker flags given in the testing
     instructions?
2.  If so, what is the rationale underlying the assertions?
3.  If not, how should the build be configured to support the
     documented testing instructions?

As a possible solution to #3:

4.  Should the assertion in elf/get-dynamic-info.h be disabled at
     configuration time if the compiler used to build glibc supplies
     -Wl,-rpath implicitly?

If not, then perhaps the documented build instructions should be
modified to comply with the assertion, though I’m not sure how one
should go about it.   If glibc requires a newer compiler, the complexity
of the steps required to get the newer compiler installed on the system
could be considerable.

Thanks again for the clue.

-chris


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