This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: LTO and version scripts
- From: Alan Modra <amodra at gmail dot com>
- To: Ulrich Drepper <drepper at gmail dot com>
- Cc: Richard Biener <richard dot guenther at gmail dot com>, GCC Development <gcc at gcc dot gnu dot org>
- Date: Thu, 7 Aug 2014 12:37:05 +0930
- Subject: Re: LTO and version scripts
- Authentication-results: sourceware.org; auth=none
- References: <CAOPLpQfvs_E8rfHHAF18t+bGxc5+-Rtg7dAUv+oTpws-wt3wuw at mail dot gmail dot com> <CAFiYyc0EdAgd56Ja5bBGFdfJ5NMxb84NwnDw+sJ1z8fmXwakmA at mail dot gmail dot com> <20140805045728 dot GN8921 at bubble dot grove dot modra dot org> <CAOPLpQfTV7Q+bhPmu5UeiT-NYX_rOKGs8T8jxO+gns4T+A1+8g at mail dot gmail dot com>
On Tue, Aug 05, 2014 at 08:18:06PM -0400, Ulrich Drepper wrote:
> On Tue, Aug 5, 2014 at 12:57 AM, Alan Modra <amodra@gmail.com> wrote:
> > What version linker? In particular, do you have the fix for PR12975?
>
> The Fedora 19 version. I think it hasn't changed since then which
> means it is 2.23.88.0.1-13 (from the RPM version number). No idea
> whether that fix is included and unfortunately won't have time to try
> before the weekend.
Both Fedora 19 and 20 have the patch needed for this to work. Hmm, I
suppose the other thing necessary is a gcc that implements
LDPT_GET_SYMBOLS_V2. You may be lacking that. Here's what I see with
mainline gcc and ld.
cat > ltoshare.c <<\EOF
int
cond (void)
{
return 0;
}
extern void something (void);
int
main (void)
{
if (cond ())
something ();
return 0;
}
EOF
cat > ltoshare.ver <<\EOF
{
global: main;
local: *;
};
EOF
~/build/gcc-current/gcc/xgcc -B ~/build/gcc-current/gcc/ -B ld/tmpdir/ld -O2 -fPIC -flto -c ltoshare.c
~/build/gcc-current/gcc/xgcc -B ~/build/gcc-current/gcc/ -B ld/tmpdir/ld -shared -flto -o ltoshare.so ltoshare.o
nm -D ltoshare.so | grep something
U something
~/build/gcc-current/gcc/xgcc -B ~/build/gcc-current/gcc/ -B ld/tmpdir/ld -shared -flto -o ltoshare.so ltoshare.o -Wl,--version-script=ltoshare.ver
nm -D ltoshare.so | grep something
--
Alan Modra
Australia Development Lab, IBM