[PATCH] D11487: llvm-objdump --section, -j section filtering

Kevin Enderby enderby at apple.com
Fri Jul 24 11:21:39 PDT 2015

Hi Colin,

Just a bit of back ground as I was the one that added -section to the current llvm-objdump in r227649.  Since the syntax of the flag is simply section=string why can’t it be used for both your use and the use for Mach-O files?

The functionally I was trying to provide was the darwin otool(1) option of “-s segname sectname”.  But the -s flag in llvm-objdump already had the functionality of "Display the content of each section”.  And the Linux objdump seem to allow -section=string it seemed like a good fit.  I didn’t want to attempt to change the command line parsing to deal with two options for just this flag so in Mach-O I the code looks for a comma as a separator between the segname sectname arguments.  So a use might be “-section __DATA,__mod_init_func" as seen in the test case.  I also added the short hand with no comma as a separator to take the string as a section name and just look for that in all Mach-O segments.

My thoughts,

P.S. And as Eric is fond of, “test case?"

> On Jul 24, 2015, at 9:15 AM, Colin LeMahieu <colinl at codeaurora.org> wrote:
> colinl created this revision.
> colinl added reviewers: rafael, loladiro, majnemer.
> colinl added a subscriber: llvm-commits.
> colinl set the repository for this revision to rL LLVM.
> This patch adds the --section and -j options to llvm-objdump to specify a section to dump.
> One thing that needs to be addressed is the --section flag is in conflict with the MachO flag of the same name.  We either need to change the name of the filtering flag which might be unexpected behavior for people coming from other toolchains or change the MachO flag which would change existing behavior.
> My recommendation would be changing the machO flag to --macho-section.
> Repository:
>  rL LLVM
> http://reviews.llvm.org/D11487
> Files:
>  tools/llvm-objdump/llvm-objdump.cpp
> <D11487.30576.patch>_______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

More information about the llvm-commits mailing list