[llvm] r194421 - Add support for DT_VERxxx and DT_MIPS_xxx .dynamic section entries to the
Simon Atanasyan
simon at atanasyan.com
Mon Nov 11 12:51:49 PST 2013
Author: atanasyan
Date: Mon Nov 11 14:51:48 2013
New Revision: 194421
URL: http://llvm.org/viewvc/llvm-project?rev=194421&view=rev
Log:
Add support for DT_VERxxx and DT_MIPS_xxx .dynamic section entries to the
llvm-readobj.
The patch reviewed by Michael Spencer.
http://llvm-reviews.chandlerc.com/D2113
Added:
llvm/trunk/test/tools/llvm-readobj/Inputs/dynamic-table.c
llvm/trunk/test/tools/llvm-readobj/Inputs/dynamic-table.mips
llvm/trunk/test/tools/llvm-readobj/dynamic.test
Modified:
llvm/trunk/tools/llvm-readobj/ELFDumper.cpp
Added: llvm/trunk/test/tools/llvm-readobj/Inputs/dynamic-table.c
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-readobj/Inputs/dynamic-table.c?rev=194421&view=auto
==============================================================================
--- llvm/trunk/test/tools/llvm-readobj/Inputs/dynamic-table.c (added)
+++ llvm/trunk/test/tools/llvm-readobj/Inputs/dynamic-table.c Mon Nov 11 14:51:48 2013
@@ -0,0 +1,7 @@
+// clang -target mipsel-linux-gnu -shared -fPIC -lc dynamic-table.c \
+// -o dynamic-table.mips
+int puts(const char *);
+
+void foo(void) {
+ puts("Hello, World");
+}
Added: llvm/trunk/test/tools/llvm-readobj/Inputs/dynamic-table.mips
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-readobj/Inputs/dynamic-table.mips?rev=194421&view=auto
==============================================================================
Binary files llvm/trunk/test/tools/llvm-readobj/Inputs/dynamic-table.mips (added) and llvm/trunk/test/tools/llvm-readobj/Inputs/dynamic-table.mips Mon Nov 11 14:51:48 2013 differ
Added: llvm/trunk/test/tools/llvm-readobj/dynamic.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-readobj/dynamic.test?rev=194421&view=auto
==============================================================================
--- llvm/trunk/test/tools/llvm-readobj/dynamic.test (added)
+++ llvm/trunk/test/tools/llvm-readobj/dynamic.test Mon Nov 11 14:51:48 2013
@@ -0,0 +1,33 @@
+RUN: llvm-readobj -dynamic-table %p/Inputs/dynamic-table.mips \
+RUN: | FileCheck %s -check-prefix ELF-MIPS
+
+ELF-MIPS: Format: ELF32-mips
+ELF-MIPS: Arch: mipsel
+ELF-MIPS: AddressSize: 32bit
+ELF-MIPS: LoadName:
+ELF-MIPS: DynamicSection [ (23 entries)
+ELF-MIPS: Tag Type Name/Value
+ELF-MIPS: 0x00000001 NEEDED SharedLibrary (libc.so.6)
+ELF-MIPS: 0x0000000C INIT 0x528
+ELF-MIPS: 0x0000000D FINI 0x860
+ELF-MIPS: 0x00000004 HASH 0x210
+ELF-MIPS: 0x00000005 STRTAB 0x3D8
+ELF-MIPS: 0x00000006 SYMTAB 0x2A8
+ELF-MIPS: 0x0000000A STRSZ 231 (bytes)
+ELF-MIPS: 0x0000000B SYMENT 16 (bytes)
+ELF-MIPS: 0x00000003 PLTGOT 0x108E0
+ELF-MIPS: 0x00000011 REL 0x518
+ELF-MIPS: 0x00000012 RELSZ 16 (bytes)
+ELF-MIPS: 0x00000013 RELENT 8 (bytes)
+ELF-MIPS: 0x70000001 MIPS_RLD_VERSION 1
+ELF-MIPS: 0x70000005 MIPS_FLAGS 0x2
+ELF-MIPS: 0x70000006 MIPS_BASE_ADDRESS 0x0
+ELF-MIPS: 0x7000000A MIPS_LOCAL_GOTNO 10
+ELF-MIPS: 0x70000011 MIPS_SYMTABNO 19
+ELF-MIPS: 0x70000012 MIPS_UNREFEXTNO 26
+ELF-MIPS: 0x70000013 MIPS_GOTSYM 0xD
+ELF-MIPS: 0x6FFFFFFE VERNEED 0x4E8
+ELF-MIPS: 0x6FFFFFFF VERNEEDNUM 1
+ELF-MIPS: 0x6FFFFFF0 VERSYM 0x4C0
+ELF-MIPS: 0x00000000 NULL 0x0
+ELF-MIPS: ]
Modified: llvm/trunk/tools/llvm-readobj/ELFDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/ELFDumper.cpp?rev=194421&r1=194420&r2=194421&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-readobj/ELFDumper.cpp (original)
+++ llvm/trunk/tools/llvm-readobj/ELFDumper.cpp Mon Nov 11 14:51:48 2013
@@ -683,6 +683,16 @@ static const char *getTypeString(uint64_
LLVM_READOBJ_TYPE_CASE(SYMENT);
LLVM_READOBJ_TYPE_CASE(SYMTAB);
LLVM_READOBJ_TYPE_CASE(TEXTREL);
+ LLVM_READOBJ_TYPE_CASE(VERNEED);
+ LLVM_READOBJ_TYPE_CASE(VERNEEDNUM);
+ LLVM_READOBJ_TYPE_CASE(VERSYM);
+ LLVM_READOBJ_TYPE_CASE(MIPS_RLD_VERSION);
+ LLVM_READOBJ_TYPE_CASE(MIPS_FLAGS);
+ LLVM_READOBJ_TYPE_CASE(MIPS_BASE_ADDRESS);
+ LLVM_READOBJ_TYPE_CASE(MIPS_LOCAL_GOTNO);
+ LLVM_READOBJ_TYPE_CASE(MIPS_SYMTABNO);
+ LLVM_READOBJ_TYPE_CASE(MIPS_UNREFEXTNO);
+ LLVM_READOBJ_TYPE_CASE(MIPS_GOTSYM);
default: return "unknown";
}
}
@@ -715,9 +725,21 @@ static void printValue(const ELFFile<ELF
case DT_FINI_ARRAY:
case DT_PREINIT_ARRAY:
case DT_DEBUG:
+ case DT_VERNEED:
+ case DT_VERSYM:
case DT_NULL:
+ case DT_MIPS_FLAGS:
+ case DT_MIPS_BASE_ADDRESS:
+ case DT_MIPS_GOTSYM:
OS << format("0x%" PRIX64, Value);
break;
+ case DT_VERNEEDNUM:
+ case DT_MIPS_RLD_VERSION:
+ case DT_MIPS_LOCAL_GOTNO:
+ case DT_MIPS_SYMTABNO:
+ case DT_MIPS_UNREFEXTNO:
+ OS << Value;
+ break;
case DT_PLTRELSZ:
case DT_RELASZ:
case DT_RELAENT:
More information about the llvm-commits
mailing list