These were in lld. They can be reused for other tools, e.g. llvm-readobj.
If needed, we can introduce another class as COFF does (i.e. COFFSymboRef).
Note: Hexagon has a different notion of common symbol I'm not entirely sure I understand.
I wasn't able to find documentation either, so any help on this side is greatly appreciated.
Details
- Reviewers
ruiu • rafael • shankar.easwaran
Diff Detail
Event Timeline
include/llvm/Object/ELF.h | ||
---|---|---|
1030 ↗ | (On Diff #27166) | You don't need the type, just she st_shndx. |
1033 ↗ | (On Diff #27166) | This is scary and should probably not be in the common function. These values can be reused by other architectures to mean something else, no? So they can only be checked in a hexagon only path. |
1042 ↗ | (On Diff #27166) | You only need to check the st_shndx. My suggestion would be to have predicates that cover all values: SHN_UNDEF -> isUndefinedSymbol |
include/llvm/Object/ELF.h | ||
---|---|---|
1030 ↗ | (On Diff #27166) | Actually, sorry, you need the type. On a .o the symbol is required to have SHN_COMMON, but that doesn't exist on a .so. Since we want this to work for both what you have is probably the best. |
All these member functions don't seem to actually belong to ELFFile. They
just call member functions of their arguments. Does it make more sense if
we add them to Elf_Sym?
2015-06-05 13:56 GMT-07:00 Rui Ueyama <ruiu@google.com>:
LGTM but please wait for Rafael.
Sure, no rush.
LGTM with a fix for common symbols.
include/llvm/Object/ELFTypes.h | ||
---|---|---|
185 | Now that I think of it, do we count common as defined? For ELF probably. With that you can use !isUndefiredSymbol && !(st_shndx >= SHN_LORESERVE && st_shndx < SHN_ABS); |
Now that I think of it, do we count common as defined? For ELF probably.
With that you can use
!isUndefiredSymbol && !(st_shndx >= SHN_LORESERVE && st_shndx < SHN_ABS);