This is the mail archive of the 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: [gold RFC] Do not generate dynamic reloc for unresolved TLS symbol

> As the comment says it "could reasonably be the case for a weak
> undefined symbol".  If the reference to a weak symbol is in PIC, then
> you can emit dynamic relocs and have an executable do something
> reasonable based on whether the symbol is defined at runtime.

With my patch, I get an internal error for the unresolved TLS symbol
when trying to apply a (PIC) R_X86_64_TLSGD relocation.

For PIC code, Gnu ld will generate dynamic relocations for a non-TLS
symbol or function symbol, but not for a TLS symbol. Is that a bug, or
behavior that gold should match?

So, yeah, it looks like the expected behavior depends on the
relocation, so patching it in target-independent code isn't going to
work (unless I pass an is_pic_relocation flag to

Making the symbols weak vs. using --warn-unresolved-symbols doesn't
seem to make a difference -- Either way, Gnu ld will statically
resolve non-PIC references to 0, and will make dynamic relocs for PIC
non-TLS references.


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