[PATCH] D44357: COFF: Adjust how we detect weak externals
Peter Collingbourne via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 15 18:51:54 PDT 2018
pcc added a comment.
Probably the ideal test would be an object file with three weak externals with each of the possible characteristics. Then test that the archive symbol table contains only an entry for the symbol with characteristics `IMAGE_WEAK_EXTERN_SEARCH_ALIAS`.
================
Comment at: lib/Object/COFFImportFile.cpp:549
1},
- {{{2, 0, 0, 0, 3, 0, 0, 0}}, u32(0), u16(0), u16(0), uint8_t(0), 0},
+ {{{2, 0, 0, 0, IMAGE_WEAK_EXTERN_SEARCH_ALIAS, 0, 0, 0}},
+ u32(0),
----------------
Please commit this part as a separate cleanup.
================
Comment at: lib/Object/COFFObjectFile.cpp:235
- if (Symb.isAnyUndefined())
+ if (Symb.isAnyUndefined() && !(this->getCharacteristics() &
+ COFF::IMAGE_WEAK_EXTERN_SEARCH_ALIAS))
----------------
I don't think that `getCharacteristics` does what you are expecting it to do here. It looks like it retrieves the characteristics from the COFF header, and not the symbol: http://llvm-cs.pcc.me.uk/include/llvm/Object/COFF.h#821
Also, I think you will want to compare the characteristics to `IMAGE_WEAK_EXTERN_SEARCH_ALIAS` with `!=`, not use it as a bitmask.
Repository:
rL LLVM
https://reviews.llvm.org/D44357
More information about the llvm-commits
mailing list