[PATCH,take 2,trunk+2.21.1] Re: Fix link order problem with LD plugin API.
Alan Modra
amodra@gmail.com
Thu Feb 3 13:28:00 GMT 2011
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
More information about the Binutils
mailing list