This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] make default linker --hash-style configurable option
- From: Paul Pluzhnikov <ppluzhnikov at google dot com>
- To: Ian Lance Taylor <iant at google dot com>
- Cc: Richard Guenther <richard dot guenther at gmail dot com>, "Joseph S. Myers" <joseph at codesourcery dot com>, Paolo Bonzini <bonzini at gnu dot org>, Matthias Klose <doko at ubuntu dot com>, gcc-patches at sourceware dot org, satorux at google dot com, aoliva at redhat dot com, dj at redhat dot com, neroden at gcc dot gnu dot org, Ralf dot Wildenhues at gmx dot de
- Date: Tue, 10 May 2011 07:24:38 -0700
- Subject: Re: [patch] make default linker --hash-style configurable option
- References: <20110404181738.52D661909EB@elbrus2.mtv.corp.google.com> <4D9A4BA3.6000607@ubuntu.com> <Pine.LNX.4.64.1104042358240.552@digraph.polyomino.org.uk> <BANLkTinqtZYFaS60NPVJ=QeZdJfdjOxA+Q@mail.gmail.com> <BANLkTimXt=3nn6t+TqZ1DL3N9isDN2QPUQ@mail.gmail.com> <BANLkTikwzfYNVSSXXfs16eM0MaW2Zs9rFQ@mail.gmail.com> <BANLkTik0+NG=cJ2jP+2wLFjSXDQLKDU8RQ@mail.gmail.com> <Pine.LNX.4.64.1105021459150.18768@digraph.polyomino.org.uk> <BANLkTikLpE85SiAzMD783fbmBJB2qnPSeA@mail.gmail.com> <BANLkTik+TaJDqfJyO8_pJ4KsypVcS6MNJg@mail.gmail.com> <4DC81276.8040201@gnu.org> <Pine.LNX.4.64.1105091642500.21102@digraph.polyomino.org.uk> <BANLkTikBW+fj_vP+f=Y1qnUy_=MeCbLG9w@mail.gmail.com> <Pine.LNX.4.64.1105091651150.21102@digraph.polyomino.org.uk> <BANLkTi=kgtAuAAYQkUDMuF+3si_VLHheUw@mail.gmail.com> <BANLkTima9JKAZOWmgq=dK0SCitoeO0FJLA@mail.gmail.com> <mcrliyemz5n.fsf@coign.corp.google.com>
On Tue, May 10, 2011 at 7:02 AM, Ian Lance Taylor <iant@google.com> wrote:
> Richard Guenther <richard.guenther@gmail.com> writes:
>> I wonder why this is a GCC specific patch and not a linker patch. ?Why
>> not change the linker(s) to accept such configure option that changes its
>> default behavior?
>
> It is traditionally gcc which tells the linker what to do. ?E.g., Fedora
> has patched gcc to pass --hash-style=gnu to the linker.
I think 'traditionally' is the key here.
The same argument applies to e.g. --build-id. We already have GCC
supply that, but we could have changed the default in
binutils/{ld,gold}.
Also, the argument is discoverable (by observing 'gcc -v' output).
Changing the default in {ld,gold} makes it hard(er) to understand why
e.g. binaries linked from the same object files using two different
versions of GCC are different.
>> Otherwise if people link with ld they suddenly get different hash-style.
>> That looks wrong to me.
>
> That turns out not to be the case.
I think Richard meant "if people link directly with either ld or gold
(i.e. bypassing 'gcc' driver) get different hash-style". That's kind
of expected though -- if you want to get the same output you get from
'gcc', you need to examine 'gcc -v' very carefully. And, as Jakub
noted, linking directly with 'ld' is discouraged.
Thanks,
--
Paul Pluzhnikov