• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1Test plain passthrough copying with llvm-objcopy, by checking that obj2yaml
2produces identical output for both input and output object files/executables.
3(Intentionally not comparing to the original input yaml, in case there are
4superficial differences like line endings.) In order to have a check of the
5whole file and not just individual fields with FileCheck, checking with
6obj2yaml+cmp instead of llvm-readobj+cmp, as llvm-readobj also prints file
7details that can differ between otherwise equal files (such as file offsets).
8
9Actual copied object files/executables can differ in, among others, the
10following aspects:
11- The padding of executable sections (lld uses 0xcc, which is int3 on x86)
12- The actual layout of the string table (it can be filled linearly,
13  strings can be dedupliated, the table can be optimized by sharing tails
14  of longer strings; different parts in llvm do each of these three options)
15- The size indication for an empty/missing string table can either be 4
16  or left out altogether
17- Alignment of section data
18- Checksums
19
20RUN: yaml2obj %p/Inputs/i386-obj.yaml -o %t.i386.o
21RUN: llvm-objcopy %t.i386.o %t.i386-copy.o
22RUN: obj2yaml %t.i386.o > %t.i386.o.yaml
23RUN: obj2yaml %t.i386-copy.o > %t.i386-copy.o.yaml
24RUN: cmp %t.i386.o.yaml %t.i386-copy.o.yaml
25
26RUN: yaml2obj %p/Inputs/x86_64-obj.yaml -o %t.x86_64.o
27RUN: llvm-objcopy %t.x86_64.o %t.x86_64-copy.o
28RUN: obj2yaml %t.x86_64.o > %t.x86_64.o.yaml
29RUN: obj2yaml %t.x86_64-copy.o > %t.x86_64-copy.o.yaml
30RUN: cmp %t.x86_64.o.yaml %t.x86_64-copy.o.yaml
31
32RUN: yaml2obj %p/Inputs/i386-exe.yaml -o %t.i386.exe
33RUN: llvm-objcopy %t.i386.exe %t.i386-copy.exe
34RUN: obj2yaml %t.i386.exe > %t.i386.exe.yaml
35RUN: obj2yaml %t.i386-copy.exe > %t.i386-copy.exe.yaml
36RUN: cmp %t.i386.exe.yaml %t.i386-copy.exe.yaml
37
38RUN: yaml2obj %p/Inputs/x86_64-exe.yaml -o %t.x86_64.exe
39RUN: llvm-objcopy %t.x86_64.exe %t.x86_64-copy.exe
40RUN: obj2yaml %t.x86_64.exe > %t.x86_64.exe.yaml
41RUN: obj2yaml %t.x86_64-copy.exe > %t.x86_64-copy.exe.yaml
42RUN: cmp %t.x86_64.exe.yaml %t.x86_64-copy.exe.yaml
43
44RUN: yaml2obj %p/Inputs/no-symbols.yaml -o %t.no-symbols.o
45RUN: llvm-objcopy %t.no-symbols.o %t.no-symbols-copy.o
46RUN: obj2yaml %t.no-symbols.o > %t.no-symbols.o.yaml
47RUN: obj2yaml %t.no-symbols-copy.o > %t.no-symbols-copy.o.yaml
48RUN: cmp %t.no-symbols.o.yaml %t.no-symbols-copy.o.yaml
49