1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00
Commit Graph

86 Commits

Author SHA1 Message Date
Peter Collingbourne
1fe1482c3b llvm-objcopy: Implement --extract-partition and --extract-main-partition.
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
2019-06-07 17:57:48 +00:00
George Rimar
d659dfcb08 [llvm-objcopy] - Emit error and don't crash if program header reaches past 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
2019-06-07 08:34:18 +00:00
Eugene Leviant
af6cdfbe43 [llvm-objcopy] Remove %p format specifiers
On 32-bit machines %p expects 32 bit values, however
addresses in llvm-objcopy are always 64 bits.

llvm-svn: 362074
2019-05-30 09:09:01 +00:00
Eugene Leviant
523d93b47d Attempt to fix buildbot after r361949
llvm-svn: 361954
2019-05-29 12:26:23 +00:00
Eugene Leviant
eabc336677 [llvm-objcopy] Implement IHEX writer
Differential revision: https://reviews.llvm.org/D60270

llvm-svn: 361949
2019-05-29 11:37:16 +00:00
George Rimar
0de8bf12ce [llvm-objcopy] - Strip undefined symbols if they are no longer referenced 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
2019-05-24 15:04:50 +00:00
Peter Collingbourne
6543be6733 llvm-objcopy: Change sectionWithinSegment() to use virtual addresses instead of file offsets for SHT_NOBITS sections.
Without this, sectionWithinSegment() will return the wrong answer for bss
sections. This doesn't seem to matter now (for non-broken ELF files), but
it will matter with a change that I'm working on.

Differential Revision: https://reviews.llvm.org/D58426

llvm-svn: 361578
2019-05-24 00:21:46 +00:00
George Rimar
c79b83a7a5 [llvm-objcopy] - Many minor NFC changes to cleanup/improve the code in ELF/Object.cpp.
The code in ELF/Object.cpp is sometimes a bit hard to read because of
lots of auto used everywhere. The main intention of this patch is
to replace them with the real type for places where it is not obvious.
Also it cleanups few places.

It is NFC change, but I want to be sure that there is no objections to do that since it
is massive.

DIfferential revision: https://reviews.llvm.org/D62260

llvm-svn: 361466
2019-05-23 09:18:57 +00:00
Seiya Nuta
5db619390a [llvm-objcopy] Add file names to error messages
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
2019-05-23 00:42:46 +00:00
James Henderson
dd58819f42 [llvm-objcopy] Tidy up error messages
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
2019-05-22 13:23:26 +00:00
Eugene Leviant
557952fd6e [llvm-objcopy] Strip file symbols with --strip-unneeded
Differential revision: https://reviews.llvm.org/D61641

llvm-svn: 361231
2019-05-21 09:09:33 +00:00
James Henderson
25eba33f86 [llvm-objcopy] Cache gnu_debuglink's target CRC
.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
2019-05-14 10:59:04 +00:00
James Henderson
5f4b241a54 [llvm-objcopy] Add --prefix-alloc-sections
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
2019-05-08 09:49:35 +00:00
George Rimar
93db2eac21 [llvm-objcopy] - Fix for "Bug 41775 - SymbolTableSection::addSymbol - shadow 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
2019-05-08 07:31:05 +00:00
Fangrui Song
53adc7fe70 [llvm-objcopy] Simplify SHT_NOBITS -> SHT_PROGBITS promotion
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
2019-05-01 00:39:31 +00:00
George Rimar
c0310342fc [llvm-objcopy] - Check dynamic relocation sections for broken references.
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
2019-04-30 11:02:09 +00:00
Fangrui Song
056369f3a7 Use llvm::stable_sort. NFC
llvm-svn: 358897
2019-04-22 15:53:43 +00:00
James Henderson
e9c954f970 [llvm-objcopy][llvm-strip] Add switch to allow removing referenced sections
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
2019-04-18 09:13:30 +00:00
Eugene Leviant
18f44745f8 [llvm-objcopy] Fill .symtab_shndx section correctly
Differential revision: https://reviews.llvm.org/D60555

llvm-svn: 358278
2019-04-12 11:59:30 +00:00
Jordan Rupprecht
5f836d34ef [llvm-objcopy] Change SHT_NOBITS to SHT_PROBITS for some --set-section-flags
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
2019-04-02 16:49:56 +00:00
James Henderson
7f20d02d8a [llvm-objcopy]Allow llvm-objcopy to be used on an ELF file with no section 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
2019-04-02 14:11:13 +00:00
Fangrui Song
45420320ae [llvm-objcopy] Replace the size() helper with SectionTableRef::size
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
2019-03-30 14:08:59 +00:00
Fangrui Song
d1644d3934 [llvm-objcopy] Fix case style of LayoutSegments. NFC
llvm-svn: 357265
2019-03-29 15:27:58 +00:00
Fangrui Song
927867a7c7 [llvm-objcopy] Delete two redundant reinterpret_cast. NFC
llvm-svn: 357238
2019-03-29 08:08:20 +00:00
Jordan Rupprecht
067ecefdde [llvm-objcopy][NFC] Move ELF-specific logic into /ELF/ directory
llvm-svn: 357199
2019-03-28 18:27:00 +00:00
George Rimar
caaf2335d9 [llvm-objcopy] - Strip sections before symbols.
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
2019-03-26 18:42:15 +00:00
James Henderson
b9df0119e0 [llvm-objcopy]Preserve data in segments not covered by sections
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
2019-03-25 16:36:26 +00:00
George Rimar
54694e09fc [llvm-objcopy] - Refactor the code. NFC.
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
2019-03-25 12:34:25 +00:00
George Rimar
298a3ae983 Recommit r356738 "[llvm-objcopy] - Implement replaceSectionReferences for 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
2019-03-24 14:41:45 +00:00
George Rimar
469cb2e814 [llvm-objcopy] - Report SHT_GROUP sections with invalid alignment.
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
2019-03-24 13:31:08 +00:00
George Rimar
490cc98cbb Revert r356738 "[llvm-objcopy] - Implement replaceSectionReferences for GroupSection class."
Seems this broke ubsan bot:
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap-ubsan/builds/11760

llvm-svn: 356745
2019-03-22 12:14:04 +00:00
George Rimar
c70312a254 [llvm-objcopy] - Implement replaceSectionReferences for GroupSection class.
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
2019-03-22 10:24:37 +00:00
James Henderson
797cb8f639 [llvm-objcopy]Add support for *-freebsd output formats
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
2019-03-22 10:21:09 +00:00
George Rimar
5602fd9683 [llvm-objcopy] - Use replaceSectionReferences to update the sections for 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
2019-03-20 13:57:47 +00:00
Jake Ehrlich
83efed9fe8 [llvm-objcopy] Make .build-id linking atomic
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
2019-03-18 20:35:18 +00:00
George Rimar
85af6d1c85 [llvm-objcopy] - Calculate the string table section sizes correctly.
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
2019-03-18 14:27:41 +00:00
Fangrui Song
9abcfb073d [llvm-objcopy] Delete unused parameter from replaceDebugSections. NFC
llvm-svn: 356245
2019-03-15 10:27:28 +00:00
Fangrui Song
afd6b2d8c3 [llvm-objcopy] Don't use {}; NFC
llvm-svn: 356244
2019-03-15 10:20:51 +00:00
James Henderson
f563d45752 [llvm-objcopy]Don't implicitly strip sections in segments
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
2019-03-14 11:47:41 +00:00
James Henderson
88e40ab1b8 Revert r356129 due to greendragon bot failures
llvm-svn: 356133
2019-03-14 11:23:04 +00:00
James Henderson
1bd484c2b8 [llvm-objcopy]Don't implicitly strip sections in segments
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
2019-03-14 10:20:27 +00:00
Eugene Leviant
27a13eb691 [llvm-objcopy] Remove unneeded checks. NFC
Differential revision: https://reviews.llvm.org/D59081

llvm-svn: 355914
2019-03-12 12:41:06 +00:00
Peter Collingbourne
ab72ac7186 llvm-objcopy: Remove unused field. NFCI.
Differential Revision: https://reviews.llvm.org/D59126

llvm-svn: 355892
2019-03-12 02:17:01 +00:00
George Rimar
3e5b9fe4cd [llvm-objcopy] - Fix --compress-debug-sections when there are relocations.
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
2019-03-11 11:01:24 +00:00
George Rimar
4f51fe0c01 [llvm-objcopy] - Remove dead code. NFCI.
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
2019-03-06 14:12:18 +00:00
George Rimar
edd70802af [llvm-objcopy] - Remove an excessive zlib::isAvailable() check and dead code.
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
2019-03-06 14:08:27 +00:00
George Rimar
09f6aceae8 [llvm-objcopy] - Fix incorrect CompressedSection creation.
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
2019-03-06 14:01:54 +00:00
George Rimar
e24ba5947b [llvm-objcopy] - Simplify isCompressable and fix the issue relative.
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
2019-03-05 13:07:43 +00:00
George Rimar
47c7c0875f [llvm-objdump] - Improve the error message for "removing a section that is used by relocation" case.
This refines/improves the error message introduced in D58625

Differential revision: https://reviews.llvm.org/D58709

llvm-svn: 355074
2019-02-28 08:21:50 +00:00
George Rimar
25f42156b9 [llvm-objcopy] - Check for invalidated relocations when removing a section.
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
2019-02-27 11:18:27 +00:00