This adds EPhOff, EPhEntSize and EPhNum keys.
Will be useful for creating broken objects for testing llvm-readelf.
Details
Diff Detail
Event Timeline
llvm/lib/ObjectYAML/ELFYAML.cpp | ||
---|---|---|
873–875 | The section header table related fields use "SH" not "Sh". It probably makes sense for us to standardise on one form or the other. In other words, I think we should probably use "PH*" here. | |
llvm/test/tools/yaml2obj/ELF/header-sh-fields.yaml | ||
4–15 | This case isn't really checking the default values any more. It's checking that the default variable values as specified in the YAML are followed, but the purpose of the check seems to me to be to show what happens when the fields aren't specified. | |
4–15 | Didn't realise this is part of a stack - the comment applies to the previous commit. |
llvm/lib/ObjectYAML/ELFYAML.cpp | ||
---|---|---|
873–875 | Fields in Sections class also use Sh*: // This can be used to override the offset stored in the sh_name field. // It does not affect the name stored in the string table. Optional<llvm::yaml::Hex64> ShName; // This can be used to override the sh_offset field. It does not place the // section data at the offset specified. Optional<llvm::yaml::Hex64> ShOffset; // This can be used to override the sh_size field. It does not affect the // content written. Optional<llvm::yaml::Hex64> ShSize; // This can be used to override the sh_flags field. Optional<llvm::yaml::Hex64> ShFlags; So we have 2 options it seems:
What should we do? |
Relatedly, how about we actually name these fields more precisely like their spec names, e.g. EShoff, EPhoff, EShentsize (or something equivalent). I don't mind which approach we go with naming, but I'd recommend we be consistent.
llvm/lib/ObjectYAML/ELFYAML.cpp | ||
---|---|---|
873–875 | But we do not add E prefix to other fields. E.g: we call e_type as Type. |
llvm/lib/ObjectYAML/ELFYAML.cpp | ||
---|---|---|
873–875 |
Thinking about it again, probably we should use the E prefix for these fields, because them are special. |
LGTM, thanks.
llvm/lib/ObjectYAML/ELFYAML.cpp | ||
---|---|---|
873–875 | Right, exactly. The convention we seem to have adopted is <Prefix><Thing> for the direct writing to fields that would typically be auto-generated/inferred from other fields etc. which should have no impact on anything except the final value of the field in the output, and just <Thing> for the other fields. |
The section header table related fields use "SH" not "Sh". It probably makes sense for us to standardise on one form or the other. In other words, I think we should probably use "PH*" here.