summaryrefslogtreecommitdiffstats
path: root/lld/test/ELF/invalid
Commit message (Collapse)AuthorAgeFilesLines
...
* [ELF] - Get rid of precompiled elf object in test case.George Rimar2018-06-282-4/+17
| | | | | | | | | We has precompiled object with unsupported FDE version (=2). It is possible to use llvm-mc instead for this test. Patch do this change. llvm-svn: 335818
* [lld] Add REQUIRES: x86 where needed to testsJoel Jones2018-06-061-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | If building lld without x86 support, tests that require that support should be treated as unsupported, not errors. Tested using: 1. cmake '-DLLVM_TARGETS_TO_BUILD=AArch64;X86' make check-lld => Expected Passes : 1406 Unsupported Tests : 287 2. cmake '-DLLVM_TARGETS_TO_BUILD=AArch64' make check-lld => Expected Passes : 410 Unsupported Tests : 1283 Patch by Joel Jones Differential Revision: https://reviews.llvm.org/D47748 llvm-svn: 334095
* [ELF] - Add test case for "unsupported relocation reference" error. NFCI.George Rimar2018-03-201-0/+30
| | | | | | | | | We do not have test showing we explicitly reject objects where relocation section goes before the target, i.e .rel[a].text is listed before .text, for example. The patch adds it. llvm-svn: 327963
* Don't accept unsuitable ELF files such as executables or core files.Rui Ueyama2018-02-023-5/+9
| | | | | | Differential Revision: https://reviews.llvm.org/D42827 llvm-svn: 324041
* Simplify error handling.Rui Ueyama2017-10-282-4/+0
| | | | | | | | I don't think we have to aim for precise bug compatibility. We can return a nullptr if a section is consumed by the linker, and the rest should naturally work. llvm-svn: 316817
* Remove one parameter from Target::getRelExpr.Rui Ueyama2017-10-122-3/+3
| | | | | | | | A section was passed to getRelExpr just to create an error message. But if there's an invalid relocation, we would eventually report it in relocateOne. So we don't have to pass a section to getRelExpr. llvm-svn: 315552
* Fix which file is in an error message.Rafael Espindola2017-08-041-6/+12
| | | | | | | When reporting an invalid relocation we were blaming the destination file instead of the file with the relocation. llvm-svn: 310084
* Speed up gdb index creation.Rafael Espindola2017-07-191-2/+1
| | | | | | | | | | | With that in place we can use lld's own infrastructure for the low level detail of dwarf parsing. With this we don't decompress sections twice, we don't scan all realocations and even with this simplistic implementation linking clang with gdb index goes from 34.09 seconds to 20.80 seconds. llvm-svn: 308544
* ELF: Reword a somewhat misleading error message.Peter Collingbourne2017-07-141-2/+2
| | | | | | | | | | | PT_TLS is a type of program header, so we wouldn't expect to see one in an object file. This error should probably be referring to the fact that we didn't see a section with the flag SHF_TLS, which would normally cause us to create a PT_TLS program header. Differential Revision: https://reviews.llvm.org/D35395 llvm-svn: 307983
* [ELF] - Fail the link if something happens on DWARF parsing stage of ↵George Rimar2017-07-071-0/+41
| | | | | | | | | | | | | | | | | | -gdb-index building This is relative to PR33173, Previously if something wrong happened on DWARF parsers side during parsing object for building gdb index (like was in PR: unsupported relocation) then LLD continued and finished the link. DWARF parsers sure showed error message on their side, but that is all. Patch changes behavior to fail the link in this case and show more detailed message. Differential revision: https://reviews.llvm.org/D34814 llvm-svn: 307370
* [ELF] - Remove use of precomipled binary for invalid-relocation-x64.testGeorge Rimar2017-07-032-10/+7
| | | | | | | | | | Since yaml2obj is now able to parse integer values as relocation types, there is no need to keep hex edited elf object for this test, we can produce it on fly, just like this patch do. Differential revision: https://reviews.llvm.org/D34893 llvm-svn: 307032
* Include filenames in error messages to report broken files.Rui Ueyama2017-03-302-2/+2
| | | | llvm-svn: 299115
* ELF: Change check(Expected<T>, const Twine &) to call toString instead of ↵Peter Collingbourne2017-03-171-1/+1
| | | | | | converting to an error code. llvm-svn: 298155
* [ELF] - Report filename for unknown relocation error.George Rimar2017-01-311-2/+2
| | | | | | | | | | | | Our reporting for that case was just like: ld.lld: error: do not know how to handle relocation 'R_386_PC8' (23) It did not give any information about error location. Patch adds filename to error. Differential revision: https://reviews.llvm.org/D29282 llvm-svn: 293640
* Do not use .s extension for non-assembly files.Rui Ueyama2017-01-252-0/+0
| | | | llvm-svn: 293096
* Make error messages more consistent with other messages.Rui Ueyama2017-01-251-2/+2
| | | | llvm-svn: 293095
* [ELF] - Explicitly list supported relocations for x64 target.George Rimar2017-01-121-2/+2
| | | | | | | | | The same we did for x86 earlier: list supported relocations explicitly and error out on unknown. Differential revision: https://reviews.llvm.org/D28564 llvm-svn: 291751
* [ELF] - Use error() instead of fatal() during relaxation of R_X86_64_GOTTPOFFGeorge Rimar2016-12-222-0/+46
| | | | | | | | | | | | This is last known noticable fatal() in target.cpp. We also have other ones for unknown relocations or creating unknown targets, but that one can be just error I think. Used yaml2obj to generate test. Differential revision: https://reviews.llvm.org/D28049 llvm-svn: 290335
* [ELF] - Removed trailing whitespaces. NFC.George Rimar2016-12-211-1/+0
| | | | llvm-svn: 290243
* [ELF] - Do not call fatal() in Target.cpp, call error() instead.George Rimar2016-12-212-0/+31
| | | | | | | | | | | | | | | | | | | | | We probably would want to avoid fatal() if we can in context of librarification, but for me reason of that patch is to help D27900 go. D27900 changes errors reporting to something like error: text1 note: text2 note: text3 where hint used to provide additional information about location. In that case I can't just call fatal() because user will not see notes after that what adds additional complication to handle. So It is good to switch fatal() to error() where it is possible. Also it adds testcase with broken relocation number. Previously we did not have any, It checks that error() instead of fatal() works fine. Differential revision: https://reviews.llvm.org/D27973 llvm-svn: 290239
* [ELF] Refactor several error messagesEugene Leviant2016-11-231-2/+2
| | | | | | Differential revision: https://reviews.llvm.org/D26970 llvm-svn: 287753
* [ELF] Update lld now that ELF.h in LLVM has been converted to Expected.Davide Italiano2016-11-162-2/+2
| | | | llvm-svn: 287082
* Partially revert r287009: Remove trailing whitespace.Rui Ueyama2016-11-151-1/+0
| | | | | | This reverts part of r287009 because I accidentally changed binary files. llvm-svn: 287010
* Remove trailing whitespace.Rui Ueyama2016-11-151-1/+2
| | | | llvm-svn: 287009
* [ELF] - Allow symbols of STT_NOTYPE to be associated with SHT_SYMTAB sections.George Rimar2016-11-151-0/+25
| | | | | | | | | | | | | | | | | | | | Found this when tried to link lang/ccl FreeBSD port. Issue is very close to D23201. This is the reason of lang/ccl port link fail. GNU assembler 2.17.50 [FreeBSD] 2007-07-03 could generate broken objects, where notype symbols are associated with symtab: ... [ 9] .symtab SYMTAB 0000000000000000 00003c78 0000000000006858 0000000000000018 10 803 8 ... 192: 000000000000000d 0 NOTYPE LOCAL DEFAULT 9 _cons_org Patch allows to handle such objects. Differential revision: https://reviews.llvm.org/D26613 llvm-svn: 286939
* Parse relocations only once.Rafael Espindola2016-11-101-1/+1
| | | | | | | | | | | | | | | | Relocations are the last thing that we wore storing a raw section pointer to and parsing on demand. With this patch we parse it only once and store a pointer to the actual data. The patch also changes where we store it. It is now in InputSectionBase. Not all sections have relocations, but most do and this simplifies the logic. It also means that we now only support one relocation section per section. Given that that constraint is maintained even with -r with gold bfd and lld, I think it is OK. llvm-svn: 286459
* [ELF][MIPS] Convert .MIPS.abiflags section to synthetic input sectionSimon Atanasyan2016-11-091-21/+0
| | | | | | | | | | | | | | Previously, we have both input and output section for .MIPS.abiflags. Now we have only one class for .MIPS.abiflags, which is MipsAbiFlagsSection. This class is a synthetic input section. .MIPS.abiflags sections are handled as regular sections until the control reaches Writer. Writer then aggregates all sections whose type is SHT_MIPS_ABIFLAGS to create a single synthesized input section. The synthesized section is then processed normally as if it came from an input file. llvm-svn: 286398
* [ELF][MIPS] Convert .reginfo and .MIPS.options sections to synthetic input ↵Simon Atanasyan2016-11-093-51/+1
| | | | | | | | | | | | | | | | | | | sections Previously, we have both input and output sections for .reginfo and .MIPS.options. Now for each such sections we have one synthetic input sections: MipsReginfoSection and MipsOptionsSection respectively. Both sections are handled as regular sections until the control reaches Writer. Writer then aggregates all sections whose type is SHT_MIPS_REGINFO or SHT_MIPS_OPTIONS to create a single synthesized input section. In that moment Writer also save GP0 value to the MipsGp0 field of the corresponding ObjectFile. This value required for R_MIPS_GPREL16 and R_MIPS_GPREL32 relocations calculation. Differential revision: https://reviews.llvm.org/D26444 llvm-svn: 286397
* Update for llvm change.Rafael Espindola2016-11-032-4/+3
| | | | llvm-svn: 285962
* [ELF] - Check that .dynsym is present in DSO if SHT_GNU_versym section is.George Rimar2016-11-021-0/+26
| | | | | | | | | | | | | | | When we have SHT_GNU_versym section, it is should be associated with symbol table section. Usually (and in out implementation) it is .dynsym. In case when .dynsym is absent (due to broken object for example), lld crashes in parseVerdefs() when accesses null pointer: Versym = reinterpret_cast<const Elf_Versym *>(this->ELFObj.base() + VersymSec->sh_offset) + this->Symtab->sh_info; DIfferential revision: https://reviews.llvm.org/D25553 llvm-svn: 285796
* Update for llvm change.Rafael Espindola2016-11-012-4/+0
| | | | | | We no longer use the section names in this test. llvm-svn: 285754
* Update for llvm change.Rafael Espindola2016-11-011-1/+1
| | | | llvm-svn: 285739
* [ELF] - Testcase checking that we do not crash on invalid sh_info in ↵George Rimar2016-10-202-0/+3
| | | | | | | | | | SHT_GROUP sections. NFC. Fix was landed as r284702 "[Object/ELF] - Check index argument in getSymbol()." Patch contains LLD testcase only. llvm-svn: 284703
* [ELF] - Don't crash on multiple SHT_MIPS_REGINFO/SHT_MIPS_ABIFLAGS sections.George Rimar2016-10-172-0/+46
| | | | | | | | | | In continue of D25555, this patch fixes possible crash when we have multiple SHT_MIPS_REGINFO or SHT_MIPS_ABIFLAGS sections. yaml2obj was used to produce such objects. Differential revision: https://reviews.llvm.org/D25609 llvm-svn: 284376
* [ELF] - Added testcase relative to D25090.George Rimar2016-10-172-0/+4
| | | | | | | | | | | | | | | | | | | | It was requested on review for https://reviews.llvm.org/D25090 to add testcase in lld. Spec says (http://www.sco.com/developers/gabi/1998-04-29/ch4.eheader.html) : e_shnum This member holds the number of entries in the section header table. Thus the product of e_shentsize and e_shnum gives the section header table's size in bytes. If a file has no section header table, e_shnum holds the value zero. In case revealed, broken input did not contain zero in this field. LLD then could crash when proccessed sections (returned array has incorrect size): template <class ELFT> void SharedFile<ELFT>::parseSoName() { ... for (const Elf_Shdr &Sec : Obj.sections()) { ... llvm-svn: 284375
* [ELF] - Do not crash when object has multiple SHT_MIPS_OPTIONSGeorge Rimar2016-10-141-0/+25
| | | | | | | | | | | | Issue was revealed by AFl and I was able to generate such object using yaml2obj. When object has more than one SHT_MIPS_OPTIONS, each except the last one is destroyed after placing into Sections array. Sections array contains dead pointers finally. LLD may crash then. Differential revision: https://reviews.llvm.org/D25555 llvm-svn: 284227
* [ELF] - Fixed assertion fail when symbol table has invalid sh_info value.George Rimar2016-10-112-0/+5
| | | | | | | | | | | This part was splitted from D25016. When sh_info value was set in the way that non-local symbol was treated as local, lld was asserting, patch fixes that. Differential revision: https://reviews.llvm.org/D25371 llvm-svn: 283859
* Remove trailing whitespace.Rui Ueyama2016-10-101-1/+1
| | | | llvm-svn: 283786
* Recommit r283733 "[ELF] - Do not crash if common symbol alignment set to ↵George Rimar2016-10-102-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | value greater than UINT32_MAX. With fix: commit changes from InputFiles.cpp too. Original commit message: We have following code in lld, that truncates the alignment value to 32 bit. Big alignment in this case may give result 0 and crash later. template <class ELFT> CommonInputSection<ELFT>::CommonInputSection(std::vector<DefinedCommon *> Syms) : InputSection<ELFT>(nullptr, &Hdr, "") { .... for (DefinedCommon *Sym : Syms) { this->Alignment = std::max<uintX_t>(this->Alignment, Sym->Alignment); ... } } Patch fixes the issue. Differential revision: https://reviews.llvm.org/D25235 llvm-svn: 283738
* Revert r283733 "[ELF] - Do not crash if common symbol alignment set to value ↵George Rimar2016-10-102-7/+1
| | | | | | | | greater than UINT32_MAX." Broke BB because forgot to commit source file. llvm-svn: 283737
* [ELF] - Do not crash if common symbol alignment set to value greater than ↵George Rimar2016-10-102-1/+7
| | | | | | | | | | | | | | | | | | | | | | | UINT32_MAX. We have following code in lld, that truncates the alignment value to 32 bit. Big alignment in this case may give result 0 and crash later. template <class ELFT> CommonInputSection<ELFT>::CommonInputSection(std::vector<DefinedCommon *> Syms) : InputSection<ELFT>(nullptr, &Hdr, "") { .... for (DefinedCommon *Sym : Syms) { this->Alignment = std::max<uintX_t>(this->Alignment, Sym->Alignment); ... } } Patch fixes the issue. Differential revision: https://reviews.llvm.org/D25235 llvm-svn: 283733
* [ELF] - Fixed assert fail when symbol table has zero sh_info value.George Rimar2016-10-072-0/+4
| | | | | | | | | | When sh_info of sumbol table value was set to zero, lld was asserting. Patch fixes the issue. Differential revision: https://reviews.llvm.org/D25016 llvm-svn: 283562
* [ELF] - Check that section alignment is a power of 2.George Rimar2016-10-073-1/+6
| | | | | | | | | | | | I found that this check still may be useful in some cases. At fact since we use uint32_t alignment, then maximum value that is valid for us is 0x80000000. But some broken files, for example file from testcase may have greater value. Because of that offset calculation overflow and crash happens. Differential revision: https://reviews.llvm.org/D25324 llvm-svn: 283544
* [ELF] - Do not crash on invalid size of dynamic section.George Rimar2016-10-072-0/+4
| | | | | | | | | | | | Previously if sh_size of dynamic section was broken, lld may crash. Or even may not crash if used 32 bits host. (then value may be truncated to 32 bits when doing pointer arithmetic and could be just zero). Patch fixes the issue. Differential revision: https://reviews.llvm.org/D25327 llvm-svn: 283533
* [ELF] - Do not crash when unable to parse ELF object file.George Rimar2016-10-072-0/+5
| | | | | | | | | | | | | createELFObj() may call error(...), for example when file is too short. In that case header is not set and following line lead to crash: EMachine = ELFObj.getHeader()->e_machine; Patch fixes the issue. Differential revision: https://reviews.llvm.org/D25233 llvm-svn: 283532
* [ELF] - Make checks in ObjectFile<ELFT>::getSection() stricter.George Rimar2016-10-062-0/+4
| | | | | | | | | This patch makes the check for null section stricter, so it is only allowed for STT_SECTION symbols now. Differential revision: https://reviews.llvm.org/D25231 llvm-svn: 283426
* Remove trailing whitespace.Rui Ueyama2016-10-051-1/+1
| | | | llvm-svn: 283372
* [ELF] - Removed "invalid-" prefix from testcase. NFC.George Rimar2016-10-042-2/+2
| | | | llvm-svn: 283213
* [ELF] - Do not hang if broken object has option descriptor in .MIPS.options ↵George Rimar2016-10-042-0/+5
| | | | | | | | | | | with size of zero. Previously lld would hang in infinite loop in this case, patch fixes the issue. Object was found during AFL run. Differential revision: https://reviews.llvm.org/D25229 llvm-svn: 283208
* [ELF] - Do not crash on invalid symbol index.George Rimar2016-10-042-0/+10
| | | | | | | | | | | | | | Relative to PR30540. If .symtab has invalid type in elf, no bodies are created and any relocation that tries to access them will fail. The same can happen if symbol index is just incorrect. This was revealed by "id_000005,sig_11,src_000000,op_flip2,pos_420" Differential revision: https://reviews.llvm.org/D25025 llvm-svn: 283201
OpenPOWER on IntegriCloud