[PATCH] D74736: [ELF] Use ALIGN to decide output section alignment
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 18 11:30:16 PST 2020
MaskRay marked 4 inline comments as done.
MaskRay added inline comments.
================
Comment at: lld/test/ELF/linkerscript/section-align2.test:1
+# REQUIRES: aarch64
+# RUN: echo '.globl _start; _start: ret; .data.rel.ro; .balign 8; .byte 0; .data; .byte 0; \
----------------
grimar wrote:
> grimar wrote:
> > Can it be x86?
> I've found the answer here: https://reviews.llvm.org/D74741#inline-679844
aarch64 is to test thunks. AArch64 uses thunks, while x86 doesn't.
This helps us avoid https://sourceware.org/bugzilla/show_bug.cgi?id=25570
================
Comment at: lld/test/ELF/linkerscript/section-align2.test:26
+ ## The input section has a larger alignment and is thus preceded by a gap.
+ .bss . : ALIGN(16) {}
+}
----------------
grimar wrote:
> > The output section is aligned to 16.
>
> But it is aligned to 32 in your output:
>
> ```
> # CHECK: Name Type Address Off Size ES Flg Lk Inf Al
> ...
> # CHECK-NEXT: .bss NOBITS 0000000000020010 020009 000011 00 WA 0 0 32
> ```
Its sh_addr is aligned to 16 though sh_addralign is 32 (max(output section alignment, maximum input section alignment))
This is GNU ld's behavior.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D74736/new/
https://reviews.llvm.org/D74736
More information about the llvm-commits
mailing list