diff options
Diffstat (limited to 'llvm/test/tools')
-rw-r--r-- | llvm/test/tools/llvm-objcopy/ELF/add-symbol-new-symbol-visibility.test | 20 | ||||
-rw-r--r-- | llvm/test/tools/llvm-objcopy/ELF/new-symbol-visibility.test | 22 |
2 files changed, 42 insertions, 0 deletions
diff --git a/llvm/test/tools/llvm-objcopy/ELF/add-symbol-new-symbol-visibility.test b/llvm/test/tools/llvm-objcopy/ELF/add-symbol-new-symbol-visibility.test new file mode 100644 index 00000000000..9ef5849f991 --- /dev/null +++ b/llvm/test/tools/llvm-objcopy/ELF/add-symbol-new-symbol-visibility.test @@ -0,0 +1,20 @@ +## Ensure that the visibility of symbols added with --add-symbol can be +## specified with the --new-symbol-visibility switch. + +# RUN: yaml2obj %s -o %t.obj +# RUN: llvm-objcopy --new-symbol-visibility protected --add-symbol symbol_protected=.text:42 \ +# RUN: --add-symbol symbol_hidden=.text:42,hidden %t.obj %t +# RUN: llvm-readelf -s %t | FileCheck %s + +!ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_REL + Machine: EM_X86_64 +Sections: + - Name: .text + Type: SHT_PROGBITS + +# CHECK: PROTECTED {{.*}} symbol_protected +# CHECK: HIDDEN {{.*}} symbol_hidden diff --git a/llvm/test/tools/llvm-objcopy/ELF/new-symbol-visibility.test b/llvm/test/tools/llvm-objcopy/ELF/new-symbol-visibility.test new file mode 100644 index 00000000000..143a18c0a7e --- /dev/null +++ b/llvm/test/tools/llvm-objcopy/ELF/new-symbol-visibility.test @@ -0,0 +1,22 @@ +## 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 -B i386: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 -B i386: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 -B i386: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 -B i386: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 -B i386: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 -B i386:x86-64 %s %t.error 2>&1 \ +# RUN: | FileCheck %s --check-prefix=ERR + +# ERR: error: 'fluff' is not a valid symbol visibility |