1 # UNSUPPORTED: system-windows
4 # RUN: rm -rf %t; split-file %s %t
6 # Synthesize raw cgdata without the header (32 byte) from the indexed cgdata.
7 # RUN: llvm-cgdata --convert --format binary %t/raw-1.cgtext -o %t/raw-1.cgdata
8 # RUN: od -t x1 -j 32 -An %t/raw-1.cgdata | tr -d '\n\r\t' | sed 's/[ ][ ]*/ /g; s/^[ ]*//; s/[ ]*$//; s/[ ]/,0x/g; s/^/0x/' > %t/raw-1-bytes.txt
9 # RUN: sed "s/<RAW_BYTES>/$(cat %t/raw-1-bytes.txt)/g" %t/merge-template.s > %t/merge-1.s
10 # RUN: llvm-cgdata --convert --format binary %t/raw-2.cgtext -o %t/raw-2.cgdata
11 # RUN: od -t x1 -j 32 -An %t/raw-2.cgdata | tr -d '\n\r\t' | sed 's/[ ][ ]*/ /g; s/^[ ]*//; s/[ ]*$//; s/[ ]/,0x/g; s/^/0x/' > %t/raw-2-bytes.txt
12 # RUN: sed "s/<RAW_BYTES>/$(cat %t/raw-2-bytes.txt)/g" %t/merge-template.s > %t/merge-2.s
14 # RUN: llvm-mc -filetype obj -triple arm64-apple-darwin %t/merge-1.s -o %t/merge-1.o
15 # RUN: llvm-mc -filetype obj -triple arm64-apple-darwin %t/merge-2.s -o %t/merge-2.o
16 # RUN: llvm-mc -filetype obj -triple arm64-apple-darwin %t/main.s -o %t/main.o
18 # This checks if the codegen data from the linker is identical to the merged codegen data
19 # from each object file, which is obtained using the llvm-cgdata tool.
20 # RUN: %no-arg-lld -dylib -arch arm64 -platform_version ios 14.0 15.0 -o %t/out \
21 # RUN: %t/merge-1.o %t/merge-2.o %t/main.o --codegen-data-generate-path=%t/out-cgdata
22 # RUN: llvm-cgdata --merge %t/merge-1.o %t/merge-2.o %t/main.o -o %t/merge-cgdata
23 # RUN: diff %t/out-cgdata %t/merge-cgdata
25 # Merge order doesn't matter. `main.o` is dropped due to missing __llvm_outline.
26 # RUN: llvm-cgdata --merge %t/merge-2.o %t/merge-1.o -o %t/merge-cgdata-shuffle
27 # RUN: diff %t/out-cgdata %t/merge-cgdata-shuffle
29 # We can also generate the merged codegen data from the executable that is not dead-stripped.
30 # RUN: llvm-objdump -h %t/out| FileCheck %s
31 # CHECK: __llvm_outline
32 # RUN: llvm-cgdata --merge %t/out -o %t/merge-cgdata-exe
33 # RUN: diff %t/merge-cgdata-exe %t/merge-cgdata
35 # Dead-strip will remove __llvm_outline sections from the final executable.
36 # But the codeden data is still correctly produced from the linker.
37 # RUN: %no-arg-lld -dylib -arch arm64 -platform_version ios 14.0 15.0 -o %t/out-strip \
38 # RUN: %t/merge-1.o %t/merge-2.o %t/main.o -dead_strip --codegen-data-generate-path=%t/out-cgdata-strip
39 # RUN: llvm-cgdata --merge %t/merge-1.o %t/merge-2.o %t/main.o -o %t/merge-cgdata-strip
40 # RUN: diff %t/out-cgdata-strip %t/merge-cgdata-strip
41 # RUN: diff %t/out-cgdata-strip %t/merge-cgdata
43 # Ensure no __llvm_outline section remains in the executable.
44 # RUN: llvm-objdump -h %t/out-strip | FileCheck %s --check-prefix=STRIP
45 # STRIP-NOT: __llvm_outline
80 .section __DATA,__llvm_outline