[PATCH] D65541: [llvm-objcopy][MachO] Implement --only-section
Seiya Nuta via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 17 18:03:31 PDT 2019
seiya updated this revision to Diff 225551.
seiya marked an inline comment as done.
seiya added a comment.
Before committing this patch, I noticed that we need to consider how llvm-objcopy should handle wildcards in Mach-O support.
First I thought that validating the segment/section names would be helpful for users, for example:
$ llvm-objcopy llvm-objcopy --only-section __text foo
error: invalid section name '__text' (should be formatted as '<segment name>,<section name>')
However, the validation (check that the option value is formatted as `<segment name>,<section name>`) does not make sense when taking into account wildcards. In GNU objcopy, it seems it does not care about the segment/section name separator (`.`) at all. In the following example, GNU objcopy accepts both `__TEXT*` and `__TEXT.*` and outputs identical outputs.
$ gobjcopy llvm-objcopy --only-section '__TEXT*' foo foo2
$ gobjcopy llvm-objcopy --only-section '__TEXT.*' foo foo3
$ cmp foo2 foo3
$ echo $?
0
In this change, I've removed the Mach-O segment/section names validation from NameOrPattern.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D65541/new/
https://reviews.llvm.org/D65541
Files:
llvm/docs/CommandGuide/llvm-objcopy.rst
llvm/test/tools/llvm-objcopy/MachO/only-section.test
llvm/tools/llvm-objcopy/MachO/MachOObjcopy.cpp
llvm/tools/llvm-objcopy/MachO/MachOReader.cpp
llvm/tools/llvm-objcopy/MachO/Object.cpp
llvm/tools/llvm-objcopy/MachO/Object.h
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65541.225551.patch
Type: text/x-patch
Size: 10444 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191018/346cae7e/attachment.bin>
More information about the llvm-commits
mailing list