[MCJIT] Temporarily revert r220245 - it broke several bots.
authorLang Hames <lhames@gmail.com>
Tue, 21 Oct 2014 00:24:02 +0000 (00:24 +0000)
committerLang Hames <lhames@gmail.com>
Tue, 21 Oct 2014 00:24:02 +0000 (00:24 +0000)
(See e.g. http://bb.pgr.jp/builders/cmake-llvm-x86_64-linux/builds/17653)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220249 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Object/ELFObjectFile.h
include/llvm/Object/ELFTypes.h
include/llvm/Object/SymbolicFile.h
include/llvm/Support/ELF.h
lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
lib/Object/MachOObjectFile.cpp
test/ExecutionEngine/RuntimeDyld/AArch64/MachO_ARM64_relocations.s
test/ExecutionEngine/RuntimeDyld/ARM/MachO_ARM_PIC_relocations.s
test/ExecutionEngine/RuntimeDyld/X86/MachO_i386_DynNoPIC_relocations.s
test/ExecutionEngine/RuntimeDyld/X86/MachO_x86-64_PIC_relocations.s

index bb7c90ac34897e7824ccc9fddc7bc2e593ade4a3..4676ae8bdbc09261b43e29daa786ca0dab6e0e03 100644 (file)
@@ -177,19 +177,6 @@ protected:
     return DRI;
   }
 
     return DRI;
   }
 
-  bool isExportedToOtherDSO(const Elf_Sym *ESym) const {
-    unsigned char Binding = ESym->getBinding();
-    unsigned char Visibility = ESym->getVisibility();
-
-    if (Binding != ELF::STB_GLOBAL && Binding != ELF::STB_WEAK)
-      return false;
-
-    if (Visibility != ELF::STV_DEFAULT && Visibility != ELF::STV_PROTECTED)
-      return false;
-
-    return true;
-  }
-
   // This flag is used for classof, to distinguish ELFObjectFile from
   // its subclass. If more subclasses will be created, this flag will
   // have to become an enum.
   // This flag is used for classof, to distinguish ELFObjectFile from
   // its subclass. If more subclasses will be created, this flag will
   // have to become an enum.
@@ -386,9 +373,6 @@ uint32_t ELFObjectFile<ELFT>::getSymbolFlags(DataRefImpl Symb) const {
       EF.getSymbolTableIndex(ESym) == ELF::SHN_COMMON)
     Result |= SymbolRef::SF_Common;
 
       EF.getSymbolTableIndex(ESym) == ELF::SHN_COMMON)
     Result |= SymbolRef::SF_Common;
 
-  if (isExportedToOtherDSO(ESym))
-    Result |= SymbolRef::SF_Exported;
-
   return Result;
 }
 
   return Result;
 }
 
index 21a49fb6eaa6bbd54094c252fd7e01259b46877a..9a23c8c4e49016eea1235ea5c82f2e21396fe935 100644 (file)
@@ -158,7 +158,7 @@ struct Elf_Sym_Base<ELFType<TargetEndianness, MaxAlign, false> > {
   Elf_Addr st_value;      // Value or address associated with the symbol
   Elf_Word st_size;       // Size of the symbol
   unsigned char st_info;  // Symbol's type and binding attributes
   Elf_Addr st_value;      // Value or address associated with the symbol
   Elf_Word st_size;       // Size of the symbol
   unsigned char st_info;  // Symbol's type and binding attributes
-  unsigned char st_other; // Visibility in the lower 2 bits, the rest is zero
+  unsigned char st_other; // Must be zero; reserved
   Elf_Half st_shndx;      // Which section (header table index) it's defined in
 };
 
   Elf_Half st_shndx;      // Which section (header table index) it's defined in
 };
 
@@ -167,7 +167,7 @@ struct Elf_Sym_Base<ELFType<TargetEndianness, MaxAlign, true> > {
   LLVM_ELF_IMPORT_TYPES(TargetEndianness, MaxAlign, true)
   Elf_Word st_name;       // Symbol name (index into string table)
   unsigned char st_info;  // Symbol's type and binding attributes
   LLVM_ELF_IMPORT_TYPES(TargetEndianness, MaxAlign, true)
   Elf_Word st_name;       // Symbol name (index into string table)
   unsigned char st_info;  // Symbol's type and binding attributes
-  unsigned char st_other; // Visibility in the lower 2 bits, the rest is zero
+  unsigned char st_other; // Must be zero; reserved
   Elf_Half st_shndx;      // Which section (header table index) it's defined in
   Elf_Addr st_value;      // Value or address associated with the symbol
   Elf_Xword st_size;      // Size of the symbol
   Elf_Half st_shndx;      // Which section (header table index) it's defined in
   Elf_Addr st_value;      // Value or address associated with the symbol
   Elf_Xword st_size;      // Size of the symbol
@@ -176,21 +176,16 @@ struct Elf_Sym_Base<ELFType<TargetEndianness, MaxAlign, true> > {
 template <class ELFT>
 struct Elf_Sym_Impl : Elf_Sym_Base<ELFT> {
   using Elf_Sym_Base<ELFT>::st_info;
 template <class ELFT>
 struct Elf_Sym_Impl : Elf_Sym_Base<ELFT> {
   using Elf_Sym_Base<ELFT>::st_info;
-  using Elf_Sym_Base<ELFT>::st_other;
 
   // These accessors and mutators correspond to the ELF32_ST_BIND,
   // ELF32_ST_TYPE, and ELF32_ST_INFO macros defined in the ELF specification:
   unsigned char getBinding() const { return st_info >> 4; }
   unsigned char getType() const { return st_info & 0x0f; }
 
   // These accessors and mutators correspond to the ELF32_ST_BIND,
   // ELF32_ST_TYPE, and ELF32_ST_INFO macros defined in the ELF specification:
   unsigned char getBinding() const { return st_info >> 4; }
   unsigned char getType() const { return st_info & 0x0f; }
-  unsigned char getVisibility() const { return st_other & 0x3; }
   void setBinding(unsigned char b) { setBindingAndType(b, getType()); }
   void setType(unsigned char t) { setBindingAndType(getBinding(), t); }
   void setBindingAndType(unsigned char b, unsigned char t) {
     st_info = (b << 4) + (t & 0x0f);
   }
   void setBinding(unsigned char b) { setBindingAndType(b, getType()); }
   void setType(unsigned char t) { setBindingAndType(getBinding(), t); }
   void setBindingAndType(unsigned char b, unsigned char t) {
     st_info = (b << 4) + (t & 0x0f);
   }
-  void setVisibility(unsigned char v) {
-    st_other = (st_other & ~0x3) | (v & 0x3);
-  }
 };
 
 /// Elf_Versym: This is the structure of entries in the SHT_GNU_versym section
 };
 
 /// Elf_Versym: This is the structure of entries in the SHT_GNU_versym section
index f7b7cb422dd6a680710f034eb3e907cc1eaa8fce..435799a34ebc29cd56397f1636e2c82014174b18 100644 (file)
@@ -87,10 +87,9 @@ public:
     SF_Absolute = 1U << 3,       // Absolute symbol
     SF_Common = 1U << 4,         // Symbol has common linkage
     SF_Indirect = 1U << 5,       // Symbol is an alias to another symbol
     SF_Absolute = 1U << 3,       // Absolute symbol
     SF_Common = 1U << 4,         // Symbol has common linkage
     SF_Indirect = 1U << 5,       // Symbol is an alias to another symbol
-    SF_Exported = 1U << 6,       // Symbol is visible to other DSOs
-    SF_FormatSpecific = 1U << 7, // Specific to the object file format
+    SF_FormatSpecific = 1U << 6, // Specific to the object file format
                                  // (e.g. section symbols)
                                  // (e.g. section symbols)
-    SF_Thumb = 1U << 8,          // Thumb symbol in a 32-bit ARM binary
+    SF_Thumb = 1U <<           // Thumb symbol in a 32-bit ARM binary
   };
 
   BasicSymbolRef() : OwningObject(nullptr) { }
   };
 
   BasicSymbolRef() : OwningObject(nullptr) { }
index 9b5d18e47da95a5fcf37b3c2071bfb8ef12cbd69..a51a05135299a8c78daff489533a6cd5edc2d27e 100644 (file)
@@ -1458,29 +1458,25 @@ struct Elf32_Sym {
   Elf32_Addr    st_value; // Value or address associated with the symbol
   Elf32_Word    st_size;  // Size of the symbol
   unsigned char st_info;  // Symbol's type and binding attributes
   Elf32_Addr    st_value; // Value or address associated with the symbol
   Elf32_Word    st_size;  // Size of the symbol
   unsigned char st_info;  // Symbol's type and binding attributes
-  unsigned char st_other; // Visibility in the lower 2 bits, the rest is zero
+  unsigned char st_other; // Must be zero; reserved
   Elf32_Half    st_shndx; // Which section (header table index) it's defined in
 
   // These accessors and mutators correspond to the ELF32_ST_BIND,
   // ELF32_ST_TYPE, and ELF32_ST_INFO macros defined in the ELF specification:
   unsigned char getBinding() const { return st_info >> 4; }
   unsigned char getType() const { return st_info & 0x0f; }
   Elf32_Half    st_shndx; // Which section (header table index) it's defined in
 
   // These accessors and mutators correspond to the ELF32_ST_BIND,
   // ELF32_ST_TYPE, and ELF32_ST_INFO macros defined in the ELF specification:
   unsigned char getBinding() const { return st_info >> 4; }
   unsigned char getType() const { return st_info & 0x0f; }
-  unsigned char getVisibility() const { return st_other & 0x3; }
   void setBinding(unsigned char b) { setBindingAndType(b, getType()); }
   void setType(unsigned char t) { setBindingAndType(getBinding(), t); }
   void setBindingAndType(unsigned char b, unsigned char t) {
     st_info = (b << 4) + (t & 0x0f);
   }
   void setBinding(unsigned char b) { setBindingAndType(b, getType()); }
   void setType(unsigned char t) { setBindingAndType(getBinding(), t); }
   void setBindingAndType(unsigned char b, unsigned char t) {
     st_info = (b << 4) + (t & 0x0f);
   }
-  void setVisibility(unsigned char v) {
-    st_other = (st_other & ~0x3) | (v & 0x3);
-  }
 };
 
 // Symbol table entries for ELF64.
 struct Elf64_Sym {
   Elf64_Word      st_name;  // Symbol name (index into string table)
   unsigned char   st_info;  // Symbol's type and binding attributes
 };
 
 // Symbol table entries for ELF64.
 struct Elf64_Sym {
   Elf64_Word      st_name;  // Symbol name (index into string table)
   unsigned char   st_info;  // Symbol's type and binding attributes
-  unsigned char   st_other; // Visibility in the lower 2 bits, the rest is zero
+  unsigned char   st_other; // Must be zero; reserved
   Elf64_Half      st_shndx; // Which section (header tbl index) it's defined in
   Elf64_Addr      st_value; // Value or address associated with the symbol
   Elf64_Xword     st_size;  // Size of the symbol
   Elf64_Half      st_shndx; // Which section (header tbl index) it's defined in
   Elf64_Addr      st_value; // Value or address associated with the symbol
   Elf64_Xword     st_size;  // Size of the symbol
@@ -1489,15 +1485,11 @@ struct Elf64_Sym {
   // symbol table entries.
   unsigned char getBinding() const { return st_info >> 4; }
   unsigned char getType() const { return st_info & 0x0f; }
   // symbol table entries.
   unsigned char getBinding() const { return st_info >> 4; }
   unsigned char getType() const { return st_info & 0x0f; }
-  unsigned char getVisibility() const { return st_other & 0x3; }
   void setBinding(unsigned char b) { setBindingAndType(b, getType()); }
   void setType(unsigned char t) { setBindingAndType(getBinding(), t); }
   void setBindingAndType(unsigned char b, unsigned char t) {
     st_info = (b << 4) + (t & 0x0f);
   }
   void setBinding(unsigned char b) { setBindingAndType(b, getType()); }
   void setType(unsigned char t) { setBindingAndType(getBinding(), t); }
   void setBindingAndType(unsigned char b, unsigned char t) {
     st_info = (b << 4) + (t & 0x0f);
   }
-  void setVisibility(unsigned char v) {
-    st_other = (st_other & ~0x3) | (v & 0x3);
-  }
 };
 
 // The size (in bytes) of symbol table entries.
 };
 
 // The size (in bytes) of symbol table entries.
index 5c16f0ab7125dc2ad47ec24f02d7b0713a5a56fc..488130112decfb757395d79d6420a1bb558d7132 100644 (file)
@@ -205,14 +205,10 @@ RuntimeDyldImpl::loadObject(std::unique_ptr<ObjectImage> Obj) {
         bool IsCode = SI->isText();
         unsigned SectionID =
             findOrEmitSection(*Obj, *SI, IsCode, LocalSections);
         bool IsCode = SI->isText();
         unsigned SectionID =
             findOrEmitSection(*Obj, *SI, IsCode, LocalSections);
-        // Add the symbol to the local symbol table for this module.
         LocalSymbols[Name.data()] = SymbolLoc(SectionID, SectOffset);
         DEBUG(dbgs() << "\tOffset: " << format("%p", (uintptr_t)SectOffset)
                      << " flags: " << Flags << " SID: " << SectionID);
         LocalSymbols[Name.data()] = SymbolLoc(SectionID, SectOffset);
         DEBUG(dbgs() << "\tOffset: " << format("%p", (uintptr_t)SectOffset)
                      << " flags: " << Flags << " SID: " << SectionID);
-        // If exported, add to the global symbol table for other modules to also link in.
-        if (Flags & SymbolRef::SF_Exported) {
-          GlobalSymbolTable[Name] = SymbolLoc(SectionID, SectOffset);
-        }
+        GlobalSymbolTable[Name] = SymbolLoc(SectionID, SectOffset);
       }
     }
     DEBUG(dbgs() << "\tType: " << SymType << " Name: " << Name << "\n");
       }
     }
     DEBUG(dbgs() << "\tType: " << SymType << " Name: " << Name << "\n");
index 91aa13f713055533000c1babc99e61624911cd03..6e83d8182a41ef9dc932a4554684c969e0d43e63 100644 (file)
@@ -454,9 +454,6 @@ uint32_t MachOObjectFile::getSymbolFlags(DataRefImpl DRI) const {
       if (Value && Value != UnknownAddressOrSize)
         Result |= SymbolRef::SF_Common;
     }
       if (Value && Value != UnknownAddressOrSize)
         Result |= SymbolRef::SF_Common;
     }
-
-    if (!(MachOType & MachO::N_PEXT))
-      Result |= SymbolRef::SF_Exported;
   }
 
   if (MachOFlags & (MachO::N_WEAK_REF | MachO::N_WEAK_DEF))
   }
 
   if (MachOFlags & (MachO::N_WEAK_REF | MachO::N_WEAK_DEF))
index 1bf98a93d5d5988cbfc433f93d87447e2ac83dea..29c95e6ce353af8ddf8a1f3d386ca1ba33aa77be 100644 (file)
@@ -18,7 +18,6 @@ _foo:
 # and therefore ignored.
 # rtdyld-check:  decode_operand(br1, 0)[25:0] = (_foo - br1)[27:2]
 _test_branch_reloc:
 # and therefore ignored.
 # rtdyld-check:  decode_operand(br1, 0)[25:0] = (_foo - br1)[27:2]
 _test_branch_reloc:
-    .globl  br1
 br1:
     b _foo
     ret
 br1:
     b _foo
     ret
@@ -33,10 +32,8 @@ br1:
     .globl  _test_adrp_ldr
     .align  2
 _test_adrp_ldr:
     .globl  _test_adrp_ldr
     .align  2
 _test_adrp_ldr:
-    .globl  adrp1
 adrp1:
     adrp x0, _ptr@PAGE
 adrp1:
     adrp x0, _ptr@PAGE
-    .globl  ldr1
 ldr1:
     ldr  x0, [x0, _ptr@PAGEOFF]
     ret
 ldr1:
     ldr  x0, [x0, _ptr@PAGEOFF]
     ret
@@ -52,10 +49,8 @@ ldr1:
     .globl  _test_adrp_ldr
     .align  2
 _test_got_adrp_ldr:
     .globl  _test_adrp_ldr
     .align  2
 _test_got_adrp_ldr:
-    .globl  adrp2
 adrp2:
     adrp x0, _ptr@GOTPAGE
 adrp2:
     adrp x0, _ptr@GOTPAGE
-    .globl  ldr2
 ldr2:
     ldr  x0, [x0, _ptr@GOTPAGEOFF]
     ret
 ldr2:
     ldr  x0, [x0, _ptr@GOTPAGEOFF]
     ret
index 8214a2594ede64b14e1668c064de2618550d185c..7ff3a8975769c3281b0ee8dd683941d2a004c8e3 100644 (file)
@@ -8,15 +8,12 @@
 bar:
 # Check lower 16-bits of section difference relocation
 # rtdyld-check: decode_operand(insn1, 1) = (foo$non_lazy_ptr-(nextPC+8))[15:0]
 bar:
 # Check lower 16-bits of section difference relocation
 # rtdyld-check: decode_operand(insn1, 1) = (foo$non_lazy_ptr-(nextPC+8))[15:0]
-        .globl  insn1
 insn1:
         movw    r0, :lower16:(foo$non_lazy_ptr-(nextPC+8))
 # Check upper 16-bits of section difference relocation
 # rtdyld-check: decode_operand(insn2, 2) = (foo$non_lazy_ptr-(nextPC+8))[31:16]
 insn1:
         movw    r0, :lower16:(foo$non_lazy_ptr-(nextPC+8))
 # Check upper 16-bits of section difference relocation
 # rtdyld-check: decode_operand(insn2, 2) = (foo$non_lazy_ptr-(nextPC+8))[31:16]
-        .globl  insn2
 insn2:
         movt    r0, :upper16:(foo$non_lazy_ptr-(nextPC+8))
 insn2:
         movt    r0, :upper16:(foo$non_lazy_ptr-(nextPC+8))
-        .globl  nextPC
 nextPC:
         add     r1, r0, r0
 
 nextPC:
         add     r1, r0, r0
 
@@ -28,7 +25,6 @@ nextPC:
 # rtdyld-check: *{4}(stub_addr(foo.o, __text, baz) + 4) = baz
 #
 # rtdyld-check: decode_operand(insn3, 0) = stub_addr(foo.o, __text, baz) - (insn3 + 8)
 # rtdyld-check: *{4}(stub_addr(foo.o, __text, baz) + 4) = baz
 #
 # rtdyld-check: decode_operand(insn3, 0) = stub_addr(foo.o, __text, baz) - (insn3 + 8)
-        .globl  insn3
 insn3:
         bl      baz
 
 insn3:
         bl      baz
 
@@ -48,7 +44,6 @@ insn4:
 # rtdyld-check: *{4}foo$non_lazy_ptr = foo
         .section       __DATA,__nl_symbol_ptr,non_lazy_symbol_pointers
        .align  2
 # rtdyld-check: *{4}foo$non_lazy_ptr = foo
         .section       __DATA,__nl_symbol_ptr,non_lazy_symbol_pointers
        .align  2
-        .globl  foo$non_lazy_ptr
 foo$non_lazy_ptr:
        .indirect_symbol        foo
        .long   0
 foo$non_lazy_ptr:
        .indirect_symbol        foo
        .long   0
index 48b470d9a30dd120f8a1dfee2a42e37602f8c336..f427b985b58c336f8efc1bb48fec92e4f9e9a103 100644 (file)
@@ -6,19 +6,16 @@
        .align  4, 0x90
 bar:
        calll   tmp0$pb
        .align  4, 0x90
 bar:
        calll   tmp0$pb
-       .globl  tmp0$pb
 tmp0$pb:
        popl    %eax
 # Test section difference relocation to non-lazy ptr section.
 # rtdyld-check: decode_operand(inst1, 4) = x$non_lazy_ptr - tmp0$pb
 tmp0$pb:
        popl    %eax
 # Test section difference relocation to non-lazy ptr section.
 # rtdyld-check: decode_operand(inst1, 4) = x$non_lazy_ptr - tmp0$pb
-       .globl  inst1
 inst1:
        movl    x$non_lazy_ptr-tmp0$pb(%eax), %eax
         movl    (%eax), %ebx
 
 # Test VANILLA relocation to jump table.
 # rtdyld-check: decode_operand(inst2, 0) = bling$stub - next_pc(inst2)
 inst1:
        movl    x$non_lazy_ptr-tmp0$pb(%eax), %eax
         movl    (%eax), %ebx
 
 # Test VANILLA relocation to jump table.
 # rtdyld-check: decode_operand(inst2, 0) = bling$stub - next_pc(inst2)
-       .globl  inst2
 inst2:
         calll  bling$stub
         addl    %ebx, %eax
 inst2:
         calll  bling$stub
         addl    %ebx, %eax
@@ -30,13 +27,11 @@ inst3:
        retl
 
        .section        __IMPORT,__jump_table,symbol_stubs,pure_instructions+self_modifying_code,5
        retl
 
        .section        __IMPORT,__jump_table,symbol_stubs,pure_instructions+self_modifying_code,5
-       .globl  bling$stub
 bling$stub:
        .indirect_symbol        bling
        .ascii  "\364\364\364\364\364"
 
        .section        __IMPORT,__pointers,non_lazy_symbol_pointers
 bling$stub:
        .indirect_symbol        bling
        .ascii  "\364\364\364\364\364"
 
        .section        __IMPORT,__pointers,non_lazy_symbol_pointers
-       .globl  x$non_lazy_ptr
 x$non_lazy_ptr:
        .indirect_symbol        x
        .long   0
 x$non_lazy_ptr:
        .indirect_symbol        x
        .long   0
index d9893b0f2bb1607a5b578d06fa80ca695ba94cb0..502f276501f84e4775ca4c8861b5dca1885d60c4 100644 (file)
@@ -12,13 +12,11 @@ foo:
 main:
 # Test PC-rel branch.
 # rtdyld-check: decode_operand(insn1, 0) = foo - next_pc(insn1)
 main:
 # Test PC-rel branch.
 # rtdyld-check: decode_operand(insn1, 0) = foo - next_pc(insn1)
-       .globl  insn1
 insn1:
         callq  foo
 
 # Test PC-rel signed.
 # rtdyld-check: decode_operand(insn2, 4) = x - next_pc(insn2)
 insn1:
         callq  foo
 
 # Test PC-rel signed.
 # rtdyld-check: decode_operand(insn2, 4) = x - next_pc(insn2)
-       .globl  insn2
 insn2:
        movl    x(%rip), %eax
 
 insn2:
        movl    x(%rip), %eax
 
@@ -27,7 +25,6 @@ insn2:
 # references the correct GOT entry address:
 # rtdyld-check: *{8}(stub_addr(test_x86-64.o, __text, y)) = y
 # rtdyld-check: decode_operand(insn3, 4) = stub_addr(test_x86-64.o, __text, y) - next_pc(insn3)
 # references the correct GOT entry address:
 # rtdyld-check: *{8}(stub_addr(test_x86-64.o, __text, y)) = y
 # rtdyld-check: decode_operand(insn3, 4) = stub_addr(test_x86-64.o, __text, y) - next_pc(insn3)
-       .globl  insn3
 insn3:
         movq   y@GOTPCREL(%rip), %rax
 
 insn3:
         movq   y@GOTPCREL(%rip), %rax