[PATCH] D60250: [llvm-objdump] Allow -dynamic-reloc on ET_EXEC files

Chih-Mao Chen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 10 09:14:08 PDT 2019


PkmX added a comment.

In D60250#1461308 <https://reviews.llvm.org/D60250#1461308>, @MaskRay wrote:

> I think the error message `error: not a dynamic object` is a bit inappropriate. GNU objdump reports the error if it cannot find the dynamic section and the BFD flag `DYNAMIC` (`ET_DYN`) is not set. This rules looks weird to me as it can just say it cannot find the `.dynamic` section. What if the file is an `ET_DYN` but its `.dynamic` is missing? It may swallow the error message.


Yeah the rule is a bit weird but I think `ET_DYN` without a `.dynamic` section is really a corner case. I did try to craft one by hex-editing and ran `objdump -R` on it, which did successfully *workaround* this condition but then it hit another error in another place.

> I believe we don't have to limit us to `ET_EXEC` and `ET_DYN`. If a coredump (`ET_CORE`) contains `.dynamic`, we can dump its `.dynamic` section as well. A probably better error message can just say that the `.dynamic` section is missing.

I agree, we really should just look for `.dynamic` section in the file regardless of its `e_type`. Also I don't think coredump records dynamic sections, at least it doesn't seem to on Linux.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D60250/new/

https://reviews.llvm.org/D60250





More information about the llvm-commits mailing list