This patch gives elfabi the ability to read DT_NEEDED entries from ELF binaries to populate NeededLibs in TextAPI's ELFStub.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
Other than me realizing I made a mistake in previous reviews and a minor little issue (NeededLibCount), this LGTM.
llvm/tools/llvm-elfabi/ELFObjHandler.cpp | ||
---|---|---|
132 | You never use the NeededLibCount. Why do you have it? | |
llvm/tools/llvm-elfabi/ELFObjHandler.h | ||
31 ↗ | (On Diff #178779) | ditto (below) |
37 ↗ | (On Diff #178779) | ditto (below) |
45 ↗ | (On Diff #178779) | ditto (below) |
56 ↗ | (On Diff #178779) | Just realized something I should have caught in previous reviews. You don't need these in the headers. You can make them static template functions in just the file they're used in. That reduces .o size and improves the compilers ability to perform optimizations. |
69 ↗ | (On Diff #178779) | Ditto here. |
llvm/tools/llvm-elfabi/ELFObjHandler.cpp | ||
---|---|---|
126 | nit: I believe you don't need std::string as std::string has an implicit constructor from const char *. |
Rebase and use terminatedSubstr() to fetch DT_NEEDED strings from .dynstr string table.
llvm/tools/llvm-elfabi/ELFObjHandler.cpp | ||
---|---|---|
36–37 | Indentation should be 2 spaces. | |
126 | I think all strings in a string table should be terminated with '\0' in any ELF file. If the last string "overruns" the string table, it is an error, and the last string should not automatically be terminated at the end of the string table. |
Rebase, update error message for DT_NEEDED entries that are outside the string table, and add another test.
nit: remove extraneous space characters?