summaryrefslogtreecommitdiffstats
path: root/llvm/test/Object
diff options
context:
space:
mode:
authorGeorge Rimar <grimar@accesssoftek.com>2019-08-05 13:54:35 +0000
committerGeorge Rimar <grimar@accesssoftek.com>2019-08-05 13:54:35 +0000
commit149aa2f7fc6214e7f340da9011a857d75fe5a652 (patch)
tree7e3dcaaa6d7966116270717db5de95a699a67c07 /llvm/test/Object
parent2a4817637350661b9002c10ff830241697e0f639 (diff)
downloadbcm5719-llvm-149aa2f7fc6214e7f340da9011a857d75fe5a652.tar.gz
bcm5719-llvm-149aa2f7fc6214e7f340da9011a857d75fe5a652.zip
[yaml2obj] - Allow overriding sh_entsize for SHT_GNU_versym sections.
This allows to write a test case for one of untested errors in llvm/Object/ELF.h. I did it in this patch to demonstrate. Differential revision: https://reviews.llvm.org/D65394 llvm-svn: 367860
Diffstat (limited to 'llvm/test/Object')
-rw-r--r--llvm/test/Object/invalid.test25
1 files changed, 25 insertions, 0 deletions
diff --git a/llvm/test/Object/invalid.test b/llvm/test/Object/invalid.test
index 7071dee98eb..04a332d5fa4 100644
--- a/llvm/test/Object/invalid.test
+++ b/llvm/test/Object/invalid.test
@@ -627,3 +627,28 @@ Sections:
Content: ""
Symbols:
- Name: foo
+
+## Check that we report an error if SHT_GNU_versym has invalid
+## sh_entsize value (3 instead of 2) when trying to access the entries.
+
+# RUN: yaml2obj %s --docnum=30 -o %t30
+# RUN: not llvm-readobj -V %t30 2>&1 | FileCheck --check-prefix=INVALID-VER-SHENTSIZE %s
+
+# INVALID-VER-SHENTSIZE: error: section [index 1] has invalid sh_entsize: expected 2, but got 3
+
+--- !ELF
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2LSB
+ OSABI: ELFOSABI_FREEBSD
+ Type: ET_DYN
+ Machine: EM_X86_64
+Sections:
+ - Name: .gnu.version
+ Type: SHT_GNU_versym
+ EntSize: 0x0000000000000003
+ Entries: [ ]
+## Needed to trigger creation of .dynsym.
+DynamicSymbols:
+ - Name: foo
+ Binding: STB_GLOBAL
OpenPOWER on IntegriCloud