Untested code

Rafael EspĂ­ndola via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 11 13:46:42 PDT 2016


Hi Simon,

I just noticed that some mips code is not currently tested. All tests
pass with the attached patch.

Could you try adding tests for it?

Thanks,
Rafael
-------------- next part --------------
diff --git a/ELF/InputFiles.cpp b/ELF/InputFiles.cpp
index 71d7a58..64d8d82 100644
--- a/ELF/InputFiles.cpp
+++ b/ELF/InputFiles.cpp
@@ -102,12 +102,6 @@ ArrayRef<SymbolBody *> elf::ObjectFile<ELFT>::getSymbols() {
   return makeArrayRef(this->SymbolBodies).slice(1);
 }
 
-template <class ELFT> uint32_t elf::ObjectFile<ELFT>::getMipsGp0() const {
-  if (MipsReginfo)
-    return MipsReginfo->Reginfo->ri_gp_value;
-  return 0;
-}
-
 template <class ELFT>
 void elf::ObjectFile<ELFT>::parse(DenseSet<StringRef> &ComdatGroups) {
   // Read section and symbol tables.
diff --git a/ELF/InputFiles.h b/ELF/InputFiles.h
index ca41d16..0ca4cc1 100644
--- a/ELF/InputFiles.h
+++ b/ELF/InputFiles.h
@@ -129,11 +129,6 @@ public:
 
   const Elf_Shdr *getSymbolTable() const { return this->Symtab; };
 
-  // Get MIPS GP0 value defined by this file. This value represents the gp value
-  // used to create the relocatable object and required to support
-  // R_MIPS_GPREL16 / R_MIPS_GPREL32 relocations.
-  uint32_t getMipsGp0() const;
-
   // The number is the offset in the string table. It will be used as the
   // st_name of the symbol.
   std::vector<std::pair<const DefinedRegular<ELFT> *, unsigned>> KeptLocalSyms;
diff --git a/ELF/InputSection.cpp b/ELF/InputSection.cpp
index ba77b3e..d89c33c 100644
--- a/ELF/InputSection.cpp
+++ b/ELF/InputSection.cpp
@@ -208,13 +208,6 @@ static uintX_t adjustMipsSymVA(uint32_t Type, const elf::ObjectFile<ELFT> &File,
                                uintX_t SymVA) {
   if (Type == R_MIPS_HI16 && &Body == ElfSym<ELFT>::MipsGpDisp)
     return SymVA - AddrLoc;
-  if (Type == R_MIPS_LO16 && &Body == ElfSym<ELFT>::MipsGpDisp)
-    return SymVA - AddrLoc + 4;
-  if (Body.isLocal() && (Type == R_MIPS_GPREL16 || Type == R_MIPS_GPREL32))
-    // We need to adjust SymVA value in case of R_MIPS_GPREL16/32
-    // relocations because they use the following expression to calculate
-    // the relocation's result for local symbol: S + A + GP0 - G.
-    return SymVA + File.getMipsGp0();
   return SymVA;
 }
 


More information about the llvm-commits mailing list