[llvm] [llvm-nm] Introduce synthetic flag (PR #138232)
James Henderson via llvm-commits
llvm-commits at lists.llvm.org
Sun Jun 15 23:50:05 PDT 2025
================
@@ -1783,6 +1785,55 @@ getDynamicSyms(SymbolicFile &Obj) {
return E->getDynamicSymbolIterators();
}
+// Returns false if there is error found or true otherwise.
+static bool getPltSyms(SymbolicFile &Obj, std::vector<NMSymbol> &SymbolList) {
+ const auto *ELFObj = dyn_cast<ELFObjectFileBase>(&Obj);
+ if (!ELFObj)
+ return true;
+
+ std::string Err;
+ Triple TT;
+ TT.setArch(ELFObj->getArch());
+ TT.setOS(ELFObj->getOS());
+ const Target *TheTarget = TargetRegistry::lookupTarget(TT, Err);
+ if (!TheTarget) {
+ error("unable to find target for " + Obj.getFileName() + ": " + Err);
+ return false;
+ }
+
+ std::unique_ptr<const MCSubtargetInfo> STI;
+ STI.reset(TheTarget->createMCSubtargetInfo(
+ TT.getTriple(), ELFObj->tryGetCPUName().value_or("").str(), ""));
+ if (!STI) {
+ error("unable to create subtarget info for " + Obj.getFileName());
+ return false;
+ }
+
+ for (auto Plt : ELFObj->getPltEntries(*STI)) {
----------------
jh7370 wrote:
LLVM style guide says to only use `auto` where it improves readability. As things stand, I can't tell what the type of `Plt` is here, which means it's harming readability here and should be expanded. Also, using `auto` here doesn't convey whether this is a reference or not, when it probably should be `const &`.
https://github.com/llvm/llvm-project/pull/138232
More information about the llvm-commits
mailing list