summaryrefslogtreecommitdiff
path: root/test/Scripts
diff options
context:
space:
mode:
authorJack Carter <jcarter@mips.com>2012-06-27 22:48:25 +0000
committerJack Carter <jcarter@mips.com>2012-06-27 22:48:25 +0000
commit0140e55393c4403ab240c386501cdc5e438dcc0e (patch)
tree51a2ac662d7b33478bcb331df6cc42df1cea27bf /test/Scripts
parent36b8fed61db8d772bf07ed828ff505ce15461bd7 (diff)
downloadllvm-0140e55393c4403ab240c386501cdc5e438dcc0e.tar.gz
llvm-0140e55393c4403ab240c386501cdc5e438dcc0e.tar.bz2
llvm-0140e55393c4403ab240c386501cdc5e438dcc0e.tar.xz
This allows hello world to be compiled for Mips 64 direct object.
It takes advantage of r159299 which introduces relocation support for N64. elf-dump needed to be upgraded to support N64 relocations as well. This passes make check. Jack git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159301 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Scripts')
-rwxr-xr-xtest/Scripts/elf-dump38
1 files changed, 29 insertions, 9 deletions
diff --git a/test/Scripts/elf-dump b/test/Scripts/elf-dump
index 58ca177328..69cdacde45 100755
--- a/test/Scripts/elf-dump
+++ b/test/Scripts/elf-dump
@@ -15,6 +15,7 @@ class Reader:
self.file = open(path, "rb")
self.isLSB = None
self.is64Bit = None
+ self.isN64 = False
def seek(self, pos):
self.file.seek(pos)
@@ -122,15 +123,28 @@ def dumpRel(f, section, dumprela = False):
f.seek(section.sh_offset[0] + index * section.sh_entsize[0])
print " # Relocation %s" % index
print " (('r_offset', %s)" % common_dump.HexDump(f.readWord())
- r_info = f.readWord()[0]
- if f.is64Bit:
- r_sym = (r_info >> 32, 32)
- r_type = (r_info & 0xffffffff, 32)
+
+ if f.isN64:
+ r_sym = f.read32()
+ r_ssym = f.read8()
+ r_type3 = f.read8()
+ r_type2 = f.read8()
+ r_type = f.read8()
+ print " ('r_sym', %s)" % common_dump.HexDump(r_sym)
+ print " ('r_ssym', %s)" % common_dump.HexDump(r_ssym)
+ print " ('r_type3', %s)" % common_dump.HexDump(r_type3)
+ print " ('r_type2', %s)" % common_dump.HexDump(r_type2)
+ print " ('r_type', %s)" % common_dump.HexDump(r_type)
else:
- r_sym = (r_info >> 8, 24)
- r_type = (r_info & 0xff, 8)
- print " ('r_sym', %s)" % common_dump.HexDump(r_sym)
- print " ('r_type', %s)" % common_dump.HexDump(r_type)
+ r_info = f.readWord()[0]
+ if f.is64Bit:
+ r_sym = (r_info >> 32, 32)
+ r_type = (r_info & 0xffffffff, 32)
+ else:
+ r_sym = (r_info >> 8, 24)
+ r_type = (r_info & 0xff, 8)
+ print " ('r_sym', %s)" % common_dump.HexDump(r_sym)
+ print " ('r_type', %s)" % common_dump.HexDump(r_type)
if dumprela:
print " ('r_addend', %s)" % common_dump.HexDump(f.readWord())
print " ),"
@@ -166,7 +180,13 @@ def dumpELF(path, opts):
f.seek(16) # Seek to end of e_ident.
print "('e_type', %s)" % common_dump.HexDump(f.read16())
- print "('e_machine', %s)" % common_dump.HexDump(f.read16())
+
+ # Does any other architecture use N64?
+ e_machine = f.read16()
+ if e_machine[0] == 0x0008 and f.is64Bit: # EM_MIPS && 64 bit
+ f.isN64 = True
+
+ print "('e_machine', %s)" % common_dump.HexDump(e_machine)
print "('e_version', %s)" % common_dump.HexDump(f.read32())
print "('e_entry', %s)" % common_dump.HexDump(f.readWord())
print "('e_phoff', %s)" % common_dump.HexDump(f.readWord())