From 80b86a43d569f26ae554ea3a481053109a056688 Mon Sep 17 00:00:00 2001 From: Simon Atanasyan Date: Fri, 17 Jan 2014 21:18:14 +0000 Subject: [PATCH] [Mips] Provide default name of MIPS-specific interpreter. llvm-svn: 199514 --- .../ReaderWriter/ELF/Mips/MipsLinkingContext.cpp | 4 ++++ lld/lib/ReaderWriter/ELF/Mips/MipsLinkingContext.h | 1 + lld/test/elf/Mips/base-address.test | 10 +++++----- lld/test/elf/Mips/entry-name.test | 2 +- lld/test/elf/Mips/interpreter.test | 13 +++++++++++++ 5 files changed, 24 insertions(+), 6 deletions(-) create mode 100644 lld/test/elf/Mips/interpreter.test diff --git a/lld/lib/ReaderWriter/ELF/Mips/MipsLinkingContext.cpp b/lld/lib/ReaderWriter/ELF/Mips/MipsLinkingContext.cpp index c1156727c04a..c83b891b58c9 100644 --- a/lld/lib/ReaderWriter/ELF/Mips/MipsLinkingContext.cpp +++ b/lld/lib/ReaderWriter/ELF/Mips/MipsLinkingContext.cpp @@ -46,6 +46,10 @@ StringRef MipsLinkingContext::entrySymbolName() const { return _entrySymbolName; } +StringRef MipsLinkingContext::getDefaultInterpreter() const { + return "/lib/ld.so.1"; +} + void MipsLinkingContext::addPasses(PassManager &pm) { auto pass = createMipsRelocationPass(*this); if (pass) diff --git a/lld/lib/ReaderWriter/ELF/Mips/MipsLinkingContext.h b/lld/lib/ReaderWriter/ELF/Mips/MipsLinkingContext.h index e3c1d58be6a6..dba676944af7 100644 --- a/lld/lib/ReaderWriter/ELF/Mips/MipsLinkingContext.h +++ b/lld/lib/ReaderWriter/ELF/Mips/MipsLinkingContext.h @@ -37,6 +37,7 @@ public: virtual bool isLittleEndian() const; virtual uint64_t getBaseAddress() const; virtual StringRef entrySymbolName() const; + virtual StringRef getDefaultInterpreter() const; virtual void addPasses(PassManager &pm); }; diff --git a/lld/test/elf/Mips/base-address.test b/lld/test/elf/Mips/base-address.test index eb1370f3fe59..321512daf3d0 100644 --- a/lld/test/elf/Mips/base-address.test +++ b/lld/test/elf/Mips/base-address.test @@ -7,9 +7,9 @@ # CHECK: DynamicSection [ (15 entries) # CHECK: Tag Type Name/Value -# CHECK: 0x00000004 HASH 0x400110 -# CHECK: 0x00000005 STRTAB 0x400130 -# CHECK: 0x00000006 SYMTAB 0x400120 +# CHECK: 0x00000004 HASH 0x400104 +# CHECK: 0x00000005 STRTAB 0x400124 +# CHECK: 0x00000006 SYMTAB 0x400114 # CHECK: 0x0000000A STRSZ 1 (bytes) # CHECK: 0x0000000B SYMENT 16 (bytes) # CHECK: 0x0000001A FINI_ARRAY 0x0 @@ -52,8 +52,8 @@ # CHECK: } # CHECK: ProgramHeader { # CHECK: Type: PT_DYNAMIC (0x2) -# CHECK: Offset: 0x138 -# CHECK: VirtualAddress: 0x400138 +# CHECK: Offset: 0x12C +# CHECK: VirtualAddress: 0x40012C # CHECK: } # CHECK: ] diff --git a/lld/test/elf/Mips/entry-name.test b/lld/test/elf/Mips/entry-name.test index 4eb626a34d0b..86a1e4d7ef7b 100644 --- a/lld/test/elf/Mips/entry-name.test +++ b/lld/test/elf/Mips/entry-name.test @@ -4,7 +4,7 @@ # RUN: llvm-objdump -t %t2 | FileCheck %s # CHECK: SYMBOL TABLE: -# CHECK: 00400134 g F .text 00000004 main +# CHECK: 00400128 g F .text 00000004 main # CHECK: 00000000 *UND* 00000000 __start .global main diff --git a/lld/test/elf/Mips/interpreter.test b/lld/test/elf/Mips/interpreter.test new file mode 100644 index 000000000000..5415573ee318 --- /dev/null +++ b/lld/test/elf/Mips/interpreter.test @@ -0,0 +1,13 @@ +# Check program interpreter setup. +# RUN: llvm-mc -triple=mipsel -filetype=obj -o=%t1 %s +# RUN: lld -flavor gnu -target mipsel -e main -o %t2 %t1 +# RUN: llvm-objdump -s %t2 | FileCheck %s + +# CHECK: Contents of section .interp: +# CHECK-NEXT: 4000f4 2f6c6962 2f6c642e 736f2e31 00 /lib/ld.so.1. + + .global main + .ent main +main: + nop + .end main