[ELF] GLOBAL_OFFSET_TABLE is a hidden symbol

llvm-svn: 232868
This commit is contained in:
Shankar Easwaran 2015-03-20 23:47:08 +00:00
parent 14726cd11b
commit 37d5add8a3
6 changed files with 35 additions and 35 deletions

View File

@ -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; }

View File

@ -51,7 +51,7 @@ void DynamicLibraryWriter<ELFT>::buildDynamicSymbolTable(const File &file) {
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);
}

View File

@ -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

View File

@ -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:

View File

@ -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:

View File

@ -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: