[llvm] [llvm-readobj, ELF] Support reading binary with more than PN_XNUM segments. (PR #165278)

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 24 02:56:56 PDT 2026


================

----------------
jh7370 wrote:

They're not really extraneous, because there are different routes to the same root warning (note how the start of each warning is different, which is why the duplicates are being emitted rather than hidden by the `reportUniqueWarning` code). The GNU one has an easy fix that can be applied to this PR (see my inline comment in the code).

The LLVM one is a bit more involved. The problem is that for reasons that escape me, we pre-load the dynamic table during construction of the dumper. This has always bugged me and I don't think it is right, because we're doing unnecessary work in many cases. Better would be to defer loading the dynamic table until it is actually needed. This would remove the duplicate warning from the majority of cases and mean it only appears when someone is trying to do something with the dynamic segment at the same time as print the program header table, which I expect to be a rare occurrence. This feels like it's outside the scope of this PR. You are welcome to look at it in the future, if you want, but don't feel obliged to. I will say that the TODO needs updating (and probably moving to the point where the dynamic table warning is emitted), to something like "TODO: the dynamic table isn't relevant to printing the program headers, so this warning should not be printed here."

https://github.com/llvm/llvm-project/pull/165278


More information about the llvm-commits mailing list