Index: test/ELF/linkerscript/mixed-sections-symbols.s =================================================================== --- test/ELF/linkerscript/mixed-sections-symbols.s +++ test/ELF/linkerscript/mixed-sections-symbols.s @@ -0,0 +1,83 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t + +# RUN: echo "SECTIONS { . = SIZEOF_HEADERS; \ +# RUN: .rodata : { *(.rodata) *(.rodata.*) A = .; *(.foo.*) B = .; } \ +# RUN: }" > %t.script +# RUN: ld.lld -o %t1 --script %t.script %t +# RUN: llvm-readobj -s -t %t1 | FileCheck %s --check-prefix=xx + +.section .rodata,"a" +.byte 11 + +.section .rodata,"a" +.byte 22 + +.section .rodata.1,"aMS",@progbits,1 +.asciz "foo" + +.section .rodata.2,"aMS",@progbits,1 +.asciz "foo" + +.section .foo.1,"a" +.byte 33 + +.section .foo.2,"a" +.byte 44 + +## Output is below. Notice A == B == 0xF0, though it is not correct values: +## +## Section { +## Index: 1 +## Name: .rodata (1) +## Type: SHT_PROGBITS (0x1) +## Flags [ (0x2) +## SHF_ALLOC (0x2) +## ] +## Address: 0xE8 +## Offset: 0xE8 +## Size: 4 +## Link: 0 +## Info: 0 +## AddressAlignment: 1 +## EntrySize: 0 +## } +## Section { +## Index: 2 +## Name: .rodata (1) +## Type: SHT_PROGBITS (0x1) +## Flags [ (0x32) +## SHF_ALLOC (0x2) +## SHF_MERGE (0x10) +## SHF_STRINGS (0x20) +## ] +## Address: 0xEC +## Offset: 0xEC +## Size: 4 +## Link: 0 +## Info: 0 +## AddressAlignment: 1 +## EntrySize: 1 +## } +## ... +## Symbols [ +## ... +## Symbol { +## Name: A (1) +## Value: 0xF0 +## Size: 0 +## Binding: Global (0x1) +## Type: None (0x0) +## Other: 0 +## Section: .rodata (0x2) +## } +## Symbol { +## Name: B (3) +## Value: 0xF0 +## Size: 0 +## Binding: Global (0x1) +## Type: None (0x0) +## Other: 0 +## Section: .rodata (0x2) +## } +## ]