[PATCH] D47414: [llvm-objcopy] Fix null symbol handling

Paul Semel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat May 26 14:37:15 PDT 2018


paulsemel added a comment.

Hi !

In https://reviews.llvm.org/D47414#1113435, @alexshap wrote:

> thanks for addressing this (i noticed this isssue too, but didn't have a minute to send a fix).
>  Regarding the code: to be honest i would prefer to avoid these somewhat "hacky" manipulations with the index (i.e. in getSymbolByIndex etc),
>  instead, i would keep this special symbol in the symbol table and in llvm-objcopy.cpp I would replace the check !Obj.SymbolTable->empty() with
>  Obj.SymbolTable->size() >= 2 or smth like this (+ add a comment that we need to take into account that special symbol).
>  What are your thoughts ?


Thansk for reviewing ! I actually agree with you that this hacky thing with the indexes is not perfect at all.. However, as it is with the null section, I would have really liked not to expose this symbol at all to the user.
Indeed, we might really want not to think about this dummy symbol while implementing new options or smth.
I couldn't find a smarter way to do this, do you have smth in mind ? :)


Repository:
  rL LLVM

https://reviews.llvm.org/D47414





More information about the llvm-commits mailing list