This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Relocation against discarded sections


> I understand why some sections should be discarded, but why are there relocations against discarded sections at all?
>
> I'm
> running into a case in a private port that indicates that the
> relocation is in code referencing RTTI data when the data section has
> been discarded because there's another such section.  FWIW, both the
> code and data sections came from the same object in the STL.
>
> I'm wondering why the linker - if it's the culprit - didn't fix references to the section being discarded.

It sounds like the relocations in the code sections were referring to
local symbols defined in the RTTI data sections. In that case, there's
nothing the linker can do to fix it up. There are two ways to fix
this: have the compiler put both code and data in the same COMDAT
group, so that if one gets discarded, the other does too; or make the
symbols in the RTTI data sections global. Presumably, the data section
is being discarded because it's the same as one from another
compilation unit; in that case, the linker will resolve the references
to the symbols defined in the kept section.

With gcc, I expect to see relocations against discarded sections from
debug sections, where it's too much trouble to split the debug info up
and put it into the comdat group it belongs with.

-cary


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