[PATCH] D58445: [yaml2obj]Allow symbol Index field to take values lower than SHN_LORESERVE

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 21 02:56:56 PST 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL354566: [yaml2obj]Allow symbol Index field to take values lower than SHN_LORESERVE (authored by jhenderson, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D58445?vs=187561&id=187750#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58445/new/

https://reviews.llvm.org/D58445

Files:
  llvm/trunk/lib/ObjectYAML/ELFYAML.cpp
  llvm/trunk/test/tools/yaml2obj/symbol-index.yaml


Index: llvm/trunk/lib/ObjectYAML/ELFYAML.cpp
===================================================================
--- llvm/trunk/lib/ObjectYAML/ELFYAML.cpp
+++ llvm/trunk/lib/ObjectYAML/ELFYAML.cpp
@@ -832,9 +832,6 @@
   if (Symbol.Index && *Symbol.Index == ELFYAML::ELF_SHN(ELF::SHN_XINDEX)) {
     return "Large indexes are not supported";
   }
-  if (Symbol.Index && *Symbol.Index < ELFYAML::ELF_SHN(ELF::SHN_LORESERVE)) {
-    return "Use a section name to define which section a symbol is defined in";
-  }
   return StringRef();
 }
 
Index: llvm/trunk/test/tools/yaml2obj/symbol-index.yaml
===================================================================
--- llvm/trunk/test/tools/yaml2obj/symbol-index.yaml
+++ llvm/trunk/test/tools/yaml2obj/symbol-index.yaml
@@ -1,5 +1,5 @@
 # RUN: yaml2obj %s > %t
-# RUN: llvm-readobj -symbols %t | FileCheck %s
+# RUN: llvm-readelf -symbols %t | FileCheck %s
 
 !ELF
 FileHeader:
@@ -7,29 +7,38 @@
   Data:            ELFDATA2LSB
   Type:            ET_EXEC
   Machine:         EM_X86_64
+Sections:
+  - Name: .text
+    Type: SHT_PROGBITS
 Symbols:
   Global:
-    - Name:     test
+    - Name:     absolute1
       Index:    SHN_ABS
       Value:    0x1234
+    - Name:     absolute2
+      Index:    0xfff1
+      Value:    0x4321
+    - Name:     common1
+      Index:    SHN_COMMON
+    - Name:     common2
+      Index:    0xfff2
+    - Name:     good
+      Index:    0x1
+    - Name:     bad
+      Index:    0x42
+    - Name:     undef1
+      Index:    SHN_UNDEF
+    - Name:     undef2
+      Index:    0
 
-#CHECK:     Symbols [
-#CHECK-NEXT:   Symbol {
-#CHECK-NEXT:    Name:  (0)
-#CHECK-NEXT:    Value: 0x0
-#CHECK-NEXT:    Size: 0
-#CHECK-NEXT:    Binding: Local (0x0)
-#CHECK-NEXT:    Type: None (0x0)
-#CHECK-NEXT:    Other: 0
-#CHECK-NEXT:    Section: Undefined (0x0)
-#CHECK-NEXT:  }
-#CHECK-NEXT:  Symbol {
-#CHECK-NEXT:    Name: test (1)
-#CHECK-NEXT:    Value: 0x1234
-#CHECK-NEXT:    Size: 0
-#CHECK-NEXT:    Binding: Global (0x1)
-#CHECK-NEXT:    Type: None (0x0)
-#CHECK-NEXT:    Other: 0
-#CHECK-NEXT:    Section: Absolute (0xFFF1)
-#CHECK-NEXT:  }
-#CHECK-NEXT:]
+# CHECK:      Symbol table '.symtab' contains 9 entries
+# CHECK-NEXT:   Num: {{.*}} Ndx Name
+# CHECK-NEXT:     0: {{.*}} UND
+# CHECK-NEXT:     1: {{.*}} ABS absolute1
+# CHECK-NEXT:     2: {{.*}} ABS absolute2
+# CHECK-NEXT:     3: {{.*}} COM common1
+# CHECK-NEXT:     4: {{.*}} COM common2
+# CHECK-NEXT:     5: {{.*}}   1 good
+# CHECK-NEXT:     6: {{.*}}  66 bad
+# CHECK-NEXT:     7: {{.*}} UND undef1
+# CHECK-NEXT:     8: {{.*}} UND undef2


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58445.187750.patch
Type: text/x-patch
Size: 2589 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190221/abaea404/attachment-0001.bin>


More information about the llvm-commits mailing list