No functional changes.
llvm-svn: 238050
# a) Emitting R_MIPS_REL32 relocations for both undefined symbols.
# b) There should be no PLT entries.
#
-# RUN: yaml2obj -format=elf %s > %t-obj
-# RUN: lld -flavor gnu -target mipsel -shared --noinhibit-exec -o %t1-so %t-obj
-# RUN: llvm-readobj -dt -r -s %t1-so | FileCheck -check-prefix=PLT-SYM %s
+# RUN: yaml2obj -format=elf %s > %t.o
+# RUN: lld -flavor gnu -target mipsel -shared --noinhibit-exec -o %t.so %t.o
+# RUN: llvm-readobj -dt -r -s %t.so | FileCheck %s
-# PLT-SYM: Sections [
-# PLT-SYM: Section {
-# PLT-SYM-NOT: Name: .plt ({{[0-9]+}})
+# CHECK: Sections [
+# CHECK: Section {
+# CHECK-NOT: Name: .plt ({{[0-9]+}})
#
-# PLT-SYM: Relocations [
-# PLT-SYM-NEXT: Section (4) .rel.dyn {
-# PLT-SYM-NEXT: 0x140 R_MIPS_REL32 T1 0x0
-# PLT-SYM-NEXT: 0x2000 R_MIPS_REL32 T1 0x0
-# PLT-SYM-NEXT: }
-# PLT-SYM-NEXT: ]
+# CHECK: Relocations [
+# CHECK-NEXT: Section (4) .rel.dyn {
+# CHECK-NEXT: 0x[[ADDR1:[0-9A-Z]+]] R_MIPS_REL32 T1 0x0
+# CHECK-NEXT: 0x[[ADDR2:[0-9A-Z]+]] R_MIPS_REL32 T1 0x0
+# CHECK-NEXT: }
+# CHECK-NEXT: ]
#
-# PLT-SYM: Name: T1@ (7)
-# PLT-SYM-NEXT: Value: 0x0
-# PLT-SYM-NEXT: Size: 0
-# PLT-SYM-NEXT: Binding: Global (0x1)
-# PLT-SYM-NEXT: Type: None (0x0)
-# PLT-SYM-NEXT: Other: 0
-# PLT-SYM-NEXT: Section: Undefined (0x0)
+# CHECK: Symbol {
+# CHECK: Name: T0@
+# CHECK-NEXT: Value: 0x[[ADDR1]]
+# CHECK-NEXT: Size: 8
+# CHECK-NEXT: Binding: Global
+# CHECK-NEXT: Type: Function
+# CHECK-NEXT: Other: 0
+# CHECK-NEXT: Section: .text
+# CHECK-NEXT: }
+# CHECK: Symbol {
+# CHECK: Name: D0@
+# CHECK-NEXT: Value: 0x[[ADDR2]]
+# CHECK-NEXT: Size: 8
+# CHECK-NEXT: Binding: Global
+# CHECK-NEXT: Type: Object
+# CHECK-NEXT: Other: 0
+# CHECK-NEXT: Section: .data
+# CHECK-NEXT: }
+# CHECK: Symbol {
+# CHECK: Name: T1@
+# CHECK-NEXT: Value: 0x0
+# CHECK-NEXT: Size: 0
+# CHECK-NEXT: Binding: Global
+# CHECK-NEXT: Type: None
+# CHECK-NEXT: Other: 0
+# CHECK-NEXT: Section: Undefined
+# CHECK-NEXT: }
-!ELF
-FileHeader: !FileHeader
- Class: ELFCLASS32
- Data: ELFDATA2LSB
- Type: ET_REL
+FileHeader:
+ Class: ELFCLASS32
+ Data: ELFDATA2LSB
+ Type: ET_REL
Machine: EM_MIPS
- Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32]
+ Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32]
Sections:
-- Name: .text
- Type: SHT_PROGBITS
- Content: "0000000000000000"
+- Name: .text
+ Type: SHT_PROGBITS
+ Size: 8
AddressAlign: 16
- Flags: [SHF_EXECINSTR, SHF_ALLOC]
+ Flags: [SHF_EXECINSTR, SHF_ALLOC]
-- Name: .data
- Type: SHT_PROGBITS
- Content: "0000000000000000"
+- Name: .data
+ Type: SHT_PROGBITS
+ Size: 8
AddressAlign: 16
- Flags: [SHF_WRITE, SHF_ALLOC]
+ Flags: [SHF_WRITE, SHF_ALLOC]
-- Name: .rel.text
- Type: SHT_REL
- Info: .text
+- Name: .rel.text
+ Type: SHT_REL
+ Info: .text
AddressAlign: 4
Relocations:
- - Offset: 0x00
+ - Offset: 0
Symbol: T1
- Type: R_MIPS_32
+ Type: R_MIPS_32
-- Name: .rel.data
- Type: SHT_REL
- Info: .data
+- Name: .rel.data
+ Type: SHT_REL
+ Info: .data
AddressAlign: 4
Relocations:
- - Offset: 0x00
+ - Offset: 0
Symbol: T1
- Type: R_MIPS_32
+ Type: R_MIPS_32
Symbols:
Global:
- - Name: T0
+ - Name: T0
Section: .text
- Type: STT_FUNC
- Value: 0x0
- Size: 4
- - Name: T1
- - Name: D0
+ Type: STT_FUNC
+ Value: 0
+ Size: 4
+ - Name: T1
+ - Name: D0
Section: .data
- Type: STT_OBJECT
- Value: 0x0
- Size: 8
+ Type: STT_OBJECT
+ Value: 0
+ Size: 8
#
# RUN: yaml2obj -format=elf %s > %t.o
# RUN: lld -flavor gnu -target mips64el -shared -o %t.so %t.o
-# RUN: llvm-readobj -dt -r -s %t.so | FileCheck -check-prefix=CHECK %s
+# RUN: llvm-readobj -dt -r -s %t.so | FileCheck -check-prefix=SYM %s
# RUN: llvm-readobj -mips-plt-got %t.so | FileCheck -check-prefix=GOT %s
-# CHECK: Sections [
-# CHECK: Section {
-# CHECK-NOT: Name: .plt ({{[0-9]+}})
+# SYM: Sections [
+# SYM: Section {
+# SYM-NOT: Name: .plt ({{[0-9]+}})
-# CHECK: Relocations [
-# CHECK-NEXT: Section (4) .rel.dyn {
-# CHECK-NEXT: 0x170 R_MIPS_REL32/R_MIPS_64/R_MIPS_NONE T0 0x0
-# CHECK-NEXT: }
-# CHECK-NEXT: ]
+# SYM: Relocations [
+# SYM-NEXT: Section (4) .rel.dyn {
+# SYM-NEXT: 0x[[ADDR:[0-9A-Z]+]] R_MIPS_REL32/R_MIPS_64/R_MIPS_NONE T0 0x0
+# SYM-NEXT: }
+# SYM-NEXT: ]
-# CHECK: DynamicSymbols [
-# CHECK-NEXT: Symbol {
-# CHECK-NEXT: Name: @ (0)
-# CHECK-NEXT: Value: 0x0
-# CHECK-NEXT: Size: 0
-# CHECK-NEXT: Binding: Local (0x0)
-# CHECK-NEXT: Type: None (0x0)
-# CHECK-NEXT: Other: 0
-# CHECK-NEXT: Section: Undefined (0x0)
-# CHECK-NEXT: }
-# CHECK-NEXT: Symbol {
-# CHECK-NEXT: Name: T1@ (4)
-# CHECK-NEXT: Value: 0x174
-# CHECK-NEXT: Size: 4
-# CHECK-NEXT: Binding: Global (0x1)
-# CHECK-NEXT: Type: Function (0x2)
-# CHECK-NEXT: Other: 0
-# CHECK-NEXT: Section: .text (0x5)
-# CHECK-NEXT: }
-# CHECK-NEXT: Symbol {
-# CHECK-NEXT: Name: T0@ (1)
-# CHECK-NEXT: Value: 0x170
-# CHECK-NEXT: Size: 4
-# CHECK-NEXT: Binding: Global (0x1)
-# CHECK-NEXT: Type: Function (0x2)
-# CHECK-NEXT: Other: 0
-# CHECK-NEXT: Section: .text (0x5)
-# CHECK-NEXT: }
-# CHECK-NEXT: ]
+# SYM: Symbol {
+# SYM: Name: @ (0)
+# SYM-NEXT: Value: 0x0
+# SYM-NEXT: Size: 0
+# SYM-NEXT: Binding: Local (0x0)
+# SYM-NEXT: Type: None (0x0)
+# SYM-NEXT: Other: 0
+# SYM-NEXT: Section: Undefined (0x0)
+# SYM-NEXT: }
+# SYM: Symbol {
+# SYM: Name: T1@ (4)
+# SYM-NEXT: Value: 0x174
+# SYM-NEXT: Size: 4
+# SYM-NEXT: Binding: Global (0x1)
+# SYM-NEXT: Type: Function (0x2)
+# SYM-NEXT: Other: 0
+# SYM-NEXT: Section: .text (0x5)
+# SYM-NEXT: }
+# SYM: Symbol {
+# SYM: Name: T0@ (1)
+# SYM-NEXT: Value: 0x[[ADDR]]
+# SYM-NEXT: Size: 4
+# SYM-NEXT: Binding: Global (0x1)
+# SYM-NEXT: Type: Function (0x2)
+# SYM-NEXT: Other: 0
+# SYM-NEXT: Section: .text (0x5)
+# SYM-NEXT: }
# GOT: Local entries [
# GOT-NEXT: ]
# a) There should be no PLT entries.
# b) Linker creates a single R_MIPS_REL32 relocation.
#
-# RUN: yaml2obj -format=elf %s > %t-obj
-# RUN: lld -flavor gnu -target mipsel -shared -o %t1-so %t-obj
-# RUN: llvm-readobj -dt -r -s %t1-so | FileCheck -check-prefix=PLT1 %s
-# RUN: llvm-readobj -mips-plt-got %t1-so | FileCheck -check-prefix=GOT %s
+# RUN: yaml2obj -format=elf %s > %t.o
+# RUN: lld -flavor gnu -target mipsel -shared -o %t.so %t.o
+# RUN: llvm-readobj -dt -r -s %t.so | FileCheck -check-prefix=SYM %s
+# RUN: llvm-readobj -mips-plt-got %t.so | FileCheck -check-prefix=GOT %s
-# PLT1-SYM: Sections [
-# PLT1-SYM: Section {
-# PLT1-SYM-NOT: Name: .plt ({{[0-9]+}})
+# SYM: Sections [
+# SYM: Section {
+# SYM-NOT: Name: .plt ({{[0-9]+}})
-# PLT1: Relocations [
-# PLT1-NEXT: Section (4) .rel.dyn {
-# PLT1-NEXT: 0x100 R_MIPS_REL32 T0 0x0
-# PLT1-NEXT: }
-# PLT1-NEXT: ]
+# SYM: Relocations [
+# SYM-NEXT: Section (4) .rel.dyn {
+# SYM-NEXT: 0x[[ADDR:[0-9A-Z]+]] R_MIPS_REL32 T0 0x0
+# SYM-NEXT: }
+# SYM-NEXT: ]
-# PLT1: DynamicSymbols [
-# PLT1-NEXT: Symbol {
-# PLT1-NEXT: Name: @ (0)
-# PLT1-NEXT: Value: 0x0
-# PLT1-NEXT: Size: 0
-# PLT1-NEXT: Binding: Local (0x0)
-# PLT1-NEXT: Type: None (0x0)
-# PLT1-NEXT: Other: 0
-# PLT1-NEXT: Section: Undefined (0x0)
-# PLT1-NEXT: }
-# PLT1-NEXT: Symbol {
-# PLT1-NEXT: Name: T1@ (4)
-# PLT1-NEXT: Value: 0x104
-# PLT1-NEXT: Size: 4
-# PLT1-NEXT: Binding: Global (0x1)
-# PLT1-NEXT: Type: Function (0x2)
-# PLT1-NEXT: Other: 0
-# PLT1-NEXT: Section: .text (0x5)
-# PLT1-NEXT: }
-# PLT1-NEXT: Symbol {
-# PLT1-NEXT: Name: T0@ (1)
-# PLT1-NEXT: Value: 0x100
-# PLT1-NEXT: Size: 4
-# PLT1-NEXT: Binding: Global (0x1)
-# PLT1-NEXT: Type: Function (0x2)
-# PLT1-NEXT: Other: 0
-# PLT1-NEXT: Section: .text (0x5)
-# PLT1-NEXT: }
-# PLT1-NEXT: ]
+# SYM: Symbol {
+# SYM: Name: @ (0)
+# SYM-NEXT: Value: 0x0
+# SYM-NEXT: Size: 0
+# SYM-NEXT: Binding: Local (0x0)
+# SYM-NEXT: Type: None (0x0)
+# SYM-NEXT: Other: 0
+# SYM-NEXT: Section: Undefined (0x0)
+# SYM-NEXT: }
+# SYM: Symbol {
+# SYM: Name: T1@ (4)
+# SYM-NEXT: Value: 0x104
+# SYM-NEXT: Size: 4
+# SYM-NEXT: Binding: Global (0x1)
+# SYM-NEXT: Type: Function (0x2)
+# SYM-NEXT: Other: 0
+# SYM-NEXT: Section: .text (0x5)
+# SYM-NEXT: }
+# SYM: Symbol {
+# SYM: Name: T0@ (1)
+# SYM-NEXT: Value: 0x[[ADDR]]
+# SYM-NEXT: Size: 4
+# SYM-NEXT: Binding: Global (0x1)
+# SYM-NEXT: Type: Function (0x2)
+# SYM-NEXT: Other: 0
+# SYM-NEXT: Section: .text (0x5)
+# SYM-NEXT: }
# GOT: Local entries [
# GOT-NEXT: ]
# GOT-NEXT: }
# GOT-NEXT: ]
-!ELF
-FileHeader: !FileHeader
- Class: ELFCLASS32
- Data: ELFDATA2LSB
- Type: ET_REL
+FileHeader:
+ Class: ELFCLASS32
+ Data: ELFDATA2LSB
+ Type: ET_REL
Machine: EM_MIPS
- Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32]
+ Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32]
Sections:
-- Name: .text
- Type: SHT_PROGBITS
- Content: "0000000000000000"
+- Name: .text
+ Type: SHT_PROGBITS
+ Size: 8
AddressAlign: 16
- Flags: [SHF_EXECINSTR, SHF_ALLOC]
+ Flags: [SHF_EXECINSTR, SHF_ALLOC]
-- Name: .rel.text
- Type: SHT_REL
- Info: .text
+- Name: .rel.text
+ Type: SHT_REL
+ Info: .text
AddressAlign: 4
Relocations:
- - Offset: 0x00
+ - Offset: 0
Symbol: T0
- Type: R_MIPS_32
+ Type: R_MIPS_32
-- Name: .pdr
- Type: SHT_PROGBITS
- Content: "0000000000000000"
+- Name: .pdr
+ Type: SHT_PROGBITS
+ Size: 8
AddressAlign: 16
- Flags: []
+ Flags: []
-- Name: .rel.pdr
- Type: SHT_REL
- Info: .pdr
+- Name: .rel.pdr
+ Type: SHT_REL
+ Info: .pdr
AddressAlign: 4
Relocations:
- - Offset: 0x00
+ - Offset: 0
Symbol: T1
- Type: R_MIPS_32
+ Type: R_MIPS_32
Symbols:
Global:
- - Name: T0
+ - Name: T0
Section: .text
- Type: STT_FUNC
- Value: 0x0
- Size: 4
- - Name: T1
+ Type: STT_FUNC
+ Value: 0
+ Size: 4
+ - Name: T1
Section: .text
- Type: STT_FUNC
- Value: 0x4
- Size: 4
+ Type: STT_FUNC
+ Value: 4
+ Size: 4
# RUN: yaml2obj -format=elf %s > %t.o
# RUN: lld -flavor gnu -target mips64el -e T0 -o %t.exe %t.o
+# RUN: llvm-readobj -r %t.exe | FileCheck --check-prefix=REL-EXE %s
# RUN: llvm-objdump -s %t.exe | FileCheck %s
+# RUN: llvm-nm %t.exe | FileCheck --check-prefix=SYM %s
+
+# REL-EXE: Relocations [
+# REL-EXE-NEXT: ]
# CHECK: Contents of section .text:
-# CHECK-NEXT: 1200001a0 c871ffff ffffffff c871ffff c871ffff .q.......q...q..
-# CHECK-NEXT: 1200001b0 c871ffff ffffffff 00000000 00000000 .q..............
+# CHECK-NEXT: 1200001a0 c871ffff ffffffff c871ffff c871ffff
+# CHECK-NEXT: 1200001b0 c871ffff ffffffff 00000000 00000000
+
+# SYM: 00000001200001b8 T LT1
+# SYM: 0000000120001000 ? _GLOBAL_OFFSET_TABLE_
+
+# RUN: lld -flavor gnu -target mips64el -shared -o %t.so %t.o
+# RUN: llvm-readobj -r %t.so | FileCheck --check-prefix=REL-SO %s
+
+# REL-SO: Relocations [
+# REL-SO-NEXT: ]
---
FileHeader: