summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC
Commit message (Collapse)AuthorAgeFilesLines
* [WebAssembly] Update relocation names to match specSam Clegg2017-09-011-11/+11
| | | | | | | | Summary: See https://github.com/WebAssembly/tool-conventions/blob/master/Linking.md Differential Revision: https://reviews.llvm.org/D37385 llvm-svn: 312342
* Untabify.NAKAMURA Takumi2017-08-281-4/+4
| | | | llvm-svn: 311875
* [X86AsmParser] Refactoring, (almost) NFC.Coby Tayree2017-08-241-14/+15
| | | | | | | | | | Some refactoring to X86AsmParser, mostly regarding the way rewrites are conducted. Mainly, we try to concentrate all the rewrite effort under one hood, so it'll hopefully be less of a mess and easier to maintain and understand. naturally, some frontend tests were affected: D36794 Differential Revision: https://reviews.llvm.org/D36793 llvm-svn: 311639
* [AsmParser] Recommit: Hash is not a comment on some targetsOliver Stannard2017-08-212-18/+0
| | | | | | | | | | | | | | | Re-committing after r311325 fixed an unintentional use of '#' comments in clang. The '#' token is not a comment for all targets (on ARM and AArch64 it marks an immediate operand), so we shouldn't treat it as such. Comments are already converted to AsmToken::EndOfStatement by AsmLexer::LexLineComment, so this check was unnecessary. Differential Revision: https://reviews.llvm.org/D36405 llvm-svn: 311326
* [Triple] Add isThumb and isARM functions.Florian Hahn2017-08-121-2/+1
| | | | | | | | | | | | | | | | | | | Summary: isThumb returns true for Thumb triples (little and big endian), isARM returns true for ARM triples (little and big endian). There are a few more checks using arm/thumb that are not covered by those functions, e.g. that the architecture is either ARM or Thumb (little endian) or ARM/Thumb little endian only. Reviewers: javed.absar, rengolin, kristof.beyls, t.p.northover Reviewed By: rengolin Subscribers: llvm-commits, aemerson Differential Revision: https://reviews.llvm.org/D34682 llvm-svn: 310781
* Revert "[AsmParser] Hash is not a comment on some targets"Ahmed Bougacha2017-08-102-0/+18
| | | | | | | | This reverts commit r310457. It causes clang-produced IR to fail llvm codegen. llvm-svn: 310662
* [AsmParser] Hash is not a comment on some targetsOliver Stannard2017-08-092-18/+0
| | | | | | | | | | | | The '#' token is not a comment for all targets (on ARM and AArch64 it marks an immediate operand), so we shouldn't treat it as such. Comments are already converted to AsmToken::EndOfStatement by AsmLexer::LexLineComment, so this check was unnecessary. Differential Revision: https://reviews.llvm.org/D36405 llvm-svn: 310457
* Don't pass the code model to MCRafael Espindola2017-08-021-20/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | I was surprised to see the code model being passed to MC. After all, it assembles code, it doesn't create it. The one place it is used is in the expansion of .cfi directives to handle .eh_frame being more that 2gb away from the code. As far as I can tell, gnu assembler doesn't even have an option to enable this. Compiling a c file with gcc -mcmodel=large produces a regular looking .eh_frame. This is probably because in practice linker parse and recreate .eh_frames. In llvm this is used because the JIT can place the code and .eh_frame very far apart. Ideally we would fix the jit and delete this option. This is hard. Apart from confusion another problem with the current interface is that most callers pass CodeModel::Default, which is bad since MC has no way to map it to the target default if it actually needed to. This patch then replaces the argument with a boolean with a default value. The vast majority of users don't ever need to look at it. In fact, only CodeGen and llvm-mc use it and llvm-mc just to enable more testing. llvm-svn: 309884
* [AsmParser][GAS-compatibility] Ignore an empty 'p2align' directiveCoby Tayree2017-08-021-1/+8
| | | | | | | | | GAS ignores the aforementioned issue this patch aligns LLVM + throws in an appropriate warning Differential Revision: https://reviews.llvm.org/D36060 llvm-svn: 309841
* MC: simplify internal function call parameterSaleem Abdulrasool2017-07-291-30/+26
| | | | | | | | | | Rather than passing along most of the parameters, pass a reference to the MCDWARFrameInfo instead. This makes it easier to pass additional information about the frame to the checks. We need to keep the extra constructor for the Key around to allow the construction of the null and tombstone keys. NFC. llvm-svn: 309493
* MC: account for the return column in the CIE keySaleem Abdulrasool2017-07-291-8/+11
| | | | | | | | If the return column is different, we cannot coalesce the CIE across the FDEs. Add that to the key calculation. This ensures that we emit a separate CIE. llvm-svn: 309492
* MC: add support for cfi_return_columnSaleem Abdulrasool2017-07-284-10/+40
| | | | | | | | | This adds support for the CFI pseudo-op return_column. This specifies the frame table column which contains the return address. Addresses PR33953! llvm-svn: 309360
* MC: clang-format enumeration (NFC)Saleem Abdulrasool2017-07-281-29/+146
| | | | | | | This was hard to insert elements into. clang-format it so that it is easier. NFC. llvm-svn: 309359
* Simplify interface now that we don't need to pass IsPCRel. NFC.Rafael Espindola2017-07-115-16/+20
| | | | llvm-svn: 307734
* Fully fix the movw/movt addend.Rafael Espindola2017-07-111-5/+6
| | | | | | | | | | The issue is not if the value is pcrel. It is whether we have a relocation or not. If we have a relocation, the static linker will select the upper bits. If we don't have a relocation, we have to do it. llvm-svn: 307730
* [WebAssembly] Fix use of cast vs dyn_castSam Clegg2017-07-111-15/+7
| | | | | | Differential Revision: https://reviews.llvm.org/D35233 llvm-svn: 307612
* [WebAssembly] Use the correct size for MCFillFragmentSam Clegg2017-07-101-1/+1
| | | | | | | | | | | Summary: When implementing MCFillFragment, use the size of the fragment, rather than the size of the section. Patch by Dan Gohman Differential Revision: https://reviews.llvm.org/D35090 llvm-svn: 307565
* [WebAssembly] Support weak defined symbolsSam Clegg2017-07-071-65/+68
| | | | | | | | | | | | Model weakly defined symbols as symbols that are both exports and imported and marked as weak. Local references to the symbols refer to the import but the linker can resolve this to the weak export if not strong symbol is found at link time. Differential Revision: https://reviews.llvm.org/D35029 llvm-svn: 307348
* [WebAssembly] Fix types for address taken functionsSam Clegg2017-07-051-1/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D34966 llvm-svn: 307198
* [WebAssembly] MC: Don't generate extra types for weak aliasSam Clegg2017-07-051-0/+4
| | | | | | | | | | Previously we were generating a void(void) function type for a weak alias. Update the weak-alias test case to catch this. Differential Revision: https://reviews.llvm.org/D34734 llvm-svn: 307194
* Rename and adjust processFixupValue.Rafael Espindola2017-06-301-3/+3
| | | | | | | It was not processing any value. All that it ever did was force relocations, so name it shouldForceRelocation. llvm-svn: 306906
* [WebAssembly] Add data size and alignement to linking sectionSam Clegg2017-06-271-7/+17
| | | | | | | | | The overal size of the data section (including BSS) is otherwise not included in the wasm binary. Differential Revision: https://reviews.llvm.org/D34657 llvm-svn: 306459
* Simplify the processFixupValue interface. NFC.Rafael Espindola2017-06-241-2/+1
| | | | llvm-svn: 306202
* Remove redundant argument.Rafael Espindola2017-06-241-1/+1
| | | | llvm-svn: 306189
* ARM: move some logic from processFixupValue to applyFixup.Rafael Espindola2017-06-231-7/+9
| | | | | | | | | | | | processFixupValue is called on every relaxation iteration. applyFixup is only called once at the very end. applyFixup is then the correct place to do last minute changes and value checks. While here, do proper range checks again for fixup_arm_thumb_bl. We used to do it, but dropped because of thumb2. We now do it again, but use the thumb2 range. llvm-svn: 306177
* COFF: Produce an error on invalid pcrel relocs.Rafael Espindola2017-06-231-2/+2
| | | | | | | | | | X86_64 COFF only has support for 32 bit pcrel relocations. Produce an error on all others. Note that gnu as has extended the relocation values to support this. It is not clear if we should support the gnu extension. llvm-svn: 306082
* COFF: handle "undef - ." expressions.Rafael Espindola2017-06-231-11/+0
| | | | | | | This is another thing that the ELF implementation can do but is missing from COFF. llvm-svn: 306078
* Change creation of relative relocations on COFF.Rafael Espindola2017-06-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For whatever reason, when processing .globl foo foo: .data bar: .long foo-bar llvm-mc creates a relocation with the section: 0x0 IMAGE_REL_I386_REL32 .text This is different than when the relocation is relative from the beginning. For example, a file with call foo produces 0x0 IMAGE_REL_I386_REL32 foo I would like to refactor the logic for converting "foo - ." into a relative relocation so that it is shared with ELF. This is the first step and just changes the coff implementation to match what ELF (and COFF in the case of calls) does. llvm-svn: 306063
* [MC] Allow assembling .secidx and .secrel32 for undefined symbolsReid Kleckner2017-06-221-2/+4
| | | | | | | | | | | There's nothing incorrect about emitting such relocations against symbols defined in other objects. The code in EmitCOFFSec* was missing the visitUsedExpr part of MCStreamer::EmitValueImpl, so these symbols were not being registered with the object file assembler. This will be used to make reduced test cases for LLD. llvm-svn: 306057
* Simplify WinCOFFObjectWriter::recordRelocation.Rafael Espindola2017-06-221-14/+5
| | | | | | | | | It looks like that when this code was written recordRelocation could be called with A-B where A and B are in the same section. The expression evaluation logic these days makes sure those are folded, so some of this code was dead. llvm-svn: 306053
* [MC] Fix const qualifier warningEkaterina Vaartis2017-06-221-2/+2
| | | | llvm-svn: 306045
* MC: Fix dumping of MCFragment valuesSam Clegg2017-06-221-2/+4
| | | | | | | | | | Without this cast the "char" overload of operator<< is chosen and the values is output as an ascii rather than an integer. Differential Revision: https://reviews.llvm.org/D34486 llvm-svn: 306039
* Add a common error checking for some invalid expressions.Rafael Espindola2017-06-222-7/+13
| | | | | | | This refactors a bit of duplicated code and fixes an assertion failure on ELF. llvm-svn: 306035
* [WebAssembly] Cleanup WasmObjectWriter.cpp. NFCSam Clegg2017-06-211-78/+70
| | | | | | | | | | | - Use auto where appropriate - Use early return to reduce nesting - Remove stray comment line - Use C++ foreach over explicit iterator Differential Revision: https://reviews.llvm.org/D34477 llvm-svn: 305971
* Use a MutableArrayRef. NFC.Rafael Espindola2017-06-211-2/+2
| | | | llvm-svn: 305968
* Mark dump() methods as const. NFCSam Clegg2017-06-212-5/+5
| | | | | | | | | Add const qualifier to any dump() method where adding one was trivial. Differential Revision: https://reviews.llvm.org/D34481 llvm-svn: 305963
* Rename WinCOFFStreamer.cpp -> MCWinCOFFStreamer.cppSam Clegg2017-06-212-2/+2
| | | | | | | | | For consistency with other MC*Streamer.cpp files and the header file. Differential Revision: https://reviews.llvm.org/D34466 llvm-svn: 305952
* WasmObjectWriter.cpp: Tweak a comment line. [-Wdocumentation]NAKAMURA Takumi2017-06-201-1/+1
| | | | llvm-svn: 305777
* Fix unused function build error in lldSam Clegg2017-06-201-0/+2
| | | | | | | | | | | | The lld-x86_64-darwin13 is failing with: error: unused function 'operator<<' Wrap the declation in ifndef NDEBUG, which matches what is done in MipsELFObjectWriter.cpp. Differential Revision: https://reviews.llvm.org/D34384 llvm-svn: 305771
* [WebAssembly] Fix build failures introduced in r305769Sam Clegg2017-06-201-2/+1
| | | | | | | | | | | This fixes two build failures that only occur in certain configurations: - error: unused function 'operator<<' - error: control reaches end of non-void function Differential Revision: https://reviews.llvm.org/D34382 llvm-svn: 305770
* [WebAssembly] Add support for weak symbols in the binary formatSam Clegg2017-06-202-46/+135
| | | | | | | | | | | This also introduces the updated format for the "linking" section which can represent extra symbol information. See: https://github.com/WebAssembly/tool-conventions/pull/10 Differential Revision: https://reviews.llvm.org/D34019 llvm-svn: 305769
* [WebAssembly] Use __stack_pointer global when writing wasm binarySam Clegg2017-06-161-2/+6
| | | | | | | | | | | | | | | | | | This ensures that symbolic relocations are generated for stack pointer manipulations. These relocations are of type R_WEBASSEMBLY_GLOBAL_INDEX_LEB. This change also adds support for reading relocations of this type in WasmObjectFile.cpp. Since its a globally imported symbol this does mean that the get_global/set_global instruction won't be valid until the objects are linked that global used in no longer an imported global. Differential Revision: https://reviews.llvm.org/D34172 llvm-svn: 305616
* MC, Object: Reserve a section type, SHT_LLVM_ODRTAB, for the ODR table.Peter Collingbourne2017-06-142-0/+4
| | | | | | | | | | | | | | This is part of the ODR checker proposal: http://lists.llvm.org/pipermail/llvm-dev/2017-June/113820.html Per discussion on the gnu-gabi mailing list [1] the section type range 0x6fff4c00..0x6fff4cff is reserved for LLVM. [1] https://sourceware.org/ml/gnu-gabi/2017-q2/msg00030.html Differential Revision: https://reviews.llvm.org/D33978 llvm-svn: 305407
* [WebAssembly] Cleanup WebAssemblyWasmObjectWriterSam Clegg2017-06-131-4/+5
| | | | | | Differential Revision: https://reviews.llvm.org/D34131 llvm-svn: 305316
* [WebAssembly] MC: Fix value of R_WEBASSEMBLY_TABLE_INDEX relocationsSam Clegg2017-06-121-14/+20
| | | | | | | | | | | | | Previously we were writing the value function index space value but for these types of relocations we want to be writing the table element index space value. Add a test case for these relocation types that fails without this change. Differential Revision: https://reviews.llvm.org/D33962 llvm-svn: 305253
* [MC] Fix compiler crash in AsmParser::LexNirav Dave2017-06-091-2/+2
| | | | | | | | | | | | | | | | When an empty comment is present in an assembly file, the compiler will crash because it checks the first character for '\n' or '\r'. The fix consists of also checking if the string is empty before accessing the *front* method of the StringRef. A test is included for the x86 target, but this issue is reproducible with other targets as well. Patch by Alexandru Guduleasa! Reviewers: niravd, grosbach, llvm-commits Reviewed By: niravd Differential Revision: https://reviews.llvm.org/D33993 llvm-svn: 305077
* sink DebugCompressionType into MC for exposing to clangSaleem Abdulrasool2017-06-091-6/+10
| | | | | | | | | | | | | | This is a preparatory change to expose the debug compression style to clang. It requires exposing the enumeration and passing the actual value through to the backend from the frontend in actual value form rather than a boolean that selects the GNU style of debug info compression. Minor tweak to the ELF Object Writer to use a variable for re-used values. Add an assertion that debug information format is one of the two currently known types if debug information is being compressed. llvm-svn: 305038
* [MachO] Fix codegen of alias of alias.Evgeniy Stepanov2017-06-081-0/+4
| | | | | | Fixes PR33316. llvm-svn: 305012
* Move Object format code to lib/BinaryFormat.Zachary Turner2017-06-0723-24/+25
| | | | | | | | | | | | This creates a new library called BinaryFormat that has all of the headers from llvm/Support containing structure and layout definitions for various types of binary formats like dwarf, coff, elf, etc as well as the code for identifying a file from its magic. Differential Revision: https://reviews.llvm.org/D33843 llvm-svn: 304864
* [WebAssembly] MC: Refactor relocation handlingSam Clegg2017-06-061-151/+94
| | | | | | | | | | | | | The change cleans up and unifies the handling of relocation entries in WasmObjectWriter. Type index relocation no longer need to be handled separately. The only externally visible change should be that type index relocations are no longer grouped at the end. Differential Revision: https://reviews.llvm.org/D33918 llvm-svn: 304816
OpenPOWER on IntegriCloud