Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make ALIGN work with -r in linker scripts
Patch by Mark Kettenis. Make ALIGN work in linker scripts used with the -r option. This works in GNU ld (ld.bfd) and is used to generate the "random gap" object for linking the OpenBSD kernel. Differential Revision: https://reviews.llvm.org/D46839 llvm-svn: 332656
- Loading branch information
Showing
2 changed files
with
26 additions
and
4 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# REQUIRES: x86 | ||
|
||
## Check output section ALIGN modifier with -r | ||
|
||
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/align.s -o %t1.o | ||
# RUN: ld.lld -r -o %t2.o --script %s %t1.o | ||
# RUN: llvm-readelf -s %t2.o | FileCheck %s | ||
|
||
# CHECK: Section Headers: | ||
# CHECK-NEXT: Name Type Address Off Size ES Flg Lk Inf Al | ||
# CHECK-NEXT: NULL 0000000000000000 000000 000000 00 | ||
# CHECK-NEXT: .aaa PROGBITS 0000000000000000 000040 000008 00 A 0 0 1 | ||
# CHECK-NEXT: .bbb PROGBITS 0000000000000000 001000 000008 00 A 0 0 4096 | ||
# CHECK-NEXT: .ccc PROGBITS 0000000000000000 004000 000008 00 A 0 0 16384 | ||
|
||
SECTIONS { | ||
. = 0x10000; | ||
.aaa : { *(.aaa) } | ||
.bbb : ALIGN(4096) { *(.bbb) } | ||
.ccc : ALIGN(4096 * 4) { *(.ccc) } | ||
} |