summaryrefslogtreecommitdiffstats
path: root/llvm/test/tools/llvm-objcopy/ELF
Commit message (Collapse)AuthorAgeFilesLines
...
* [llvm-strip] Error when using stdin twiceAlex Brachet2019-06-181-0/+26
| | | | | | | | | | | | | | | | Summary: Implements bug [[ https://bugs.llvm.org/show_bug.cgi?id=42204 | 42204 ]]. llvm-strip now warns when the same input file is used more than once, and errors when stdin is used more than once. Reviewers: jhenderson, rupprecht, espindola, alexshap Reviewed By: jhenderson, rupprecht Subscribers: emaste, arichardson, jakehehrlich, MaskRay, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D63122 llvm-svn: 363638
* [llvm-objcopy] Add elf32-sparc and elf32-sparcel targetSeiya Nuta2019-06-171-0/+12
| | | | | | | | | | | | | | | | | | | Summary: The "sparc"/"sparcel" architectures appears in ArchMap (used by -B option) but not in OutputFormatMap (used by -I/-O option). Add their targets into OutputFormatMap for consistency. Note that AFAIK there're no targets for 32-bit little-endian SPARC ("elf32-sparcel") in GNU binutils. Reviewers: espindola, alexshap, rupprecht, jhenderson, compnerd, jakehehrlich Reviewed By: jhenderson, compnerd, jakehehrlich Subscribers: jyknight, emaste, arichardson, fedor.sergeev, jakehehrlich, MaskRay, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D63238 llvm-svn: 363524
* [objcopy] Error when --preserve-dates is specified with standard streamsAlex Brachet2019-06-151-0/+23
| | | | | | | | | | | | | | | | Summary: llvm-objcopy/strip now error when -p is specified when reading from stdin or writing to stdout Reviewers: jhenderson, rupprecht, espindola, alexshap Reviewed By: jhenderson, rupprecht Subscribers: emaste, arichardson, jakehehrlich, MaskRay, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D63090 llvm-svn: 363485
* [llvm-objcopy][IHEX] Improve test case formatting. NFCEugene Leviant2019-06-141-75/+88
| | | | | | Differential revision: https://reviews.llvm.org/D63258 llvm-svn: 363359
* [llvm-objcopy] Changed command line parsing errorsAlex Brachet2019-06-1410-16/+16
| | | | | | | | | | | | | | | | Summary: Tidied up errors during command line parsing to be more consistent with the rest of llvm-objcopy errors. Reviewers: jhenderson, rupprecht, espindola, alexshap Reviewed By: jhenderson, rupprecht Subscribers: emaste, arichardson, MaskRay, llvm-commits, jakehehrlich Tags: #llvm Differential Revision: https://reviews.llvm.org/D62973 llvm-svn: 363350
* [llvm-objcopy] Fix sparc target endiannessSeiya Nuta2019-06-131-2/+8
| | | | | | | | | | | | | | | | Summary: AFAIK, the "sparc" target is big endian and the target for 32-bit little-endian SPARC is denoted as "sparcel". This patch fixes the endianness of "sparc" target and adds "sparcel" target for 32-bit little-endian SPARC. Reviewers: espindola, alexshap, rupprecht, jhenderson Reviewed By: jhenderson Subscribers: jyknight, emaste, arichardson, fedor.sergeev, jakehehrlich, MaskRay, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D63251 llvm-svn: 363336
* [llvm-objcopy] Implement IHEX readerEugene Leviant2019-06-132-0/+218
| | | | | | | This is the final part of IHEX format support in llvm-objcopy Differential revision: https://reviews.llvm.org/D62583 llvm-svn: 363243
* [llvm-objcopy] Fix SHT_GROUP ordering.Jordan Rupprecht2019-06-104-20/+74
| | | | | | | | | | | | | | | | | | | | | Summary: When llvm-objcopy sorts sections during finalization, it only sorts based on the offset, which can cause the group section to come after the sections it contains. This causes link failures when using gold to link objects created by llvm-objcopy. Fix this for now by copying GNU objcopy's behavior of placing SHT_GROUP sections first. In the future, we may want to remove this sorting entirely to more closely preserve the input file layout. This fixes https://bugs.llvm.org/show_bug.cgi?id=42052. Reviewers: jakehehrlich, jhenderson, MaskRay, espindola, alexshap Reviewed By: MaskRay Subscribers: phuongtrang148993, emaste, arichardson, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D62620 llvm-svn: 362973
* llvm-objcopy: Implement --extract-partition and --extract-main-partition.Peter Collingbourne2019-06-073-0/+215
| | | | | | | | | | | | | | | | | | | This implements the functionality described in https://lld.llvm.org/Partitions.html. It works as follows: - Reads the section headers using the ELF header at file offset 0; - If extracting a loadable partition: - Finds the section containing the required partition ELF header by looking it up in the section table; - Reads the ELF and program headers from the section. - If extracting the main partition: - Reads the ELF and program headers from file offset 0. - Filters the section table according to which sections are in the program headers that it read: - If ParentSegment != nullptr or section is not SHF_ALLOC, then it goes in. - Sections containing partition ELF headers or program headers are excluded as there are no headers for these in ordinary ELF files. Differential Revision: https://reviews.llvm.org/D62364 llvm-svn: 362818
* [llvm-objcopy] - Emit error and don't crash if program header reaches past ↵George Rimar2019-06-071-0/+45
| | | | | | | | | | | | | | | | end of file. This is https://bugs.llvm.org/show_bug.cgi?id=42122. If an object file has a size less than program header's file [offset + size] (i.e. if we have overflow), llvm-objcopy crashes instead of reporting a error. The patch fixes this issue. Differential revision: https://reviews.llvm.org/D62898 llvm-svn: 362778
* [test][llvm-objcopy] Test llvm-objcopy with standard streamsAlex Brachet2019-06-041-0/+6
| | | | | | Differential Revision: https://reviews.llvm.org/D62817 llvm-svn: 362556
* [llvm-ar] Reapply Fix relative thin archive path handlingOwen Reynolds2019-06-041-4/+4
| | | | | | | | | | Includes a fix for an introduced build failure due to a post c++11 use of std::mismatch. This fixes some thin archive relative path issues, paths are shortened where possible and paths are output correctly when using the display table command. Differential Revision: https://reviews.llvm.org/D59491 llvm-svn: 362484
* Revert "[llvm-ar] Fix relative thin archive path handling"Dmitri Gribenko2019-06-031-4/+4
| | | | | | | | | | This reverts commit r362407. It broke compilation of llvm/lib/Object/ArchiveWriter.cpp: error: type 'llvm::sys::path::const_iterator' does not provide a call operator llvm-svn: 362413
* [llvm-ar] Fix relative thin archive path handlingOwen Reynolds2019-06-031-4/+4
| | | | | | | | This fixes some thin archive relative path issues, paths are shortened where possible and paths are output correctly when using the display table command. Differential Revision: https://reviews.llvm.org/D59491 llvm-svn: 362407
* [llvm-objcopy] Remove %p format specifiersEugene Leviant2019-05-301-3/+3
| | | | | | | On 32-bit machines %p expects 32 bit values, however addresses in llvm-objcopy are always 64 bits. llvm-svn: 362074
* Yet another attempt to fix buildbot after r361949Eugene Leviant2019-05-291-3/+3
| | | | | | | Looks like %p format specifier of createStringError behaves differently on different platforms llvm-svn: 361993
* [llvm-objcopy] Implement IHEX writerEugene Leviant2019-05-295-0/+260
| | | | | | Differential revision: https://reviews.llvm.org/D60270 llvm-svn: 361949
* [llvm-objcopy] - Strip undefined symbols if they are no longer referenced ↵George Rimar2019-05-241-0/+60
| | | | | | | | | | | | | following --only-section This is https://bugs.llvm.org/show_bug.cgi?id=40004. In this patch I teach llvm-objcopy to remove undefined symbols if them are not used anymore after applying -j/--only-section option. Differential revision: https://reviews.llvm.org/D62317 llvm-svn: 361642
* [llvm-objcopy] Add file names to error messagesSeiya Nuta2019-05-2310-24/+28
| | | | | | | | | | | | | | | | | | | Summary: This patch adds the file names to llvm-objcopy error messages. It makes easy to identify which file causes an error. Bugzilla: https://bugs.llvm.org/show_bug.cgi?id=41798 Reviewers: espindola, alexshap, rupprecht, jhenderson, jakehehrlich Reviewed By: rupprecht, jhenderson, jakehehrlich Subscribers: emaste, arichardson, jakehehrlich, MaskRay, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D61993 llvm-svn: 361450
* [llvm-objcopy] Tidy up error messagesJames Henderson2019-05-2218-18/+18
| | | | | | | | | | | | | | This patch brings various error messages into line with each other, by removing trailing full stops, and making the first letter lower-case. This addresses https://bugs.llvm.org/show_bug.cgi?id=40859. Reviewed by: jhenderson, rupprecht, jakehehrlich Differential Revision: https://reviews.llvm.org/D62072 Patch by Alex Brachet llvm-svn: 361384
* [NFC] Remove a blank line (test commit)Seiya Nuta2019-05-221-1/+0
| | | | llvm-svn: 361349
* [llvm-objcopy] Strip file symbols with --strip-unneededEugene Leviant2019-05-211-10/+8
| | | | | | Differential revision: https://reviews.llvm.org/D61641 llvm-svn: 361231
* [llvm-objcopy] Add additional testing for various casesJames Henderson2019-05-1010-41/+497
| | | | | | | | | | | | | This patch adds a number of tests to test various cases not covered by existing tests. All of them work correctly, with no need to change llvm-objcopy itself, although some do indicate possible areas for improvement. Reviewed by: MaskRay Differential Revision: https://reviews.llvm.org/D61727 llvm-svn: 360422
* [NFC]Fix British English -> American English issuesJames Henderson2019-05-081-2/+2
| | | | llvm-svn: 360252
* [llvm-objcopy] Improve error message for unrecognised archive memberJames Henderson2019-05-081-0/+45
| | | | | | | | | | | | | | Prior to this patch, llvm-objcopy's error messages for archives with unsupported members only mentioned the archive name, not the member name, making them unhelpful. This change improves it by approximately following GNU objcopy's error message syntax of "<archive name>(<member name>): <problem>". Reviewed by: grimar Differential Revision: https://reviews.llvm.org/D61674 llvm-svn: 360251
* [llvm-objcopy] Add --prefix-alloc-sectionsJames Henderson2019-05-083-0/+73
| | | | | | | | | | | | | | | | 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
* Let --discard-all imply --strip-debug.Sid Manning2019-05-031-0/+5
| | | | | | | | This will match gnu strip's behavior. Differential Revision: https://reviews.llvm.org/D61092 llvm-svn: 359887
* [llvm-strip]Add --no-strip-all to disable --strip-all behaviour (including ↵James Henderson2019-05-027-20/+59
| | | | | | | | | | | | | | | | | default stripping) If certain switches are not specified, llvm-strip behaves as if --strip-all were specified. This means that for testing, when we don't want the stripping behaviour, we have to specify one of these switches, which can be confusing. This change adds --no-strip-all to allow an alternative way of suppressing the default stripping, in a less confusing manner. Reviewed by: jakehehrlich, MaskRay Differential Revision: https://reviews.llvm.org/D61377 llvm-svn: 359781
* [yaml2obj] - Report when unknown section is referenced from program header ↵George Rimar2019-05-011-1/+1
| | | | | | | | | | | | declaration block. Previously we did not report this. Also this removes multiple lookups in the map what cleanups the code. Differential revision: https://reviews.llvm.org/D61322 llvm-svn: 359663
* [llvm-readobj] Change -t to --symbols in tests. NFCFangrui Song2019-05-011-1/+1
| | | | | | | | | | -t is --symbols in llvm-readobj but --section-details (unimplemented) in readelf. The confusing option should not be used since we aim for improving compatibility. Keep just one llvm-readobj -t use case in test/tools/llvm-readobj/symbols.test llvm-svn: 359661
* [llvm-readobj] llvm-readobj --elf-output-style=GNU => llvm-readelf. NFCFangrui Song2019-05-012-3/+3
| | | | | | | | | The latter is much more common. A dedicated --elf-output-style=GNU test demonstrating it is the same as llvm-readelf is sufficient. llvm-svn: 359652
* [llvm-readobj] Change -long-option to --long-option in tests. NFCFangrui Song2019-05-017-15/+15
| | | | | | | | | | We use both -long-option and --long-option in tests. Switch to --long-option for consistency. In the "llvm-readelf" mode, -long-option is discouraged as it conflicts with grouped short options and it is not accepted by GNU readelf. While updating the tests, change llvm-readobj -s to llvm-readobj -S to reduce confusion ("s" is --section-headers in llvm-readobj but --symbols in llvm-readelf). llvm-svn: 359649
* [llvm-objcopy] Simplify SHT_NOBITS -> SHT_PROGBITS promotionFangrui Song2019-05-012-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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] Add RISC-V support for -B/-OJordan Rupprecht2019-04-302-15/+43
| | | | | | | | | | | | Reviewers: jorgbrown, espindola, alexshap, jhenderson Subscribers: emaste, arichardson, fedor.sergeev, jakehehrlich, kito-cheng, shiva0217, MaskRay, rogfer01, rkruppe, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D61272 llvm-svn: 359568
* [llvm-objcopy] - Check dynamic relocation sections for broken references.George Rimar2019-04-302-0/+64
| | | | | | | | | | | | | | 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
* Fix llvm-objcopy/ELF/preserve-segment-contents test on UTF-8 localeAlexandre Ganea2019-04-261-2/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D61137 llvm-svn: 359302
* [llvm-objcopy] Accept --long-option but not -long-optionFangrui Song2019-04-264-15/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: llvm-{objcopy,strip} (and many other LLVM binary utilities) accept cl::opt style -long-option as well as many short options (e.g. -p -S -x). People who use them as replacement of GNU binutils often use the grouped option syntax (POSIX Utility Conventions), e.g. -Sx => -S -x, -Wd => -W -d, -sj.text => -s -j.text There is ambiguity if a long option starts with the character used by a short option. Drop the support for -long-option to resolve the ambiguity. This divergence from other utilities is accepted (other utilities continue supporting -long-option). https://lists.llvm.org/pipermail/llvm-dev/2019-April/131786.html Reviewers: alexshap, jakehehrlich, jhenderson, rupprecht, espindola Reviewed By: jakehehrlich, jhenderson, rupprecht Subscribers: grimar, emaste, arichardson, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D60439 llvm-svn: 359265
* [llvm-objcopy] Add -B mipsJordan Rupprecht2019-04-181-8/+15
| | | | llvm-svn: 358667
* [llvm-objcopy][llvm-strip] Add switch to allow removing referenced sectionsJames Henderson2019-04-184-6/+76
| | | | | | | | | | | | | | | | | | | | 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] Support full list of bfd targets that lld uses.Jordan Rupprecht2019-04-172-25/+101
| | | | | | | | | | | | | | | | | | | | | Summary: This change takes the full list of bfd targets that lld supports (see `ScriptParser.cpp`), including generic handling for `*-freebsd` targets (which uses the same settings but with a FreeBSD OSABI). In particular this adds mips support for `--output-target` (but not yet via `--binary-architecture`). lld and llvm-objcopy use their own different custom data structures, so I'd prefer to check this in as-is (add support directly in llvm-objcopy, including all the test coverage) and do a separate NFC patch(s) that consolidate the two by putting this mapping into libobject. See [[ https://bugs.llvm.org/show_bug.cgi?id=41462 | PR41462 ]]. Reviewers: jhenderson, jakehehrlich, espindola, alexshap, arichardson Reviewed By: arichardson Subscribers: fedor.sergeev, emaste, sdardis, krytarowski, atanasyan, llvm-commits, MaskRay, arichardson Tags: #llvm Differential Revision: https://reviews.llvm.org/D60773 llvm-svn: 358562
* [llvm-objcopy] Fill .symtab_shndx section correctlyEugene Leviant2019-04-121-0/+50
| | | | | | Differential revision: https://reviews.llvm.org/D60555 llvm-svn: 358278
* [llvm-objcopy] [llvm-symbolizer] Fix failing testsDon Hinton2019-04-041-9/+15
| | | | | | | | | | | | | | | | Summary: Fix failing tests that matched substrings in path. Reviewers: evgeny777, mattd, espindola, alexshap, rupprecht, jhenderson Reviewed By: jhenderson Subscribers: Bulletmagnet, emaste, arichardson, jakehehrlich, MaskRay, rupprecht, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D60170 llvm-svn: 357709
* [yaml2obj][obj2yaml] - Change how symbol's binding is descibed when ↵George Rimar2019-04-0347-619/+640
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | parsing/dumping. Currently, YAML has the following syntax for describing the symbols: Symbols: Local: LocalSymbol1: ... LocalSymbol2: ... ... Global: GlobalSymbol1: ... Weak: ... GNUUnique: I.e. symbols are grouped by their bindings. That is not very convenient, because: It does not allow to set a custom binding, what can be useful for producing broken/special outputs for test cases. Adding a new binding would require to change a syntax (what we observed when added GNUUnique recently). It does not allow to change the order of the symbols in .symtab/.dynsym, i.e. currently all Local symbols are placed first, then Global, Weak and GNUUnique are following, but we are not able to change the order. It is not consistent. Binding is just one of the properties of the symbol, we do not group them by other properties. It makes the code more complex that it can be. This patch shows it can be simplified with the change performed. The patch changes the syntax to just: Symbols: Symbol1: ... Symbol2: ... ... With that, we are able to work with the binding field just like with any other symbol property. Differential revision: https://reviews.llvm.org/D60122 llvm-svn: 357595
* [NFC] Address missed review comment for testJames Henderson2019-04-032-1/+5
| | | | | | | | Reviewed by: grimar Differential Revision: https://reviews.llvm.org/D60200 llvm-svn: 357594
* [llvm-objcopy] Make section rename/set flags case-insensitiveJames Henderson2019-04-032-0/+18
| | | | | | | | | | | | This fixes https://bugs.llvm.org/show_bug.cgi?id=41305. GNU objcopy --set-section-flags/--rename-section flags are case-insensitive, so this patch updates llvm-objcopy to match. Reviewed by: grimar Differential Revision: https://reviews.llvm.org/D60200 llvm-svn: 357590
* [llvm-objcopy] Change SHT_NOBITS to SHT_PROBITS for some --set-section-flagsJordan Rupprecht2019-04-022-75/+146
| | | | | | | | | | | | | | | | | | | | | 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-021-0/+26
| | | | | | | | | | | | | | | | | | | | 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] Add --keep-symbols optionYi Kong2019-04-011-0/+7
| | | | | | Differential Revision: https://reviews.llvm.org/D60054 llvm-svn: 357418
* [llvm-objcopy] - Strip sections before symbols.George Rimar2019-03-261-0/+48
| | | | | | | | | | | | 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-0/+680
| | | | | | | | | | | | | | | | 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
OpenPOWER on IntegriCloud