https://bugs.llvm.org/show_bug.cgi?id=42990
Bug ID: 42990
Summary: assignments made before SECTIONS do not reflect final
values after section parsing
Product: lld
Version: unspecified
Hardware: All
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: All Bugs
Assignee: unassignedb...@nondot.org
Reporter: keesc...@chromium.org
CC: llvm-bugs@lists.llvm.org, peter.sm...@linaro.org
The following poc.lds links differently between bfd and lld:
__efistub__end = _end;
SECTIONS
{
. = 0xffff;
. += ((_end >> 8) - 0xff );
_end = .;
}
Linking with an empty .o file:
$ ld.lld -maarch64elf -shared -o vmlinux.lld -T poc.lds /tmp/test.o && readelf
-Ws vmlinux.lld | egrep '\b(__init_pg_size|(__efistub_|)_end)\b'
2: 000000000000ffff 0 NOTYPE GLOBAL DEFAULT 1 _end
3: 000000000000ff00 0 NOTYPE GLOBAL DEFAULT 1 __efistub__end
i.e. __efistub__end is calculated before _end is known. Moving the
__efistub__end assignment to after the SECTIONS {} works around this bug.
bfd produces the same results with either ordering:
$ aarch64-linux-gnu-ld.bfd -maarch64elf -shared -o vmlinux.bfd -T poc.lds
/tmp/test.o && readelf -Ws vmlinux.bfd | egrep
'\b(__init_pg_size|(__efistub_|)_end)\b'
2: 000000000000ffff 0 NOTYPE GLOBAL DEFAULT 1 _end
4: 000000000000ffff 0 NOTYPE GLOBAL DEFAULT ABS __efistub__end
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs