The test changes are just because of the symbol order.
llvm-svn: 266037
Config->EntrySym = Symtab.addUndefined(S);
}
- if (Config->EMachine == EM_MIPS) {
- // Define _gp for MIPS. st_value of _gp symbol will be updated by Writer
- // so that it points to an absolute address which is relative to GOT.
- // See "Global Data Symbols" in Chapter 6 in the following document:
- // ftp://www.linux-mips.org/pub/linux/mips/doc/ABI/mipsabi.pdf
- ElfSym<ELFT>::MipsGp = Symtab.addAbsolute("_gp", STV_DEFAULT);
- }
-
for (std::unique_ptr<InputFile> &F : Files)
Symtab.addFile(std::move(F));
if (HasError)
// the linking result. This function defines such symbols.
template <class ELFT> void Writer<ELFT>::addReservedSymbols() {
if (Config->EMachine == EM_MIPS) {
+ // Define _gp for MIPS. st_value of _gp symbol will be updated by Writer
+ // so that it points to an absolute address which is relative to GOT.
+ // See "Global Data Symbols" in Chapter 6 in the following document:
+ // ftp://www.linux-mips.org/pub/linux/mips/doc/ABI/mipsabi.pdf
+ ElfSym<ELFT>::MipsGp = Symtab.addAbsolute("_gp", STV_DEFAULT);
+
// On MIPS O32 ABI, _gp_disp is a magic symbol designates offset between
// start of function and 'gp' pointer into GOT.
ElfSym<ELFT>::MipsGpDisp = Symtab.addIgnored("_gp_disp");
# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t.o
# RUN: not ld.lld -shared %t.o -o %t.so 2>&1 | FileCheck %s
-# CHECK: duplicate symbol: _gp in (internal) and {{.*}}
+# CHECK: duplicate symbol: _gp in {{.*}} and (internal)
# REQUIRES: mips
# DSO: ]
# DSO: DynamicSymbols [
# DSO: Name: @
-# DSO: Name: _gp@
# DSO: Name: __start@
# DSO: Name: _foo@
+# DSO: Name: _gp@
# DSO: ]
# DSO: DynamicSection [
# DSO-NEXT: Tag Type Name/Value
# EXE_SYM: Sections:
# EXE_SYM: .got 0000000c 0000000000030000 DATA
# EXE_SYM: SYMBOL TABLE:
+# EXE_SYM: 00040000 g .data 00000004 v1
# EXE_SYM: 00037ff0 *ABS* 00000000 _gp
# ^-- .got + GP offset (0x7ff0)
-# EXE_SYM: 00040000 g .data 00000004 v1
+
# EXE_GOT_BE: Contents of section .got:
# EXE_GOT_BE: 30000 00000000 80000000 00040000
# DSO_SYM: Sections:
# DSO_SYM: .got 0000000c 0000000000020000 DATA
# DSO_SYM: SYMBOL TABLE:
+# DSO_SYM: 00030000 g .data 00000004 v1
# DSO_SYM: 00027ff0 *ABS* 00000000 _gp
# ^-- .got + GP offset (0x7ff0)
-# DSO_SYM: 00030000 g .data 00000004 v1
# DSO_GOT_BE: Contents of section .got:
# DSO_GOT_BE: 20000 00000000 80000000 00030000
# EXE: SYMBOL TABLE:
# EXE: 00020000 .text 00000000 __start
-# EXE: 00037ff0 *ABS* 00000000 _gp
# EXE: 00020010 .text 00000000 _foo
+# EXE: 00037ff0 *ABS* 00000000 _gp
# SO: Disassembly of section .text:
# SO-NEXT: __start:
# ^-- %lo(0x27ff0-0x10004+4)
# SO: SYMBOL TABLE:
-# SO: 00027ff0 *ABS* 00000000 _gp
# SO: 00010000 .text 00000000 __start
# SO: 00010010 .text 00000000 _foo
+# SO: 00027ff0 *ABS* 00000000 _gp