File: basic-copy.test

package info (click to toggle)
llvm-toolchain-14 1%3A14.0.6-12
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,496,180 kB
  • sloc: cpp: 5,593,972; ansic: 986,872; asm: 585,869; python: 184,223; objc: 72,530; lisp: 31,119; f90: 27,793; javascript: 9,780; pascal: 9,762; sh: 9,482; perl: 7,468; ml: 5,432; awk: 3,523; makefile: 2,538; xml: 953; cs: 573; fortran: 567
file content (48 lines) | stat: -rw-r--r-- 2,340 bytes parent folder | download | duplicates (21)
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