summaryrefslogtreecommitdiffstats
path: root/llvm/test/MC/ELF
Commit message (Collapse)AuthorAgeFilesLines
...
* Add STB_GNU_UNIQUE to the ELF writer.Rafael Espindola2015-01-231-1/+11
| | | | | | This lets llvm-mc assemble files produced by gcc. llvm-svn: 226895
* [pr21886] Change MCJIT/ELF to support MSVC C++ mangled symbol.Rafael Espindola2015-01-221-0/+59
| | | | | | | | | | | | The ELF format is used on Windows by the MCJIT engine. Thus, on Windows, the ELFObjectWriter can encounter symbols mangled using the MS Visual Studio C++ name mangling. Symbols mangled using the MSVC C++ name mangling can legally have "@@@" as a substring. The EFLObjectWriter should not interpret the "@@@" substring as specifying GNU-style symbol versioning. The ELFObjectWriter therefore check for the MSVC C++ name mangling prefix which is either "?", "@?", "imp_?" or "imp_?@". llvm-svn: 226830
* Produce errors when an assignment expression would use a common symbol.Rafael Espindola2015-01-192-0/+12
| | | | | | | | | | | An assignment will produce a symbol with a given section and offset. There is no way to represent something like "1 byte after a common symbol". This matches the behavior of GNU as. Part of PR22217. llvm-svn: 226470
* Support @PLT loads on 32bit x86.Joerg Sonnenberger2015-01-151-0/+3
| | | | llvm-svn: 226182
* IR: Move MDLocation into placeDuncan P. N. Exon Smith2015-01-141-1/+1
| | | | | | | | | | | | | | | | | | | | This commit moves `MDLocation`, finishing off PR21433. There's an accompanying clang commit for frontend testcases. I'll attach the testcase upgrade script I used to PR21433 to help out-of-tree frontends/backends. This changes the schema for `DebugLoc` and `DILocation` from: !{i32 3, i32 7, !7, !8} to: !MDLocation(line: 3, column: 7, scope: !7, inlinedAt: !8) Note that empty fields (line/column: 0 and inlinedAt: null) don't get printed by the assembly writer. llvm-svn: 226048
* MC: Label definitions are permitted after .set directivesDavid Majnemer2014-12-241-0/+13
| | | | | | | | | .set directives may be overridden by other .set directives as well as label definitions. This fixes PR22019. llvm-svn: 224811
* IR: Make metadata typeless in assemblyDuncan P. N. Exon Smith2014-12-151-13/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now that `Metadata` is typeless, reflect that in the assembly. These are the matching assembly changes for the metadata/value split in r223802. - Only use the `metadata` type when referencing metadata from a call intrinsic -- i.e., only when it's used as a `Value`. - Stop pretending that `ValueAsMetadata` is wrapped in an `MDNode` when referencing it from call intrinsics. So, assembly like this: define @foo(i32 %v) { call void @llvm.foo(metadata !{i32 %v}, metadata !0) call void @llvm.foo(metadata !{i32 7}, metadata !0) call void @llvm.foo(metadata !1, metadata !0) call void @llvm.foo(metadata !3, metadata !0) call void @llvm.foo(metadata !{metadata !3}, metadata !0) ret void, !bar !2 } !0 = metadata !{metadata !2} !1 = metadata !{i32* @global} !2 = metadata !{metadata !3} !3 = metadata !{} turns into this: define @foo(i32 %v) { call void @llvm.foo(metadata i32 %v, metadata !0) call void @llvm.foo(metadata i32 7, metadata !0) call void @llvm.foo(metadata i32* @global, metadata !0) call void @llvm.foo(metadata !3, metadata !0) call void @llvm.foo(metadata !{!3}, metadata !0) ret void, !bar !2 } !0 = !{!2} !1 = !{i32* @global} !2 = !{!3} !3 = !{} I wrote an upgrade script that handled almost all of the tests in llvm and many of the tests in cfe (even handling many `CHECK` lines). I've attached it (or will attach it in a moment if you're speedy) to PR21532 to help everyone update their out-of-tree testcases. This is part of PR21532. llvm-svn: 224257
* Commit back the correct bits of r222760 (was r222538).Rafael Espindola2014-11-271-0/+27
| | | | | | | | | | | | | | | | | I also added a test. Original message: Allow FDE references outside the +/-2GB range supported by PC relative offsets for code models other than small/medium. For JIT application, memory layout is less controlled and can result in truncations otherwise. Patch from Akos Kiss. Differential Revision: http://reviews.llvm.org/D6079 llvm-svn: 222897
* Revert "Reapply 222538 and update tests to explicitly request small code ↵Rafael Espindola2014-11-2719-57/+19
| | | | | | | | | | | | | | | | model and PIC:" This reverts commit r222760. It changed our behaviour on PIC so we don't match gas anymore. It also included lots of unnecessary changes to tests. If those changes are desirable, there should be an independent discussion as they are out of scope for that patch. I will recommit the other bits. llvm-svn: 222896
* Reapply 222538 and update tests to explicitly request small code modelJoerg Sonnenberger2014-11-2519-19/+57
| | | | | | | | | | | | | | | and PIC: Allow FDE references outside the +/-2GB range supported by PC relative offsets for code models other than small/medium. For JIT application, memory layout is less controlled and can result in truncations otherwise. Patch from Akos Kiss. Differential Revision: http://reviews.llvm.org/D6079 llvm-svn: 222760
* Add back commits r219835 and a fixed version of r219829.Rafael Espindola2014-10-174-1/+126
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The only difference from r219829 is using getOrCreateSectionSymbol(*ELFSec) instead of GetOrCreateSymbol(ELFSec->getSectionName()) in ELFObjectWriter which causes us to use the correct section symbol even if we have multiple sections with the same name. Original messages: r219829: Correctly handle references to section symbols. When processing assembly like .long .text we were creating a new undefined symbol .text. GAS on the other hand would handle that as a reference to the .text section. This patch implements that by creating the section symbols earlier so that they are visible during asm parsing. The patch also updates llvm-readobj to print the symbol number in the relocation dump so that the test can differentiate between two sections with the same name. r219835: Allow forward references to section symbols. llvm-svn: 220021
* Add a test that would have found the bug in r219829.Rafael Espindola2014-10-171-0/+31
| | | | llvm-svn: 220016
* Revert commit r219835 and r219829.Rafael Espindola2014-10-174-126/+1
| | | | | | | | | Revert "Correctly handle references to section symbols." Revert "Allow forward references to section symbols." Rui found a regression I am debugging. llvm-svn: 220010
* Allow forward references to section symbols.Rafael Espindola2014-10-151-0/+28
| | | | llvm-svn: 219835
* Correctly handle references to section symbols.Rafael Espindola2014-10-153-1/+98
| | | | | | | | | | | | | | | | | When processing assembly like .long .text we were creating a new undefined symbol .text. GAS on the other hand would handle that as a reference to the .text section. This patch implements that by creating the section symbols earlier so that they are visible during asm parsing. The patch also updates llvm-readobj to print the symbol number in the relocation dump so that the test can differentiate between two sections with the same name. llvm-svn: 219829
* Revert "Revert "DI: Fold constant arguments into a single MDString""Duncan P. N. Exon Smith2014-10-031-6/+6
| | | | | | | | | | | | | | | | | | | | | | This reverts commit r218918, effectively reapplying r218914 after fixing an Ocaml bindings test and an Asan crash. The root cause of the latter was a tightened-up check in `DILexicalBlock::Verify()`, so I'll file a PR to investigate who requires the loose check (and why). Original commit message follows. -- This patch addresses the first stage of PR17891 by folding constant arguments together into a single MDString. Integers are stringified and a `\0` character is used as a separator. Part of PR17891. Note: I've attached my testcases upgrade scripts to the PR. If I've just broken your out-of-tree testcases, they might help. llvm-svn: 219010
* Revert "DI: Fold constant arguments into a single MDString"Duncan P. N. Exon Smith2014-10-021-6/+6
| | | | | | This reverts commit r218914 while I investigate some bots. llvm-svn: 218918
* DI: Fold constant arguments into a single MDStringDuncan P. N. Exon Smith2014-10-021-6/+6
| | | | | | | | | | | | | This patch addresses the first stage of PR17891 by folding constant arguments together into a single MDString. Integers are stringified and a `\0` character is used as a separator. Part of PR17891. Note: I've attached my testcases upgrade scripts to the PR. If I've just broken your out-of-tree testcases, they might help. llvm-svn: 218914
* Fix typos in comments, NFCRobin Morisset2014-08-291-1/+1
| | | | | | | | | | | | | | Summary: Just fixing comments, no functional change. Test Plan: N/A Reviewers: jfb Subscribers: mcrosier, llvm-commits Differential Revision: http://reviews.llvm.org/D5130 llvm-svn: 216784
* Avoid revocations when possible.Rafael Espindola2014-07-011-0/+19
| | | | | | | | This is a small targeted fix for pr20119. The code needs quiet a bit of refactoring and I added some FIXMEs about it, but I want to get the testcase passing first. llvm-svn: 212101
* Allow using .cfi_startproc without a leading symbol.Rafael Espindola2014-06-231-0/+14
| | | | | | This is possible now that we don't produce .eh symbols. This fixes pr19430. llvm-svn: 211502
* Introduce a Lit feature "debug_frame" and apply it to ↵NAKAMURA Takumi2014-06-221-0/+3
| | | | | | | | llvm/test/MC/ELF/cfi-version.ll. .debug_frame is not emitted for targeting Windows x64. llvm-svn: 211466
* Report error for non-zero data in .bssWeiming Zhao2014-06-221-0/+9
| | | | | | | | | | | | User may initialize a var with non-zero value and specify .bss section. E.g. : int a __attribute__((section(".bss"))) = 2; This patch converts an assertion to error report for better user experience. Differential Revision: http://reviews.llvm.org/D4199 llvm-svn: 211455
* Fix this test a little harder - use llc_dwarf to make sure we don'tEric Christopher2014-06-191-3/+3
| | | | | | try to execute it on windows. llvm-svn: 211298
* Relax this test a bit, we don't need the full contents of theEric Christopher2014-06-191-7/+2
| | | | | | frame section to match, just the version for this test. llvm-svn: 211293
* Emit DWARF3 call frame information when DWARF3+ debug info is requestedOliver Stannard2014-06-1920-55/+102
| | | | | | | | | | | | | | | | Currently, llvm always emits a DWARF CIE with a version of 1, even when emitting DWARF 3 or 4, which both support CIE version 3. This patch makes it emit the newer CIE version when we are emitting DWARF 3 or 4. This will not reduce compatibility, as we already emit other DWARF3/4 features, and is worth doing as the DWARF3 spec removed some ambiguities in the interpretation of call frame information. It also fixes a minor bug where the "return address" field of the CIE was encoded as a ULEB128, which is only valid when the CIE version is 3. There are no test changes for this, because (as far as I can tell) none of the platforms that we test have a return address register with a DWARF register number >127. llvm-svn: 211272
* Reduce verbiage of lit.local.cfg filesAlp Toker2014-06-092-4/+2
| | | | | | We can just split targets_to_build in one place and make it immutable. llvm-svn: 210496
* Re-enable ARM ELF testsAlp Toker2014-06-081-3/+3
| | | | | | r210408 inadvertently disabled them when X86 is not selected. llvm-svn: 210412
* test: move some tests into ARM directorySaleem Abdulrasool2014-06-083-0/+4
| | | | | | | | | | Rather than requiring ARM support for the ELF tests (which is odd), move the tests that require ARM into a subdirectory to use lit to disable them if the support is not present. Play this game to prevent disabling the ELF tests on the Windows build bots as they have caught issues in the past with interactions between various platforms. llvm-svn: 210408
* MC: make ELF .type handling more GNU AS compatibleSaleem Abdulrasool2014-06-084-0/+81
| | | | | | | | | | | | | | GAS documents the .type directive as having an optional comma following the key symbol name when using the STT_<TYPE_IN_UPPER_CASE> form. However, it treats the comma as optional in all cases. This makes the IAS support both forms of inputs. Furthermore, the prefixed forms take either the upper case name or the lower case alias. The tests are split into two separate sets as the hash character serves as a comment character on x86, which is tested in the second set by using arm-elf which uses the at symbol as a comment character. llvm-svn: 210407
* Move MCOptions that aren't shared between programs into their specificEric Christopher2014-05-211-1/+1
| | | | | | program and have them initialize the MCOptions struct explicitly. llvm-svn: 209321
* Fix pr19645.Rafael Espindola2014-05-032-1/+5
| | | | | | | | | | | | | | | | The fix itself is fairly simple: move getAccessVariant to MCValue so that we replace the old weak expression evaluation with the far more general EvaluateAsRelocatable. This then requires that EvaluateAsRelocatable stop when it finds a non trivial reference kind. And that in turn requires the ELF writer to look harder for weak references. Last but not least, this found a case where we were being bug by bug compatible with gas and accepting an invalid input. I reported pr19647 to track it. llvm-svn: 207920
* Record the DWARF version in MCContextOliver Stannard2014-05-011-3/+11
| | | | | | | Record the DWARF version in MCContext, and use it when emitting the dwarf version into the debug info. llvm-svn: 207739
* Move a testcase from ELF to ARM64, incorrectly placed in r207627.James Molloy2014-04-301-4/+0
| | | | llvm-svn: 207706
* Add a testcase for r207627.James Molloy2014-04-301-0/+4
| | | | llvm-svn: 207697
* ELFObjectWriter: deduplicate suffices in strtabHans Wennborg2014-04-3013-73/+94
| | | | | | | | | | | | | | | We already do this for shstrtab, so might as well do it for strtab. This extracts the string table building code into a separate class. The idea is to use it for other object formats too. I mostly wanted to do this for the general principle, but it does save a little bit on object file size. I tried this on a clang bootstrap and saved 0.54% on the sum of object file sizes (1.14 MB out of 212 MB for a release build). Differential Revision: http://reviews.llvm.org/D3533 llvm-svn: 207670
* Relax the test a bit.Rafael Espindola2014-04-301-24/+24
| | | | | | | It is not relevant where the symbol and section names are stored, just their values. llvm-svn: 207662
* Rename the test, it is testing the symver directive.Rafael Espindola2014-04-301-0/+0
| | | | llvm-svn: 207658
* Add an option for evaluating past symbols.Rafael Espindola2014-04-281-0/+59
| | | | | | | | | | | | | When evaluating an assembly expression for a relocation, we want to stop at MCSymbols that are in the symbol table, even if they are variables. This is needed since the semantics may require that the relocation use them. That is not the case when computing the value of a symbol in the symbol table. There are no relocations in this case and we have to keep going until we hit a section or find out that the expression doesn't have an assembly time value. llvm-svn: 207445
* Don't include an invalid symbol in the symbol table.Rafael Espindola2014-04-281-0/+3
| | | | | | | | | | | | The symbol table itself has no relocations, so it is not possible to represent things like a = undefined + 1 With the patch we just omit these variables. That matches the behaviour of the gnu assembler. llvm-svn: 207419
* List the entire symbol table in this test.Rafael Espindola2014-04-281-10/+66
| | | | | | | This will allow us to extend this test to show that other symbols don't show up in the symbol table. llvm-svn: 207418
* Produce an error instead of a crash in an expr we cannot represent.Rafael Espindola2014-04-281-0/+8
| | | | llvm-svn: 207414
* Handle _GLOBAL_OFFSET_TABLE_ in 64 bit mode.Rafael Espindola2014-04-211-0/+5
| | | | | | | | | With this MC is able to handle _GLOBAL_OFFSET_TABLE_ in 64 bit mode, which is needed for medium and large code models. This fixes pr19470. llvm-svn: 206793
* Compress debug sections only when beneficial.David Blaikie2014-04-181-14/+31
| | | | | | | | | Both ZLIB and the debug info compressed section header ("ZLIB" + the size of the uncompressed data) take some constant overhead so in some cases the compressed data is actually larger than the uncompressed data. In these cases, just don't compress or rename the section at all. llvm-svn: 206659
* Update the fragments of symbols in compressed sections.David Blaikie2014-04-181-1/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While unnamed relocations are already cached in side tables in ELFObjectWriter::RecordRelocation, symbols still need their fragments updated to refer to the newly compressed fragment (even if that fragment isn't big enough to fit the offset). Even though we only create temporary symbols in debug info sections this comes up in 32 bit builds where even temporary symbols in mergeable sections (such as debug_str) have to be emitted as named symbols. I tried a few other ways to do this but they all didn't work for various reasons: 1) Canonicalize the MCSymbolData in RecordRelocation, nulling out the Fragment (so it didn't have to be updated by CompressDebugSection). This doesn't work because some code relies on symbols having fragments to indicate that they're defined, I think. 2) Canonicalize the MCSymbolData in RecordRelocation to be "first fragment + absolute offset" so it would be cheaper to just test and update the fragment in CompressDebugSections. This doesn't work because the offset computed in RecordRelocation isn't that of the symbol's fragment, it's the passed in fragment (I haven't figured out what that fragment is - perhaps it's the location where the relocation is to be written). And if the fragment offset has to be computed only for this use we might as well just do it when we need to, in CompressDebugSection. I also added an assert to help catch this a bit more clearly, even though it is UB. The test case improvements would either assert fail and/or valgrind vail without the fix, even if they wouldn't necessarily fail the FileCheck output. llvm-svn: 206653
* Fix up MCFixup::getAccessVariant to handle unary expressions.Kaelyn Takata2014-04-141-0/+3
| | | | | | | | | | | | This allows correct relocations to be generated for a symbolic address that is being adjusted by a negative constant. Since r204294, such expressions have triggered undefined behavior when LLVM was built without assertions. Credit goes to Rafael for this patch; I'm submitting it on his behalf as he is on vacation this week. llvm-svn: 206192
* Reimplement debug info compression by compressing the whole section, rather ↵David Blaikie2014-04-101-8/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | than a fragment. To support compressing the debug_line section that contains multiple fragments (due, I believe, to variation in choices of line table encoding depending on the size of instruction ranges in the actual program code) we needed to support compressing multiple MCFragments in a single pass. This patch implements that behavior by mutating the post-relaxed and relocated section to be the compressed form of its former self, including renaming the section. This is a more flexible (and less invasive, to a degree) implementation that will allow for other features such as "use compression only if it's smaller than the uncompressed data". Compressing debug_frame would be a possible further extension to this work, but I've left it for now. The hurdle there is alignment sections - which might require going as far as to refactor MCAssembler.cpp:writeFragment to handle writing to a byte buffer or an MCObjectWriter (there's already a virtual call there, so it shouldn't add substantial compile-time cost) which could in turn involve refactoring MCAsmBackend::writeNopData to use that same abstraction... which involves touching all the backends. This would remove the limited handling of fragment writing seen in ELFObjectWriter.cpp:getUncompressedData which would be nice - but it's more invasive. I did discover that I (perhaps obviously) don't need to handle relocations when I rewrite the fragments - since the relocations have already been applied and computed (and stored into ELFObjectWriter::Relocations) by this stage (necessarily, because we need to have written any immediate values or assembly-time relocations into the data already before we compress it, which we have). The test case doesn't necessarily cover that in detail - I can add more test coverage if that's preferred. llvm-svn: 205990
* Revert debug info compression support.David Blaikie2014-04-101-0/+2
| | | | | | | | | | To support compression for debug_line and debug_frame a different approach is required. To simplify review, revert the old implementation and XFAIL the test case. New implementation to follow shortly. Reverts r205059 and r204958. llvm-svn: 205989
* X86MCAsmInfoGNUCOFF: Set PointerSize as 8 for targeting x64. It caused ↵NAKAMURA Takumi2014-04-081-1/+0
| | | | | | | DW_LNE_set_address was misemitted on x64. FIXME: I haven't investigate whether CalleeSaveStackSlotSize should be 8. llvm-svn: 205772
* Work around gold bug http://sourceware.org/PR16794.Rafael Espindola2014-04-022-3/+3
| | | | llvm-svn: 205416
OpenPOWER on IntegriCloud