File: basic-copy.test

package info (click to toggle)
llvm-toolchain-20 1%3A20.1.8-1~exp1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 2,111,388 kB
  • sloc: cpp: 7,438,767; ansic: 1,393,871; asm: 1,012,926; python: 241,728; f90: 86,635; objc: 75,411; lisp: 42,144; pascal: 17,286; sh: 10,027; ml: 5,082; perl: 4,730; awk: 3,523; makefile: 3,349; javascript: 2,251; xml: 892; fortran: 672
file content (48 lines) | stat: -rw-r--r-- 2,340 bytes parent folder | download | duplicates (22)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
Test plain passthrough copying with llvm-objcopy, by checking that obj2yaml
produces identical output for both input and output object files/executables.
(Intentionally not comparing to the original input yaml, in case there are
superficial differences like line endings.) In order to have a check of the
whole file and not just individual fields with FileCheck, checking with
obj2yaml+cmp instead of llvm-readobj+cmp, as llvm-readobj also prints file
details that can differ between otherwise equal files (such as file offsets).

Actual copied object files/executables can differ in, among others, the
following aspects:
- The padding of executable sections (lld uses 0xcc, which is int3 on x86)
- The actual layout of the string table (it can be filled linearly,
  strings can be dedupliated, the table can be optimized by sharing tails
  of longer strings; different parts in llvm do each of these three options)
- The size indication for an empty/missing string table can either be 4
  or left out altogether
- Alignment of section data
- Checksums

RUN: yaml2obj %p/Inputs/i386-obj.yaml -o %t.i386.o
RUN: llvm-objcopy %t.i386.o %t.i386-copy.o
RUN: obj2yaml %t.i386.o > %t.i386.o.yaml
RUN: obj2yaml %t.i386-copy.o > %t.i386-copy.o.yaml
RUN: cmp %t.i386.o.yaml %t.i386-copy.o.yaml

RUN: yaml2obj %p/Inputs/x86_64-obj.yaml -o %t.x86_64.o
RUN: llvm-objcopy %t.x86_64.o %t.x86_64-copy.o
RUN: obj2yaml %t.x86_64.o > %t.x86_64.o.yaml
RUN: obj2yaml %t.x86_64-copy.o > %t.x86_64-copy.o.yaml
RUN: cmp %t.x86_64.o.yaml %t.x86_64-copy.o.yaml

RUN: yaml2obj %p/Inputs/i386-exe.yaml -o %t.i386.exe
RUN: llvm-objcopy %t.i386.exe %t.i386-copy.exe
RUN: obj2yaml %t.i386.exe > %t.i386.exe.yaml
RUN: obj2yaml %t.i386-copy.exe > %t.i386-copy.exe.yaml
RUN: cmp %t.i386.exe.yaml %t.i386-copy.exe.yaml

RUN: yaml2obj %p/Inputs/x86_64-exe.yaml -o %t.x86_64.exe
RUN: llvm-objcopy %t.x86_64.exe %t.x86_64-copy.exe
RUN: obj2yaml %t.x86_64.exe > %t.x86_64.exe.yaml
RUN: obj2yaml %t.x86_64-copy.exe > %t.x86_64-copy.exe.yaml
RUN: cmp %t.x86_64.exe.yaml %t.x86_64-copy.exe.yaml

RUN: yaml2obj %p/Inputs/no-symbols.yaml -o %t.no-symbols.o
RUN: llvm-objcopy %t.no-symbols.o %t.no-symbols-copy.o
RUN: obj2yaml %t.no-symbols.o > %t.no-symbols.o.yaml
RUN: obj2yaml %t.no-symbols-copy.o > %t.no-symbols-copy.o.yaml
RUN: cmp %t.no-symbols.o.yaml %t.no-symbols-copy.o.yaml