Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 28 May 2012 21:33:52 +0200
From:      Dimitry Andric <dim@FreeBSD.org>
To:        Roman Divacky <rdivacky@freebsd.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Konstantin Belousov <kib@FreeBSD.org>
Subject:   Re: svn commit: r236137 - head/contrib/gcc/config/i386
Message-ID:  <4FC3D320.1070709@FreeBSD.org>
In-Reply-To: <20120527203100.GA22921@freebsd.org>
References:  <201205270527.q4R5Rm44028055@svn.freebsd.org> <20120527203100.GA22921@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2012-05-27 22:31, Roman Divacky wrote:
> Fwiw, to enable the same thing in clang you want this simple patch:
> 
> ===================================================================
> --- Tools.cpp   (revision 157545)
> +++ Tools.cpp   (working copy)
> @@ -4794,6 +4794,7 @@
>    if (Args.hasArg(options::OPT_static)) {
>      CmdArgs.push_back("-Bstatic");
>    } else {
> +    CmdArgs.push_back("--hash-style=both");
>      if (Args.hasArg(options::OPT_rdynamic))
>        CmdArgs.push_back("-export-dynamic");
>      CmdArgs.push_back("--eh-frame-hdr");
> 
> 
> 
> I cant commit this upstream as this option doesn't work with ld 2.15. What
> should be done here? Commit this to local FreeBSD version? Commit it upstream
> making it not work with old ld? Leave it out completely?

I think this can be committed locally in our version, especially if it
is better for performance.  We already have a few local modifications,
this one isn't very shocking. :)

For upstream, you should really add a configure check for gnu hash
support in ld, and then surround the above addition with conditionals,
e.g. #ifdef HAVE_LINK_GNU_HASH or something.

On the other hand, it's really platform-dependent: I've checked several
Linux distributions, and it is fairly unpredictable whether their gcc
passes --hash-style to the linker, or if they do, which option they use.

For example, Debian stable uses --hash-style=both, while Ubuntu 12.04
uses --hash-style=gnu.  So the correct mechanism for this is tricky.  It
should be discussed on the clang mailing list, not here.

Lastly, my personal preference would be to adjust these defaults in the
linker itself, depending on platform, but apparently nobody does that...



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4FC3D320.1070709>