diff options
-rw-r--r-- | lld/lib/ReaderWriter/ELF/WriterELF.cpp | 5 | ||||
-rw-r--r-- | lld/test/elf/sections.objtxt | 33 |
2 files changed, 19 insertions, 19 deletions
diff --git a/lld/lib/ReaderWriter/ELF/WriterELF.cpp b/lld/lib/ReaderWriter/ELF/WriterELF.cpp index c81ddaae8f7..a47935fbd0a 100644 --- a/lld/lib/ReaderWriter/ELF/WriterELF.cpp +++ b/lld/lib/ReaderWriter/ELF/WriterELF.cpp @@ -397,6 +397,7 @@ StockSectionChunk<target_endianness, is64Bits>:: break; case DefinedAtom::typeZeroFill: this->_type = ELF::SHT_NOBITS; + break; case DefinedAtom::typeConstant: this->_type = ELF::SHT_PROGBITS; break; @@ -912,9 +913,7 @@ void ELFWriter<target_endianness, is64Bits> StringRef sectionName = a->customSectionName(); if (a->sectionChoice() == DefinedAtom::SectionChoice::sectionBasedOnContent) { - if (a->size() <8) - sectionName = ".sbss"; - else + if (a->contentType() == DefinedAtom::typeZeroFill) sectionName = ".bss"; } auto pos = sectionMap.find(sectionName); diff --git a/lld/test/elf/sections.objtxt b/lld/test/elf/sections.objtxt index 929abf25504..74ad2e1c945 100644 --- a/lld/test/elf/sections.objtxt +++ b/lld/test/elf/sections.objtxt @@ -3,31 +3,32 @@ RUN: llvm-readobj %t1 | FileCheck -check-prefix=READOBJ %s RUN: elf-dump --dump-section %t1 | FileCheck -check-prefix=ED %s OBJDUMP: 0 000000000 00000000000000000 -OBJDUMP: 2 .anotherspecial 000000004 000000000000001c8 DATA -OBJDUMP: 3 .special 000000004 000000000000001cc DATA -OBJDUMP: 4 .text 00000000a 000000000000001d0 TEXT DATA -OBJDUMP: 5 .data 000000004 000000000000001dc DATA -OBJDUMP: 7 .symtab 000000150 000000000000001e0 -OBJDUMP: 8 .strtab 00000003b 00000000000000330 -OBJDUMP: 9 .shstrtab 00000004b 0000000000000036b +OBJDUMP: 1 .anotherspecial 000000004 000000000000001a0 DATA +OBJDUMP: 2 .special 000000004 000000000000001a4 DATA +OBJDUMP: 3 .bss 000000001 000000000000001a8 +OBJDUMP: 4 .text 00000000a 000000000000001ac TEXT DATA +OBJDUMP: 5 .data 000000004 000000000000001b8 DATA +OBJDUMP: 6 .symtab 000000140 000000000000001bc +OBJDUMP: 7 .strtab 00000003b 000000000000002fc +OBJDUMP: 8 .shstrtab 000000045 00000000000000337 READOBJ: File Format : ELF32-i386 READOBJ: Arch : i386 READOBJ: Address Size: 32 bits READOBJ: Symbols -READOBJ: .anotherspecial DBG 1c8 0 1c8 formatspecific -READOBJ: .symtab DBG 1e0 0 1e0 formatspecific -READOBJ: baz FUNC 0 a 1d0 global -READOBJ: z DATA 0 4 1c8 global -READOBJ: Total: 20 +READOBJ: .anotherspecial DBG 1a0 0 1a0 formatspecific +READOBJ: .symtab DBG 1bc 0 1bc formatspecific +READOBJ: baz FUNC 0 a 1ac global +READOBJ: z DATA 0 4 1a0 global +READOBJ: Total: 19 ED: 'e_indent[EI_DATA]', 0x01 ED: 'e_machine', 0x0003 ED: Section 1 -ED: 'sh_addralign', 0x00000001 -ED: Section 2 ED: 'sh_addralign', 0x00000008 -ED: Section 7 -ED: 'sh_link', 0x00000008 +ED: Section 2 +ED: 'sh_addralign', 0x00000004 +ED: Section 6 +ED: 'sh_link', 0x00000007 ED: 'sh_addralign', 0x00000004 ED: 'sh_entsize', 0x00000010 |