1# REQUIRES: x86, zlib
2
3## NOTE GNU ld makes .debug_str and .debug_info SHF_ALLOC due to `. += 10`.
4# RUN: echo "SECTIONS { \
5# RUN:          .text : { . += 0x10; *(.text) } \
6# RUN:          .debug_str 0 : { . += 0x10; *(.debug_str) } \
7# RUN:          .debug_info 0 : { . += 0x10; *(.debug_info) } \
8# RUN:          }" > %t.script
9
10# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
11# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %S/../Inputs/compress-debug.s -o %t2.o
12# RUN: ld.lld %t2.o %t.o -o %t1 --compress-debug-sections=zlib -T %t.script
13# RUN: llvm-dwarfdump %t1 -debug-str | FileCheck %s
14# These two checks correspond to the patched values of a_sym and a_debug_sym.
15# T = 0x54 - address of .text input section for this file (the start address of
16#     .text is 0 by default, the size of the preceding .text in the other input
17#	  file is 0x44, and the linker script adds an additional 0x10).
18# S = 0x53 - offset of .debug_info section for this file (the size of
19#     the preceding .debug_info from the other input file is 0x43, and the
20#	  linker script adds an additional 0x10).
21# Also note that the .debug_str offsets are also offset by 0x10, as directed by
22# the linker script.
23# CHECK: 0x00000010: "T"
24# CHECK: 0x00000014: "S"
25
26.text
27a_sym:
28nop
29
30.section .debug_str,"MS",@progbits,1
31.long a_sym
32.long a_debug_sym
33
34.section .debug_info,"",@progbits
35a_debug_sym:
36.long 0x88776655
37