Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ELF] - Linkerscript: implemented SUBALIGN() command.
You can force input section alignment within an output section by using SUBALIGN. The value specified overrides any alignment given by input sections, whether larger or smaller. SUBALIGN is used in many projects in the wild. Differential revision: https://reviews.llvm.org/D23063 llvm-svn: 279256
- Loading branch information
George Rimar
committed
Aug 19, 2016
1 parent
0b86722
commit db24d9c
Showing
3 changed files
with
52 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# REQUIRES: x86 | ||
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1.o | ||
|
||
# RUN: echo "SECTIONS { .aaa : { *(.aaa.*) } }" > %t1.script | ||
# RUN: ld.lld -o %t1 --script %t1.script %t1.o | ||
# RUN: llvm-objdump -s %t1 | FileCheck -check-prefix=NOALIGN %s | ||
# NOALIGN: Contents of section .aaa: | ||
# NOALIGN-NEXT: 01000000 00000000 00000000 00000000 | ||
# NOALIGN-NEXT: 00000000 00000000 00000000 00000000 | ||
# NOALIGN-NEXT: 02000000 00000000 00000000 00000000 | ||
# NOALIGN-NEXT: 00000000 00000000 00000000 00000000 | ||
# NOALIGN-NEXT: 03000000 00000000 00000000 00000000 | ||
# NOALIGN-NEXT: 00000000 00000000 00000000 00000000 | ||
# NOALIGN-NEXT: 00000000 00000000 00000000 00000000 | ||
# NOALIGN-NEXT: 00000000 00000000 00000000 00000000 | ||
# NOALIGN-NEXT: 04000000 00000000 | ||
|
||
# RUN: echo "SECTIONS { .aaa : SUBALIGN(1) { *(.aaa.*) } }" > %t2.script | ||
# RUN: ld.lld -o %t2 --script %t2.script %t1.o | ||
# RUN: llvm-objdump -s %t2 | FileCheck -check-prefix=SUBALIGN %s | ||
# SUBALIGN: Contents of section .aaa: | ||
# SUBALIGN: 01000000 00000000 02000000 00000000 | ||
# SUBALIGN: 03000000 00000000 04000000 00000000 | ||
|
||
.global _start | ||
_start: | ||
nop | ||
|
||
.section .aaa.1, "a" | ||
.align 16 | ||
.quad 1 | ||
|
||
.section .aaa.2, "a" | ||
.align 32 | ||
.quad 2 | ||
|
||
.section .aaa.3, "a" | ||
.align 64 | ||
.quad 3 | ||
|
||
.section .aaa.4, "a" | ||
.align 128 | ||
.quad 4 |