summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-objcopy/ELF
Commit message (Collapse)AuthorAgeFilesLines
...
* [llvm-objcopy] Strip file symbols with --strip-unneededEugene Leviant2019-05-211-1/+1
| | | | | | Differential revision: https://reviews.llvm.org/D61641 llvm-svn: 361231
* [llvm-objcopy] Cache gnu_debuglink's target CRCJames Henderson2019-05-143-20/+11
| | | | | | | | | | | | | | | | | | | | | | .gnu_debuglink section contains information regarding file with debugging symbols, identified by its CRC32. This target file is not intended to ever change or it would invalidate the stored checksum, yet the checksum is calculated over and over again for each of the objects inside the archive, usually hundreds of times. This patch precomputes the CRC32 of the target once and then reuses the value where required, saving lots of redundant I/O. The error message reported should stay the same, although now it might be reported earlier. Reviewed by: jhenderson, jakehehrlich, MaskRay Differential Revision: https://reviews.llvm.org/D61343 Patch by Michal Janiszewski llvm-svn: 360661
* [llvm-objcopy] Add --prefix-alloc-sectionsJames Henderson2019-05-081-1/+57
| | | | | | | | | | | | | | | | This patch adds support for --prefix-alloc-sections, which adds a prefix to every allocated section names. It adds a prefix after renaming section names by --rename-section as GNU objcopy does. Fixes PR41266: https://bugs.llvm.org/show_bug.cgi?id=41266 Differential Revision: https://reviews.llvm.org/D60042 Patch by Seiya Nuta. llvm-svn: 360233
* [llvm-objcopy] - Fix for "Bug 41775 - SymbolTableSection::addSymbol - shadow ↵George Rimar2019-05-082-3/+3
| | | | | | | | | | | | | | | | | | | variable names" This is a fix for https://bugs.llvm.org/show_bug.cgi?id=41775, Problem is in the final line: Size += this->EntrySize; I checked that we do not actually need it in this place, since we always call removeSectionReferences which calls removeSymbols which updates the Size. But it worth to keep it, that allows to relax the dependencies. Differential revision: https://reviews.llvm.org/D61636 llvm-svn: 360227
* [llvm-objcopy] Simplify SHT_NOBITS -> SHT_PROGBITS promotionFangrui Song2019-05-011-7/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GNU objcopy uses bfd_elf_get_default_section_type to decide the candidate section type, which roughly translates to our [a] (I assume SEC_COMMON implies SHF_ALLOC): (!(Sec.Flags & ELF::SHF_ALLOC) || Flags & (SectionFlag::SecContents | SectionFlag::SecLoad))) Then, it updates the section type in bfd/elf.c:elf_fake_sections if: if (this_hdr->sh_type == SHT_NULL) this_hdr->sh_type = sh_type; // common case else if (this_hdr->sh_type == SHT_NOBITS && sh_type == SHT_PROGBITS && (asect->flags & SEC_ALLOC) != 0) // uncommon case ... this_hdr->sh_type = sh_type; If the following condition is met the uncommon branch is executed: if (elf_section_type (osec) == SHT_NULL && (osec->flags == isec->flags || (final_link && ((osec->flags ^ isec->flags) & ~(SEC_LINK_ONCE | SEC_LINK_DUPLICATES | SEC_RELOC)) == 0))) I suggest we just ignore this clause and follow the common case behavior, which is done in this patch. Rationales to do so: If --set-section-flags is a no-op (osec->flags == isec->flags) (corresponds to the "readonly" test in set-section-flags.test), GNU objcopy will require (Sec.Flags & ELF::SHF_ALLOC). [a] is essentially: Flags & (SectionFlag::SecContents | SectionFlag::SecLoad) This special case is not really useful. Non-SHF_ALLOC SHT_NOBITS sections do not make much sense and it doesn't matter if they are SHT_NOBITS or SHT_PROGBITS. For all other RUN lines in set-section-flags.test, the new behavior matches GNU objcopy, i.e. this patch improves compatibility. Differential Revision: https://reviews.llvm.org/D60189 llvm-svn: 359639
* [llvm-objcopy] - Check dynamic relocation sections for broken references.George Rimar2019-04-302-12/+36
| | | | | | | | | | | | | | This is a fix for https://bugs.llvm.org/show_bug.cgi?id=41371. Currently, it is possible to break the sh_link field of the dynamic relocation section by removing the section it refers to. The patch fixes an issue and adds 2 test cases. One of them shows that it does not seem possible to break the sh_info field. I added an assert to verify this. Differential revision: https://reviews.llvm.org/D60825 llvm-svn: 359552
* Use llvm::stable_sort. NFCFangrui Song2019-04-221-8/+4
| | | | llvm-svn: 358897
* [llvm-objcopy][llvm-strip] Add switch to allow removing referenced sectionsJames Henderson2019-04-183-32/+56
| | | | | | | | | | | | | | | | | | | | llvm-objcopy currently emits an error if a section to be removed is referenced by another section. This is a reasonable thing to do, but is different to GNU objcopy. We should allow users who know what they are doing to have a way to produce the invalid ELF. This change adds a new switch --allow-broken-links to both llvm-strip and llvm-objcopy to do precisely that. The corresponding sh_link field is then set to 0 instead of an error being emitted. I cannot use llvm-readelf/readobj to test the link fields because they emit an error if any sections, like the .dynsym, cannot be properly loaded. Reviewed by: rupprecht, grimar Differential Revision: https://reviews.llvm.org/D60324 llvm-svn: 358649
* [llvm-objcopy] Fill .symtab_shndx section correctlyEugene Leviant2019-04-122-12/+31
| | | | | | Differential revision: https://reviews.llvm.org/D60555 llvm-svn: 358278
* [llvm-objcopy] Change SHT_NOBITS to SHT_PROBITS for some --set-section-flagsJordan Rupprecht2019-04-021-5/+16
| | | | | | | | | | | | | | | | | | | | | Summary: Some flags accepted by --set-section-flags and --rename-section can change a SHT_NOBITS section to a SHT_PROGBITS section. Note that none of them can change a SHT_PROGBITS to SHT_NOBITS. The full list (found via experimentation of individually setting each flag) that does this is: contents, load, noload, code, data, rom, and debug. This was found by testing llvm-objcopy with the gnu binutils test suite, specifically this test case: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=blob;f=binutils/testsuite/binutils-all/copy-1.d;h=f2b0d9e90df738c2891b4d5c7b62f62894b556ca;hb=HEAD Reviewers: jhenderson, grimar, jakehehrlich, alexshap, espindola Reviewed By: jhenderson Subscribers: emaste, arichardson, MaskRay, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D59958 llvm-svn: 357492
* [llvm-objcopy]Allow llvm-objcopy to be used on an ELF file with no section ↵James Henderson2019-04-022-13/+21
| | | | | | | | | | | | | | | | | | | | headers This patch fixes https://bugs.llvm.org/show_bug.cgi?id=41293 and https://bugs.llvm.org/show_bug.cgi?id=41045. llvm-objcopy assumed that it could always read a section header string table. This isn't the case when the sections were previously all stripped, and the e_shstrndx field was set to 0. This patch fixes this. It also fixes a double space in an error message relating to this issue, and prevents llvm-objcopy from adding extra space for non-existent section headers, meaning that --strip-sections on the output of a previous --strip-sections run produces identical output, simplifying the test. Reviewed by: rupprecht, grimar Differential Revision: https://reviews.llvm.org/D59989 llvm-svn: 357475
* [llvm-objcopy] Replace the size() helper with SectionTableRef::sizeFangrui Song2019-03-302-10/+6
| | | | | | | | | | | | | | | | | | | Summary: BTW, STLExtras.h provides llvm::size() which is similar to std::size() for random access iterators. However, if we prefer qualified llvm::size(), the member function .size() will be more convenient. Reviewers: jhenderson, jakehehrlich, rupprecht, grimar, alexshap, espindola Reviewed By: grimar Subscribers: emaste, arichardson, jdoerfert, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D60028 llvm-svn: 357347
* [llvm-objcopy] Fix case style of LayoutSegments. NFCFangrui Song2019-03-291-2/+2
| | | | llvm-svn: 357265
* [llvm-objcopy] Delete two redundant reinterpret_cast. NFCFangrui Song2019-03-291-5/+3
| | | | llvm-svn: 357238
* [llvm-objcopy][NFC] Move ELF-specific logic into /ELF/ directoryJordan Rupprecht2019-03-281-4/+20
| | | | llvm-svn: 357199
* [llvm-objcopy] - Strip sections before symbols.George Rimar2019-03-261-2/+6
| | | | | | | | | | | | This is a fix for https://bugs.llvm.org/show_bug.cgi?id=40007. Idea is to swap the order of stripping. So that we strip sections before symbols what allows us to strip relocation sections without emitting the error about relative symbols. Differential revision: https://reviews.llvm.org/D59763 llvm-svn: 357017
* [llvm-objcopy]Preserve data in segments not covered by sectionsJames Henderson2019-03-252-5/+47
| | | | | | | | | | | | | | | | llvm-objcopy previously knew nothing about data in segments that wasn't covered by section headers, meaning that it wrote zeroes instead of what was there. As it is possible for this data to be useful to the loader, this patch causes llvm-objcopy to start preserving this data. Data in sections that are explicitly removed continues to be written as zeroes. This fixes https://bugs.llvm.org/show_bug.cgi?id=41005. Reviewed by: jakehehrlich, rupprecht Differential Revision: https://reviews.llvm.org/D59483 llvm-svn: 356919
* [llvm-objcopy] - Refactor the code. NFC.George Rimar2019-03-251-96/+106
| | | | | | | | | | The idea of the patch is about to move out the code to a new helper static functions (to reduce the size of 'handleArgs' and to isolate the parts of it's logic). Differential revision: https://reviews.llvm.org/D59762 llvm-svn: 356889
* Recommit r356738 "[llvm-objcopy] - Implement replaceSectionReferences for ↵George Rimar2019-03-242-0/+9
| | | | | | | | | | | | | | | | | | | GroupSection class." Fix: r356853 + set AddressAlign to 4 in Inputs/compress-debug-sections.yaml for the new group section introduced. Original commit message: Currently, llvm-objcopy incorrectly handles compression and decompression of the sections from COMDAT groups, because we do not implement the replaceSectionReferences for this type of the sections. The patch does that. Differential revision: https://reviews.llvm.org/D59638 llvm-svn: 356856
* [llvm-objcopy] - Report SHT_GROUP sections with invalid alignment.George Rimar2019-03-241-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | This patch fixes the reason of ubsan failure (UB detected) happened after landing the D59638 (I had to revert it). http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap-ubsan/builds/11760/steps/check-llvm%20ubsan/logs/stdio) Problem is the following. Our implementation of GroupSection assumes that its address is 4 bytes aligned when writes it: template <class ELFT> void ELFSectionWriter<ELFT>::visit(const GroupSection &Sec) { ELF::Elf32_Word *Buf = reinterpret_cast<ELF::Elf32_Word *>(Out.getBufferStart() + Sec.Offset); ... But the test case for D59638 did not set AddressAlign in YAML. So address was not 4 bytes aligned since Sec.Offset was odd. That triggered the issue. This patch teaches llvm-objcopy to report an error for such sections (which should not met in reality), what is better than having UB. Differential revision: https://reviews.llvm.org/D59695 llvm-svn: 356853
* Revert r356738 "[llvm-objcopy] - Implement replaceSectionReferences for ↵George Rimar2019-03-222-9/+0
| | | | | | | | | GroupSection class." Seems this broke ubsan bot: http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap-ubsan/builds/11760 llvm-svn: 356745
* [llvm-objcopy] - Implement replaceSectionReferences for GroupSection class.George Rimar2019-03-222-0/+9
| | | | | | | | | | | | Currently, llvm-objcopy incorrectly handles compression and decompression of the sections from COMDAT groups, because we do not implement the replaceSectionReferences for this type of the sections. The patch does that. Differential revision: https://reviews.llvm.org/D59638 llvm-svn: 356738
* [llvm-objcopy]Add support for *-freebsd output formatsJames Henderson2019-03-221-2/+6
| | | | | | | | | | | | | | GNU objcopy can support output formats like elf32-i386-freebsd and elf64-x86-64-freebsd. The only difference from their regular non-freebsd counterparts that I have observed is that the freebsd versions set the OS/ABI field to ELFOSABI_FREEBSD. This patch sets the OS/ABI field according based on the format whenever --output-format is specified. Reviewed by: rupprecht, grimar Differential Revision: https://reviews.llvm.org/D59645 llvm-svn: 356737
* [llvm-objcopy] - Use replaceSectionReferences to update the sections for ↵George Rimar2019-03-202-6/+9
| | | | | | | | | | | symbols in symbol table. If the compression was used and we had a symbol not involved in relocation, we never updated its section and it was silently removed from the output. Differential revision: https://reviews.llvm.org/D59542 llvm-svn: 356554
* [llvm-objcopy] Make .build-id linking atomicJake Ehrlich2019-03-181-9/+43
| | | | | | | | This change makes linking into .build-id atomic and safe to use. Some users under particular workflows are reporting that this races more than half the time under particular conditions. llvm-svn: 356404
* [llvm-objcopy] - Calculate the string table section sizes correctly.George Rimar2019-03-182-12/+12
| | | | | | | | | | | | | | This fixes the https://bugs.llvm.org/show_bug.cgi?id=40980. Previously if string optimization occurred as a result of StringTableBuilder's finalize() method, the size wasn't updated. This hopefully also makes the interaction between sections during finalization processes a bit more clear. Differential revision: https://reviews.llvm.org/D59488 llvm-svn: 356371
* [llvm-objcopy] Delete unused parameter from replaceDebugSections. NFCFangrui Song2019-03-151-3/+3
| | | | llvm-svn: 356245
* [llvm-objcopy] Don't use {}; NFCFangrui Song2019-03-151-1/+1
| | | | llvm-svn: 356244
* [llvm-objcopy]Don't implicitly strip sections in segmentsJames Henderson2019-03-141-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | This patch changes llvm-objcopy's behaviour to not strip sections that are in segments, if they otherwise would be due to a stripping operation (--strip-all, --strip-sections, --strip-non-alloc). This preserves the segment contents. It does not change the behaviour of --strip-all-gnu (although we could choose to do so), because GNU objcopy's behaviour in this case seems to be to strip the section, nor does it prevent removing of sections in segments with --remove-section (if a user REALLY wants to remove a section, we should probably let them, although I could be persuaded that warning might be appropriate). Tests have been added to show this latter behaviour. This fixes https://bugs.llvm.org/show_bug.cgi?id=41006. Reviewed by: grimar, rupprecht, jakehehrlich Differential Revision: https://reviews.llvm.org/D59293 This is a reland of r356129, attempting to fix greendragon failures due to a suspected compatibility issue with od on the greendragon bots versus other versions. llvm-svn: 356136
* Revert r356129 due to greendragon bot failuresJames Henderson2019-03-141-4/+2
| | | | llvm-svn: 356133
* [llvm-objcopy]Don't implicitly strip sections in segmentsJames Henderson2019-03-141-2/+4
| | | | | | | | | | | | | | | | | | | | | This patch changes llvm-objcopy's behaviour to not strip sections that are in segments, if they otherwise would be due to a stripping operation (--strip-all, --strip-sections, --strip-non-alloc). This preserves the segment contents. It does not change the behaviour of --strip-all-gnu (although we could choose to do so), because GNU objcopy's behaviour in this case seems to be to strip the section, nor does it prevent removing of sections in segments with --remove-section (if a user REALLY wants to remove a section, we should probably let them, although I could be persuaded that warning might be appropriate). Tests have been added to show this latter behaviour. This fixes https://bugs.llvm.org/show_bug.cgi?id=41006. Reviewed by: grimar, rupprecht, jakehehrlich Differential Revision: https://reviews.llvm.org/D59293 llvm-svn: 356129
* [llvm-objcopy] Remove unneeded checks. NFCEugene Leviant2019-03-121-27/+23
| | | | | | Differential revision: https://reviews.llvm.org/D59081 llvm-svn: 355914
* llvm-objcopy: Remove unused field. NFCI.Peter Collingbourne2019-03-122-9/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D59126 llvm-svn: 355892
* [llvm-objcopy] - Fix --compress-debug-sections when there are relocations.George Rimar2019-03-113-16/+32
| | | | | | | | | | | | | | | When --compress-debug-sections is given, llvm-objcopy removes the uncompressed sections and adds compressed to the section list. This makes all the pointers to old sections to be outdated. Currently, code already has logic for replacing the target sections of the relocation sections. But we also have to update the relocations by themselves. This fixes https://bugs.llvm.org/show_bug.cgi?id=40885. Differential revision: https://reviews.llvm.org/D58960 llvm-svn: 355821
* [llvm-objcopy] - Remove dead code. NFCI.George Rimar2019-03-061-7/+1
| | | | | | | | | | | | | | DecompressedSection can only be created if --decompress-debug-sections is specified. https://github.com/llvm-mirror/llvm/blob/master/tools/llvm-objcopy/ELF/ELFObjcopy.cpp#L492 If it is specified when !zlib::isAvailable(), we error out early when parsing the options: https://github.com/llvm-mirror/llvm/blob/master/tools/llvm-objcopy/CopyConfig.cpp#L657 What means the code I am removing in this patch is dead. Differential revision: https://reviews.llvm.org/D59017 llvm-svn: 355505
* [llvm-objcopy] - Remove an excessive zlib::isAvailable() check and dead code.George Rimar2019-03-061-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are 2 places where llvm-objcopy creates CompressedSection: For --compress-debug-sections. It might create the compressed section from regular here: https://github.com/llvm-mirror/llvm/blob/master/tools/llvm-objcopy/ELF/ELFObjcopy.cpp#L486 All initially compressed sections are created as CompressedSection during reading the sections from an object: https://github.com/llvm-mirror/llvm/blob/master/tools/llvm-objcopy/ELF/Object.cpp#L1118 Those have DebugCompressionType::None type and a different constructor. Case 1 has the following code in its constructor: if (!zlib::isAvailable()) { CompressionType = DebugCompressionType::None; return; } (https://github.com/llvm-mirror/llvm/blob/master/tools/llvm-objcopy/ELF/Object.cpp#L267) We can never reach that code with because would report an error much earlier: https://github.com/llvm-mirror/llvm/blob/master/tools/llvm-objcopy/CopyConfig.cpp#L480 So the code I am removing is dead. Landing this will address the issue mentioned in https://bugs.llvm.org/show_bug.cgi?id=40886. Differential revision: https://reviews.llvm.org/D59019 llvm-svn: 355503
* [llvm-objcopy] - Fix incorrect CompressedSection creation.George Rimar2019-03-061-1/+2
| | | | | | | | | | We should create CompressedSection only if the section has SHF_COMPRESSED flag or it's name starts from '.zdebug'. Currently, we create it if section's data starts from ZLIB signature. Differential revision: https://reviews.llvm.org/D59018 llvm-svn: 355501
* [llvm-objcopy] - Simplify `isCompressable` and fix the issue relative.George Rimar2019-03-051-11/+2
| | | | | | | | | | | | When --compress-debug-sections is given, llvm-objcopy do not compress sections that have "ZLIB" header in data. Normally this signature is used in zlib-gnu compression format. But if zlib-gnu used then the name of the compressed section should start from .z* (e.g .zdebug_info). If it does not, then it is not a zlib-gnu format and section should be treated as a normal uncompressed section. Differential revision: https://reviews.llvm.org/D58908 llvm-svn: 355399
* [llvm-objdump] - Improve the error message for "removing a section that is ↵George Rimar2019-02-281-6/+6
| | | | | | | | | | used by relocation" case. This refines/improves the error message introduced in D58625 Differential revision: https://reviews.llvm.org/D58709 llvm-svn: 355074
* [llvm-objcopy] - Check for invalidated relocations when removing a section.George Rimar2019-02-272-6/+26
| | | | | | | | | | | This is https://bugs.llvm.org/show_bug.cgi?id=40818 Removing a section that is used by relocation is an error we did not report. The patch fixes that. Differential revision: https://reviews.llvm.org/D58625 llvm-svn: 354962
* Fix Wenum-compare gcc7 warning. NFCI.Simon Pilgrim2019-02-271-3/+3
| | | | llvm-svn: 354958
* [llvm-objcopy] Add --set-start, --change-start and --adjust-startEugene Leviant2019-02-261-0/+2
| | | | | | Differential revision: https://reviews.llvm.org/D58173 llvm-svn: 354854
* [llvm-objcopy] Add --add-symbolEugene Leviant2019-02-252-0/+13
| | | | | | Differential revision: https://reviews.llvm.org/D58234 llvm-svn: 354787
* [llvm-objcopy] Make removeSectionReferences batchedJordan Rupprecht2019-02-212-17/+31
| | | | | | | | | | | | | | | | | | | | | | Summary: Removing a large number of sections from a file with a lot of symbols can have abysmal (i.e. O(n^2)) performance, e.g. when running `--only-section` to extract one section out of a large file. This comes from iterating over all symbols in the symbol table each time we remove a section, to remove references to the section we just removed. Instead, do just one pass of symbol removal by passing a hash set of all the sections we'd like to remove references to. This fixes a regression when running llvm-objcopy -j <one section> on an object file with many sections and symbols -- on my machine, running `objcopy -j .keep_me huge-input.o /tmp/foo.o` takes .3s with GNU objcopy, 1.3s with an updated llvm-objcopy, and 7+ minutes with llvm-objcopy prior to this patch. Reviewers: MaskRay, jhenderson, jakehehrlich, alexshap, espindola Reviewed By: MaskRay, jhenderson Subscribers: echristo, emaste, arichardson, mgrang, jdoerfert, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D58296 llvm-svn: 354597
* [llvm-objcopy] Add --strip-unneeded-symbol(s)Eugene Leviant2019-02-131-4/+10
| | | | | | Differential revision: https://reviews.llvm.org/D58027 llvm-svn: 353919
* [llvm-objcopy][NFC] Propagate errors in removeSymbols/removeSectionReferencesJordan Rupprecht2019-02-013-61/+84
| | | | | | | | | | | | | | Reviewers: jhenderson, alexshap, jakehehrlich, espindola Reviewed By: jhenderson Subscribers: emaste, arichardson, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D57543 llvm-svn: 352877
* [llvm-objcopy] Skip --localize-symbol for undefined symbolsJordan Rupprecht2019-01-311-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Include the symbol being defined in the list of requirements for using --localize-symbol. This is used, for example, when someone is depending on two different projects that have the same (or close enough) method defined in each library, and using "-L sym" for a conflicting symbol in one of the libraries so that the definition from the other one is used. However, the library may have internal references to the symbol, which cause program crashes when those are used, i.e.: ``` $ cat foo.c int foo() { return 5; } $ cat bar.c int foo(); int bar() { return 2 * foo(); } $ cat foo2.c int foo() { /* Safer implementation */ return 42; } $ cat main.c int bar(); int main() { __builtin_printf("bar = %d\n", bar()); return 0; } $ ar rcs libfoo.a foo.o bar.o $ ar rcs libfoo2.a foo2.o # Picks the wrong foo() impl $ clang main.o -lfoo -lfoo2 -L. -o main # Picks the right foo() impl $ objcopy -L foo libfoo.a && clang main.o -lfoo -lfoo2 -L. -o main # Links somehow, but crashes at runtime $ llvm-objcopy -L foo libfoo.a && clang main.o -lfoo -lfoo2 -L. -o main ``` Reviewers: jhenderson, alexshap, jakehehrlich, espindola Subscribers: emaste, arichardson Differential Revision: https://reviews.llvm.org/D57417 llvm-svn: 352767
* [llvm-objcopy][NFC] More error propagation (linkToBuildIdDir)Jordan Rupprecht2019-01-301-13/+21
| | | | llvm-svn: 352640
* [llvm-objcopy] Support -X|--discard-locals.Jordan Rupprecht2019-01-301-3/+5
| | | | | | | | | | | | | | | | | | | 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][NFC] More error propagationJordan Rupprecht2019-01-302-29/+37
| | | | | | | | | | | | Summary: Do some more error cleanup, removing some dependencies from llvm-objcopy's error/reportError in [ELF/COFF]Objcopy methods. Reviewers: jhenderson, alexshap, jakehehrlich, mstorsjo, espindola Subscribers: emaste, arichardson Differential Revision: https://reviews.llvm.org/D57423 llvm-svn: 352625
OpenPOWER on IntegriCloud