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 regression vs BFD ld: __ehdr_start

> I tried it against all the ehdr_start test cases in ld/testsuite.
> It dies with an assertion failure on ld-elf/ehdr_start-missing.d and
> ld-elf/ehdr_start-weak.d.

Those test cases use a linker script with a SECTIONS clause and no
PHDRS clause. In this case, gold runs define_standard_symbols before
any segments have been created at all. As a result, all the standard
symbols that get added are added as constants, and that failed my
assert in set_output_segment(). I can relax that assert, but I've got
to wonder if we're doing the right thing here with any of the other
standard symbols -- it seems to me they'll all get set incorrectly.

In ld/testsuite, the ehdr_start_missing.t script attempts to construct
a situation where the first load segment cannot contain the headers by
setting the text section start address to 0x10000000. That doesn't
work! (At least, not in gold.) Gold will happily place the headers at
0x10000000, and place the text section immediately after that. I'm not
sure if this is a bug or a feature. I think this is a known difference
between the two linkers that has been discussed before.

The only way to keep the headers out of the first load segment is to
set the text segment at an address that is not a multiple of the page
size. For example, if I run with -Ttext=0x1000100, I'll get the
expected undefined reference error.

Unfortunately, even if the reference is weak, we always get an error.
By defining the symbol early, it's overriding the symbol's binding
with STB_GLOBAL, so by the time we try to apply the relocation, we've
lost track of the weak binding.


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