summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-objcopy/CopyConfig.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Small refactoring of FileError. NFC.Eugene Leviant2019-02-111-1/+1
| | | | | | Differential revision: https://reviews.llvm.org/D57945 llvm-svn: 353679
* [llvm-objcopy] Add few file processing directivesEugene Leviant2019-02-081-5/+17
| | | | | | Differential revision: https://reviews.llvm.org/D57877 llvm-svn: 353521
* [llvm-objcopy] Add --redefine-symsEugene Leviant2019-02-081-0/+32
| | | | | | Differential revision: https://reviews.llvm.org/D57738 llvm-svn: 353509
* [llvm-objcopy] Allow regular expressions in name comparisonEugene Leviant2019-02-061-17/+30
| | | | | | Differential revision: https://reviews.llvm.org/D57517 llvm-svn: 353289
* [llvm-objcopy][NFC] Use StringSaver for --keep-global-symbolsJordan Rupprecht2019-02-041-5/+8
| | | | | | | | | | | | | | Summary: Use StringSaver/BumpPtrAlloc when parsing lines from --keep-global-symbols files. This allows us to consistently use StringRef for driver options, which avoids copying the full strings for each object copied, as well as simplifies part of D57517. Reviewers: jhenderson, evgeny777, alexshap Subscribers: jakehehrlich Tags: #llvm Differential Revision: https://reviews.llvm.org/D57617 llvm-svn: 353068
* [llvm-strip] Implement --keep-file-symbolsEugene Leviant2019-02-011-0/+1
| | | | | | Differential revision: https://reviews.llvm.org/D57582 llvm-svn: 352878
* [llvm-strip] Add --strip-symbolEugene Leviant2019-01-311-4/+7
| | | | | | Differential revision: https://reviews.llvm.org/D57440 llvm-svn: 352746
* [llvm-objcopy] Support -X|--discard-locals.Jordan Rupprecht2019-01-301-4/+12
| | | | | | | | | | | | | | | | | | | Summary: This adds support for the --discard-locals flag, which acts similarly to --discard-all, except it only applies to compiler-generated symbols (i.e. symbols starting with `.L` in ELF). I am not sure about COFF local symbols: those appear to also use `.L` in most cases, but also use just `L` in other cases, so for now I am just leaving it unimplemented there. Fixes PR36160 Reviewers: jhenderson, alexshap, jakehehrlich, mstorsjo, espindola Reviewed By: jhenderson Subscribers: llvm-commits, emaste, arichardson Differential Revision: https://reviews.llvm.org/D57248 llvm-svn: 352626
* [llvm-objcopy] Implement --set-section-flags.Jordan Rupprecht2019-01-291-24/+63
| | | | | | | | | | | | | | | | | Summary: --set-section-flags is used to change the section flags (e.g. SHF_ALLOC) for given sections. The flags allowed are the same from the existing --rename-section=.old=.new[,flags] feature. Additionally, make sure that --set-section-flag cannot be used with --rename-section (either the source or destination), since --rename-section accepts flags. This avoids ambiguity for something like "--rename-section=.foo=.bar,alloc --set-section-flag=.bar,code". Reviewers: jhenderson, jakehehrlich, alexshap, espindola Reviewed By: jhenderson, jakehehrlich Subscribers: llvm-commits, emaste, arichardson Differential Revision: https://reviews.llvm.org/D57198 llvm-svn: 352505
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* [llvm-objcopy] Handle -O <format> flag.Jordan Rupprecht2019-01-071-0/+18
| | | | | | | | | | | | | | | | | Summary: The -O flag is currently being mostly ignored; it's only checked whether or not the output format is "binary". This adds support for a few formats (e.g. elf64-x86-64), so that when specified, the output can change between 32/64 bit and sizes/alignments are updated accordingly. This fixes PR39135 Reviewers: jakehehrlich, jhenderson, alexshap, espindola Reviewed By: jhenderson Subscribers: emaste, arichardson, llvm-commits Differential Revision: https://reviews.llvm.org/D53667 llvm-svn: 350541
* [llvm-objcopy] Change --only-keep to --only-sectionJake Ehrlich2018-12-061-2/+2
| | | | | | | | | | | | I just hard core goofed when I wrote this and created a different name for no good reason. I'm failry aware of most "fresh" users of llvm-objcopy (that is, users which are not using it as a drop in replacement for GNU objcopy) and can say that only "-j" is being used by such people so this patch should strictly increase compatibility and not remove it. Differential Revision: https://reviews.llvm.org/D52180 llvm-svn: 348446
* [llvm-objcopy] Add --build-id-link-dir flagJake Ehrlich2018-12-031-1/+8
| | | | | | | | | | | | | | | This flag does not exist in GNU objcopy but has a major use case. Debugging tools support the .build-id directory structure to find debug binaries. There is no easy way to build this structure up however. One way to do it is by using llvm-readelf and some crazy shell magic. This implements the feature directly. It is most often the case that you'll want to strip a file and send the original to the .build-id directory but if you just want to send a file to the .build-id directory you can copy to /dev/null instead. Differential Revision: https://reviews.llvm.org/D54384 llvm-svn: 348174
* [llvm-objcopy] Hook up the -V alias to --version, output "GNU strip"Martin Storsjo2018-11-281-0/+2
| | | | | | | | | | | This allows libtool to detect the presence of llvm-strip and use it with the options --strip-debug and --strip-unneeded. Also hook up the -V alias for objcopy. Differential Revision: https://reviews.llvm.org/D54936 llvm-svn: 347731
* [llvm-objcopy] Rename --keep to --keep-section.Jordan Rupprecht2018-11-131-4/+4
| | | | | | | | | | | | | | | | Summary: llvm-objcopy/strip support `--keep` (for sections) and `--keep-symbols` (for symbols). For consistency and clarity, rename `--keep` to `--keep-section`. In fact, for GNU compatability, -K is --keep-symbol, so it's weird that the alias `-K` is not the same as the short-ish `--keep`. Reviewers: jakehehrlich, jhenderson, alexshap, MaskRay, espindola Reviewed By: jakehehrlich, MaskRay Subscribers: emaste, arichardson, llvm-commits Differential Revision: https://reviews.llvm.org/D54477 llvm-svn: 346782
* [llvm-strip] Support --keep and --strip-all-gnu from llvm-objcopyJordan Rupprecht2018-11-011-1/+6
| | | | | | | | | | | | | | Summary: Add --keep and --strip-all-gnu from llvm-objcopy into llvm-strip. Reviewers: jakehehrlich, jhenderson, alexshap Reviewed By: jhenderson, alexshap Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D53954 llvm-svn: 345861
* [llvm-objcopy] Support --{enable,disable}-deterministic-archivesJordan Rupprecht2018-11-011-0/+8
| | | | | | | | | | | | | | Summary: ar and objcopy/strip all support configuring whether archives are written deterministically (timestamps/UIDs/GIDs/etc zero'd). This has been ported to llvm-ar (the U/D modifiers) but not yet to llvm-objcopy/strip. Reviewers: jakehehrlich, jhenderson, alexshap Reviewed By: jhenderson Subscribers: ruiu, mgrang, llvm-commits Differential Revision: https://reviews.llvm.org/D53913 llvm-svn: 345859
* [llvm-objcopy] Fix use-after-move clang-tidy warningJordan Rupprecht2018-10-231-2/+2
| | | | llvm-svn: 345079
* [llvm-strip] Support -s alias for --strip-all. Make both strip and objcopy ↵Jordan Rupprecht2018-10-231-2/+2
| | | | | | | | | | | | | | | | | | | | | case sensitive to support both -s (--strip-all) and -S (--strip-debug). Summary: GNU strip supports both `-s` and `-S` as aliases for `--strip-all` and `--strip-debug`, respectfully. As part of this, it turns out that strip/objcopy were accepting case insensitive command line args. I'm not sure if there was an explicit reason for this. The only others uses of this are llvm-cvtres/llvm-mt/llvm-lib, which are all tools specific for windows support. Forcing case sensitivity allows both aliases to exist, but seems like a good idea anyway. And as a surprise test case adjustment, the llvm-strip unit test was running with `-keep=unavailable_symbol`, despite `keep` not be a valid flag for strip. This is because there is a flag `-K` which, when case insensitivity is permitted, allows it to be interpreted as `-K` = `eep=unavailable_symbol` (e.g. to allow `-Kfoo` == `--keep-symbol=foo`). Reviewers: jakehehrlich, jhenderson, alexshap Reviewed By: jakehehrlich Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D53163 llvm-svn: 345068
* [llvm-objcopy] Add -F|--target compatibilityJordan Rupprecht2018-10-121-2/+12
| | | | | | | | | | | | | | | | | Summary: This change adds support for the GNU --target flag, which sets both --input-target and --output-target. GNU objcopy doesn't do any checking for whether both --target and --{input,output}-target are used, and so it allows both, e.g. "--target A --output-target B" is equivalent to "--input-target A --output-target B" since the later command line flag would override earlier ones. This may be error prone, so I chose to implement it as an error if both are used. I'm not sure if anyone is actually using both. Reviewers: jakehehrlich, jhenderson, alexshap Reviewed By: jakehehrlich, alexshap Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D53029 llvm-svn: 344321
* [llvm-objcopy] Factor out CopyConfigAlexander Shaposhnikov2018-10-111-0/+424
In this diff we move out CopyConfig from llvm-oobjcopy.cpp into a separate header CopyConfig.h to enable us (in the future) reuse this class in the other implementations of objcopy (for coff, mach-o). Additionally this enables us to unload the complexity from llvm-objcopy.cpp a little bit. Test plan: make check-all Differential revision: https://reviews.llvm.org/D53006 llvm-svn: 344307
OpenPOWER on IntegriCloud