This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH,take 2,trunk+2.21.1] Re: Fix link order problem with LD plugin API.
- From: Alan Modra <amodra at gmail dot com>
- To: Dave Korn <dave dot korn dot cygwin at gmail dot com>
- Cc: "H.J. Lu" <hjl dot tools at gmail dot com>, "binutils at sourceware dot org" <binutils at sourceware dot org>
- Date: Thu, 3 Feb 2011 23:58:35 +1030
- Subject: Re: [PATCH,take 2,trunk+2.21.1] Re: Fix link order problem with LD plugin API.
- References: <4D437207.4040903@gmail.com> <AANLkTino6tHjPdxZAaixhPfJKEX-mLeH8KaA5GkmDRFn@mail.gmail.com> <AANLkTik6PH6WTFq_yRy1ceLwOu0u+t_LuRv4wyCCwgsk@mail.gmail.com> <AANLkTimqcPcy0QBBVB5o-wADx_kkzoKDmMFB0hS-bUaK@mail.gmail.com> <4D439979.1010302@gmail.com> <AANLkTimW9tZSSdgaVGfRBTwtvNHjH5wXZKicodc4KXs9@mail.gmail.com> <4D461D1F.8020800@gmail.com> <20110203051145.GV9489@bubble.grove.modra.org> <4D4A46D2.4000709@gmail.com>
On Thu, Feb 03, 2011 at 06:10:26AM +0000, Dave Korn wrote:
> particular, something to get rid of those stray left-over symbols when the IR
> symtabs in the input files mention something that ltrans subsequently decides
> it can optimise away.)
Good. That can hide, at least until runtime, lto bugs. I've been
poking a little at one today where a function was mentioned in the IR,
called in the final object, but not emitted. So ld quite happily sent
the call to an IR symbol.
I have this in my tree to expose that particular problem, but haven't
tested it properly yet. Results in
../../gcc-curr/gcc/xgcc -B../../gcc-curr/gcc/ -w -O2 -m32 -flto abs-2.i abs-2-lib.i main.i -lm
`main_test' referenced in section `.text.startup' of /tmp/ccBT9axe.ltrans0.ltrans.o: defined in discarded section `.text' of /tmp/ccgfeeJG.o.ironly
collect2: ld returned 1 exit status
Index: ld/plugin.c
===================================================================
RCS file: /cvs/src/src/ld/plugin.c,v
retrieving revision 1.22
diff -u -p -r1.22 plugin.c
--- ld/plugin.c 22 Jan 2011 10:16:29 -0000 1.22
+++ ld/plugin.c 3 Feb 2011 13:23:50 -0000
@@ -243,8 +243,8 @@ plugin_get_ir_dummy_bfd (const char *nam
sec = bfd_make_section_old_way (abfd, ".text");
bfd_set_section_flags (abfd, sec,
(SEC_CODE | SEC_HAS_CONTENTS | SEC_READONLY
- | SEC_ALLOC | SEC_LOAD | SEC_KEEP));
- sec->output_section = sec;
+ | SEC_ALLOC | SEC_LOAD | SEC_KEEP | SEC_EXCLUDE));
+ sec->output_section = NULL;
sec->output_offset = 0;
return abfd;
}
--
Alan Modra
Australia Development Lab, IBM