[llvm] Allow "[[FLAGS=<none>]]" value in the ELF Fileheader Flags field (PR #143845)
James Henderson via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 8 23:53:43 PDT 2025
================
@@ -281,7 +281,8 @@ template <class ELFT> Expected<ELFYAML::Object *> ELFDumper<ELFT>::dump() {
Y->Header.Type = Obj.getHeader().e_type;
if (Obj.getHeader().e_machine != 0)
Y->Header.Machine = ELFYAML::ELF_EM(Obj.getHeader().e_machine);
- Y->Header.Flags = Obj.getHeader().e_flags;
+ if (Obj.getHeader().e_flags != 0)
+ Y->Header.Flags = Obj.getHeader().e_flags;
----------------
jh7370 wrote:
This code could do with an explicit test, which essentially is the inverse of the test you wrote.
In practice, this test would use yaml2obj to generate an ELF with different e_flags values and show that the obj2yaml output generates a Flags entry in the YAML if e_flags is non-zero.
https://github.com/llvm/llvm-project/pull/143845
More information about the llvm-commits
mailing list