[PATCH] D111871: [ELF] Let sections reach the end of the address space

Hristo Venev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 16 05:44:01 PDT 2021


hvenev added a comment.

This error looks interesting...

It appears that there is an empty `.text` section that in the 32-bit case the linker places at address 1<<32. This probably means that there is overflow in when assigning section addresses. For now I'm discarding the `.text` sections in the 32-bit test case.

GNU ld silently truncates all addresses to 32/64 bits. Sections are allowed to overflow the address space in all cases. However, I don't think this is what we want.

It is more of an issue in the 64-bit case because there we don't detect the overflow. I think the following happens:

1. `LinkerScript::addOrphanSections` creates an output `.text` section command at the end of the `SECTIONS` block
2. `LinkerScript::assignOffsets` is called on the `.text` output section with `dot` set to 0`.

I will send a follow-up patch that emits an error when an overflowed `.` is used as a section base address.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D111871/new/

https://reviews.llvm.org/D111871



More information about the llvm-commits mailing list