diff options
| author | George Rimar <grimar@accesssoftek.com> | 2017-05-30 05:48:09 +0000 |
|---|---|---|
| committer | George Rimar <grimar@accesssoftek.com> | 2017-05-30 05:48:09 +0000 |
| commit | d4096140e3516640c97d832c0ea7b889f62d388b (patch) | |
| tree | 727fcb47b5f58349d3e21c2aef7dfb62542f2f44 /lld/ELF/LinkerScript.cpp | |
| parent | 707e37fb0d8389f28c60b31ae6769b3294dfa33a (diff) | |
| download | bcm5719-llvm-d4096140e3516640c97d832c0ea7b889f62d388b.tar.gz bcm5719-llvm-d4096140e3516640c97d832c0ea7b889f62d388b.zip | |
[ELF] - Do not crash when linkerscript applies fill to .bss.
I found that during visual inspection of code while wrote different patch.
Script in testcase probably have nothing common with real life, but
we segfault currently using it.
If output section is known NOBITS, there is no need to create
writers threads for doing nothing or proccess any filler logic that
is useless here. We can just early return, that is what this patch do.
DIfferential revision: https://reviews.llvm.org/D33646
llvm-svn: 304192
Diffstat (limited to 'lld/ELF/LinkerScript.cpp')
| -rw-r--r-- | lld/ELF/LinkerScript.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp index 7c4bf3aaebb..99c464e3714 100644 --- a/lld/ELF/LinkerScript.cpp +++ b/lld/ELF/LinkerScript.cpp @@ -1080,6 +1080,9 @@ template <class ELFT> void OutputSectionCommand::writeTo(uint8_t *Buf) { return; } + if (Sec->Type == SHT_NOBITS) + return; + // Write leading padding. ArrayRef<InputSection *> Sections = Sec->Sections; uint32_t Filler = getFiller(); |

