[Nix-dev] Bootstrapping from a gcc with "--enable-shared"

Lluís Batlle viriketo at gmail.com
Mon Aug 31 19:11:13 CEST 2009


Hello,

in nixpkgs we bootstrap from a gcc with "--enable-shared"; afaik, this
means that it will create ELF programs linked with libgcc_s (if
needed: the gcc spec uses for ld --as-needed -lgcc_s --no-as-needed),
if using the default "-shared-libgcc" in gcc. The libgcc_s.so in our
bootstrap files is dynamically linked with libc, as all the
libgcc_s.so files I've seen)

When we use the bootstrap files to build a new libc, the programs
coming with that libc will be linked with the libgcc_s, which was
built to use the bootstrap-files libc, not the new libc.

In i686 and x86_64, rarely the programs are linked with libgcc_s.
Specially as the glibc nptl pthreads try to dlopen that library at
runtime, if needed.

But in ARM (I still don't know why for sure), all shared ELF programs
compiled with gcc are linked with libgcc_s. At least all the simple
programs I've tried to compile.

Thus, having a gcc built with --enable-shared in the bootstrap files,
or having glibc programs built with the default -shared-libgcc may
lead to a libgcc_s egg-or-chicken problem specially in store paths.

libgcc_s uses very few common symbols from glibc, so maybe I should
not worry much, if we take the glibc, and remove any rpath reference
to the bootstrap-files libraries, and set it to use only those of the
latest gcc. But this would mean changing files in a store path after
it has been built. Otherwise the glibc programs and libs would
reference by rpath the libgcc_s in the bootstrap files.

What do you think of this? I'll try to make glibc build all the
programs with -static-libgcc, and I'll see if that is enough for
removing any libgcc_s reference in it.



More information about the nix-dev mailing list