This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: bad interaction between PIC and linkonce sections on linux/ia86
- To: snyder at fnal dot gov
- Subject: Re: bad interaction between PIC and linkonce sections on linux/ia86
- From: "Martin v. Loewis" <martin at loewis dot home dot cs dot tu-berlin dot de>
- Date: Thu, 2 Mar 2000 10:39:52 +0100
- CC: bug-gcc at gnu dot org
- References: <200003012236.QAA26269@d0sgibnl1.fnal.gov>
> The problem is that in some cases, the LPR0 stub may be emitted in a linkonce
> section. Further, it may not be emitted in linkonce sections of the
> same name in a different compilation unit. I think this is the root of the
> problem (although i have not fully understood why the linker behaves like
> it does -- changing the LPR0 call to offset 0).
That indeed looks like the problem. If the linker finds references to
local labels which get removed as part of linkonce sections, it sets
the references to 0. This can also be observed in the exception
handling: the exception tables and dwarf unwind info (i.e. the FDEs)
might refer to functions that got removed, in which case the linker
also sets their addresses to 0 - what else should he put in there.
The right solution to me seems to make sure that the LPR0 symbol is
always in the text section. So in asm_output_function_prefix, you'll
need to switch to text_section before emitting the symbol, and then
switch back to the previous section. I've tried this in your example,
and it seems to work.
Regards,
Martin