summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC
Commit message (Collapse)AuthorAgeFilesLines
...
* [WebAssembly] Reorder symbol table to match MC orderNicholas Wilson2018-02-281-41/+40
| | | | | | | | This removes a TODO introduced in rL325860 Differential Revision: https://reviews.llvm.org/D43685 llvm-svn: 326334
* [WebAssembly] Remove DataSize from linking metadata sectionSam Clegg2018-02-271-9/+3
| | | | | | | | | | | Neither the linker nor the runtime need this information anymore. We were originally using this to model BSS size but the plan is now to use the segment metadata to allow for BSS segments. Differential Revision: https://reviews.llvm.org/D41366 llvm-svn: 326267
* [DebugInfo] Support DWARF v5 source code embedding extensionScott Linder2018-02-235-31/+92
| | | | | | | | | | | | | | | | | | | In DWARF v5 the Line Number Program Header is extensible, allowing values with new content types. In this extension a content type is added, DW_LNCT_LLVM_source, which contains the embedded source code of the file. Add new optional attribute for !DIFile IR metadata called source which contains source text. Use this to output the source to the DWARF line table of code objects. Analogously extend METADATA_FILE in Bitcode and .file directive in ASM to support optional source. Teach llvm-dwarfdump and llvm-objdump about the new values. Update the output format of llvm-dwarfdump to make room for the new attribute on file_names entries, and support embedded sources for the -source option in llvm-objdump. Differential Revision: https://reviews.llvm.org/D42765 llvm-svn: 325970
* Simplify a DEBUG statement to remove a set but not used variable in release ↵Eric Christopher2018-02-231-7/+4
| | | | | | builds. llvm-svn: 325959
* Shrink various scheduling tables by using narrower types.Benjamin Kramer2018-02-231-1/+1
| | | | | | 16 bits ought to be enough for everyone. This shrinks clang by ~1MB. llvm-svn: 325941
* [WebAssembly] Add first claass symbol table to wasm objectsSam Clegg2018-02-232-134/+162
| | | | | | | | | | | | | | | | | | | | This is combination of two patches by Nicholas Wilson: 1. https://reviews.llvm.org/D41954 2. https://reviews.llvm.org/D42495 Along with a few local modifications: - One change I made was to add the UNDEFINED bit to the binary format to avoid the extra byte used when writing data symbols. Although this bit is redundant for other symbols types (i.e. undefined can be implied if a function or global is a wasm import) - I prefer to be explicit and consistent and not have derived flags. - Some field renaming. - Some reverting of unrelated minor changes. - No test output differences. Differential Revision: https://reviews.llvm.org/D43147 llvm-svn: 325860
* [DWARFv5] Turn an assert into a diagnostic. Hand-coded assembler filesPaul Robinson2018-02-225-37/+48
| | | | | | | | should not trigger assertions. Differential Revision: https://reviews.llvm.org/D43152 llvm-svn: 325831
* [MC] Don't crash on modulo by zero (PR35650)Simon Pilgrim2018-02-221-2/+5
| | | | | | | | Extension to D12776, handle modulo by zero in the same way we handle divide by zero. Differential Revision: https://reviews.llvm.org/D43631 llvm-svn: 325810
* [MC] - Don't crash on unclosed frame.George Rimar2018-02-201-3/+4
| | | | | | | | | | | | | | | | llvm-mc can crash when there is cfi_startproc without cfi_end_proc: .text .globl foo foo: .cfi_startproc Testcase shows the issue, patch fixes it. Differential revision: https://reviews.llvm.org/D43456 llvm-svn: 325564
* [WebAssembly] MC: Make explicit our current lack of support for relocations ↵Sam Clegg2018-02-161-2/+17
| | | | | | | | | | | | against unnamed temporary symbols. Add an explicit check before looking up symbol in SymbolIndices. This was previously silently succeeding and returning zero for such unnamed temporaries. Differential Revision: https://reviews.llvm.org/D43365 llvm-svn: 325367
* Store defined macros in MCContext.Rafael Espindola2018-02-141-51/+5
| | | | | | | | | | | | | | | So that macros defined in inline assembly blocks are available to the whole file. This provides a consistent behavior with other assembly directives, since equations for example are already preserved between inline assembly blocks. PR: 36110 Patch by Roger! llvm-svn: 325139
* [WebAssembly] MC: Remove redundant struct typesSam Clegg2018-02-121-52/+35
| | | | | | Differential Revision: https://reviews.llvm.org/D43210 llvm-svn: 324957
* Test commit: reformat commentNicholas Wilson2018-02-121-3/+3
| | | | llvm-svn: 324889
* [MC] Issue error message when data region is not terminatedGerolf Hoflehner2018-02-121-1/+7
| | | | llvm-svn: 324868
* Use assembler expressions to lay out the EH LSDA.Rafael Espindola2018-02-093-15/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rely on the assembler to finalize the layout of the DWARF/Itanium exception-handling LSDA. Rather than calculate the exact size of each thing in the LSDA, use assembler directives: To emit the offset to the TTBase label: .uleb128 .Lttbase0-.Lttbaseref0 .Lttbaseref0: To emit the size of the call site table: .uleb128 .Lcst_end0-.Lcst_begin0 .Lcst_begin0: ... call site table entries ... .Lcst_end0: To align the type info table: ... action table ... .balign 4 .long _ZTIi .long _ZTIl .Lttbase0: Using assembler directives simplifies the compiler and allows switching the encoding of offsets in the call site table from udata4 to uleb128 for a large code size savings. (This commit does not change the encoding.) The combination of the uleb128 followed by a balign creates an unfortunate dependency cycle that the assembler must sometimes resolve either by padding an LEB or by inserting zero padding before the type table. See PR35809 or GNU as bug 4029. Patch by Ryan Prichard! llvm-svn: 324749
* [ELF] Print the .type assembly directive correctly for STT_NOTYPEOliver Stannard2018-02-091-1/+1
| | | | | | | | | | The llvm assembly parser and gas both accept "@notype" in the .type assembly directive, but we were printing it as "@no_type", which isn't accepted by either assembler. Differential revision: https://reviews.llvm.org/D43116 llvm-svn: 324731
* [DWARFv5] Emit .debug_line_str (in a non-DWO file).Paul Robinson2018-02-063-23/+124
| | | | | | | | This should enable the linker to do string-pooling of path names. Differential Revision: https://reviews.llvm.org/D42707 llvm-svn: 324393
* [MC] Fix assembler infinite loop on EH table using LEB padding.Rafael Espindola2018-02-011-2/+6
| | | | | | | | | | | | | Fix the infinite loop reported in PR35809. It can occur with GCC-style EH table assembly, where the compiler relies on the assembler to calculate the offsets in the EH table. Also see https://sourceware.org/bugzilla/show_bug.cgi?id=4029 for the equivalent issue in the GNU assembler. Patch by Ryan Prichard! llvm-svn: 323934
* [WebAssembly] MC: Remove unused code for handling of wasm globalsSam Clegg2018-01-311-79/+9
| | | | | | | | | | | | | | | For now, we are not using wasm globals, except for modeling of the stack points. Alos, factor out common struct WasmGlobalType, which matches the name for that tuple in the Wasm spec and rename methods to "isBindingGlobal", "isTypeGlobal" to avoid ambiguity. Patch by Nicholas Wilson! Differential Revision: https://reviews.llvm.org/D42750 llvm-svn: 323901
* [WebAssembly] MC: Resolve aliases when creating provisional table entriesSam Clegg2018-01-311-31/+25
| | | | | | | | | | | | | | | | This change is useful for the upcoming addition of the symbol table (D41954) since in that world aliases for given function all share the same function index. This change does not effect lld because it essentially ignores the wasm "table". The table exists only to the wasm objects will validate and disassembly meaningfully. Patch by Nicholas Wilson! Differential Revision: https://reviews.llvm.org/D42095 llvm-svn: 323900
* [WebAssembly] Remove some unused code and tidy logging. NFC.Sam Clegg2018-01-311-14/+7
| | | | | | | | Patch by Nicholas Wilson! Differential Revision: https://reviews.llvm.org/D42540 llvm-svn: 323846
* Turn two static functions into methods, to simplify calling them.Paul Robinson2018-01-301-14/+6
| | | | llvm-svn: 323821
* CodeGen: support an extension to pass linker options on ELFSaleem Abdulrasool2018-01-302-0/+4
| | | | | | | | | | | | | | | | | | Introduce an extension to support passing linker options to the linker. These would be ignored by older linkers, but newer linkers which support this feature would be able to process the linker. Emit a special discarded section `.linker-option`. The content of this section is a pair of strings (key, value). The key is a type identifier for the parameter. This allows for an argument free parameter that will be processed by the linker with the value being the parameter. As an example, `lib` identifies a library to be linked against, traditionally the `-l` argument for Unix-based linkers with the parameter being the library name. Thanks to James Henderson, Cary Coutant, Rafael Espinolda, Sean Silva for the valuable discussion on the design of this feature. llvm-svn: 323783
* [WebAssembly] Remove "name" section of object wasm object filesSam Clegg2018-01-231-33/+0
| | | | | | | | | | | | | LLD is unaffected, no changes needed there. LLD continues to write out a name section, using the symbol names. Fixes: https://github.com/WebAssembly/tool-conventions/issues/37 Patch by Nicholas Wilson! Differential Revision: https://reviews.llvm.org/D42425 llvm-svn: 323234
* [WebAssembly] Store function index rather than table index in TABLE_INDEX ↵Sam Clegg2018-01-231-59/+53
| | | | | | | | | | | | | | | | | | | | | relocations Relocations of type R_WEBASSEMBLY_TABLE_INDEX represent places where the table index for a given function is needed. While the value stored in this location is a table index, the index in the relocation entry itself is a function index (the index of the function which is to be called indirectly). This is how is was spec'd originally but the LLVM implementation didn't do this. This makes things a little simpler in the linker since the table in the input file can essentially be ignored that the output table can be created purely based on these relocations. Patch by Nicholas Wilson! Differential Revision: https://reviews.llvm.org/D42080 llvm-svn: 323165
* [WebAssembly] MC: Start table at offset 1 rather than 0Sam Clegg2018-01-191-2/+6
| | | | | | | | | | | | | | | Summary: For consistency with the output of lld. This is useful in runnable binaries as can them be sure the null function pointer will never be a valid argument call_indirect. Subscribers: jfb, dschuff, jgravelle-google, aheejin, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D42284 llvm-svn: 322978
* [CodeView] Add line numbers for inlined call sitesReid Kleckner2018-01-181-3/+27
| | | | | | | | We did this for inline call site line tables, but we hadn't done it for regular function line tables yet. This patch copies that logic from encodeInlineLineTable. llvm-svn: 322905
* [CodeView] Sink complex inline functions to .cpp file, NFCReid Kleckner2018-01-181-0/+45
| | | | | | I'm cleaning up this code before I attempt to fix a line table bug. llvm-svn: 322904
* [WebAssembly] Remove debug names from symbol tableSam Clegg2018-01-171-14/+11
| | | | | | | | | | | | | | | | | | | | | | | | | Get rid of DEBUG_FUNCTION_NAME symbols. When we actually debug data, maybe we'll want somewhere to put it... but having a symbol that just stores the name of another symbol seems odd. It means you have multiple Symbols with the same name, one containing the actual function and another containing the name! Store the names in a vector on the WasmObjectFile when reading them in. Also stash them on the WasmFunctions themselves. The names are //not// "symbol names" or aliases or anything, they're just the name that a debugger should show against the function body itself. NB. The WasmObjectFile stores them so that they can be exported in the YAML losslessly, and hence the tests can be precise. Enforce that the CODE section has been read in before reading the "names" section. Requires minor adjustment to some tests. Patch by Nicholas Wilson! Differential Revision: https://reviews.llvm.org/D42075 llvm-svn: 322741
* [WebAssembly] Make WasmObjectWriter's destructor public; NFCDan Gohman2018-01-151-5/+2
| | | | | | This fixes the FIXME introduced in r315327. llvm-svn: 322490
* [DWARFv5] CodeGen support for MD5 file checksumsPaul Robinson2018-01-121-0/+4
| | | | | | | | | | Pass MD5 checksums through from IR to assembly/object files. After this, getting Clang to compute the MD5 should be the last step to supporting MD5 in the DWARF v5 line table header. Differential Revision: https://reviews.llvm.org/D41926 llvm-svn: 322391
* MC: Remove redundant `SetUsed` arguments in MCSymbol methodsSam Clegg2018-01-121-1/+1
| | | | | | | | | | | We can probably take this a step further since the only user of the isUsed flag is AsmParser it should probably be doing this explicitly. For now this is a step in the right direction though. Differential Revision: https://reviews.llvm.org/D41971 llvm-svn: 322386
* [WebAssembly] MC: Remove SetUsed argument when calling MCSymbol::isDefined et alSam Clegg2018-01-111-7/+7
| | | | | | | | | | | | | Summary: This argument (the isUsed flag) seems to only be relevant when parsing. Other calls sites such as these don't seem to ever use it. Subscribers: jfb, dschuff, jgravelle-google, aheejin, sunfish Differential Revision: https://reviews.llvm.org/D41970 llvm-svn: 322332
* [WebAssemlby] MC: Don't write COMDAT symbols as global importsSam Clegg2018-01-112-2/+5
| | | | | | | | This was causing undefined references at link time in lld. Differential Revision: https://reviews.llvm.org/D41959 llvm-svn: 322309
* Reland "Emit Function IDs table for Control Flow Guard"Adrian McCarthy2018-01-095-1/+43
| | | | | | | | | | | | | | | | | Adds option /guard:cf to clang-cl and -cfguard to cc1 to emit function IDs of functions that have their address taken into a section named .gfids$y for compatibility with Microsoft's Control Flow Guard feature. The original patch didn't have the lit.local.cfg file that restricts the new test to x86, thus the new test was failing on the non-x86 bots. Differential Revision: https://reviews.llvm.org/D40531 The reverts r322008, which was a revert of r322005. This reverts commit a05b89f9aca70597dc79fe97bc49b50b51f525ba. llvm-svn: 322136
* [WebAssembly] Add COMDAT supportSam Clegg2018-01-091-5/+46
| | | | | | | | | | | | | | This adds COMDAT support to the Wasm object-file format. Spec: https://github.com/WebAssembly/tool-conventions/pull/31 Corresponding LLD change: https://bugs.llvm.org/show_bug.cgi?id=35533, and D40845 Patch by Nicholas Wilson Differential Revision: https://reviews.llvm.org/D40844 llvm-svn: 322135
* [DWARFv5] MC support for MD5 file checksumsPaul Robinson2018-01-095-19/+68
| | | | | | | Extend .file directive syntax to allow specifying an MD5 checksum for the source file. Emit the checksums in DWARF v5 line tables. llvm-svn: 322134
* Use a MCExpr for the size of MCFillFragment.Rafael Espindola2018-01-093-16/+18
| | | | | | | This allows the size to be found during ralaxation. This fixes pr35858. llvm-svn: 322131
* [WebAssembly] MC: Use zero for provisional value of undefined symbolsSam Clegg2018-01-091-2/+2
| | | | | | | | | | This is more in line with what happens in the final executable when symbols are undefined (i.e. weak references). Differential Revision: https://reviews.llvm.org/D41840 llvm-svn: 322130
* Don't create MCFillFragment directly.Rafael Espindola2018-01-092-32/+15
| | | | | | Instead use higher level APIs that take care of most bookkeeping. llvm-svn: 322123
* Inline a emitFill variant that is only used once. NFC.Rafael Espindola2018-01-093-21/+7
| | | | llvm-svn: 322111
* Make one of the emitFill methods non virtual. NFC.Rafael Espindola2018-01-093-21/+8
| | | | | | This is just preparatory work to fix PR35858. llvm-svn: 322108
* Revert "Emit Function IDs table for Control Flow Guard"Adrian McCarthy2018-01-085-43/+1
| | | | | | | | | | The new test fails on the Hexagon bot. Reverting while I investigate. This reverts https://reviews.llvm.org/rL322005 This reverts commit b7e0026b4385180c378edc658ec91a39566f2942. llvm-svn: 322008
* Emit Function IDs table for Control Flow GuardAdrian McCarthy2018-01-085-1/+43
| | | | | | | | | | Adds option /guard:cf to clang-cl and -cfguard to cc1 to emit function IDs of functions that have their address taken into a section named .gfids$y for compatibility with Microsoft's Control Flow Guard feature. Differential Revision: https://reviews.llvm.org/D40531 llvm-svn: 322005
* [MC] - Stop ignoring invalid meta data symbols.George Rimar2017-12-311-1/+1
| | | | | | | | | | | Previously llvm-mc would silently accept code from testcase, that contains invalid metadata symbol in section declaration. Patch fixes the issue. Differential revision: https://reviews.llvm.org/D41641 llvm-svn: 321599
* [MC] - Disallow invalid section groups declarations.George Rimar2017-12-251-2/+2
| | | | | | | | | | | | This fixes parseGroup() so that it always sets error condition on error. Previously it was not done, because parseIdentifier looks never do that, assuming that caller should do it if he wants to. So previously cases from test were silently accepted and produced broken output. Differential revision: https://reviews.llvm.org/D41559 llvm-svn: 321439
* Make helpers static. No functionality change.Benjamin Kramer2017-12-241-1/+1
| | | | llvm-svn: 321425
* [MC] - Teach llvm-mc to handle comdats whose names are numbers.George Rimar2017-12-241-1/+5
| | | | | | | | | | | | | | | Currently llvm-mc ignores COMDATs whose names are numbers, for example following code: .section .foo,"G",@progbits,123,comdat would produce no COMDATs at all. Patch fixes the issue. Differential revision: https://reviews.llvm.org/D41552 llvm-svn: 321419
* [WebAssembly] MC: Fix for address taken aliasesSam Clegg2017-12-221-39/+30
| | | | | | | | | | | | | | Previously, taking the address for an alias would result in: "Symbol not found in table index space" Increase test coverage for weak aliases. This code should be more efficient too as it avoids building the `IsAddressTaken` set. Differential Revision: https://reviews.llvm.org/D41510 llvm-svn: 321384
* [WebAssembly] Fix local references to weak aliasesSam Clegg2017-12-211-2/+2
| | | | | | | | | | | | | | | | When weak aliases are used with in same translation unit we need to be able to directly reference to alias and not just the thing it is aliases. We do this by defining both a wasm import and a wasm export in this case that result in a single Symbol. This change is a partial revert of rL314245. A corresponding lld change address the previous issues we had with this. See: https://github.com/WebAssembly/tool-conventions/issues/34 Differential Revision: https://reviews.llvm.org/D41472 llvm-svn: 321242
OpenPOWER on IntegriCloud