[PATCH] D11487: llvm-objdump --section, -j section filtering
colinl at codeaurora.org
Fri Jul 24 13:00:45 PDT 2015
Using the same option is a possibility, as long as there's not a case where we'd want to use both at the same time. Looking in DumpInput it looks like if -macho is set it'll follow the ParseInputMachO path whereas otherwise it will dump it as an archive or object file so this seems like they're currently mutually exclusive.
Agreed on the test case, I'll prepare something and modify the patch.
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
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.
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.
> rL LLVM
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
More information about the llvm-commits