1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00
llvm-mirror/test/tools/llvm-objcopy/ELF/new-symbol-visibility.test
Fangrui Song e807376803 [llvm-objcopy] Default --output-target to --input-target when unspecified
Fixes PR42171.

In GNU objcopy, if -O (--output-target) is not specified, the value is
copied from -I (--input-target).

```
objcopy -I binary -B i386:x86-64 a.txt b       # b is copied from a.txt
llvm-objcopy -I binary -B i386:x86-64 a.txt b  # b is an x86-64 object file
```

This patch changes our behavior to match GNU. With this change, we can
delete code related to -B handling (D67215).

Reviewed By: jakehehrlich

Differential Revision: https://reviews.llvm.org/D67144

llvm-svn: 371913
2019-09-14 01:36:16 +00:00

23 lines
1.4 KiB
Plaintext

## Ensure that the visibility of the start, end and size symbols created when
## using binary input can be specified with the --new-symbol-visibility switch.
# RUN: llvm-objcopy -I binary -O elf64-x86-64 %s %t.unspecified
# RUN: llvm-readelf -s %t.unspecified | FileCheck %s --check-prefix=BINARY -DVISIBILITY=DEFAULT
# RUN: llvm-objcopy --new-symbol-visibility default -I binary -O elf64-x86-64 %s %t.default
# RUN: llvm-readelf -s %t.default | FileCheck %s --check-prefix=BINARY -DVISIBILITY=DEFAULT
# RUN: llvm-objcopy --new-symbol-visibility hidden -I binary -O elf64-x86-64 %s %t.hidden
# RUN: llvm-readelf -s %t.hidden | FileCheck %s --check-prefix=BINARY -DVISIBILITY=HIDDEN
# RUN: llvm-objcopy --new-symbol-visibility protected -I binary -O elf64-x86-64 %s %t.protected
# RUN: llvm-readelf -s %t.protected | FileCheck %s --check-prefix=BINARY -DVISIBILITY=PROTECTED
# RUN: llvm-objcopy --new-symbol-visibility internal -I binary -O elf64-x86-64 %s %t.internal
# RUN: llvm-readelf -s %t.internal | FileCheck %s --check-prefix=BINARY -DVISIBILITY=INTERNAL
# BINARY: [[VISIBILITY]] {{.*}} _binary{{.*}}_start
# BINARY-NEXT: [[VISIBILITY]] {{.*}} _binary{{.*}}_end
# BINARY-NEXT: [[VISIBILITY]] {{.*}} _binary{{.*}}_size
# RUN: not llvm-objcopy --new-symbol-visibility fluff -I binary -O elf64-x86-64 \
# RUN: %s %t.error 2>&1 | FileCheck %s --check-prefix=ERR
# ERR: error: 'fluff' is not a valid symbol visibility