[lld] r232868 - [ELF] GLOBAL_OFFSET_TABLE is a hidden symbol

Shankar Easwaran shankare at codeaurora.org
Fri Mar 20 16:47:08 PDT 2015


Author: shankare
Date: Fri Mar 20 18:47:08 2015
New Revision: 232868

URL: http://llvm.org/viewvc/llvm-project?rev=232868&view=rev
Log:
[ELF] GLOBAL_OFFSET_TABLE is a hidden symbol

Modified:
    lld/trunk/lib/ReaderWriter/ELF/Atoms.h
    lld/trunk/lib/ReaderWriter/ELF/DynamicLibraryWriter.h
    lld/trunk/test/elf/Mips/got16-micro.test
    lld/trunk/test/elf/Mips/got16.test
    lld/trunk/test/elf/initfini-options.test-2.test
    lld/trunk/test/elf/initfini-options.test-3.test

Modified: lld/trunk/lib/ReaderWriter/ELF/Atoms.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Atoms.h?rev=232868&r1=232867&r2=232868&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Atoms.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Atoms.h Fri Mar 20 18:47:08 2015
@@ -799,7 +799,7 @@ public:
 
   StringRef name() const override { return "_GLOBAL_OFFSET_TABLE_"; }
 
-  Scope scope() const override { return scopeGlobal; }
+  Scope scope() const override { return scopeLinkageUnit; }
 
   SectionChoice sectionChoice() const override { return sectionCustomRequired; }
 

Modified: lld/trunk/lib/ReaderWriter/ELF/DynamicLibraryWriter.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/DynamicLibraryWriter.h?rev=232868&r1=232867&r2=232868&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/DynamicLibraryWriter.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/DynamicLibraryWriter.h Fri Mar 20 18:47:08 2015
@@ -51,7 +51,7 @@ void DynamicLibraryWriter<ELFT>::buildDy
     if (auto section = dyn_cast<AtomSection<ELFT>>(sec))
       for (const auto &atom : section->atoms()) {
         const DefinedAtom *da = dyn_cast<const DefinedAtom>(atom->_atom);
-        if (da && (da->scope() != DefinedAtom::scopeTranslationUnit))
+        if (da && (da->scope() == DefinedAtom::scopeGlobal))
           this->_dynamicSymbolTable->addSymbol(atom->_atom, section->ordinal(),
                                                atom->_virtualAddr, atom);
       }

Modified: lld/trunk/test/elf/Mips/got16-micro.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/Mips/got16-micro.test?rev=232868&r1=232867&r2=232868&view=diff
==============================================================================
--- lld/trunk/test/elf/Mips/got16-micro.test (original)
+++ lld/trunk/test/elf/Mips/got16-micro.test Fri Mar 20 18:47:08 2015
@@ -105,21 +105,21 @@
 
 # RAW: Disassembly of section .text:
 # RAW: main:
-# RAW-NEXT:   164:  5c fc 18 80   lw      $2, -32744($gp)
-# RAW-NEXT:   168:  42 30 40 10   addiu   $2, $2, 4160
-# RAW-NEXT:   16c:  5c fc 1c 80   lw      $2, -32740($gp)
-# RAW-NEXT:   170:  42 30 60 20   addiu   $2, $2, 8288
-# RAW-NEXT:   174:  5c fc 20 80   lw      $2, -32736($gp)
-# RAW-NEXT:   178:  5c fc 24 80   lw      $2, -32732($gp)
-# RAW-NEXT:   17c:  5c fc 28 80   lw      $2, -32728($gp)
+# RAW-NEXT:   {{[0x0-9a-f]+}}:  5c fc 18 80   lw      $2, -32744($gp)
+# RAW-NEXT:   {{[0x0-9a-f]+}}:  42 30 40 10   addiu   $2, $2, 4160
+# RAW-NEXT:   {{[0x0-9a-f]+}}:  5c fc 1c 80   lw      $2, -32740($gp)
+# RAW-NEXT:   {{[0x0-9a-f]+}}:  42 30 60 20   addiu   $2, $2, 8288
+# RAW-NEXT:   {{[0x0-9a-f]+}}:  5c fc 20 80   lw      $2, -32736($gp)
+# RAW-NEXT:   {{[0x0-9a-f]+}}:  5c fc 24 80   lw      $2, -32732($gp)
+# RAW-NEXT:   {{[0x0-9a-f]+}}:  5c fc 28 80   lw      $2, -32728($gp)
 
 # RAW: SYMBOL TABLE:
-# RAW: 00000000       *UND*  00000000
-# RAW: 00001040 l     .data  00000000 data_1
-# RAW: 00002060 l     .data  00000001 data_2
-# RAW: 00000160 g   F .text  00000004 bar
-# RAW: 00000164 g   F .text  0000001c main
-# RAW: 00002061 g     .data  00000001 data_h
+# RAW: {{[0x0-9a-f]+}}       *UND*  00000000
+# RAW: {{[0x0-9a-f]+}} l     .data  00000000 data_1
+# RAW: {{[0x0-9a-f]+}} l     .data  00000001 data_2
+# RAW: {{[0x0-9a-f]+}} g   F .text  00000004 bar
+# RAW: {{[0x0-9a-f]+}} g   F .text  0000001c main
+# RAW: {{[0x0-9a-f]+}} g     .data  00000001 data_h
 
         .data
         .type   data_1, @object

Modified: lld/trunk/test/elf/Mips/got16.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/Mips/got16.test?rev=232868&r1=232867&r2=232868&view=diff
==============================================================================
--- lld/trunk/test/elf/Mips/got16.test (original)
+++ lld/trunk/test/elf/Mips/got16.test Fri Mar 20 18:47:08 2015
@@ -105,20 +105,20 @@
 
 # RAW: Disassembly of section .text:
 # RAW: glob:
-# RAW-NEXT:   12c:  18 80 84 8f  lw      $4, -32744($gp)
-# RAW-NEXT:   130:  00 20 84 24  addiu   $4, $4, 8192
-# RAW-NEXT:   134:  1c 80 84 8f  lw      $4, -32740($gp)
-# RAW-NEXT:   138:  00 22 84 24  addiu   $4, $4, 8704
-# RAW-NEXT:   13c:  20 80 84 8f  lw      $4, -32736($gp)
-# RAW-NEXT:   140:  24 80 84 8f  lw      $4, -32732($gp)
-# RAW-NEXT:   144:  28 80 84 8f  lw      $4, -32728($gp)
+# RAW-NEXT:   {{[0x0-9a-f]+}}:  18 80 84 8f  lw      $4, -32744($gp)
+# RAW-NEXT:   {{[0x0-9a-f]+}}:  00 20 84 24  addiu   $4, $4, 8192
+# RAW-NEXT:   {{[0x0-9a-f]+}}:  1c 80 84 8f  lw      $4, -32740($gp)
+# RAW-NEXT:   {{[0x0-9a-f]+}}:  00 22 84 24  addiu   $4, $4, 8704
+# RAW-NEXT:   {{[0x0-9a-f]+}}:  20 80 84 8f  lw      $4, -32736($gp)
+# RAW-NEXT:   {{[0x0-9a-f]+}}:  24 80 84 8f  lw      $4, -32732($gp)
+# RAW-NEXT:   {{[0x0-9a-f]+}}:  28 80 84 8f  lw      $4, -32728($gp)
 
 # RAW: SYMBOL TABLE:
-# RAW: 00000000       *UND*  00000000
-# RAW: 00002000 l     .data  00000000 str1
-# RAW: 00012200 l     .data  00000005 str2
-# RAW: 0000012c g   F .text  0000001c glob
-# RAW: 00012205 g     .data  00000004 hidden
+# RAW: {{[0x0-9a-f]+}}       *UND*  00000000
+# RAW: {{[0x0-9a-f]+}} l     .data  00000000 str1
+# RAW: {{[0x0-9a-f]+}} l     .data  00000005 str2
+# RAW: {{[0x0-9a-f]+}} g   F .text  0000001c glob
+# RAW: {{[0x0-9a-f]+}} g     .data  00000004 hidden
 
 ---
 FileHeader:

Modified: lld/trunk/test/elf/initfini-options.test-2.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/initfini-options.test-2.test?rev=232868&r1=232867&r2=232868&view=diff
==============================================================================
--- lld/trunk/test/elf/initfini-options.test-2.test (original)
+++ lld/trunk/test/elf/initfini-options.test-2.test Fri Mar 20 18:47:08 2015
@@ -6,12 +6,12 @@
 # RUN: llvm-readobj -symbols -dynamic-table %t.so | FileCheck %s
 
 # CHECK:      Name: _init (8)
-# CHECK-NEXT: Value: 0x4001E4
+# CHECK-NEXT: Value: {{[0x0-9a-f]+}}
 # CHECK:      Name: _fini (14)
-# CHECK-NEXT: Value: 0x4001EB
+# CHECK-NEXT: Value: {{[0x0-9a-f]+}}
 #
-# CHECK: 0x000000000000000C INIT 0x4001E4
-# CHECK: 0x000000000000000D FINI 0x4001EB
+# CHECK: 0x000000000000000C INIT {{[0x0-9a-f]+}}
+# CHECK: 0x000000000000000D FINI {{[0x0-9a-f]+}}
 
 ---
 FileHeader:

Modified: lld/trunk/test/elf/initfini-options.test-3.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/initfini-options.test-3.test?rev=232868&r1=232867&r2=232868&view=diff
==============================================================================
--- lld/trunk/test/elf/initfini-options.test-3.test (original)
+++ lld/trunk/test/elf/initfini-options.test-3.test Fri Mar 20 18:47:08 2015
@@ -7,12 +7,12 @@
 # RUN: llvm-readobj -symbols -dynamic-table %t.so | FileCheck %s
 
 # CHECK:      Name: _start (1)
-# CHECK-NEXT: Value: 0x4001FC
+# CHECK-NEXT: Value: {{[0x0-9a-f]+}}
 # CHECK:      Name: _stop (8)
-# CHECK-NEXT: Value: 0x400204
+# CHECK-NEXT: Value: {{[0x0-9a-f]+}}
 #
-# CHECK: 0x000000000000000C INIT 0x4001FC
-# CHECK: 0x000000000000000D FINI 0x400204
+# CHECK: 0x000000000000000C INIT {{[0x0-9a-f]+}}
+# CHECK: 0x000000000000000D FINI {{[0x0-9a-f]+}}
 
 ---
 FileHeader:





More information about the llvm-commits mailing list