[PATCH] D145199: [ELF] Mention section name and offset for STT_SECTION in reportRangeError()

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 2 23:29:37 PST 2023


MaskRay added a comment.

In D145199#4165987 <https://reviews.llvm.org/D145199#4165987>, @dblaikie wrote:

> So this:
>
>   (.text+0x3): relocation R_X86_64_PC32 out of range: 2147483648 is not in [-2147483648, 2147483647]; references .bss+0
>
> Says that we're trying to write into `.text+0x3` (3 bytes into the `.text` section) the value `2147483648` as an offset, relative to `.bss+0`? (are there cases where the offset would be non-zero and the `+N` on the second part (the `.bss+0`) would be non-zero as well?)

Yes.

> The `+0` on the `.bss` is the bit I find surprising/not sure I understand - I'd have thought it'd just be `.bss` & the +N is in the "N is not in [...];"?

A non-zero offset is possible. For example an C/C++ internal linkage function may have a non-zero offset relative to its section. A reference against the local symbol will be converted to a relocation against the section symbol.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D145199



More information about the llvm-commits mailing list