This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: bad interaction between PIC and linkonce sections on linux/ia86


> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]