Skip to content

Commit 6f4916a

Browse files
author
Alex B
committed
Switch test to use llvm/utils/update_test_body.py
1 parent 1961138 commit 6f4916a

File tree

1 file changed

+20
-36
lines changed

1 file changed

+20
-36
lines changed

llvm/test/tools/llvm-gsymutil/ARM_AArch64/macho-gsym-merged-callsites-dsym.yaml

Lines changed: 20 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -40,19 +40,7 @@
4040
# CHECK-MERGED-CALLSITES-NEXT: 0x[[#%.4x,]] Flags[None] MatchRegex[function3_copy2]
4141
# CHECK-MERGED-CALLSITES-NEXT: 0x[[#%.4x,]] Flags[None] MatchRegex[function2_copy1]
4242

43-
44-
#--- repro-script.sh
45-
#!/bin/bash
46-
set -ex
47-
48-
# Set TOOLCHAIN_DIR to point to the llvm bin directory
49-
TOOLCHAIN_DIR="llvm-project/build/Debug/bin" # Replace with the actual path to your LLVM bin directory
50-
SCRIPT_DIR="$(cd "$(dirname "$0")"; pwd)"
51-
OUT_DIR="$SCRIPT_DIR/out"
52-
cd $SCRIPT_DIR
53-
rm -rf "$OUT_DIR" && mkdir -p "$OUT_DIR"
54-
55-
cat > "$OUT_DIR/merged_funcs_test.cpp" << EOF
43+
#--- merged_funcs_test.cpp
5644
#define ATTRIB extern "C" __attribute__((noinline))
5745
volatile int global_result = 0;
5846

@@ -121,29 +109,6 @@ int main() {
121109
sum += function2_copy1(11);
122110
return sum;
123111
}
124-
EOF
125-
126-
# Compile merged_funcs_test.cpp to merged_funcs_test.o with flags -g -O3 for MachO / arm64
127-
"$TOOLCHAIN_DIR/clang++" --target=arm64-apple-macos11 -c -g -gdwarf-4 -fno-unwind-tables \
128-
-mllvm -emit-func-debug-line-table-offsets -fno-exceptions -mno-outline \
129-
-O3 "$OUT_DIR/merged_funcs_test.cpp" -o "$OUT_DIR/merged_funcs_test.o"
130-
131-
# Link using ld64.lld directly with flags "--icf=all --keep-icf-stabs"
132-
"$TOOLCHAIN_DIR/ld64.lld" \
133-
-arch arm64 \
134-
-platform_version macos 11.0.0 11.0.0 \
135-
-o "$OUT_DIR/merged_funcs_test.exe" \
136-
"$OUT_DIR/merged_funcs_test.o" \
137-
-dead_strip \
138-
--icf=all \
139-
--keep-icf-stabs
140-
141-
# Create merged_funcs_test.dSYM from merged_funcs_test.exe
142-
"$TOOLCHAIN_DIR/dsymutil" --flat "$OUT_DIR/merged_funcs_test.exe" --verify-dwarf=none -o "$OUT_DIR/merged_funcs_test.dSYM"
143-
"$TOOLCHAIN_DIR/obj2yaml" "$OUT_DIR/merged_funcs_test.dSYM" -o "$OUT_DIR/merged_funcs_test.dSYM.yaml"
144-
145-
146-
147112

148113
#--- callsites.yaml
149114
functions:
@@ -180,6 +145,25 @@ functions:
180145
- return_offset: 0x48
181146
match_regex: ["function2_copy1"]
182147

148+
#--- gen
149+
# Compile merged_funcs_test.cpp to merged_funcs_test.o with flags -g -O3 for MachO / arm64
150+
clang --target=arm64-apple-macos11 -c -g -gdwarf-4 -fno-unwind-tables \
151+
-mllvm -emit-func-debug-line-table-offsets -fno-exceptions -mno-outline \
152+
-O3 "merged_funcs_test.cpp" -o "merged_funcs_test.o"
153+
154+
# Link using ld64.lld directly with flags "--icf=all --keep-icf-stabs"
155+
"ld64.lld" \
156+
-arch arm64 \
157+
-platform_version macos 11.0.0 11.0.0 \
158+
-o "merged_funcs_test.exe" \
159+
"merged_funcs_test.o" \
160+
-dead_strip \
161+
--icf=all \
162+
--keep-icf-stabs
163+
164+
# Create merged_funcs_test.dSYM from merged_funcs_test.exe
165+
"dsymutil" --flat "merged_funcs_test.exe" --verify-dwarf=none -o "merged_funcs_test.dSYM"
166+
"obj2yaml" "merged_funcs_test.dSYM"
183167

184168

185169
#--- merged_callsites.dSYM.yaml

0 commit comments

Comments
 (0)