summaryrefslogtreecommitdiff
path: root/test/elf/Mips/exe-dynsym-micro.test
diff options
context:
space:
mode:
Diffstat (limited to 'test/elf/Mips/exe-dynsym-micro.test')
-rw-r--r--test/elf/Mips/exe-dynsym-micro.test94
1 files changed, 94 insertions, 0 deletions
diff --git a/test/elf/Mips/exe-dynsym-micro.test b/test/elf/Mips/exe-dynsym-micro.test
new file mode 100644
index 0000000000000..e3b00277ef6a9
--- /dev/null
+++ b/test/elf/Mips/exe-dynsym-micro.test
@@ -0,0 +1,94 @@
+# Check that symbol referenced by an entry in the global part of GOT
+# has a corresponded entry in the .dynsym section. This test covers
+# the case when the GOT entry created because of the R_MICROMIPS_GOT16
+# relocation.
+
+# Build executable
+# RUN: yaml2obj -format=elf %s > %t.o
+# RUN: lld -flavor gnu -target mipsel -e glob -o %t.exe %t.o
+# RUN: llvm-readobj -dyn-symbols %t.exe | FileCheck -check-prefix=CHECK-DYN %s
+
+# Build executabl (yaml format)e
+# RUN: lld -flavor gnu -target mipsel -e glob \
+# RUN: --output-filetype=yaml -o %t.yaml %t.o
+# RUN: FileCheck -check-prefix=CHECK-GOT %s < %t.yaml
+
+# CHECK-DYN: Format: ELF32-mips
+# CHECK-DYN: Arch: mipsel
+# CHECK-DYN: AddressSize: 32bit
+# CHECK-DYN: LoadName:
+# CHECK-DYN: DynamicSymbols [
+# CHECK-DYN: Symbol {
+# CHECK-DYN: Name: @ (0)
+# CHECK-DYN: Value: 0x0
+# CHECK-DYN: Size: 0
+# CHECK-DYN: Binding: Local (0x0)
+# CHECK-DYN: Type: None (0x0)
+# CHECK-DYN: Other: 0
+# CHECK-DYN: Section: Undefined (0x0)
+# CHECK-DYN: }
+# CHECK-DYN: Symbol {
+# CHECK-DYN: Name: weakf@ (1)
+# CHECK-DYN: Value: 0x0
+# CHECK-DYN: Size: 0
+# CHECK-DYN: Binding: Weak (0x2)
+# CHECK-DYN: Type: None (0x0)
+# CHECK-DYN: Other: 0
+# CHECK-DYN: Section: Undefined (0x0)
+# CHECK-DYN: }
+# CHECK-DYN: ]
+
+# CHECK-GOT: - type: got
+# CHECK-GOT: content: [ 00, 00, 00, 00 ]
+# CHECK-GOT: alignment: 2^2
+# CHECK-GOT: section-choice: custom-required
+# CHECK-GOT: section-name: .got
+# CHECK-GOT: permissions: rw-
+# CHECK-GOT: - type: got
+# CHECK-GOT: content: [ 00, 00, 00, 80 ]
+# CHECK-GOT: alignment: 2^2
+# CHECK-GOT: section-choice: custom-required
+# CHECK-GOT: section-name: .got
+# CHECK-GOT: permissions: rw-
+# CHECK-GOT: - ref-name: L000
+# CHECK-GOT: type: got
+# CHECK-GOT: content: [ 00, 00, 00, 00 ]
+# CHECK-GOT: alignment: 2^2
+# CHECK-GOT: section-choice: custom-required
+# CHECK-GOT: section-name: .got
+# CHECK-GOT: permissions: rw-
+# CHECK-GOT: references:
+# CHECK-GOT: - kind: LLD_R_MIPS_GLOBAL_GOT
+# CHECK-GOT: offset: 0
+# CHECK-GOT: target: weakf
+
+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_32R2, EF_MIPS_MICROMIPS ]
+Sections:
+ - Name: .text
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ AddressAlign: 0x10
+ Size: 0x04
+ - Name: .rel.text
+ Type: SHT_REL
+ Link: .symtab
+ AddressAlign: 0x04
+ Info: .text
+ Relocations:
+ - Offset: 0x00
+ Symbol: weakf
+ Type: R_MICROMIPS_GOT16
+
+Symbols:
+ Global:
+ - Name: glob
+ Section: .text
+ Other: [ STO_MIPS_MICROMIPS ]
+ Weak:
+ - Name: weakf