xref: /aosp_15_r20/external/elfutils/tests/testfile-dwp-cu-index-overflow.source (revision 7304104da70ce23c86437a01be71edd1a2d7f37e)
1*7304104dSAndroid Build Coastguard Worker# Dummy program that we patch to generate a dwp file with more than 4GB of
2*7304104dSAndroid Build Coastguard Worker# .debug_info.
3*7304104dSAndroid Build Coastguard Worker
4*7304104dSAndroid Build Coastguard Worker# Generate 2 dummy files that result in DWARF blocks.
5*7304104dSAndroid Build Coastguard Worker$ for (( i = 1; i <= 2; i++ )); do echo 'constexpr int filler'$i'[] = { 1 };' > filler$i.cc; done
6*7304104dSAndroid Build Coastguard Worker$ g++ -O2 -g -gsplit-dwarf -fdebug-types-section -dA -S filler{1,2}.cc foo.cc bar.cc main.cc
7*7304104dSAndroid Build Coastguard Worker# Patch the DWARF blocks to be 2GB.
8*7304104dSAndroid Build Coastguard Worker$ for (( i = 1; i <= 2; i++ )); do patch -p1 << EOF
9*7304104dSAndroid Build Coastguard Worker--- a/filler$i.s
10*7304104dSAndroid Build Coastguard Worker+++ b/filler$i.s
11*7304104dSAndroid Build Coastguard Worker@@ -7,5 +7,5 @@
12*7304104dSAndroid Build Coastguard Worker 	.section	.debug_info.dwo,"e",@progbits
13*7304104dSAndroid Build Coastguard Worker .Ldebug_info0:
14*7304104dSAndroid Build Coastguard Worker-	.long	0x49	# Length of Compilation Unit Info
15*7304104dSAndroid Build Coastguard Worker+	.long	0x80000048	# Length of Compilation Unit Info
16*7304104dSAndroid Build Coastguard Worker 	.value	0x5	# DWARF version number
17*7304104dSAndroid Build Coastguard Worker 	.byte	0x5	# DW_UT_split_compile
18*7304104dSAndroid Build Coastguard Worker@@ -51,9 +51,6 @@
19*7304104dSAndroid Build Coastguard Worker 	.long	0x29	# DW_AT_type
20*7304104dSAndroid Build Coastguard Worker 			# DW_AT_const_expr
21*7304104dSAndroid Build Coastguard Worker-	.byte	0x4	# DW_AT_const_value
22*7304104dSAndroid Build Coastguard Worker-	.byte	0x1	# fp or vector constant word 0
23*7304104dSAndroid Build Coastguard Worker-	.byte	0	# fp or vector constant word 1
24*7304104dSAndroid Build Coastguard Worker-	.byte	0	# fp or vector constant word 2
25*7304104dSAndroid Build Coastguard Worker-	.byte	0	# fp or vector constant word 3
26*7304104dSAndroid Build Coastguard Worker+	.long	0x80000000	# DW_AT_const_value
27*7304104dSAndroid Build Coastguard Worker+	.fill	0x80000000
28*7304104dSAndroid Build Coastguard Worker 	.byte	0	# end of children of DIE 0x14
29*7304104dSAndroid Build Coastguard Worker 	.section	.debug_info,"",@progbits
30*7304104dSAndroid Build Coastguard Worker@@ -171,5 +168,5 @@
31*7304104dSAndroid Build Coastguard Worker 	.uleb128 0x19	# (DW_FORM_flag_present)
32*7304104dSAndroid Build Coastguard Worker 	.uleb128 0x1c	# (DW_AT_const_value)
33*7304104dSAndroid Build Coastguard Worker-	.uleb128 0xa	# (DW_FORM_block1)
34*7304104dSAndroid Build Coastguard Worker+	.uleb128 0x4	# (DW_FORM_block4)
35*7304104dSAndroid Build Coastguard Worker 	.byte	0
36*7304104dSAndroid Build Coastguard Worker 	.byte	0
37*7304104dSAndroid Build Coastguard WorkerEOF
38*7304104dSAndroid Build Coastguard Workerdone
39*7304104dSAndroid Build Coastguard Worker$ for (( i = 1; i <= 2; i++ )); do as filler$i.s -o filler$i.o; done
40*7304104dSAndroid Build Coastguard Worker$ as foo.s -o foo.o
41*7304104dSAndroid Build Coastguard Worker$ as bar.s -o bar.o
42*7304104dSAndroid Build Coastguard Worker$ as main.s -o main.o
43*7304104dSAndroid Build Coastguard Worker$ g++ filler1.o foo.o filler2.o bar.o main.o -o testfile-dwp-5-cu-index-overflow
44*7304104dSAndroid Build Coastguard Worker# -continue-on-cu-index-overflow was added in LLVM 17:
45*7304104dSAndroid Build Coastguard Worker# https://reviews.llvm.org/D144565.
46*7304104dSAndroid Build Coastguard Worker$ llvm-dwp -continue-on-cu-index-overflow filler1.o foo.o filler2.o bar.o main.o -o testfile-dwp-5-cu-index-overflow.dwp
47*7304104dSAndroid Build Coastguard Worker
48*7304104dSAndroid Build Coastguard Worker# Same thing for DWARF 4.
49*7304104dSAndroid Build Coastguard Worker$ g++ -O2 -g -gdwarf-4 -gsplit-dwarf -fdebug-types-section -dA -S filler{1,2}.cc foo.cc bar.cc main.cc
50*7304104dSAndroid Build Coastguard Worker$ for (( i = 1; i <= 2; i++ )); do patch -p1 << EOF
51*7304104dSAndroid Build Coastguard Worker--- a/filler$i.s
52*7304104dSAndroid Build Coastguard Worker+++ b/filler$i.s
53*7304104dSAndroid Build Coastguard Worker@@ -6,5 +6,5 @@
54*7304104dSAndroid Build Coastguard Worker 	.section	.debug_info.dwo,"e",@progbits
55*7304104dSAndroid Build Coastguard Worker .Ldebug_info0:
56*7304104dSAndroid Build Coastguard Worker-	.long	0x48	# Length of Compilation Unit Info
57*7304104dSAndroid Build Coastguard Worker+	.long	0x80000047	# Length of Compilation Unit Info
58*7304104dSAndroid Build Coastguard Worker 	.value	0x4	# DWARF version number
59*7304104dSAndroid Build Coastguard Worker 	.long	.Ldebug_abbrev0	# Offset Into Abbrev. Section
60*7304104dSAndroid Build Coastguard Worker@@ -49,9 +49,6 @@
61*7304104dSAndroid Build Coastguard Worker 	.long	0x28	# DW_AT_type
62*7304104dSAndroid Build Coastguard Worker 			# DW_AT_const_expr
63*7304104dSAndroid Build Coastguard Worker-	.byte	0x4	# DW_AT_const_value
64*7304104dSAndroid Build Coastguard Worker-	.byte	0x1	# fp or vector constant word 0
65*7304104dSAndroid Build Coastguard Worker-	.byte	0	# fp or vector constant word 1
66*7304104dSAndroid Build Coastguard Worker-	.byte	0	# fp or vector constant word 2
67*7304104dSAndroid Build Coastguard Worker-	.byte	0	# fp or vector constant word 3
68*7304104dSAndroid Build Coastguard Worker+	.long	0x80000000	# DW_AT_const_value
69*7304104dSAndroid Build Coastguard Worker+	.fill	0x80000000
70*7304104dSAndroid Build Coastguard Worker 	.byte	0	# end of children of DIE 0xb
71*7304104dSAndroid Build Coastguard Worker 	.section	.debug_info,"",@progbits
72*7304104dSAndroid Build Coastguard Worker@@ -172,5 +169,5 @@
73*7304104dSAndroid Build Coastguard Worker 	.uleb128 0x19	# (DW_FORM_flag_present)
74*7304104dSAndroid Build Coastguard Worker 	.uleb128 0x1c	# (DW_AT_const_value)
75*7304104dSAndroid Build Coastguard Worker-	.uleb128 0xa	# (DW_FORM_block1)
76*7304104dSAndroid Build Coastguard Worker+	.uleb128 0x4	# (DW_FORM_block4)
77*7304104dSAndroid Build Coastguard Worker 	.byte	0
78*7304104dSAndroid Build Coastguard Worker 	.byte	0
79*7304104dSAndroid Build Coastguard WorkerEOF
80*7304104dSAndroid Build Coastguard Workerdone
81*7304104dSAndroid Build Coastguard Worker$ for (( i = 1; i <= 2; i++ )); do as filler$i.s -o filler$i.o; done
82*7304104dSAndroid Build Coastguard Worker$ as foo.s -o foo.o
83*7304104dSAndroid Build Coastguard Worker$ as bar.s -o bar.o
84*7304104dSAndroid Build Coastguard Worker$ as main.s -o main.o
85*7304104dSAndroid Build Coastguard Worker$ g++ filler1.o foo.o filler2.o bar.o main.o -o testfile-dwp-4-cu-index-overflow
86*7304104dSAndroid Build Coastguard Worker$ llvm-dwp -continue-on-cu-index-overflow filler1.o foo.o filler2.o bar.o main.o -o testfile-dwp-4-cu-index-overflow.dwp
87