summaryrefslogtreecommitdiffstats
path: root/llvm/test/tools/llvm-objcopy/ELF
Commit message (Collapse)AuthorAgeFilesLines
* [llvm-objcopy] -O binary: skip empty sectionsFangrui Song2020-05-011-2/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | After SHF_ALLOC sections are ordered by LMA: * If initial sections are empty, GNU objcopy skips their contents while we emit leading zeros. (binary-paddr.test %t4) * If trailing sections are empty, GNU objcopy skips their contents while we emit trailing zeros. (binary-paddr.test %t5) This patch matches GNU objcopy's behavior. Linkers don't keep p_memsz PT_LOAD segments. Such empty sections would not have a containing PT_LOAD and `Section::ParentSegment` might be null if linkers fail to optimize the file offsets (lld D79254). In particular, without D79254, the arm Linux kernel's multi_v5_defconfig depends on this behavior: in `vmlinux`, an empty .text_itcm is mapped at a very high address (0xfffe0000) but the kernel does not expect `objcopy -O binary` to create a very large `arch/arm/boot/Image` (0xfffe0000-0xc0000000 ~= 1GiB). See https://bugs.llvm.org/show_bug.cgi?id=45632 Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D79229 (cherry picked from commit ec786906f5feb4dceba1b5338927079e63e78095)
* [llvm-readelf] Print EI_ABIVERSION as decimal instead of hexadecimalFangrui Song2020-01-061-3/+3
| | | | | | | | This matches GNU readelf and llvm-readobj. Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D72234
* [llvm-readelf][llvm-readobj] - Reimplement the logic of section flags dumping.Georgii Rymar2019-12-181-1/+0
| | | | | | | | | | | | | | | | | Our logic that dumped the flags was buggy. For LLVM style it dumped SHF_MASKPROC/SHF_MASKOS named constants, though they are not flags, but masks. For GNU style it was just very inconsistent with GNU which has logic that is not straightforward. Imagine we have sh_flags == 0x90000000. SHF_EXCLUDE ("E") has a value of 0x80000000 and SHF_MASKPROC is 0xf0000000. GNU readelf will not print "E" or "Ep" in this case, but will print just "p". It only will print "E" when no other processor flag is set. I had to investigate the GNU source to find the algorithm and now our logic should match it. Differential revision: https://reviews.llvm.org/D71462
* [llvm-objcopy][ELF] -O binary: use LMA instead of sh_offset to decide where ↵Fangrui Song2019-12-151-18/+105
| | | | | | | | | | | | | | | | | | | | | | | to write section contents .text sh_address=0x1000 sh_offset=0x1000 .data sh_address=0x3000 sh_offset=0x2000 In an objcopy -O binary output, the distance between two sections equal their LMA differences (0x3000-0x1000), instead of their sh_offset differences (0x2000-0x1000). This patch changes our behavior to match GNU. This rule gets more complex when the containing PT_LOAD has p_vaddr!=p_paddr. GNU objcopy essentially computes sh_offset-p_offset+p_paddr for each candidate section, and removes the gap before the first address. Added tests to binary-paddr.test to catch the compatibility problem. Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D71035
* [llvm-objcopy][COFF] Implement --redefine-sym and --redefine-symsFangrui Song2019-11-121-15/+4
| | | | | | | | | | | | | The parsing error tests in ELF/redefine-symbols.test are not specific to ELF. Move them to redefine-symbols.test. Add COFF/redefine-symbols.test for COFF specific tests. Also fix the documentation regarding --redefine-syms: the old and new names are separated by whitespace, not an equals sign. Reviewed By: mstorsjo Differential Revision: https://reviews.llvm.org/D70036
* [llvm-objcopy][ELF] Implement --only-keep-debugFangrui Song2019-11-052-22/+224
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | --only-keep-debug produces a debug file as the output that only preserves contents of sections useful for debugging purposes (the binutils implementation preserves SHT_NOTE and non-SHF_ALLOC sections), by changing their section types to SHT_NOBITS and rewritting file offsets. See https://sourceware.org/gdb/onlinedocs/gdb/Separate-Debug-Files.html The intended use case is: ``` llvm-objcopy --only-keep-debug a a.dbg llvm-objcopy --strip-debug a b llvm-objcopy --add-gnu-debuglink=a.dbg b ``` The current layout algorithm is incapable of deleting contents and shrinking segments, so it is not suitable for implementing the functionality. This patch adds a new algorithm which assigns sh_offset to sections first, then modifies p_offset/p_filesz of program headers. It bears a resemblance to lld/ELF/Writer.cpp. Reviewed By: jhenderson, jakehehrlich Differential Revision: https://reviews.llvm.org/D67137
* [llvm-objcopy] --add-symbol: address post-commit reviews of D69093Fangrui Song2019-10-311-18/+44
| | | | | | | | | | * Improve comments. * Reorder the assignment to Obj.SectionNames before the symbol table creation code. Add a test. Reviewed By: grimar Differential Revision: https://reviews.llvm.org/D69526
* [llvm-objcopy] Preserve .ARM.attributes section when stripping filesJames Henderson2019-10-311-0/+25
| | | | | | | | | | | | | | This works around a bug in Debian's patchset for glibc. The bug is described in detail in the upstream debian bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=943798, but the short version of it is that glibc on any Debian based distro don't load libraries unless it has a .ARM.attribute section. Reviewed by: jhenderson, rupprecht, MaskRay, jakehehrlich Differential Revision: https://reviews.llvm.org/D69188 Patch by Tobias Hieta.
* [llvm-objcopy] - Do not crash on object that has relocations but no symbol ↵Georgii Rymar2019-10-302-5/+99
| | | | | | | | | | | | | table. It was revealed by D69260. Tool crashed when scanned relocations in a object without a symbol table. This patch teaches it either to handle such objects (when relocations does not use symbols we do not need a symbol table to proceed) or to show an appropriate error otherwise. Differential revision: https://reviews.llvm.org/D69304
* [yaml2obj] - Make .symtab to be not mandatory section for SHT_REL[A] section.Georgii Rymar2019-10-291-0/+2
| | | | | | | | | | | | | | Before this change .symtab section was required for SHT_REL[A] section declarations. yaml2obj automatically defined it in case when YAML document did not have it. With this change it is now possible to produce an object that has a relocation section, but has no symbol table. It simplifies the code and also it is inline with how we handle Link fields for another special sections. Differential revision: https://reviews.llvm.org/D69260
* [yaml2obj, obj2yaml] - Add support for SHT_NOTE sections.georgerim2019-10-251-0/+1
| | | | | | | | | | | | | | | | | | | | | SHT_NOTE is the section that consists of namesz, descsz, type, name + padding, desc + padding data. This patch teaches yaml2obj, obj2yaml to dump and parse them. This patch implements the section how it is described here: https://docs.oracle.com/cd/E23824_01/html/819-0690/chapter6-18048.html Which says: "For 64–bit objects and 32–bit objects, each entry is an array of 4-byte words in the format of the target processor" The official specification is different http://www.sco.com/developers/gabi/latest/ch5.pheader.html#note_section And says: "n 64-bit objects (files with e_ident[EI_CLASS] equal to ELFCLASS64), each entry is an array of 8-byte words in the format of the target processor. In 32-bit objects (files with e_ident[EI_CLASS] equal to ELFCLASS32), each entry is an array of 4-byte words in the format of the target processor" Since LLVM uses the first, 32-bit way, this patch follows it. Differential revision: https://reviews.llvm.org/D68983
* [yaml2obj][obj2yaml] - Do not create a symbol table by default.George Rimar2019-10-2023-32/+33
| | | | | | | | | | | | | | | | | | This patch tries to resolve problems faced in D68943 and uses some of the code written by Konrad Wilhelm Kleine in that patch. Previously, yaml2obj tool always created a .symtab section. This patch changes that. With it we only create it when have a "Symbols:" tag in the YAML document or when we need to create it because it is used by another section(s). obj2yaml follows the new behavior and does not print "Symbols:" anymore when there is no symbol table. Differential revision: https://reviews.llvm.org/D69041 llvm-svn: 375361
* [llvm-objcopy] Add support for shell wildcardsJordan Rupprecht2019-10-172-0/+311
| | | | | | | | | | | | | | | | | | | | Summary: GNU objcopy accepts the --wildcard flag to allow wildcard matching on symbol-related flags. (Note: it's implicitly true for section flags). The basic syntax is to allow *, ?, \, and [] which work similarly to how they work in a shell. Additionally, starting a wildcard with ! causes that wildcard to prevent it from matching a flag. Use an updated GlobPattern in libSupport to handle these patterns. It does not fully match the `fnmatch` used by GNU objcopy since named character classes (e.g. `[[:digit:]]`) are not supported, but this should support most existing use cases (mostly just `*` is what's used anyway). Reviewers: jhenderson, MaskRay, evgeny777, espindola, alexshap Reviewed By: MaskRay Subscribers: nickdesaulniers, emaste, arichardson, hiraditya, jakehehrlich, abrachet, seiya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D66613 llvm-svn: 375169
* [llvm-objcopy] --add-symbol: fix crash if SHT_SYMTAB does not existFangrui Song2019-10-171-0/+81
| | | | | | | | | | | | | | | | | | Exposed by D69041. If SHT_SYMTAB does not exist, ELFObjcopy.cpp:handleArgs will crash due to a null pointer dereference. for (const NewSymbolInfo &SI : Config.ELF->SymbolsToAdd) { ... Obj.SymbolTable->addSymbol( Fix this by creating .symtab and .strtab on demand in ELFBuilder<ELFT>::readSections, if --add-symbol is specified. Reviewed By: grimar Differential Revision: https://reviews.llvm.org/D69093 llvm-svn: 375105
* [Tests] Output of od can be lower or upper case (llvm-objcopy/yaml2obj).Kai Nacke2019-10-119-25/+25
| | | | | | | | | | | | | | | The command `od -t x` is used to dump data in hex format. The LIT tests assumes that the hex characters are in lowercase. However, there are also platforms which use uppercase letter. To solve this issue the tests are updated to use the new `--ignore-case` option of FileCheck. Reviewers: Bigcheese, jakehehrlich, rupprecht, espindola, alexshap, jhenderson Differential Revision: https://reviews.llvm.org/D68693 llvm-svn: 374547
* Revert "[Tests] Output of od can be lower or upper case ↵Dmitri Gribenko2019-10-109-1035/+1035
| | | | | | | | | (llvm-objcopy/yaml2obj)." This reverts commit r374343. It broke tests: http://lab.llvm.org:8011/builders/clang-x86_64-debian-fast/builds/19066 llvm-svn: 374358
* [Tests] Output of od can be lower or upper case (llvm-objcopy/yaml2obj).Kai Nacke2019-10-109-1035/+1035
| | | | | | | | | | | | | | | The command `od -t x` is used to dump data in hex format. The LIT tests assumes that the hex characters are in lowercase. However, there are also platforms which use uppercase letter. To solve this issue the tests are updated to use the new `--ignore-case` option of FileCheck. Reviewers: Bigcheese, jakehehrlich, rupprecht, espindola, alexshap, jhenderson Differential Revision: https://reviews.llvm.org/D68693 llvm-svn: 374343
* [llvm-objcopy] Add --set-section-alignmentFangrui Song2019-10-022-0/+62
| | | | | | | | | | | | | Fixes PR43181. This option was recently added to GNU objcopy (binutils PR24942). `llvm-objcopy -I binary -O elf64-x86-64 --set-section-alignment .data=8` can set the alignment of .data. Reviewed By: grimar, jhenderson, rupprecht Differential Revision: https://reviews.llvm.org/D67656 llvm-svn: 373461
* [llvm-objcopy][test] Clean up -B testsFangrui Song2019-09-253-30/+13
| | | | | | | | | | | | | -B is ignored for GNU objcopy compatibility after D67215/r371914. * Delete mentions of -B from input-output-target.test - we have enough -B tests. * Merge binary-input-with-arch.test into binary-output-target.test. Reviewed By: rupprecht Differential Revision: https://reviews.llvm.org/D67693 llvm-svn: 372809
* [llvm-objcopy] - Remove python invocations from 2 test cases.George Rimar2019-09-172-27/+2
| | | | | | | | | It is possible to use yaml2obj to create sections with overlapping sh_offset now. This patch does that. Differential revision: https://reviews.llvm.org/D67610 llvm-svn: 372081
* [llvm-objcopy] Ignore -B --binary-architecture=Fangrui Song2019-09-141-4/+2
| | | | | | | | | | | | | | | | | | | | | | | GNU objcopy documents that -B is only useful with architecture-less input (i.e. "binary" or "ihex"). After D67144, -O defaults to -I, and -B is essentially a NOP. * If -O is binary/ihex, GNU objcopy ignores -B. * If -O is elf*, -B provides the e_machine field in GNU objcopy. So to convert a blob to an ELF, `-I binary -B i386:x86-64 -O elf64-x86-64` has to be specified. `-I binary -B i386:x86-64 -O elf64-x86-64` creates an ELF with its e_machine field set to EM_NONE in GNU objcopy, but a regular x86_64 ELF in elftoolchain elfcopy. Follow the elftoolchain approach (ignoring -B) to simplify code. Users that expect their command line portable should specify -B. Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D67215 llvm-svn: 371914
* [llvm-objcopy] Default --output-target to --input-target when unspecifiedFangrui Song2019-09-145-37/+46
| | | | | | | | | | | | | | | | | | | | | Fixes PR42171. In GNU objcopy, if -O (--output-target) is not specified, the value is copied from -I (--input-target). ``` objcopy -I binary -B i386:x86-64 a.txt b # b is copied from a.txt llvm-objcopy -I binary -B i386:x86-64 a.txt b # b is an x86-64 object file ``` This patch changes our behavior to match GNU. With this change, we can delete code related to -B handling (D67215). Reviewed By: jakehehrlich Differential Revision: https://reviews.llvm.org/D67144 llvm-svn: 371913
* [llvm-objcopy] Add support for response files in llvm-strip and llvm-objcopyMichael Pozulp2019-09-142-0/+24
| | | | | | | | | | | | | | | | Summary: Addresses https://bugs.llvm.org/show_bug.cgi?id=42671 Reviewers: jhenderson, espindola, alexshap, rupprecht Reviewed By: jhenderson Subscribers: seiya, emaste, arichardson, jakehehrlich, MaskRay, abrachet, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D65372 llvm-svn: 371911
* [yaml2obj] Write the section header table after section contentsFangrui Song2019-09-056-19/+17
| | | | | | | | | | | | | | | | | Linkers (ld.bfd/gold/lld) place the section header table at the very end. This allows tools to strip it, which is optional in executable/shared objects. In addition, if we add or section, the size of the section header table will change. Placing the section header table in the end keeps section offsets unchanged. yaml2obj currently places the section header table immediately after the program header. Follow what linkers do to make offset updating easier. Reviewed By: grimar Differential Revision: https://reviews.llvm.org/D67221 llvm-svn: 371074
* [yaml2obj] Support PT_GNU_STACK and PT_GNU_RELROFangrui Song2019-09-041-1/+1
| | | | | | | | | | | | | PT_GNU_STACK is used in an llvm-objcopy test. I plan to use PT_GNU_RELRO in a patch to improve nested segment processing in llvm-objcopy (PR42963). Reviewed By: grimar Differential Revision: https://reviews.llvm.org/D67146 llvm-svn: 370857
* [yaml2obj][obj2yaml] - Use a single "Other" field instead of "Other", ↵George Rimar2019-08-302-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "Visibility" and "StOther". Currenly we can encode the 'st_other' field of symbol using 3 fields. 'Visibility' is used to encode STV_* values. 'Other' is used to encode everything except the visibility, but it can't handle arbitrary values. 'StOther' is used to encode arbitrary values when 'Visibility'/'Other' are not helpfull enough. 'st_other' field is used to encode symbol visibility and platform-dependent flags and values. Problem to encode it is that it consists of Visibility part (STV_* values) which are enumeration values and the Other part, which is different and inconsistent. For MIPS the Other part contains flags for all STO_MIPS_* values except STO_MIPS_MIPS16. (Like comment in ELFDumper says: "Someones in their infinite wisdom decided to make STO_MIPS_MIPS16 flag overlapped with other ST_MIPS_xxx flags."...) And for PPC64 the Other part might actually encode any value. This patch implements custom logic for handling the st_other and removes 'Visibility' and 'StOther' fields. Here is an example of a new YAML style this patch allows: - Name: foo Other: [ 0x4 ] - Name: bar Other: [ STV_PROTECTED, 4 ] - Name: zed Other: [ STV_PROTECTED, STO_MIPS_OPTIONAL, 0xf8 ] Differential revision: https://reviews.llvm.org/D66886 llvm-svn: 370472
* [llvm-objcopy] Allow the visibility of symbols created by --binary andChris Jackson2019-08-302-0/+42
| | | | | | --add-symbol to be specified with --new-symbol-visibility llvm-svn: 370458
* [llvm-objcopy] Strip debug sections when running with --strip-unneeded.Jordan Rupprecht2019-08-231-0/+30
| | | | | | | | | | | | | | | | | | | Summary: GNU --strip-unneeded strips debugging sections as well. Do that for llvm-objcopy as well. Additionally, add a test that verifies we keep the .gnu_debuglink section. This apparently was not always the case, and I'm not sure which commit fixed it, but there doesn't appear to be any test coverage to make sure we continue to do so. This fixes PR41043. Reviewers: jhenderson, jakehehrlich, espindola, alexshap Subscribers: emaste, arichardson, MaskRay, abrachet, seiya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D66623 llvm-svn: 369761
* [llvm-objcopy][test] Add a test to show that argv[0] is included in ↵Fangrui Song2019-08-201-0/+20
| | | | | | | | | | | | error/warning messages test/llvm-objcopy/ELF/error-format.test is similar to test/llvm-readobj/error-format.test added in D66425. Reviewed By: grimar, jhenderson Differential Revision: https://reviews.llvm.org/D66476 llvm-svn: 369392
* [llvm-objcopy] Append '\n' to warning messagesFangrui Song2019-08-201-3/+4
| | | | | | | | | | | | | Currently the warning message of `llvm-strip %t.o %t.o` does not include the trailing newline. Fix this by appending a '\n'. This is the only warning llvm-objcopy and llvm-strip can issue. Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D66475 llvm-svn: 369391
* [llvm-objcopy] Allow 'protected' visibility to be set when usingChris Jackson2019-08-151-5/+7
| | | | | | | | | | add-symbol Reviewers: Maskray, rupprecht Differential Revision: https://reviews.llvm.org/D65891 llvm-svn: 368982
* [llvm-strip] Support --strip-sectionsWolfgang Pieb2019-08-081-0/+5
| | | | | | | | | | | llvm-objcopy already supports --strip-sections. It is a good fit for its alias llvm-strip to support it as well. Reviewers: rupprecht, jhenderson Differential Revision: https://reviews.llvm.org/D65787 llvm-svn: 368241
* [llvm-objcopy] - Fix the strip-dwo-groups.test.George Rimar2019-08-021-10/+17
| | | | | | | | | | It was reported (https://reviews.llvm.org/D65273#1612246) that this test fails if the compilation directory contain a "debug_" substring. This should fix it. llvm-svn: 367702
* [llvm-objcopy] - Stop using Inputs/alloc-symtab.oGeorge Rimar2019-07-305-19/+46
| | | | | | | | | | | | | | | | Initially Inputs/alloc-symtab.o was added in D42222. It contains an allocatable .symtab section. Today we are able to create such sections using yaml2obj. Later people started using this input for no solid reason in their tests. Now multiple of tests are using it. (And those tests do not need such a specific case actually). In this patch I removed this binary and rewrote the few tests. Differential revision: https://reviews.llvm.org/D65278 llvm-svn: 367310
* [llvm-objcopy] Improve --add-section argument string parsingSergey Dmitriev2019-07-291-0/+16
| | | | | | Differential Revision: https://reviews.llvm.org/D65346 llvm-svn: 367236
* [llvm-objcopy] - Reimplement strip-dwo-groups.test to stop using the ↵George Rimar2019-07-292-35/+71
| | | | | | | | | | | | | | | | precompiled object. When llvm-copy removes .dwo sections the index of symbol table, the indices of the symbols and the indices of the sections which go after the removed ones changes. That affects on SHT_GROUP sections, which needs to be updated. Initially this test used a precompiled object, I rewrote it to use YAML and improved a bit. Differential revision: https://reviews.llvm.org/D65273 llvm-svn: 367202
* [llvm-objcopy] Allow strip symtab in executables and DSOsEugene Leviant2019-07-235-87/+24
| | | | | | | Re-commit of the patch after addressing -Wl,--emit-relocs case. Differential revision: https://reviews.llvm.org/D61672 llvm-svn: 366787
* llvm-objcopy/test: add REQUIRES: shell for use of umaskDavid Blaikie2019-07-222-0/+2
| | | | | | (follow-up to r365162) llvm-svn: 366755
* [test] [llvm-objcopy] Fix broken test caseAlex Brachet2019-07-191-8/+15
| | | | | | | | | | | | | | | | Summary: The test case added in D62718 did not work unless the user was root because write bits were not set for the output file. This change uses only permissions with user write (0200) to ensure tests pass regardless of the users permissions. Reviewers: jhenderson, rupprecht, MaskRay, espindola, alexshap Reviewed By: MaskRay Subscribers: emaste, arichardson, jakehehrlich, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D64302 llvm-svn: 366527
* [llvm-objcopy] Don't change permissions of non-regular output filesFangrui Song2019-07-111-0/+6
| | | | | | | | | | | | | | | | | | | | | | There is currently an EPERM error when a regular user executes `llvm-objcopy a.o /dev/null`. Worse, root can even change the mode bits of /dev/null. Fix it by checking if the output file is special. A new overload of llvm::sys::fs::setPermissions with FD as the parameter is added. Users should provide `perm & ~umask` as the parameter if they intend to respect umask. The existing overload of llvm::sys::fs::setPermissions may be deleted if we can find an implementation of fchmod() on Windows. fchmod() is usually better than chmod() because it saves syscalls and can avoid race condition. Reviewed By: jakehehrlich, jhenderson Differential Revision: https://reviews.llvm.org/D64236 llvm-svn: 365753
* Revert [llvm-objcopy] Allow strip symtab from executables and DSOsJordan Rupprecht2019-07-106-25/+88
| | | | | | | | | | | | | This reverts r365193 (git commit 194f16b3548bcb23a7f0fd638778ed72edd18d37) This patch doesn't work with binaries built w/ `--emit-relocs`, e.g. ``` $ echo 'int main() { return 0; }' | clang -Wl,--emit-relocs -x c - -o foo && llvm-objcopy --strip-unneeded foo llvm-objcopy: error: 'foo': not stripping symbol '__gmon_start__' because it is named in a relocation ``` llvm-svn: 365712
* [llvm-objcopy] Allow strip symtab from executables and DSOsEugene Leviant2019-07-056-88/+25
| | | | | | Differential revision: https://reviews.llvm.org/D61672 llvm-svn: 365193
* [Object/ELF.h] - Improve error reporting.George Rimar2019-07-052-6/+10
| | | | | | | | | | | | | | | | | The errors coming from ELF.h are usually not very useful because they are uninformative. This patch is a first step to improve the situation. I tested this patch with a run of check-llvm and found that few messages are untested. In this patch, I did not add more tests but marked all such cases with a "TODO" comment. For all tested messages I extended the error text to provide more details (see test cases changed). Differential revision: https://reviews.llvm.org/D64014 llvm-svn: 365183
* [llvm-objcopy][test] Fix respect-umask.test after D62718/r365162Fangrui Song2019-07-051-14/+3
| | | | llvm-svn: 365172
* Fix patch not passing test casesAlex Brachet2019-07-051-4/+3
| | | | llvm-svn: 365170
* Temporarily stop failing test caseAlex Brachet2019-07-051-3/+3
| | | | llvm-svn: 365168
* [llvm-objcopy] Change handling of output file permissionsAlex Brachet2019-07-043-0/+125
| | | | | | | | | | | | | | | | Summary: Address bug [[ https://bugs.llvm.org/show_bug.cgi?id=42082 | 42082 ]] where files were always outputted with 0775 permissions. Now, the output file is given either 0666 or 0777 if the object is executable. Reviewers: espindola, alexshap, rupprecht, jhenderson, jakehehrlich, MaskRay Reviewed By: rupprecht, jhenderson, jakehehrlich, MaskRay Subscribers: emaste, arichardson, jakehehrlich, MaskRay, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D62718 llvm-svn: 365162
* [llvm-objcopy] - Get rid of dynrel.elf precompiled binary from inputs.George Rimar2019-06-213-20/+64
| | | | | | | | | | We do not have to spread using the precompiled binaries in the tests, when we can use YAML. This patch removes the dynrel.elf binary and adds a few comments to the test cases. Differential revision: https://reviews.llvm.org/D63641 llvm-svn: 364052
* [NFC][llvm-objcopy] Fix overly restrictive od output checkHubert Tong2019-06-192-6/+6
| | | | | | | | | | | | | | The check against the output of `od` in the affected tests expect a specific input offset format. They also expect a specific offset value, not consistent with the EXAMPLE section for `od` in POSIX.1-2017 Chapter 4, while using the `-j` option. In particular, the example shows that the input offset begins at 0 following the bytes skipped. This patch adjusts the matching of the input offset to be more generic. In order to avoid false matches, it restricts the number of bytes to be formatted. llvm-svn: 363829
* [llvm-readobj] Allow --hex-dump/--string-dump to dump multiple sectionsFangrui Song2019-06-182-0/+2
| | | | | | | | | | | | | | | | | | 1) `-x foo` currently dumps one `foo`. This change makes it dump all `foo`. 2) `-x foo -x foo` currently dumps `foo` twice. This change makes it dump `foo` once. In addition, if foo has section index 9, `-x foo -x 9` dumps `foo` once. 3) Give a warning instead of an error if `foo` does not exist. The new behaviors match GNU readelf. Also, print a new line as a separator between two section dumps. GNU readelf uses two lines, but one seems good enough. Reviewed By: grimar, jhenderson Differential Revision: https://reviews.llvm.org/D63475 llvm-svn: 363683
OpenPOWER on IntegriCloud