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

Kevin Enderby enderby at apple.com
Wed Jul 29 10:43:24 PDT 2015


> On Jul 29, 2015, at 8:49 AM, Colin LeMahieu <colinl at codeaurora.org> wrote:
> 
> For the time being I added this with just the -j flag.  One concern I had with merging the --section flag was it looks like some MachODump operations iterate over all sections and people may want to filter those down which wouldn't be available since --section would mean something else when MachO dumping.

I don’t think there is any need for concern with the MachODump operations with your change.  As operations in the code you are are concerned with don’t want any filtering.  Specific comments below about them, where the operation is to print some specific data and so the —section flag should have no effect on those operation.

> printMachOUnwindInfo,

Not exactly sure on this one as Nick did it, but it is just looking to print the unwind info so which might refer to other sections.

> SegInfo,

This is building a table of all sections so segIndex/offset pairs can be translated from the rebase info.

> printObjc2_32bit_MetaData

This is collecting all sections into a vector of sections it can use when the Objc meta data references them.  

> are things I was thinking of.

Thanks for your concern and calling this out.  But looking at the code it looks like it is fine with your changes.

Kev

> 
> -----Original Message-----
> From: Kevin Enderby [mailto:enderby at apple.com] 
> Sent: Friday, July 24, 2015 1:22 PM
> To: reviews+D11487+public+e24b2668a2517e3a at reviews.llvm.org
> Cc: Kevin Enderby; colinl at codeaurora.org; rafael.espindola at gmail.com; kfischer at college.harvard.edu; david.majnemer at gmail.com; llvm-commits at cs.uiuc.edu
> Subject: Re: [PATCH] D11487: llvm-objdump --section, -j section filtering
> 
> 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,
> Kev
> 
> 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