[lld] r193662 - [ELF] Implement minimal support for .eh_frame_hdr.
Michael J. Spencer
bigcheesegs at gmail.com
Tue Oct 29 17:02:05 PDT 2013
Author: mspencer
Date: Tue Oct 29 19:02:04 2013
New Revision: 193662
URL: http://llvm.org/viewvc/llvm-project?rev=193662&view=rev
Log:
[ELF] Implement minimal support for .eh_frame_hdr.
Added:
lld/trunk/test/elf/eh_frame_hdr.test
Modified:
lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h
lld/trunk/lib/ReaderWriter/ELF/OutputELFWriter.h
lld/trunk/lib/ReaderWriter/ELF/SectionChunks.h
lld/trunk/test/elf/X86_64/debug.test
lld/trunk/test/elf/X86_64/layoutpass-order.test
lld/trunk/test/elf/X86_64/omagic.test
lld/trunk/test/elf/X86_64/underscore-end.test
lld/trunk/test/elf/X86_64/yamlinput.test
lld/trunk/test/elf/entry.objtxt
lld/trunk/test/elf/ifunc.test
lld/trunk/test/elf/phdr.test
lld/trunk/test/elf/symbols.test
Modified: lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h?rev=193662&r1=193661&r2=193662&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h Tue Oct 29 19:02:04 2013
@@ -439,7 +439,6 @@ Layout::SegmentType DefaultLayout<ELFT>:
case ORDER_FINI:
case ORDER_RODATA:
case ORDER_EH_FRAME:
- case ORDER_EH_FRAMEHDR:
return llvm::ELF::PT_LOAD;
case ORDER_RO_NOTE:
@@ -453,6 +452,9 @@ Layout::SegmentType DefaultLayout<ELFT>:
case ORDER_DTORS:
return llvm::ELF::PT_GNU_RELRO;
+ case ORDER_EH_FRAMEHDR:
+ return llvm::ELF::PT_GNU_EH_FRAME;
+
case ORDER_GOT:
case ORDER_GOT_PLT:
case ORDER_DATA:
Modified: lld/trunk/lib/ReaderWriter/ELF/OutputELFWriter.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/OutputELFWriter.h?rev=193662&r1=193661&r2=193662&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/OutputELFWriter.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/OutputELFWriter.h Tue Oct 29 19:02:04 2013
@@ -105,6 +105,7 @@ protected:
LLD_UNIQUE_BUMP_PTR(StringTable<ELFT>) _strtab;
LLD_UNIQUE_BUMP_PTR(StringTable<ELFT>) _shstrtab;
LLD_UNIQUE_BUMP_PTR(SectionHeader<ELFT>) _shdrtab;
+ LLD_UNIQUE_BUMP_PTR(EHFrameHeader<ELFT>) _ehFrameHeader;
/// \name Dynamic sections.
/// @{
LLD_UNIQUE_BUMP_PTR(DynamicTable<ELFT>) _dynamicTable;
@@ -267,6 +268,15 @@ template <class ELFT> void OutputELFWrit
_symtab->setStringSection(_strtab.get());
_layout->addSection(_shdrtab.get());
+ for (auto sec : _layout->sections()) {
+ if (sec->name() != ".eh_frame")
+ continue;
+ _ehFrameHeader.reset(new (_alloc) EHFrameHeader<ELFT>(
+ _context, ".eh_frame_hdr", DefaultLayout<ELFT>::ORDER_EH_FRAMEHDR));
+ _layout->addSection(_ehFrameHeader.get());
+ break;
+ }
+
if (_context.isDynamic()) {
_dynamicTable.reset(new (_alloc) DynamicTable<ELFT>(
_context, ".dynamic", DefaultLayout<ELFT>::ORDER_DYNAMIC));
Modified: lld/trunk/lib/ReaderWriter/ELF/SectionChunks.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/SectionChunks.h?rev=193662&r1=193661&r2=193662&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/SectionChunks.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/SectionChunks.h Tue Oct 29 19:02:04 2013
@@ -26,6 +26,7 @@
#include "llvm/Object/ELF.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/Debug.h"
+#include "llvm/Support/Dwarf.h"
#include "llvm/Support/ELF.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/FileOutputBuffer.h"
@@ -1284,6 +1285,52 @@ private:
std::vector<uint32_t> _chains;
const DynamicSymbolTable<ELFT> *_symbolTable;
};
+
+template <class ELFT> class EHFrameHeader : public Section<ELFT> {
+public:
+ EHFrameHeader(const ELFLinkingContext &context, StringRef name, int32_t order)
+ : Section<ELFT>(context, name) {
+ this->setOrder(order);
+ this->_entSize = 0;
+ this->_type = SHT_PROGBITS;
+ this->_flags = SHF_ALLOC;
+ // Set the alignment properly depending on the target architecture
+ if (context.is64Bits())
+ this->_align2 = 8;
+ else
+ this->_align2 = 4;
+ // Minimum size for empty .eh_frame_hdr.
+ this->_fsize = 1 + 1 + 1 + 1 + 4;
+ this->_msize = this->_fsize;
+ }
+
+ virtual void doPreFlight() LLVM_OVERRIDE {
+ // TODO: Generate a proper binary search table.
+ }
+
+ virtual void finalize() LLVM_OVERRIDE {
+ MergedSections<ELFT> *s = this->_context.template getTargetHandler<ELFT>()
+ .targetLayout()
+ .findOutputSection(".eh_frame");
+ _ehFrameAddr = s ? s->virtualAddr() : 0;
+ }
+
+ virtual void write(ELFWriter *writer,
+ llvm::FileOutputBuffer &buffer) LLVM_OVERRIDE {
+ uint8_t *chunkBuffer = buffer.getBufferStart();
+ uint8_t *dest = chunkBuffer + this->fileOffset();
+ int pos = 0;
+ dest[pos++] = 1; // version
+ dest[pos++] = llvm::dwarf::DW_EH_PE_udata4; // eh_frame_ptr_enc
+ dest[pos++] = llvm::dwarf::DW_EH_PE_omit; // fde_count_enc
+ dest[pos++] = llvm::dwarf::DW_EH_PE_omit; // table_enc
+ *reinterpret_cast<typename llvm::object::ELFFile<ELFT>::Elf_Word *>(
+ dest + pos) = (uint32_t)_ehFrameAddr;
+ }
+
+private:
+ uint64_t _ehFrameAddr;
+};
} // end namespace elf
} // end namespace lld
Modified: lld/trunk/test/elf/X86_64/debug.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/X86_64/debug.test?rev=193662&r1=193661&r2=193662&view=diff
==============================================================================
--- lld/trunk/test/elf/X86_64/debug.test (original)
+++ lld/trunk/test/elf/X86_64/debug.test Tue Oct 29 19:02:04 2013
@@ -51,7 +51,7 @@ ELF: }
RELOC: Contents of section .debug_info:
RELOC: 0000 4e000000 04000000 00000801 3a000000 N...........:...
# ^^ Relocation: ._debug_str + 0x3a
-RELOC: 0010 01780000 00000000 00a40140 00000000 .x......... at ....
+RELOC: 0010 01780000 00000000 00dc0140 00000000 .x......... at ....
# ^^ Relocation: .debug_str + 0x78
RELOC: 0020 00100000 00000000 00000000 00028100 ................
# ^^ Relocation: .debug_str + 0x81
Modified: lld/trunk/test/elf/X86_64/layoutpass-order.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/X86_64/layoutpass-order.test?rev=193662&r1=193661&r2=193662&view=diff
==============================================================================
--- lld/trunk/test/elf/X86_64/layoutpass-order.test (original)
+++ lld/trunk/test/elf/X86_64/layoutpass-order.test Tue Oct 29 19:02:04 2013
@@ -7,8 +7,8 @@ RUN: --noinhibit-exec -static
RUN: llvm-nm -n %t | FileCheck -check-prefix=SYMBOLSORDER %s
-SYMBOLSORDER: 004000b0 T main
-SYMBOLSORDER: 004000c5 T b
-SYMBOLSORDER: 004000d0 T a
-SYMBOLSORDER: 004000db T c
-SYMBOLSORDER: 004000e8 T d
+SYMBOLSORDER: {{[A-Fa-f0-9]+}} T main
+SYMBOLSORDER: {{[A-Fa-f0-9]+}} T b
+SYMBOLSORDER: {{[A-Fa-f0-9]+}} T a
+SYMBOLSORDER: {{[A-Fa-f0-9]+}} T c
+SYMBOLSORDER: {{[A-Fa-f0-9]+}} T d
Modified: lld/trunk/test/elf/X86_64/omagic.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/X86_64/omagic.test?rev=193662&r1=193661&r2=193662&view=diff
==============================================================================
--- lld/trunk/test/elf/X86_64/omagic.test (original)
+++ lld/trunk/test/elf/X86_64/omagic.test Tue Oct 29 19:02:04 2013
@@ -26,8 +26,8 @@ OMAGICSECTIONS: Flags [ (0x6)
OMAGICSECTIONS: SHF_ALLOC (0x2)
OMAGICSECTIONS: SHF_EXECINSTR (0x4)
OMAGICSECTIONS: ]
-OMAGICSECTIONS: Address: 0x4000B0
-OMAGICSECTIONS: Offset: 0xB0
+OMAGICSECTIONS: Address: 0x4000E8
+OMAGICSECTIONS: Offset: 0xE8
OMAGICSECTIONS: Size: 11
OMAGICSECTIONS: Link: 0
OMAGICSECTIONS: Info: 0
@@ -40,8 +40,8 @@ OMAGICSECTIONS: Type: SHT_PROGBITS (0
OMAGICSECTIONS: Flags [ (0x2)
OMAGICSECTIONS: SHF_ALLOC (0x2)
OMAGICSECTIONS: ]
-OMAGICSECTIONS: Address: 0x4000C0
-OMAGICSECTIONS: Offset: 0xC0
+OMAGICSECTIONS: Address: 0x4000F8
+OMAGICSECTIONS: Offset: 0xF8
OMAGICSECTIONS: Size: 56
OMAGICSECTIONS: Link: 0
OMAGICSECTIONS: Info: 0
@@ -49,6 +49,20 @@ OMAGICSECTIONS: AddressAlignment: 8
OMAGICSECTIONS: EntrySize: 0
OMAGICSECTIONS: }
OMAGICSECTIONS: Section {
+OMAGICSECTIONS: Name: .eh_frame_hdr
+OMAGICSECTIONS: Type: SHT_PROGBITS (0x1)
+OMAGICSECTIONS: Flags [ (0x2)
+OMAGICSECTIONS: SHF_ALLOC (0x2)
+OMAGICSECTIONS: ]
+OMAGICSECTIONS: Address: 0x400130
+OMAGICSECTIONS: Offset: 0x130
+OMAGICSECTIONS: Size: 8
+OMAGICSECTIONS: Link: 0
+OMAGICSECTIONS: Info: 0
+OMAGICSECTIONS: AddressAlignment: 8
+OMAGICSECTIONS: EntrySize: 0
+OMAGICSECTIONS: }
+OMAGICSECTIONS: Section {
OMAGICSECTIONS: Name: .tdata
OMAGICSECTIONS: Type: SHT_PROGBITS (0x1)
OMAGICSECTIONS: Flags [ (0x403)
@@ -56,8 +70,8 @@ OMAGICSECTIONS: SHF_ALLOC (0x2)
OMAGICSECTIONS: SHF_TLS (0x400)
OMAGICSECTIONS: SHF_WRITE (0x1)
OMAGICSECTIONS: ]
-OMAGICSECTIONS: Address: 0x4000F8
-OMAGICSECTIONS: Offset: 0xF8
+OMAGICSECTIONS: Address: 0x400138
+OMAGICSECTIONS: Offset: 0x138
OMAGICSECTIONS: Size: 4
OMAGICSECTIONS: Link: 0
OMAGICSECTIONS: Info: 0
@@ -72,8 +86,8 @@ OMAGICSECTIONS: SHF_ALLOC (0x2)
OMAGICSECTIONS: SHF_TLS (0x400)
OMAGICSECTIONS: SHF_WRITE (0x1)
OMAGICSECTIONS: ]
-OMAGICSECTIONS: Address: 0x4000FC
-OMAGICSECTIONS: Offset: 0xFC
+OMAGICSECTIONS: Address: 0x40013C
+OMAGICSECTIONS: Offset: 0x13C
OMAGICSECTIONS: Size: 8
OMAGICSECTIONS: Link: 0
OMAGICSECTIONS: Info: 0
@@ -87,8 +101,8 @@ OMAGICSECTIONS: Flags [ (0x3)
OMAGICSECTIONS: SHF_ALLOC (0x2)
OMAGICSECTIONS: SHF_WRITE (0x1)
OMAGICSECTIONS: ]
-OMAGICSECTIONS: Address: 0x400100
-OMAGICSECTIONS: Offset: 0x100
+OMAGICSECTIONS: Address: 0x400140
+OMAGICSECTIONS: Offset: 0x140
OMAGICSECTIONS: Size: 0
OMAGICSECTIONS: Link: 0
OMAGICSECTIONS: Info: 0
@@ -102,8 +116,8 @@ OMAGICSECTIONS: Flags [ (0x3)
OMAGICSECTIONS: SHF_ALLOC (0x2)
OMAGICSECTIONS: SHF_WRITE (0x1)
OMAGICSECTIONS: ]
-OMAGICSECTIONS: Address: 0x400100
-OMAGICSECTIONS: Offset: 0x100
+OMAGICSECTIONS: Address: 0x400140
+OMAGICSECTIONS: Offset: 0x140
OMAGICSECTIONS: Size: 4
OMAGICSECTIONS: Link: 0
OMAGICSECTIONS: Info: 0
@@ -117,8 +131,8 @@ OMAGICSECTIONS: Flags [ (0x3)
OMAGICSECTIONS: SHF_ALLOC (0x2)
OMAGICSECTIONS: SHF_WRITE (0x1)
OMAGICSECTIONS: ]
-OMAGICSECTIONS: Address: 0x400104
-OMAGICSECTIONS: Offset: 0x104
+OMAGICSECTIONS: Address: 0x400144
+OMAGICSECTIONS: Offset: 0x144
OMAGICSECTIONS: Size: 0
OMAGICSECTIONS: Link: 0
OMAGICSECTIONS: Info: 0
@@ -131,7 +145,7 @@ OMAGICSECTIONS: Type: SHT_PROGBITS (0
OMAGICSECTIONS: Flags [ (0x0)
OMAGICSECTIONS: ]
OMAGICSECTIONS: Address: 0x0
-OMAGICSECTIONS: Offset: 0x104
+OMAGICSECTIONS: Offset: 0x144
OMAGICSECTIONS: Size: 43
OMAGICSECTIONS: Link: 0
OMAGICSECTIONS: Info: 0
@@ -144,7 +158,7 @@ OMAGICSECTIONS: Type: SHT_PROGBITS (0
OMAGICSECTIONS: Flags [ (0x0)
OMAGICSECTIONS: ]
OMAGICSECTIONS: Address: 0x0
-OMAGICSECTIONS: Offset: 0x12F
+OMAGICSECTIONS: Offset: 0x16F
OMAGICSECTIONS: Size: 0
OMAGICSECTIONS: Link: 0
OMAGICSECTIONS: Info: 0
@@ -157,8 +171,8 @@ OMAGICSECTIONS: Type: SHT_STRTAB (0x3
OMAGICSECTIONS: Flags [ (0x0)
OMAGICSECTIONS: ]
OMAGICSECTIONS: Address: 0x0
-OMAGICSECTIONS: Offset: 0x12F
-OMAGICSECTIONS: Size: 101
+OMAGICSECTIONS: Offset: 0x16F
+OMAGICSECTIONS: Size: 115
OMAGICSECTIONS: Link: 0
OMAGICSECTIONS: Info: 0
OMAGICSECTIONS: AddressAlignment: 1
@@ -170,9 +184,9 @@ OMAGICSECTIONS: Type: SHT_SYMTAB (0x2
OMAGICSECTIONS: Flags [ (0x0)
OMAGICSECTIONS: ]
OMAGICSECTIONS: Address: 0x0
-OMAGICSECTIONS: Offset: 0x198
+OMAGICSECTIONS: Offset: 0x1E8
OMAGICSECTIONS: Size: 528
-OMAGICSECTIONS: Link: 12
+OMAGICSECTIONS: Link: 13
OMAGICSECTIONS: Info: 2
OMAGICSECTIONS: AddressAlignment: 8
OMAGICSECTIONS: EntrySize: 24
@@ -183,13 +197,14 @@ OMAGICSECTIONS: Type: SHT_STRTAB (0x3
OMAGICSECTIONS: Flags [ (0x0)
OMAGICSECTIONS: ]
OMAGICSECTIONS: Address: 0x0
-OMAGICSECTIONS: Offset: 0x3A8
+OMAGICSECTIONS: Offset: 0x3F8
OMAGICSECTIONS: Size: 246
OMAGICSECTIONS: Link: 0
OMAGICSECTIONS: Info: 0
OMAGICSECTIONS: AddressAlignment: 1
OMAGICSECTIONS: EntrySize: 0
OMAGICSECTIONS: }
+OMAGICSECTIONS: ]
OMAGICPROGRAMHEADERS: ProgramHeaders [
OMAGICPROGRAMHEADERS: ProgramHeader {
@@ -197,8 +212,8 @@ OMAGICPROGRAMHEADERS: Type: PT_LOAD
OMAGICPROGRAMHEADERS: Offset: 0x0
OMAGICPROGRAMHEADERS: VirtualAddress: 0x400000
OMAGICPROGRAMHEADERS: PhysicalAddress: 0x400000
-OMAGICPROGRAMHEADERS: FileSize: 260
-OMAGICPROGRAMHEADERS: MemSize: 260
+OMAGICPROGRAMHEADERS: FileSize: 324
+OMAGICPROGRAMHEADERS: MemSize: 324
OMAGICPROGRAMHEADERS: Flags [ (0x7)
OMAGICPROGRAMHEADERS: PF_R (0x4)
OMAGICPROGRAMHEADERS: PF_W (0x2)
@@ -208,9 +223,9 @@ OMAGICPROGRAMHEADERS: Alignment: 8
OMAGICPROGRAMHEADERS: }
OMAGICPROGRAMHEADERS: ProgramHeader {
OMAGICPROGRAMHEADERS: Type: PT_TLS (0x7)
-OMAGICPROGRAMHEADERS: Offset: 0xF8
-OMAGICPROGRAMHEADERS: VirtualAddress: 0x4000F8
-OMAGICPROGRAMHEADERS: PhysicalAddress: 0x4000F8
+OMAGICPROGRAMHEADERS: Offset: 0x138
+OMAGICPROGRAMHEADERS: VirtualAddress: 0x400138
+OMAGICPROGRAMHEADERS: PhysicalAddress: 0x400138
OMAGICPROGRAMHEADERS: FileSize: 4
OMAGICPROGRAMHEADERS: MemSize: 12
OMAGICPROGRAMHEADERS: Flags [ (0x6)
Modified: lld/trunk/test/elf/X86_64/underscore-end.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/X86_64/underscore-end.test?rev=193662&r1=193661&r2=193662&view=diff
==============================================================================
--- lld/trunk/test/elf/X86_64/underscore-end.test (original)
+++ lld/trunk/test/elf/X86_64/underscore-end.test Tue Oct 29 19:02:04 2013
@@ -45,7 +45,7 @@ NMAGICABSSYMBOLS: }
OMAGICABSSYMBOLS: Symbol {
OMAGICABSSYMBOLS: Name: __bss_start (51)
-OMAGICABSSYMBOLS: Value: 0x400104
+OMAGICABSSYMBOLS: Value: 0x400144
OMAGICABSSYMBOLS: Size: 0
OMAGICABSSYMBOLS: Binding: Global (0x1)
OMAGICABSSYMBOLS: Type: Object (0x1)
@@ -54,7 +54,7 @@ OMAGICABSSYMBOLS: Section: (0xFFF1)
OMAGICABSSYMBOLS: }
OMAGICABSSYMBOLS: Symbol {
OMAGICABSSYMBOLS: Name: __bss_end (63)
-OMAGICABSSYMBOLS: Value: 0x400104
+OMAGICABSSYMBOLS: Value: 0x400144
OMAGICABSSYMBOLS: Size: 0
OMAGICABSSYMBOLS: Binding: Global (0x1)
OMAGICABSSYMBOLS: Type: Object (0x1)
@@ -63,7 +63,7 @@ OMAGICABSSYMBOLS: Section: (0xFFF1)
OMAGICABSSYMBOLS: }
OMAGICABSSYMBOLS: Symbol {
OMAGICABSSYMBOLS: Name: _end (73)
-OMAGICABSSYMBOLS: Value: 0x400104
+OMAGICABSSYMBOLS: Value: 0x400144
OMAGICABSSYMBOLS: Size: 0
OMAGICABSSYMBOLS: Binding: Global (0x1)
OMAGICABSSYMBOLS: Type: Object (0x1)
@@ -72,7 +72,7 @@ OMAGICABSSYMBOLS: Section: (0xFFF1)
OMAGICABSSYMBOLS: }
OMAGICABSSYMBOLS: Symbol {
OMAGICABSSYMBOLS: Name: end (78)
-OMAGICABSSYMBOLS: Value: 0x400104
+OMAGICABSSYMBOLS: Value: 0x400144
OMAGICABSSYMBOLS: Size: 0
OMAGICABSSYMBOLS: Binding: Global (0x1)
OMAGICABSSYMBOLS: Type: Object (0x1)
Modified: lld/trunk/test/elf/X86_64/yamlinput.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/X86_64/yamlinput.test?rev=193662&r1=193661&r2=193662&view=diff
==============================================================================
--- lld/trunk/test/elf/X86_64/yamlinput.test (original)
+++ lld/trunk/test/elf/X86_64/yamlinput.test Tue Oct 29 19:02:04 2013
@@ -16,7 +16,7 @@ SECTIONS: ]
SECTIONS: }
SECTIONS: Section {
SECTIONS: Index: 1
-SECTIONS: Name: .interp (1)
+SECTIONS: Name: .interp
SECTIONS: Type: SHT_PROGBITS (0x1)
SECTIONS: Flags [ (0x2)
SECTIONS: SHF_ALLOC (0x2)
@@ -24,7 +24,7 @@ SECTIONS: ]
SECTIONS: }
SECTIONS: Section {
SECTIONS: Index: 2
-SECTIONS: Name: .hash (9)
+SECTIONS: Name: .hash
SECTIONS: Type: SHT_HASH (0x5)
SECTIONS: Flags [ (0x2)
SECTIONS: SHF_ALLOC (0x2)
@@ -32,7 +32,7 @@ SECTIONS: ]
SECTIONS: }
SECTIONS: Section {
SECTIONS: Index: 3
-SECTIONS: Name: .dynsym (15)
+SECTIONS: Name: .dynsym
SECTIONS: Type: SHT_DYNSYM (0xB)
SECTIONS: Flags [ (0x2)
SECTIONS: SHF_ALLOC (0x2)
@@ -40,7 +40,7 @@ SECTIONS: ]
SECTIONS: }
SECTIONS: Section {
SECTIONS: Index: 4
-SECTIONS: Name: .dynstr (23)
+SECTIONS: Name: .dynstr
SECTIONS: Type: SHT_STRTAB (0x3)
SECTIONS: Flags [ (0x2)
SECTIONS: SHF_ALLOC (0x2)
@@ -48,7 +48,7 @@ SECTIONS: ]
SECTIONS: }
SECTIONS: Section {
SECTIONS: Index: 5
-SECTIONS: Name: .text (31)
+SECTIONS: Name: .text
SECTIONS: Type: SHT_PROGBITS (0x1)
SECTIONS: Flags [ (0x6)
SECTIONS: SHF_ALLOC (0x2)
@@ -57,7 +57,7 @@ SECTIONS: ]
SECTIONS: }
SECTIONS: Section {
SECTIONS: Index: 6
-SECTIONS: Name: .rodata (37)
+SECTIONS: Name: .rodata
SECTIONS: Type: SHT_PROGBITS (0x1)
SECTIONS: Flags [ (0x2)
SECTIONS: SHF_ALLOC (0x2)
@@ -65,7 +65,7 @@ SECTIONS: ]
SECTIONS: }
SECTIONS: Section {
SECTIONS: Index: 7
-SECTIONS: Name: .eh_frame (45)
+SECTIONS: Name: .eh_frame
SECTIONS: Type: SHT_PROGBITS (0x1)
SECTIONS: Flags [ (0x2)
SECTIONS: SHF_ALLOC (0x2)
@@ -73,16 +73,11 @@ SECTIONS: ]
SECTIONS: }
SECTIONS: Section {
SECTIONS: Index: 8
-SECTIONS: Name: .init_array (55)
-SECTIONS: Type: SHT_PROGBITS (0x1)
-SECTIONS: Flags [ (0x3)
-SECTIONS: SHF_ALLOC (0x2)
-SECTIONS: SHF_WRITE (0x1)
-SECTIONS: ]
+SECTIONS: Name: .eh_frame_hdr
SECTIONS: }
SECTIONS: Section {
SECTIONS: Index: 9
-SECTIONS: Name: .fini_array (67)
+SECTIONS: Name: .init_array
SECTIONS: Type: SHT_PROGBITS (0x1)
SECTIONS: Flags [ (0x3)
SECTIONS: SHF_ALLOC (0x2)
@@ -91,7 +86,7 @@ SECTIONS: ]
SECTIONS: }
SECTIONS: Section {
SECTIONS: Index: 10
-SECTIONS: Name: .dynamic (79)
+SECTIONS: Name: .fini_array
SECTIONS: Type: SHT_PROGBITS (0x1)
SECTIONS: Flags [ (0x3)
SECTIONS: SHF_ALLOC (0x2)
@@ -100,7 +95,7 @@ SECTIONS: ]
SECTIONS: }
SECTIONS: Section {
SECTIONS: Index: 11
-SECTIONS: Name: .got.plt (88)
+SECTIONS: Name: .dynamic
SECTIONS: Type: SHT_PROGBITS (0x1)
SECTIONS: Flags [ (0x3)
SECTIONS: SHF_ALLOC (0x2)
@@ -109,7 +104,7 @@ SECTIONS: ]
SECTIONS: }
SECTIONS: Section {
SECTIONS: Index: 12
-SECTIONS: Name: .data (97)
+SECTIONS: Name: .got.plt
SECTIONS: Type: SHT_PROGBITS (0x1)
SECTIONS: Flags [ (0x3)
SECTIONS: SHF_ALLOC (0x2)
@@ -118,8 +113,8 @@ SECTIONS: ]
SECTIONS: }
SECTIONS: Section {
SECTIONS: Index: 13
-SECTIONS: Name: .bss (103)
-SECTIONS: Type: SHT_NOBITS (0x8)
+SECTIONS: Name: .data
+SECTIONS: Type: SHT_PROGBITS (0x1)
SECTIONS: Flags [ (0x3)
SECTIONS: SHF_ALLOC (0x2)
SECTIONS: SHF_WRITE (0x1)
@@ -127,35 +122,44 @@ SECTIONS: ]
SECTIONS: }
SECTIONS: Section {
SECTIONS: Index: 14
-SECTIONS: Name: .comment (108)
-SECTIONS: Type: SHT_PROGBITS (0x1)
-SECTIONS: Flags [ (0x0)
+SECTIONS: Name: .bss
+SECTIONS: Type: SHT_NOBITS (0x8)
+SECTIONS: Flags [ (0x3)
+SECTIONS: SHF_ALLOC (0x2)
+SECTIONS: SHF_WRITE (0x1)
SECTIONS: ]
SECTIONS: }
SECTIONS: Section {
SECTIONS: Index: 15
-SECTIONS: Name: .note.GNU-stack (117)
+SECTIONS: Name: .comment
SECTIONS: Type: SHT_PROGBITS (0x1)
SECTIONS: Flags [ (0x0)
SECTIONS: ]
SECTIONS: }
SECTIONS: Section {
SECTIONS: Index: 16
-SECTIONS: Name: .shstrtab (133)
-SECTIONS: Type: SHT_STRTAB (0x3)
+SECTIONS: Name: .note.GNU-stack
+SECTIONS: Type: SHT_PROGBITS (0x1)
SECTIONS: Flags [ (0x0)
SECTIONS: ]
SECTIONS: }
SECTIONS: Section {
SECTIONS: Index: 17
-SECTIONS: Name: .symtab (143)
-SECTIONS: Type: SHT_SYMTAB (0x2)
+SECTIONS: Name: .shstrtab
+SECTIONS: Type: SHT_STRTAB (0x3)
SECTIONS: Flags [ (0x0)
SECTIONS: ]
SECTIONS: }
SECTIONS: Section {
SECTIONS: Index: 18
-SECTIONS: Name: .strtab (151)
+SECTIONS: Name: .symtab
+SECTIONS: Type: SHT_SYMTAB (0x2)
+SECTIONS: Flags [ (0x0)
+SECTIONS: ]
+SECTIONS: }
+SECTIONS: Section {
+SECTIONS: Index: 19
+SECTIONS: Name: .strtab
SECTIONS: Type: SHT_STRTAB (0x3)
SECTIONS: Flags [ (0x0)
SECTIONS: ]
Added: lld/trunk/test/elf/eh_frame_hdr.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/eh_frame_hdr.test?rev=193662&view=auto
==============================================================================
--- lld/trunk/test/elf/eh_frame_hdr.test (added)
+++ lld/trunk/test/elf/eh_frame_hdr.test Tue Oct 29 19:02:04 2013
@@ -0,0 +1,26 @@
+#RUN: yaml2obj -format=elf %s > %t
+#RUN: lld -flavor gnu -target x86_64-linux %t --noinhibit-exec \
+#RUN: -o %t1
+#RUN: llvm-readobj -s %t1 | FileCheck %s
+
+!ELF
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2LSB
+ Type: ET_REL
+ Machine: EM_X86_64
+
+Sections:
+- Name: .eh_frame
+ Type: SHT_PROGBITS
+ Content: "00"
+ AddressAlign: 8
+ Flags: [SHF_ALLOC]
+
+Symbols:
+ Local:
+ - Name: .eh_frame
+ Type: STT_SECTION
+ Section: .eh_frame
+
+#CHECK: .eh_frame_hdr
Modified: lld/trunk/test/elf/entry.objtxt
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/entry.objtxt?rev=193662&r1=193661&r2=193662&view=diff
==============================================================================
--- lld/trunk/test/elf/entry.objtxt (original)
+++ lld/trunk/test/elf/entry.objtxt Tue Oct 29 19:02:04 2013
@@ -11,7 +11,7 @@
# RUN: lld -flavor gnu %s -e _entrypoint --noinhibit-exec -o %t1
# RUN: llvm-nm -n %t1 | FileCheck %s
#
-# CHECK: 004001b0 T main
+# CHECK: 004001e0 T main
# CHECK: 00401080 D _DYNAMIC
# CHECK: 00401080 A _end
# CHECK: 00401080 A end
Modified: lld/trunk/test/elf/ifunc.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/ifunc.test?rev=193662&r1=193661&r2=193662&view=diff
==============================================================================
--- lld/trunk/test/elf/ifunc.test (original)
+++ lld/trunk/test/elf/ifunc.test Tue Oct 29 19:02:04 2013
@@ -60,7 +60,7 @@ BIN-NEXT: {{[0-9a-f]+}} 00000000 0000000
RELATIVEADDEND: Relocations [
RELATIVEADDEND-NEXT: Section (1) .rela.plt {
-RELATIVEADDEND-NEXT: 0x401000 R_X86_64_IRELATIVE - 0x4000E0
+RELATIVEADDEND-NEXT: 0x401000 R_X86_64_IRELATIVE - 0x400120
RELATIVEADDEND-NEXT: }
RELATIVEADDEND-NEXT: ]
Modified: lld/trunk/test/elf/phdr.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/phdr.test?rev=193662&r1=193661&r2=193662&view=diff
==============================================================================
--- lld/trunk/test/elf/phdr.test (original)
+++ lld/trunk/test/elf/phdr.test Tue Oct 29 19:02:04 2013
@@ -11,8 +11,8 @@ I386-NEXT: Type: PT_PHDR (0x6)
I386-NEXT: Offset: 0x34
I386-NEXT: VirtualAddress: 0x34
I386-NEXT: PhysicalAddress: 0x34
-I386-NEXT: FileSize: 192
-I386-NEXT: MemSize: 192
+I386-NEXT: FileSize: 224
+I386-NEXT: MemSize: 224
I386-NEXT: Flags [ (0x5)
I386-NEXT: PF_R (0x4)
I386-NEXT: PF_X (0x1)
@@ -21,9 +21,9 @@ I386-NEXT: Alignment: 8
I386-NEXT: }
I386-NEXT: ProgramHeader {
I386-NEXT: Type: PT_INTERP (0x3)
-I386-NEXT: Offset: 0xF4
-I386-NEXT: VirtualAddress: 0xF4
-I386-NEXT: PhysicalAddress: 0xF4
+I386-NEXT: Offset: 0x114
+I386-NEXT: VirtualAddress: 0x114
+I386-NEXT: PhysicalAddress: 0x114
I386-NEXT: FileSize: 28
I386-NEXT: MemSize: 28
I386-NEXT: Flags [ (0x4)
@@ -36,8 +36,8 @@ I386-NEXT: Type: PT_LOAD (0x1)
I386-NEXT: Offset: 0x0
I386-NEXT: VirtualAddress: 0x0
I386-NEXT: PhysicalAddress: 0x0
-I386-NEXT: FileSize: 532
-I386-NEXT: MemSize: 532
+I386-NEXT: FileSize: 572
+I386-NEXT: MemSize: 572
I386-NEXT: Flags [ (0x5)
I386-NEXT: PF_R (0x4)
I386-NEXT: PF_X (0x1)
@@ -71,10 +71,22 @@ I386-NEXT: ]
I386-NEXT: Alignment: 4096
I386-NEXT: }
I386-NEXT: ProgramHeader {
+I386-NEXT: Type: PT_GNU_EH_FRAME (0x6474E550)
+I386-NEXT: Offset: 0x1F4
+I386-NEXT: VirtualAddress: 0x1F4
+I386-NEXT: PhysicalAddress: 0x1F4
+I386-NEXT: FileSize: 8
+I386-NEXT: MemSize: 8
+I386-NEXT: Flags [ (0x4)
+I386-NEXT: PF_R (0x4)
+I386-NEXT: ]
+I386-NEXT: Alignment: 4
+I386-NEXT: }
+I386-NEXT: ProgramHeader {
I386-NEXT: Type: PT_DYNAMIC (0x2)
-I386-NEXT: Offset: 0x1D4
-I386-NEXT: VirtualAddress: 0x1D4
-I386-NEXT: PhysicalAddress: 0x1D4
+I386-NEXT: Offset: 0x1FC
+I386-NEXT: VirtualAddress: 0x1FC
+I386-NEXT: PhysicalAddress: 0x1FC
I386-NEXT: FileSize: 64
I386-NEXT: MemSize: 64
I386-NEXT: Flags [ (0x4)
Modified: lld/trunk/test/elf/symbols.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/symbols.test?rev=193662&r1=193661&r2=193662&view=diff
==============================================================================
--- lld/trunk/test/elf/symbols.test (original)
+++ lld/trunk/test/elf/symbols.test Tue Oct 29 19:02:04 2013
@@ -20,7 +20,7 @@ RUN: lld -flavor gnu -shared -target i38
RUN: llvm-nm -n %t1 | FileCheck -check-prefix CHECKSHAREDSYMS %s
CHECKSYMS: 00000000 a 1.c
-CHECKSYMS: 00000114 T main
+CHECKSYMS: 00000134 T main
CHECKSYMS: 00001000 A __bss_start
CHECKSYMS: 00001000 B a
CHECKSYMS: 00001004 A __bss_end
@@ -28,6 +28,6 @@ CHECKSYMS: 00001004 A _end
CHECKSYMS: 00001004 A end
CHECKSHAREDSYMS: 00000000 a 1.c
-CHECKSHAREDSYMS: 0000010c T main
+CHECKSHAREDSYMS: 0000012c T main
CHECKSHAREDSYMS: 00001000 B a
CHECKSHAREDSYMS: 00001004 A _end
More information about the llvm-commits
mailing list