Bug 52556 - Ability to change GLIBC_DYNAMIC_LINKER
Summary: Ability to change GLIBC_DYNAMIC_LINKER
Status: UNCONFIRMED
Alias: None
Product: gcc
Classification: Unclassified
Component: driver (show other bugs)
Version: unknown
: P3 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
: 111084 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-03-11 11:25 UTC by Christer Solskogen
Modified: 2023-08-20 21:15 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christer Solskogen 2012-03-11 11:25:40 UTC
I would love to be able to change GLIBC_DYNAMIC_LINKER to something other than default without changing the source code. This is useful if you want to create a completly standalone toolchain with binutils, gcc and some kind of libc.
Comment 1 Christer Solskogen 2012-03-11 12:54:45 UTC
I see now that the google gcc branch is having this kind of ability. Any plans of integrating them?
Comment 2 Jakub Jelinek 2012-03-11 14:14:28 UTC
Just use -Wl,-dynamic-linker=/whatever/ld.so or you could use --with-specs configure option.
Comment 3 Christer Solskogen 2012-03-11 15:50:57 UTC
I could, but is not a sexy(*) as --with-runtime-root-prefix :-)

*) http://patchwork.ozlabs.org/patch/80538/
Comment 4 Benda Xu 2013-08-17 11:40:40 UTC
(In reply to Jakub Jelinek from comment #2)
> Just use -Wl,-dynamic-linker=/whatever/ld.so 

-Wl,-dynamic-linker=/whatever/ld.so cannot be set permanently. It requires a wrapper to inject such argument all the time, which is ugly.

> or you could use --with-specs configure option.

Builtin specs of GCC is already very complicated (output from gcc-4.7.3 -dumpspecs on amd64):

...

*link:
%{!static:--eh-frame-hdr} %{m32|mx32:;:-m elf_x86_64}                    %{m32:-m elf_i386}                    %{mx32:-m elf32_x86_64}   %{shared:-shared}   %{!shared:     %{!static:       %{rdynamic:-export-dynamic}       %{m32:-dynamic-linker %{muclibc:/lib/ld-uClibc.so.0;:%{mbionic:/system/bin/linker;:/lib/ld-linux.so.2}}}       %{m32|mx32:;:-dynamic-linker %{muclibc:/lib/ld64-uClibc.so.0;:%{mbionic:/system/bin/linker64;:/lib64/ld-linux-x86-64.so.2}}}       %{mx32:-dynamic-linker %{muclibc:/lib/ldx32-uClibc.so.0;:%{mbionic:/system/bin/linkerx32;:/libx32/ld-linux-x32.so.2}}}}     %{static:-static}}

...

writing an equivalent specs with prefixed dynamic linker is horrible.

Please consider sopport dynamic linker prefix by an extra configure option.
Comment 5 Benda Xu 2013-08-18 07:19:49 UTC
Dear Jakub,

I find your comment misleading for the --with-specs option.

It sets CONFIGURE_SPECS macro, which is used in gcc.c as

static const char *const driver_self_specs[] = {
  "%{fdump-final-insns:-fdump-final-insns=.} %<fdump-final-insns",
  DRIVER_SELF_SPECS, CONFIGURE_SPECS, GOMP_SELF_SPECS, GTM_SELF_SPECS
};

so it is a list of specs for the driver *itself*, should not be used to specify link spec.

If you mean passing --with-specs="-Wl,-dynamic-linker=/whatever/ld.so" to configure, it is broken in multilib cases.

Therefore we lack of a convenient way to specify a default alternative location of the dynamic linker.

Benda
Comment 6 Brooks Moses 2014-03-19 23:19:35 UTC
Richard Biener mentioned that Red Hat has "a local patch that allows amending link_spec from an external file, which would sound more flexible" here:
http://patchwork.ozlabs.org/patch/80538/

It's not completely clear whether it applies to this case, however; he mentioned that it could be used to produce the equivalent of a -Wl,-rpath=... option.  The Google-branch change that Christer mentions adds a -dynamic-linker=... option to the link spec rather than an -rpath option -- I would guess that the patch Richard mentions could cover that as well, but I'm not sure.
Comment 7 Andrew Pinski 2023-08-20 21:15:49 UTC
*** Bug 111084 has been marked as a duplicate of this bug. ***