[PATCH] D69260: [yaml2obj] - Make .symtab to be not mandatory section for SHT_REL[A] section.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 28 08:28:47 PDT 2019


grimar marked 7 inline comments as done.
grimar added a comment.

Here are comments for changes in test cases.



================
Comment at: llvm/test/Object/invalid.test:336
         Symbol: 0xFFFFFF
+Symbols: []
 
----------------
Here we test the following error message:
"unable to access section [index 2] data at 0x18000040: offset goes past the end of file"    

Without `Symbols: []` yaml2obj does not create a .symtab.
.rela.text has sh_link == 0 then and we get a different error message instead of one we check:

"section [index 0] has invalid sh_entsize: expected 24, but got 0"



================
Comment at: llvm/test/Object/objdump-sectionheaders.test:42
     Relocations:
+Symbols: []
----------------
One of the lines we check is:
"# CHECK:   5 .symtab       00000018 0000000000000000"

I added "Symbols: []" to create the `.symtab`. Previously it was created by default because `SHT_RELA` has no `Link` specified.
This patch removes this special logic, so we need to specify "Symbols: []" explicitly.


================
Comment at: llvm/test/tools/llvm-readobj/all.test:113
       - Section: .note.gnu.build-id
+Symbols: []
----------------
I added it to create the ".symtab" to test the "Symbol table '.symtab' contains {{.*}} entries:" line.

Previously it was created automatically because `.rela.data` had an empty `Link` field:
(i.e. had no field at all)

```
  - Name: .rela.data
    Type: SHT_REL
    Relocations:
```



================
Comment at: llvm/test/tools/llvm-readobj/elf-reloc-negative-addend-no-sym.test:32
     Type: SHT_RELA
-    Link: .symtab
     Info: .text
----------------
With it this test would fail, since there is no symbol table anymore. It was created implicitly before, because of `.rela.dyn` section, which does not have `Link` specified.

We do not need a symbol table for this test, so instead of adding a "Symbols: []" line, I've just removed the reference.


================
Comment at: llvm/test/tools/obj2yaml/elf-ppc64-relocations.yaml:15
 # CHECK-NEXT:     Type:    SHT_RELA
-# CHECK-NEXT:     Link:    .symtab
 # CHECK-NEXT:     EntSize: 0x0000000000000018
----------------
The same as above. We do not create the symbol table by default for `.rela.text` and we do not need to have this reference to test the relocations here.


================
Comment at: llvm/test/tools/obj2yaml/no-symbol-reloc.test:27
 # CHECK-NEXT:         Type:   R_X86_64_NONE
-# CHECK-NEXT: Symbols: []
 # CHECK-NEXT: ...
----------------
This is a cleanup change. We do not need a "Link" or a symbol table for this test.


================
Comment at: llvm/test/tools/obj2yaml/relocation-unsupported-machine.yaml:15
 # CHECK-NEXT:     Type:    SHT_RELA
-# CHECK-NEXT:     Link:    .symtab
 # CHECK-NEXT:     EntSize: 0x0000000000000018
----------------
The yaml below does not have "Symbols: []", and we do not create a symbol table by default for `.rela.text` anymore.
Hence, we do not set the sh_link too.


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

https://reviews.llvm.org/D69260





More information about the llvm-commits mailing list