summaryrefslogtreecommitdiff
path: root/test/Object
AgeCommit message (Collapse)Author
2017-12-01Add flag to ArchiveWriter to test GNU64 format more efficientlyJake Ehrlich
Even with the sparse file optimizations the SYM64 test can still be painfully slow. This unnecessarily slows down devs. It's critical that we test that the switch to the SYM64 format occurs at 4GB but there isn't any better of a way to fake the size of the file than sparse files. This change introduces a flag that allows the cutoff to be arbitrarily set to whatever power of two is desired. The flag is hidden as it really isn't meant to be used outside this one test. This is unfortunate but appears necessary, at least until the average hard drive is much faster. The changes to the test require some explanation. Prior to this change we knew that the SYM64 format was being used because the file was simply too large to have validly handled this case if the SYM64 format were not used. To ensure that the SYM64 format is still being used I am grepping the file for "SYM64". Without changing the filename however this would be pointless because "SYM64" would occur in the file either way. So the filename of the test is also changed in order to avoid this issue. Differential Revision: https://reviews.llvm.org/D40632 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319507 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-30Check alignment in getSectionContentsAsArray.Rafael Espindola
While the ArrayRef can technically have unaligned data, it would be extremely surprising if iterating over it caused undefined behavior when a reference to the underlying type was bound. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319392 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-20[AMDGPU][MC][GFX8][GFX9] Corrected names of integer ↵Dmitry Preobrazhensky
v_{add/addc/sub/subrev/subb/subbrev} See bug 34765: https://bugs.llvm.org//show_bug.cgi?id=34765 Reviewers: tamazov, SamWot, arsenm, vpykhtin Differential Revision: https://reviews.llvm.org/D40088 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318675 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-06[test] Add test files that were missed from SVN r317459Martin Storsjo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317461 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-06[ObjectYAML] Map relocation types for COFF ARMNT and ARM64Martin Storsjo
Differential Revision: https://reviews.llvm.org/D39668 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317459 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-04llvm/test/Object/archive-SYM64-write.test: Delete large temp files. They are ↵NAKAMURA Takumi
8GiB total. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317401 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-03Reland "Add support for writing 64-bit symbol tables for archives when ↵Jake Ehrlich
offsets become too large for 32-bit" Tests were failing because some bots were running out of address space and memory. Additionally the test was very slow. These issues were solved by changing the test to take advantage of sparse filse and restricting the test to run only on 64-bit systems. This should fix https://bugs.llvm.org//show_bug.cgi?id=34189 This change makes it so that if writing a K_GNU style archive, you need to output a > 32-bit offset it should output in K_GNU64 style instead. Differential Revision: https://reviews.llvm.org/D36812 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317352 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-27Revert "Add support for writing 64-bit symbol tables for archives when ↵Jake Ehrlich
offsets become too large for 32-bit" This reverts commit r316805. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316813 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-27Add support for writing 64-bit symbol tables for archives when offsets ↵Jake Ehrlich
become too large for 32-bit This should fix https://bugs.llvm.org//show_bug.cgi?id=34189 This change makes it so that if writing a K_GNU style archive, you need to output a > 32-bit offset it should output in K_GNU64 style instead. Differential Revision: https://reviews.llvm.org/D36812 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316805 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-19Fix buffer overflow.Rafael Espindola
We were reading past the end of the buffer. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316143 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-16Add base relative relocation record that can be used for the following case ↵Tony Tye
(OpenCL example): static __global int Var = 0; __global int* Ptr[] = {&Var}; ... In this case Var is a non premptable symbol and so its address can be used as the value of Ptr, with a base relative relocation that will add the delta between the ELF address and the actual load address. Such relocations do not require a symbol. Differential Revision: https://reviews.llvm.org/D38909 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315935 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-11Convert an ErrorOr to Expected.Rafael Espindola
getRelocationAddend should never be called on non SHT_RELA sections, but changing that requires changing RelocVisitor.h. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315473 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-10Make the ELFFile constructor private.Rafael Espindola
With this all clients have to use the new create method which returns an Expected. Fixes a crash on invalid input. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315376 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-10Make the ELFObjectFile constructor private.Rafael Espindola
This forces every user to use the new create method that returns an Expected. This in turn propagates better error messages. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315371 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-10Convert two uses of ErrorOr to Expected.Rafael Espindola
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315354 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-05Added phdr upper bound checks to ElfObject.Rafael Espindola
Ensure the program_headers call will fail correctly if the program headers are larger than the underlying buffer. Patch by Parker Thompson! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315012 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-05AMDGPU: Add and set AMDGPU-specific e_flagsKonstantin Zhuravlyov
Differential Revision: https://reviews.llvm.org/D38556 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314987 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-03AMDGPU: Add ELFOSABI_AMDGPU_MESA3DKonstantin Zhuravlyov
Differential Revision: https://reviews.llvm.org/D38387 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314846 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-03AMDGPU: Add ELFOSABI_AMDGPU_PALKonstantin Zhuravlyov
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314843 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-03[llvm-readobj][RISCV] Pretty-print RISCV e_flagsAlex Bradbury
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314772 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-03[RISCV] Add missed test case for r314770Alex Bradbury
Differential Revision: https://reviews.llvm.org/D38311 Patch by https://reviews.llvm.org/D38311 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314771 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-22llvm-ar: align the first archive member consistently.Rafael Espindola
Before we were aligning the member after the symbol table to 4 but other members to 8. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314010 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-22llvm-ar: Don't add an unnecessary alignment in gnu mode.Rafael Espindola
This is mostly for getting stricter testing in preparation for future changes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314000 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-21[yaml2obj] - Don't crash on one more invalid document.George Rimar
This fixes one more crash I faced. Testcase contains minimal reduced case. Differential revision: https://reviews.llvm.org/D38082 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313868 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-20Revert r313746 "[yaml2obj] - Don't crash on invalid document."George Rimar
It broke BB: http://lab.llvm.org:8011/builders/llvm-hexagon-elf/builds/9781 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313748 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-20[yaml2obj] - Don't crash on invalid document.George Rimar
Previously jaml2obj would segfault on empty document. (without yaml description). Patch fixes the issue. Differential revision: https://reviews.llvm.org/D38036 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313746 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-13[MachO] Prevent heap overflow when load command extends past EOFJonas Devlieghere
This patch fixes a heap-buffer-overflow when a malformed Mach-O has a load command who's size extends past the end of the binary. Fixes: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3225 Differential revision: https://reviews.llvm.org/D37439 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313145 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-11llvm-dwarfdump: Make -brief the default and add a -verbose option instead.Adrian Prantl
Differential Revision: https://reviews.llvm.org/D37717 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312972 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-11llvm-dwarfdump: Replace -debug-dump=sect option with individual options.Adrian Prantl
As discussed on llvm-dev in http://lists.llvm.org/pipermail/llvm-dev/2017-September/117301.html this changes the command line interface of llvm-dwarfdump to match the one used by the dwarfdump utility shipping on macOS. In addition to being shorter to type this format also has the advantage of allowing more than one section to be specified at the same time. In a nutshell, with this change $ llvm-dwarfdump --debug-dump=info $ llvm-dwarfdump --debug-dump=apple-objc becomes $ dwarfdump --debug-info --apple-objc Differential Revision: https://reviews.llvm.org/D37714 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312970 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-06Use the section name if a STT_SECTION symbol has empty name.Rafael Espindola
Without this we would have multiple relocations pointing to symbols with the same name: the empty string. There was no way for yaml2obj to be able to handle that. A more general solution would be to unique symbol names in a similar way to how we unique section names. In practice I think this covers all common cases and is a bit more user friendly than using names like sym1, sym2, sym3, etc. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312603 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-05obj2yaml: Print unique section names.Rafael Espindola
Without this patch passing a .o file with multiple sections with the same name to obj2yaml produces a yaml file that yaml2obj cannot handle. This is pr34162. The problem is that when specifying, for example, the section of a symbol, we get only Section: foo and don't know which of the sections whose name is foo we have to use. One alternative would be to use section numbers. This would work, but the output from obj2yaml would be very inconvenient to edit as deleting a section would invalidate all indexes. Another alternative would be to invent a unique section id that would exist only on yaml. This would work, but seems a bit heavy handed. We could make the id optional and default it to the section name. Since in the last alternative the id is basically what this patch uses as a name, it can be implemented as a followup patch if needed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312585 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-01[WebAssembly] Update relocation names to match specSam Clegg
Summary: See https://github.com/WebAssembly/tool-conventions/blob/master/Linking.md Differential Revision: https://reviews.llvm.org/D37385 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312342 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-31[WebAssembly] Fix getSymbolValue() for data symbolsSam Clegg
This is mostly a fix for the output of `llvm-nm` See Bug 34392: https://bugs.llvm.org//show_bug.cgi?id=34392 Differential Revision: https://reviews.llvm.org/D37359 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312294 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-23[WebAssembly] Fix overflow for input with missing versionJonas Devlieghere
Differential revision: https://reviews.llvm.org/D37070 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311605 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-20Fix archive-update.test after r311296.Kuba Mracek
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311299 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-20Remove uses of "%T" from test/Object/archive-* tests.Kuba Mracek
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311296 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-15Revert archive-* tests from r310953, there were test failures.Kuba Mracek
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310974 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-15[llvm] Get rid of "%T" expansionsKuba Mracek
The %T lit expansion expands to a common directory shared between all the tests in the same directory, which is unexpected and unintuitive, and more importantly, it's been a source of subtle race conditions and flaky tests. In https://reviews.llvm.org/D35396, it was agreed that it would be best to simply ban %T and only keep %t, which is unique to each test. When a test needs a temporary directory, it can just create one using mkdir %t. This patch removes %T in llvm. Differential Revision: https://reviews.llvm.org/D36495 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310953 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-25[LTO] Prevent dead stripping and internalization of symbols with sectionsTeresa Johnson
Summary: ELF linkers generate __start_<secname> and __stop_<secname> symbols when there is a value in a section <secname> where the name is a valid C identifier. If dead stripping determines that the values declared in section <secname> are dead, and we then internalize (and delete) such a symbol, programs that reference the corresponding start and end section symbols will get undefined reference linking errors. To fix this, add the section name to the IRSymtab entry when a symbol is defined in a specific section. Then use this in the gold-plugin to mark the symbol as external and visible from outside the summary when the section name is a valid C identifier. Reviewers: pcc Subscribers: mehdi_amini, inglorion, eraman, llvm-commits Differential Revision: https://reviews.llvm.org/D35639 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309009 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-14[llvm-readobj] - Teach readobj to print DT_FILTER dynamic tag in human ↵George Rimar
readable form. Nothing special here, output format is similar to the format used by binutils readelf and ELF Tool Chain readelf. Differential revision: https://reviews.llvm.org/D35351 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308033 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-10[WebAssembly] Be consistent in generating trivial test input filesSam Clegg
For each checked-in wasm file, make sure the there is corresponding .ll file that can be used to regenerate it if needed. Add test/Object/Inputs/trivial-object-test.wasm to match other formats and add some new wasm tests in test/Object. Differential Revision: https://reviews.llvm.org/D35213 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307585 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-30[YAML] - Teach yaml2obj/obj2yaml to work with numeric relocation values.George Rimar
That may be useful if we want to produce or parse object containing broken relocation values using yaml2obj/obj2yaml. Previously that was impossible because only enum values were parsed correctly, this patch allows to put any numeric value as a relocation type. Differential revision: https://reviews.llvm.org/D34758 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306814 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-27Object: Teach irsymtab::read() to try to use the irsymtab that we wrote to disk.Peter Collingbourne
Fixes PR27551. Differential Revision: https://reviews.llvm.org/D33974 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306488 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-27Bitcode: Write the irsymtab to disk.Peter Collingbourne
Differential Revision: https://reviews.llvm.org/D33973 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306487 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-16obj2yaml: Improve error reportingSam Clegg
Previously only the error codes were reported which meant that useful information about malformed inputs was not shown. Differential Revision: https://reviews.llvm.org/D34008 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305609 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-05test: fix hexagon buildSaleem Abdulrasool
Add a x86-registered-target requirement to the tests. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304739 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-05AMDGPU: Remove deprecated and unused elf definitionsKonstantin Zhuravlyov
Differential Revision: https://reviews.llvm.org/D33689 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304737 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-05CodeGen: add support for emitting ObjC image infoSaleem Abdulrasool
This ensures that we can emit the ObjC Image Info structure on COFF and ELF as well. The frontend already would attempt to emit this information but would get dropped when generating assembly or an object file. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304736 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-15Add support for handling ifuncs to GlobalValue::getBaseObjectTeresa Johnson
Summary: All GlobalIndirectSymbol types (not just GlobalAlias) should return their base object. Without this patch LTO would warn "Unable to determine comdat of alias!" for an ifunc. Reviewers: pcc Subscribers: mehdi_amini, inglorion, llvm-commits Differential Revision: https://reviews.llvm.org/D33202 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303096 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-15Add an extra test for archive symbol tables.Rafael Espindola
The table should include only defined symbols. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303075 91177308-0d34-0410-b5e6-96231b3b80d8