Skip to content

Commit ce5b371

Browse files
authored
[BOLT,test] Make linker scripts less sensitive to lld's orphan placement (#93763)
Then two tests rely on .interp being the first section. llvm-bolt would crash if lld places .interp after .got (f639b57). For best portability, when a linker scripts specifies a SECTIONS command, the first section for each PT_LOAD segment should be specified with a MAXPAGESIZE alignment. Otherwise, linkers have freedom to decide how to place orphan sections, which might break intention.
1 parent 435114f commit ce5b371

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

bolt/test/AArch64/Inputs/array_end.lld_script

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
SECTIONS {
2+
.interp : { *(.interp) }
3+
4+
. = ALIGN(CONSTANT(MAXPAGESIZE));
25
.fini_array :
36
{
47
PROVIDE_HIDDEN (__fini_array_start = .);

bolt/test/Inputs/lsda.ldscript

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
SECTIONS {
2+
.interp : { *(.interp) }
3+
. = ALIGN(CONSTANT(MAXPAGESIZE));
24
.text : { *(.text*) }
5+
. = ALIGN(CONSTANT(MAXPAGESIZE));
36
.gcc_except_table.main : { *(.gcc_except_table*) }
47
. = 0x20000;
58
.eh_frame : { *(.eh_frame) }

0 commit comments

Comments
 (0)