blob: 68331f23986b39cbb5b625f54637c4484a388c09 [file] [log] [blame]
Jordan Rupprechtcf676332018-08-17 18:51:11 +00001# RUN: echo abcd > %t.txt
2
3# Preserve input to verify it is not modified
4# RUN: cp %t.txt %t-copy.txt
5
Fangrui Songba530302019-09-14 01:36:16 +00006## -I binary -O binary preserves payload through in-memory representation.
7# RUN: llvm-objcopy -I binary -O binary %t.txt %t.2.txt
Jordan Rupprechtcf676332018-08-17 18:51:11 +00008# RUN: cmp %t.txt %t.2.txt
9# RUN: cmp %t.txt %t-copy.txt
10
Fangrui Songba530302019-09-14 01:36:16 +000011## If -O is not specified, it defaults to -I, i.e. "binary".
12# RUN: llvm-objcopy -I binary %t.txt %t.3.txt
Jordan Rupprechtcf676332018-08-17 18:51:11 +000013# RUN: cmp %t.txt %t.3.txt
Fangrui Songba530302019-09-14 01:36:16 +000014
15## -I binary -O elf* creates an ELF. -O binary transforms it back to the
16## original file.
17# RUN: llvm-objcopy -I binary -O elf64-x86-64 %t.txt %t.o
18# RUN: llvm-objcopy -O binary %t.o %t.4.txt
19# RUN: cmp %t.txt %t.4.txt
20
21## -B is ignored.
22# RUN: llvm-objcopy -I binary -B i386:x86-64 -O binary %t.txt %t.5.txt
23# RUN: cmp %t.txt %t.5.txt