[PATCH] D113234: Extend obj2yaml to optionally preserve raw __LINKEDIT/__DATA segments.

Alexander Shaposhnikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 5 12:23:35 PDT 2021


alexander-shaposhnikov added inline comments.


================
Comment at: llvm/tools/obj2yaml/macho2yaml.cpp:656
+Error macho2yaml(raw_ostream &Out, const object::Binary &Binary,
+                 bool RawDataSegment, bool RawLinkEditSegment) {
   if (const auto *MachOObj = dyn_cast<object::MachOUniversalBinary>(&Binary))
----------------
aprantl wrote:
> alexander-shaposhnikov wrote:
> > in the future someone might want to dump other segments too, though I'm not sure what would be the best solution here 
> These two are all I need right now, but if these options proliferate in the future, we should probably pass a list of raw segment names or an option struct.
Yeah, I also think that passing a list would be a good option.  Somehow it feels like it'd be better than the newly introduced boolean flags  - in this case we won't need to change the command line options in the future or keep them around just for compatibility. E.g. one could use --raw-segments=<segment name 1>,<segment name 2> instead  of  
'-raw-data-segment -raw-linkedit-segment' + the code will improve a little bit - maybe switch now ?



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

https://reviews.llvm.org/D113234



More information about the llvm-commits mailing list