[PATCH] D60122: [yaml2obj][obj2yaml] - Change how symbol's binding is descibed when parsing/dumping.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 2 14:20:24 PDT 2019


grimar marked an inline comment as done.
grimar added inline comments.


================
Comment at: tools/yaml2obj/yaml2elf.cpp:807-808
+    StringRef Name = Sym.Name;
+    if (Sym.Binding.value == ELF::STB_LOCAL && GlobalSymbolSeen) {
+      WithColor::error() << "Has a local symbol '" + Name + "' after global.\n";
+      return false;
----------------
rupprecht wrote:
> Why does this need to be an error?
To always produce the correct ELF output for now:
"In each symbol table, all symbols with STB_LOCAL binding precede the weak and global symbols."
(http://refspecs.linuxbase.org/elf/gabi4+/ch4.symtab.html)

Before this change, we followed this rule. And the current code does the same.

I think we might want to remove this restriction soon (to allow producing broken outputs),
but I just did not want to do it in this patch. That would require adding more test case(s) I think
to document our behavior in different situations.

Also atm `findLocalsNum` I added to yaml2elf.cpp assumes that locals always go first for simplicity.



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

https://reviews.llvm.org/D60122





More information about the llvm-commits mailing list