diff options
Diffstat (limited to 'test/elf/X86_64/mergesimilarstrings.test')
-rw-r--r-- | test/elf/X86_64/mergesimilarstrings.test | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/test/elf/X86_64/mergesimilarstrings.test b/test/elf/X86_64/mergesimilarstrings.test new file mode 100644 index 0000000000000..3836f0b507589 --- /dev/null +++ b/test/elf/X86_64/mergesimilarstrings.test @@ -0,0 +1,47 @@ +# Check that relocations to section that contains strings is properly handled +# when merging strings is enabled. +# +# RUN: yaml2obj -format=elf %s > %t.o +# RUN: lld -flavor gnu -target x86_64 %t.o --noinhibit-exec -o %t1.out +# RUN: llvm-readobj -sections %t1.out | FileCheck %s +# RUN: lld -flavor gnu -target x86_64 %t.o --noinhibit-exec -o %t2.out --output-filetype=yaml +# RUN: FileCheck %s -check-prefix=CHECKRELOCS < %t2.out + +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_REL + Machine: EM_X86_64 +Sections: + - Name: .text + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC, SHF_EXECINSTR ] + AddressAlign: 0x04 + Content: 54889e5488d3d00000000e80000000088d3d00000000e800000000b8000000005dc3 + - Name: .rela.text + Type: SHT_RELA + Link: .symtab + AddressAlign: 0x04 + Info: .text + Relocations: + - Offset: 0x07 + Symbol: .rodata + Type: R_X86_64_PC32 + Addend: -4 + - Name: .rodata + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC, SHF_MERGE, SHF_STRINGS ] + AddressAlign: 0x01 + Content: 48656c6c6f20576f726c6400576f726c6400 +Symbols: + Global: + - Name: .rodata + Section: .rodata + +#CHECK: Name: .rodata +#CHECK: Size: 18 +#CHECKRELOCS: references: +#CHECKRELOCS: - kind: R_X86_64_PC32 +#CHECKRELOCS: offset: 7 +#CHECKRELOCS: target: .rodata +#CHECKRELOCS: addend: -4 |