diff options
| author | Rui Ueyama <ruiu@google.com> | 2018-05-17 20:22:39 +0000 |
|---|---|---|
| committer | Rui Ueyama <ruiu@google.com> | 2018-05-17 20:22:39 +0000 |
| commit | b75d19c36c47a9a3581c5db4008d7ed76fb77760 (patch) | |
| tree | dfb9a0a445b68c10bfe7718aece6dfea37a1ab66 /lld/ELF/LinkerScript.cpp | |
| parent | f58ad3129c874aeda40ce720a0aede59480e02d6 (diff) | |
| download | bcm5719-llvm-b75d19c36c47a9a3581c5db4008d7ed76fb77760.tar.gz bcm5719-llvm-b75d19c36c47a9a3581c5db4008d7ed76fb77760.zip | |
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
Diffstat (limited to 'lld/ELF/LinkerScript.cpp')
| -rw-r--r-- | lld/ELF/LinkerScript.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp index b78b190d37f..9cc836bd131 100644 --- a/lld/ELF/LinkerScript.cpp +++ b/lld/ELF/LinkerScript.cpp @@ -868,6 +868,11 @@ void LinkerScript::adjustSectionsBeforeSorting() { if (!Sec) continue; + // Handle align (e.g. ".foo : ALIGN(16) { ... }"). + if (Sec->AlignExpr) + Sec->Alignment = + std::max<uint32_t>(Sec->Alignment, Sec->AlignExpr().getValue()); + // A live output section means that some input section was added to it. It // might have been removed (if it was empty synthetic section), but we at // least know the flags. @@ -906,10 +911,6 @@ void LinkerScript::adjustSectionsAfterSorting() { error("memory region '" + Sec->LMARegionName + "' not declared"); } Sec->MemRegion = findMemoryRegion(Sec); - // Handle align (e.g. ".foo : ALIGN(16) { ... }"). - if (Sec->AlignExpr) - Sec->Alignment = - std::max<uint32_t>(Sec->Alignment, Sec->AlignExpr().getValue()); } } |

