forked from OSchip/llvm-project
Don't crash on an empty section with an ALIGN.
llvm-svn: 308809
This commit is contained in:
parent
6a963f76ca
commit
ca5740d95a
|
@ -751,7 +751,7 @@ void LinkerScript::adjustSectionsAfterSorting() {
|
|||
if (auto *Cmd = dyn_cast<OutputSectionCommand>(Base)) {
|
||||
Cmd->MemRegion = findMemoryRegion(Cmd);
|
||||
// Handle align (e.g. ".foo : ALIGN(16) { ... }").
|
||||
if (Cmd->AlignExpr)
|
||||
if (Cmd->AlignExpr && Cmd->Sec)
|
||||
Cmd->Sec->updateAlignment(Cmd->AlignExpr().getValue());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
# REQUIRES: x86
|
||||
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
|
||||
# RUN: echo "SECTIONS { .foo : ALIGN(2M) { } }" > %t.script
|
||||
# RUN: ld.lld -o %t --script %t.script %t.o -shared
|
||||
|
||||
# We would crash if an empty section had an ALIGN.
|
Loading…
Reference in New Issue