[lld] r331554 - [ELF][MIPS] Add STO_MIPS_MICROMIPS flag to symbols point to microMIPS PLT records

Simon Atanasyan via llvm-commits llvm-commits at lists.llvm.org
Fri May 4 13:48:48 PDT 2018


Author: atanasyan
Date: Fri May  4 13:48:47 2018
New Revision: 331554

URL: http://llvm.org/viewvc/llvm-project?rev=331554&view=rev
Log:
[ELF][MIPS] Add STO_MIPS_MICROMIPS flag to symbols point to microMIPS PLT records

Modified:
    lld/trunk/ELF/SyntheticSections.cpp
    lld/trunk/test/ELF/mips-micro-plt.s

Modified: lld/trunk/ELF/SyntheticSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.cpp?rev=331554&r1=331553&r2=331554&view=diff
==============================================================================
--- lld/trunk/ELF/SyntheticSections.cpp (original)
+++ lld/trunk/ELF/SyntheticSections.cpp Fri May  4 13:48:47 2018
@@ -1685,8 +1685,11 @@ template <class ELFT> void SymbolTableSe
         ESym->st_other |= STO_MIPS_PLT;
       if (isMicroMips()) {
         // Set STO_MIPS_MICROMIPS flag and less-significant bit for
-        // defined microMIPS symbols and shared symbols with PLT record.
-        if (Sym->isDefined() && (Sym->StOther & STO_MIPS_MICROMIPS)) {
+        // a defined microMIPS symbol and symbol should point to its
+        // PLT entry (in case of microMIPS, PLT entries always contain
+        // microMIPS code).
+        if (Sym->isDefined() &&
+            ((Sym->StOther & STO_MIPS_MICROMIPS) || Sym->NeedsPltAddr)) {
           if (StrTabSec.isDynamic())
             ESym->st_value |= 1;
           ESym->st_other |= STO_MIPS_MICROMIPS;

Modified: lld/trunk/test/ELF/mips-micro-plt.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/mips-micro-plt.s?rev=331554&r1=331553&r2=331554&view=diff
==============================================================================
--- lld/trunk/test/ELF/mips-micro-plt.s (original)
+++ lld/trunk/test/ELF/mips-micro-plt.s Fri May  4 13:48:47 2018
@@ -42,6 +42,7 @@
 # CHECK-NEXT:     Binding: Global
 # CHECK-NEXT:     Type: Function
 # CHECK-NEXT:     Other [
+# CHECK-NEXT:       STO_MIPS_MICROMIPS
 # CHECK-NEXT:       STO_MIPS_PLT
 # CHECK-NEXT:     ]
 # CHECK-NEXT:     Section: Undefined
@@ -50,11 +51,12 @@
 # CHECK:      DynamicSymbols [
 # CHECK:        Symbol {
 # CHECK:          Name: foo0
-# CHECK-NEXT:     Value: 0x20040
+# CHECK-NEXT:     Value: 0x20041
 # CHECK-NEXT:     Size:
 # CHECK-NEXT:     Binding: Global
 # CHECK-NEXT:     Type: Function
 # CHECK-NEXT:     Other [
+# CHECK-NEXT:       STO_MIPS_MICROMIPS
 # CHECK-NEXT:       STO_MIPS_PLT
 # CHECK-NEXT:     ]
 # CHECK-NEXT:     Section: Undefined
@@ -76,7 +78,7 @@
 # CHECK-NEXT:     Entry {
 # CHECK-NEXT:       Address:
 # CHECK-NEXT:       Initial: 0x20021
-# CHECK-NEXT:       Value: 0x20040
+# CHECK-NEXT:       Value: 0x20041
 # CHECK-NEXT:       Type: Function
 # CHECK-NEXT:       Section: Undefined
 # CHECK-NEXT:       Name: foo0@




More information about the llvm-commits mailing list