a426b286c8
patch for r263619, and unify all the URLs to point to svnweb.
170 lines
7.5 KiB
Diff
170 lines
7.5 KiB
Diff
Pull in r200112 from upstream llvm trunk (by Venkatraman Govindaraju):
|
|
|
|
[Sparc] Add support for sparc relocation types in ELF object file.
|
|
|
|
Introduced here: http://svnweb.freebsd.org/changeset/base/262261
|
|
|
|
Index: test/MC/Sparc/sparc-relocations.s
|
|
===================================================================
|
|
--- test/MC/Sparc/sparc-relocations.s
|
|
+++ test/MC/Sparc/sparc-relocations.s
|
|
@@ -1,5 +1,18 @@
|
|
! RUN: llvm-mc %s -arch=sparcv9 -show-encoding | FileCheck %s
|
|
+! RUN: llvm-mc %s -arch=sparcv9 -filetype=obj | llvm-readobj -r | FileCheck %s --check-prefix=CHECK-OBJ
|
|
|
|
+ ! CHECK-OBJ: Format: ELF64-sparc
|
|
+ ! CHECK-OBJ: Relocations [
|
|
+ ! CHECK-OBJ: 0x{{[0-9,A-F]+}} R_SPARC_WDISP30 foo
|
|
+ ! CHECK-OBJ: 0x{{[0-9,A-F]+}} R_SPARC_LO10 sym
|
|
+ ! CHECK-OBJ: 0x{{[0-9,A-F]+}} R_SPARC_HI22 sym
|
|
+ ! CHECK-OBJ: 0x{{[0-9,A-F]+}} R_SPARC_H44 sym
|
|
+ ! CHECK-OBJ: 0x{{[0-9,A-F]+}} R_SPARC_M44 sym
|
|
+ ! CHECK-OBJ: 0x{{[0-9,A-F]+}} R_SPARC_L44 sym
|
|
+ ! CHECK-OBJ: 0x{{[0-9,A-F]+}} R_SPARC_HH22 sym
|
|
+ ! CHECK-OBJ: 0x{{[0-9,A-F]+}} R_SPARC_HM10 sym
|
|
+ ! CHECK-ELF: ]
|
|
+
|
|
! CHECK: call foo ! encoding: [0b01AAAAAA,A,A,A]
|
|
! CHECK: ! fixup A - offset: 0, value: foo, kind: fixup_sparc_call30
|
|
call foo
|
|
Index: include/llvm/Object/ELFObjectFile.h
|
|
===================================================================
|
|
--- include/llvm/Object/ELFObjectFile.h
|
|
+++ include/llvm/Object/ELFObjectFile.h
|
|
@@ -922,6 +922,9 @@ StringRef ELFObjectFile<ELFT>::getFileFormatName()
|
|
return "ELF32-mips";
|
|
case ELF::EM_PPC:
|
|
return "ELF32-ppc";
|
|
+ case ELF::EM_SPARC:
|
|
+ case ELF::EM_SPARC32PLUS:
|
|
+ return "ELF32-sparc";
|
|
default:
|
|
return "ELF32-unknown";
|
|
}
|
|
@@ -937,6 +940,8 @@ StringRef ELFObjectFile<ELFT>::getFileFormatName()
|
|
return "ELF64-ppc64";
|
|
case ELF::EM_S390:
|
|
return "ELF64-s390";
|
|
+ case ELF::EM_SPARCV9:
|
|
+ return "ELF64-sparc";
|
|
default:
|
|
return "ELF64-unknown";
|
|
}
|
|
@@ -967,6 +972,13 @@ unsigned ELFObjectFile<ELFT>::getArch() const {
|
|
: Triple::ppc64;
|
|
case ELF::EM_S390:
|
|
return Triple::systemz;
|
|
+
|
|
+ case ELF::EM_SPARC:
|
|
+ case ELF::EM_SPARC32PLUS:
|
|
+ return Triple::sparc;
|
|
+ case ELF::EM_SPARCV9:
|
|
+ return Triple::sparcv9;
|
|
+
|
|
default:
|
|
return Triple::UnknownArch;
|
|
}
|
|
Index: lib/Object/ELF.cpp
|
|
===================================================================
|
|
--- lib/Object/ELF.cpp
|
|
+++ lib/Object/ELF.cpp
|
|
@@ -702,6 +702,98 @@ StringRef getELFRelocationTypeName(uint32_t Machin
|
|
break;
|
|
}
|
|
break;
|
|
+ case ELF::EM_SPARC:
|
|
+ case ELF::EM_SPARC32PLUS:
|
|
+ case ELF::EM_SPARCV9:
|
|
+ switch (Type) {
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_NONE);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_8);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_16);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_32);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_DISP8);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_DISP16);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_DISP32);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_WDISP30);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_WDISP22);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_HI22);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_22);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_13);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_LO10);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_GOT10);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_GOT13);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_GOT22);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_PC10);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_PC22);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_WPLT30);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_COPY);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_GLOB_DAT);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_JMP_SLOT);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_RELATIVE);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_UA32);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_PLT32);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_HIPLT22);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_LOPLT10);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_PCPLT32);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_PCPLT22);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_PCPLT10);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_10);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_11);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_64);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_OLO10);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_HH22);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_HM10);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_LM22);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_PC_HH22);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_PC_HM10);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_PC_LM22);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_WDISP16);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_WDISP19);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_7);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_5);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_6);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_DISP64);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_PLT64);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_HIX22);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_LOX10);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_H44);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_M44);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_L44);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_REGISTER);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_UA64);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_UA16);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_TLS_GD_HI22);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_TLS_GD_LO10);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_TLS_GD_ADD);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_TLS_GD_CALL);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_TLS_LDM_HI22);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_TLS_LDM_LO10);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_TLS_LDM_ADD);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_TLS_LDM_CALL);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_TLS_LDO_HIX22);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_TLS_LDO_LOX10);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_TLS_LDO_ADD);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_TLS_IE_HI22);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_TLS_IE_LO10);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_TLS_IE_LD);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_TLS_IE_LDX);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_TLS_IE_ADD);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_TLS_LE_HIX22);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_TLS_LE_LOX10);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_TLS_DTPMOD32);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_TLS_DTPMOD64);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_TLS_DTPOFF32);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_TLS_DTPOFF64);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_TLS_TPOFF32);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_TLS_TPOFF64);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_GOTDATA_HIX22);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_GOTDATA_LOX22);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_GOTDATA_OP_HIX22);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_GOTDATA_OP_LOX22);
|
|
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_GOTDATA_OP);
|
|
+ default:
|
|
+ break;
|
|
+ }
|
|
+ break;
|
|
default:
|
|
break;
|
|
}
|