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

Colin LeMahieu colinl at codeaurora.org
Wed Jul 29 08:49:10 PDT 2015


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.

printMachOUnwindInfo, SegInfo, printObjc2_32bit_MetaData are things I was thinking of.

-----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