summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2013-12-17 06:15:09 +0000
committerRui Ueyama <ruiu@google.com>2013-12-17 06:15:09 +0000
commit1fc1bab8a80df6e8fe14be177787be855b979022 (patch)
tree1248d03f9a3ebdf55d6bf6c7624070a94a897575 /lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
parenta4acde39e942bd3594234790720be16888a69f79 (diff)
downloadbcm5719-llvm-1fc1bab8a80df6e8fe14be177787be855b979022.tar.gz
bcm5719-llvm-1fc1bab8a80df6e8fe14be177787be855b979022.zip
[PECOFF] Truncate long section name.
Executable files do not use a string table, so section names longer than 8 characters are not permitted. Long section names should just be truncated. llvm-svn: 197470
Diffstat (limited to 'lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp')
-rw-r--r--lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp b/lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
index aff6536d560..05621416015 100644
--- a/lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
+++ b/lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
@@ -631,12 +631,9 @@ llvm::object::coff_section
SectionHeaderTableChunk::createSectionHeader(SectionChunk *chunk) {
llvm::object::coff_section header;
- // Section name equal to or shorter than 8 byte fits in the section
- // header. Longer names should be stored to string table, which is not
- // implemented yet.
+ // Section name must be equal to or less than 8 characters in the
+ // executable. Longer names will be truncated.
StringRef sectionName = chunk->getSectionName();
- if (sizeof(header.Name) < sectionName.size())
- llvm_unreachable("Cannot handle section name longer than 8 byte");
// Name field must be NUL-padded. If the name is exactly 8 byte long,
// there's no terminating NUL.
OpenPOWER on IntegriCloud