[PATCH] D63596: [yaml2obj/obj2yaml] - Allow having the symbols and sections with duplicated names.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 24 04:17:07 PDT 2019


grimar updated this revision to Diff 206186.
grimar marked 11 inline comments as done.
grimar added a comment.

- Addressed review comments, added test cases.

In D63596#1553546 <https://reviews.llvm.org/D63596#1553546>, @jhenderson wrote:

> > I do not think it is a very often case to have duplicated symbol/sections name, so I selected the less intrusive way.
>
> Okay, I don't mind. To me, most important is that you can specify multiple sections/symbols with identical names, since I've wanted to do that on more than one occasion. It might be nice if you could accept the following and auto-create the suffixes internally, but I don't feel strongly about it:
>
>   Sections:
>     - Name: foo
>       Type: SHT_PROGBITS
>     - Name: foo
>       Type: SHT_PROGBITS
>


It is not hard to support this trivial case, but the problem is how to support more complex cases.
For example, if we also have a relocation section declaration:

    - Name: .rela.text
      Type: SHT_RELA
      Info: .text
      Link: .symtab
      Relocations:
        - Offset: 0x0
          Type:   R_X86_64_NONE
          Symbol: foo
        - Offset: 0x1
          Type:   R_X86_64_NONE
          Symbol: foo
  ....
  Sections:
    - Name: foo
      Type: SHT_PROGBITS
    - Name: foo
      Type: SHT_PROGBITS

Then we have ambiguity and probably want to detect it and report an error.
The same applies to other cases, e.g. for group section declarations.

If we really want to support only the trivial case mentioned,
I would do it in a separate patch with own test cases.
(I am also not sure, I would probably just improve the error reported to include the suggestion to add a suffix. Since such a situation can only happen with handwritten YAMLs after this patch)


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

https://reviews.llvm.org/D63596

Files:
  test/Object/X86/obj2yaml-dup-section-name.s
  test/tools/obj2yaml/duplicate-symbol-names.test
  test/tools/yaml2obj/duplicate-section-names.test
  test/tools/yaml2obj/duplicate-symbol-names.test
  tools/obj2yaml/elf2yaml.cpp
  tools/yaml2obj/yaml2elf.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63596.206186.patch
Type: text/x-patch
Size: 20245 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190624/0b425d83/attachment.bin>


More information about the llvm-commits mailing list