[obj2yaml][yaml2obj] - Add AArch64 STO_AARCH64_VARIANT_PCS support
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Mon, 14 Dec 2020 17:24:53 +0000 (17:24 +0000)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Thu, 17 Dec 2020 14:09:53 +0000 (11:09 -0300)
Reviewed By: grimar, MaskRay

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

llvm/lib/ObjectYAML/ELFYAML.cpp
llvm/test/tools/obj2yaml/ELF/aarch64-sym-other.yaml [new file with mode: 0644]

index 52a4a3a..3a280b0 100644 (file)
@@ -1040,6 +1040,9 @@ struct NormalizedOther {
       Map["STO_MIPS_PLT"] = ELF::STO_MIPS_PLT;
       Map["STO_MIPS_OPTIONAL"] = ELF::STO_MIPS_OPTIONAL;
     }
+
+    if (EMachine == ELF::EM_AARCH64)
+      Map["STO_AARCH64_VARIANT_PCS"] = ELF::STO_AARCH64_VARIANT_PCS;
     return Map;
   }
 
diff --git a/llvm/test/tools/obj2yaml/ELF/aarch64-sym-other.yaml b/llvm/test/tools/obj2yaml/ELF/aarch64-sym-other.yaml
new file mode 100644 (file)
index 0000000..ad20a65
--- /dev/null
@@ -0,0 +1,22 @@
+## Check AArch64 st_other extension support.
+
+# RUN: yaml2obj %s -o %t
+# RUN: obj2yaml %t | FileCheck %s
+
+# CHECK: Symbols:
+# CHECK:  - Name:  foo1
+# CHECK:    Other: [ STO_AARCH64_VARIANT_PCS ]
+# CHECK:  - Name:  foo2
+# CHECK:    Other: [ STO_AARCH64_VARIANT_PCS, 64 ]
+
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS64
+  Data:    ELFDATA2LSB
+  Type:    ET_REL
+  Machine: EM_AARCH64
+Symbols:
+  - Name:  foo1
+    Other: [ STO_AARCH64_VARIANT_PCS ]
+  - Name:  foo2
+    Other: [ STO_AARCH64_VARIANT_PCS, 0x40 ]