summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-mc
Commit message (Collapse)AuthorAgeFilesLines
...
* Provide support for preserving assembly commentsNirav Dave2016-07-111-0/+5
| | | | | | | | | | | | | | | | | Preserve assembly comments from input in output assembly and flags to toggle property. This is on by default for inline assembly and off in llvm-mc. Parsed comments are emitted immediately before an EOL which generally places them on the expected line. Reviewers: rtrieu, dwmw2, rnk, majnemer Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D20020 llvm-svn: 275058
* Change the default of -relax-relocations.Rafael Espindola2016-06-171-3/+3
| | | | | | | | | | llvm-mc is a developer tool, as such it make sense for it to use new features by default. This doesn't change the user facing clang, which still defaults to non relaxable relocations. llvm-svn: 273014
* Run clang-tidy's performance-unnecessary-copy-initialization over LLVM.Benjamin Kramer2016-06-121-1/+1
| | | | | | No functionality change intended. llvm-svn: 272516
* Search for llvm-symbolizer binary in the same directory as argv[0], beforeRichard Smith2016-06-091-1/+1
| | | | | | | looking for it along $PATH. This allows installs of LLVM tools outside of $PATH to find the symbolizer and produce pretty backtraces if they crash. llvm-svn: 272232
* Move RelaxELFRel out to llvm-mc.Rafael Espindola2016-05-291-0/+6
| | | | llvm-svn: 271160
* Recommit 270977 - [llvm-mc] - Teach llvm-mc to generate zlib styled ↵George Rimar2016-05-271-5/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | compression sections. Fix: updated clang code which was not updated by mistake. Original commit message: [llvm-mc] - Teach llvm-mc to generate zlib styled compression sections. This patch is strongly based on previously reverted D20331. (because of gnuutils < 2.26 does not support compressed debug sections in non zlib-gnu style) Difference that this patch supports both zlib and zlib-gnu styles. -compress-debug-sections option now supports next values: -compress-debug-sections=zlib-gnu -compress-debug-sections=zlib -compress-debug-sections=none Previously specifying -compress-debug-sections enabled zlib-gnu compression, so anyone can put "-compress-debug-sections=zlib-gnu" to restore the behavior that was before this patch for case when compression was enabled. Differential revision: http://reviews.llvm.org/D20676 llvm-svn: 270987
* Revert r270977 ([llvm-mc] - Teach llvm-mc to generate zlib styled ↵George Rimar2016-05-271-14/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | compression sections.) It broke buildbot: http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/13585/steps/build/logs/stdio Initial commit message: [llvm-mc] - Teach llvm-mc to generate zlib styled compression sections. This patch is strongly based on previously reverted D20331. (because of gnuutils < 2.26 does not support compressed debug sections in non zlib-gnu style) Difference that this patch supports both zlib and zlib-gnu styles. -compress-debug-sections option now supports next values: -compress-debug-sections=zlib-gnu -compress-debug-sections=zlib -compress-debug-sections=none Previously specifying -compress-debug-sections enabled zlib-gnu compression, so anyone can put "-compress-debug-sections=zlib-gnu" to restore the behavior that was before this patch for case when compression was enabled. Differential revision: http://reviews.llvm.org/D20676 llvm-svn: 270978
* [llvm-mc] - Teach llvm-mc to generate zlib styled compression sections.George Rimar2016-05-271-5/+14
| | | | | | | | | | | | | | | | | | | | This patch is strongly based on previously reverted D20331. (because of gnuutils < 2.26 does not support compressed debug sections in non zlib-gnu style) Difference that this patch supports both zlib and zlib-gnu styles. -compress-debug-sections option now supports next values: -compress-debug-sections=zlib-gnu -compress-debug-sections=zlib -compress-debug-sections=none Previously specifying -compress-debug-sections enabled zlib-gnu compression, so anyone can put "-compress-debug-sections=zlib-gnu" to restore the behavior that was before this patch for case when compression was enabled. Differential revision: http://reviews.llvm.org/D20676 llvm-svn: 270977
* Don't pass a Reloc::Model to MC.Rafael Espindola2016-05-181-15/+3
| | | | | | | | | | | | MC only needs to know if the output is PIC or not. It never has to decide about creating GOTs and PLTs for example. The only thing that MC itself uses this information for is expanding "macros" in sparc and mips. The rest I am pretty sure could be moved to CodeGen. This is a cleanup and isolates the code from future changes to Reloc::Model. llvm-svn: 269909
* MC: Don't access the filesystem in MCContext's constructorJustin Bogner2016-03-221-0/+6
| | | | | | | | | | | | | | MCContext shouldn't be accessing the filesystem - that's a gross layering violation and makes it awkward to use as a library or in a daemon where it may not even be allowed filesystem access. The CWD lookup here is normally redundant anyway, since the calling context either also looks up the CWD or sets this to something more specific. Here, we fix up the one caller that doesn't already set up a debug compilation dir and make it clear that the responsibility for such set up is in the users of MCContext. llvm-svn: 264109
* Move MCTargetAsmParser.h to llvm/MC/MCParser where it belongs.Benjamin Kramer2016-01-271-1/+1
| | | | llvm-svn: 258917
* Remove autoconf supportChris Bieneman2016-01-261-17/+0
| | | | | | | | | | | | | | | | Summary: This patch is provided in preparation for removing autoconf on 1/26. The proposal to remove autoconf on 1/26 was discussed on the llvm-dev thread here: http://lists.llvm.org/pipermail/llvm-dev/2016-January/093875.html "I felt a great disturbance in the [build system], as if millions of [makefiles] suddenly cried out in terror and were suddenly silenced. I fear something [amazing] has happened." - Obi Wan Kenobi Reviewers: chandlerc, grosbach, bob.wilson, tstellarAMD, echristo, whitequark Subscribers: chfast, simoncook, emaste, jholewinski, tberghammer, jfb, danalbert, srhines, arsenm, dschuff, jyknight, dsanders, joker.eph, llvm-commits Differential Revision: http://reviews.llvm.org/D16471 llvm-svn: 258861
* Reflect the MC/MCDisassembler split on the include/ level.Benjamin Kramer2016-01-261-1/+1
| | | | | | No functional change, just moving code around. llvm-svn: 258818
* [MC, COFF] Support link /incremental conditionallyDavid Majnemer2015-12-211-3/+4
| | | | | | | | | | | | | | | | Today, we always take into account the possibility that object files produced by MC may be consumed by an incremental linker. This results in us initialing fields which vary with time (TimeDateStamp) which harms hermetic builds (e.g. verifying a self-host went well) and produces sub-optimal code because we cannot assume anything about the relative position of functions within a section (call sites can get redirected through incremental linker thunks). Let's provide an MCTargetOption which controls this behavior so that we can disable this functionality if we know a-priori that the build will not rely on /incremental. llvm-svn: 256203
* Fix some Clang-tidy modernize warnings, other minor fixes.Eugene Zelenko2015-11-041-2/+3
| | | | | | | | Fixed warnings are: modernize-use-override, modernize-use-nullptr and modernize-redundant-void-arg. Differential revision: http://reviews.llvm.org/D14312 llvm-svn: 252087
* Revert r247692: Replace Triple with a new TargetTuple in MCTargetDesc/* and ↵Daniel Sanders2015-09-151-4/+4
| | | | | | | | related. NFC. Eric has replied and has demanded the patch be reverted. llvm-svn: 247702
* Re-commit r247683: Replace Triple with a new TargetTuple in MCTargetDesc/* ↵Daniel Sanders2015-09-151-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | and related. NFC. Summary: This is the first patch in the series to migrate Triple's (which are ambiguous) to TargetTuple's (which aren't). For the moment, TargetTuple simply passes all requests to the Triple object it holds. Once it has replaced Triple, it will start to implement the interface in a more suitable way. This change makes some changes to the public C++ API. In particular, InitMCSubtargetInfo(), createMCRelocationInfo(), and createMCSymbolizer() now take TargetTuples instead of Triples. The other public C++ API's have been left as-is for the moment to reduce patch size. This commit also contains a trivial patch to clang to account for the C++ API change. Thanks go to Pavel Labath for fixing LLDB for me. Reviewers: rengolin Subscribers: jyknight, dschuff, arsenm, rampitec, danalbert, srhines, javed.absar, dsanders, echristo, emaste, jholewinski, tberghammer, ted, jfb, llvm-commits, rengolin Differential Revision: http://reviews.llvm.org/D10969 llvm-svn: 247692
* Revert r247684 - Replace Triple with a new TargetTuple ...Daniel Sanders2015-09-151-4/+4
| | | | | | LLDB needs to be updated in the same commit. llvm-svn: 247686
* Replace Triple with a new TargetTuple in MCTargetDesc/* and related. NFC.Daniel Sanders2015-09-151-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This is the first patch in the series to migrate Triple's (which are ambiguous) to TargetTuple's (which aren't). For the moment, TargetTuple simply passes all requests to the Triple object it holds. Once it has replaced Triple, it will start to implement the interface in a more suitable way. This change makes some changes to the public C++ API. In particular, InitMCSubtargetInfo(), createMCRelocationInfo(), and createMCSymbolizer() now take TargetTuples instead of Triples. The other public C++ API's have been left as-is for the moment to reduce patch size. This commit also contains a trivial patch to clang to account for the C++ API change. Reviewers: rengolin Subscribers: jyknight, dschuff, arsenm, rampitec, danalbert, srhines, javed.absar, dsanders, echristo, emaste, jholewinski, tberghammer, ted, jfb, llvm-commits, rengolin Differential Revision: http://reviews.llvm.org/D10969 llvm-svn: 247683
* [llvm-mc] Better error handling in ENOENT case + test.Davide Italiano2015-09-141-6/+1
| | | | | | | | | | | | | This is a follow up to r247518. As a general note, I think we could do a much better job testing for error conditions in tools. I already anticipated in a previous mail, but while implementing this I noticed that the code coverage we have for error checking is pretty low. I can arbitrarily remove checks from several tools and the suite still passes. Differential Revision: http://reviews.llvm.org/D12846 llvm-svn: 247582
* [llvm-mc] More meaningful error if input file doesn't exist.Davide Italiano2015-09-131-0/+5
| | | | | | | | | Before we just printed on stderr the program name. Now at least we print the name of the file that doesn't exist. There's probably room for improvement of error handling in llvm-mc (and the tools in general), but still this is a step forward. llvm-svn: 247518
* Use named temporaries for directional labels.Rafael Espindola2015-06-171-0/+3
| | | | | | | | | | Directional labels can show up in symbol tables (and we have a llvm-mc test for that). Given that, we need to make sure they are named. With that out of the way, use setUseNamesOnTempLabels in llvm-mc so that it too benefits from the memory saving. llvm-svn: 239914
* Recommit r239721: Replace string GNU Triples with llvm::Triple in ↵Daniel Sanders2015-06-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | InitMCObjectFileInfo. NFC. Summary: This affects other tools so the previous C++ API has been retained as a deprecated function for the moment. Clang has been updated with a trivial patch (not covered by the pre-commit review) to avoid breaking -Werror builds. Other in-tree tools will be fixed with similar patches. This continues the patch series to eliminate StringRef forms of GNU triples from the internals of LLVM that began in r239036. The first time this was committed it accidentally fixed an inconsistency in triples in llvm-mc and this caused a failure. This inconsistency was fixed in r239808. Reviewers: rengolin Reviewed By: rengolin Subscribers: llvm-commits, rengolin Differential Revision: http://reviews.llvm.org/D10366 llvm-svn: 239812
* [llvm-mc] The object form of the GNU triple should be the same as the string ↵Daniel Sanders2015-06-161-1/+3
| | | | | | | | | | | | | | | | | | | | | | | form. Summary: GetTarget() may modify TripleName without also updating TheTriple. This can lead to situations where the MCObjectStreamer has a different triple to the rest of LLVM. This inconsistency caused sparc-little-endian.s to pass on Windows because most of LLVM had sparcel-pc-win32 while MCObjectStreamer had "". I believe the same kind of thing was also true of Darwin. Reviewers: rengolin Reviewed By: rengolin Subscribers: llvm-commits, rengolin, rafael Differential Revision: http://reviews.llvm.org/D10450 llvm-svn: 239808
* Revert r239721 - Replace string GNU Triples with llvm::Triple in ↵Daniel Sanders2015-06-151-4/+2
| | | | | | | | InitMCObjectFileInfo. NFC. It appears to cause sparc-little-endian.s to assert on Windows and Darwin. llvm-svn: 239724
* Replace string GNU Triples with llvm::Triple in InitMCObjectFileInfo. NFC.Daniel Sanders2015-06-151-2/+4
| | | | | | | | | | | | | | | | | | | | | Summary: This affects other tools so the previous C++ API has been retained as a deprecated function for the moment. Clang has been updated with a trivial patch (not covered by the pre-commit review) to avoid breaking -Werror builds. Other in-tree tools will be fixed with similar trivial patches. This continues the patch series to eliminate StringRef forms of GNU triples from the internals of LLVM that began in r239036. Reviewers: rengolin Reviewed By: rengolin Subscribers: llvm-commits, rengolin Differential Revision: http://reviews.llvm.org/D10366 llvm-svn: 239721
* Teaching llvm-mc how to understand the defsym command line option. This ↵Colin LeMahieu2015-06-071-0/+26
| | | | | | allows integer-constant symbols to be defined on the command line and used during assembly. llvm-svn: 239240
* Add targets to cmake for specific target components.Pete Cooper2015-04-201-1/+5
| | | | | | | | | | | | This adds the following targets to cmake. These can be used to build and link only specific parts of a backend, instead of having to link the whole backend. - AllTargetsAsmPrinters, AllTargetsAsmParsers, AllTargetsDescs, AllTargetsDisassemblers, AllTargetsInfos A typical use for these is instead of linking ${LLVM_TARGETS_TO_BUILD}. This commit changes llvm-mc to show how to use the new targets. Reviewed by Chris Bieneman. llvm-svn: 235324
* Use raw_pwrite_stream in the object writer/streamer.Rafael Espindola2015-04-141-3/+11
| | | | | | The ELF object writer will take advantage of that in the next commit. llvm-svn: 234950
* Simplify use of formatted_raw_ostream.Rafael Espindola2015-04-091-6/+6
| | | | | | | | | | | | | | | formatted_raw_ostream is a wrapper over another stream to add column and line number tracking. It is used only for asm printing. This patch moves the its creation down to where we know we are printing assembly. This has the following advantages: * Simpler lifetime management: std::unique_ptr * We don't compute column and line number of object files :-) llvm-svn: 234535
* Replace the MCSubtargetInfo parameter with a Triple when creatingEric Christopher2015-03-311-2/+2
| | | | | | | an MCInstPrinter. Update all callers and use where we wanted a Triple previously. llvm-svn: 233648
* Don't declare all text sections at the start of the .sRafael Espindola2015-03-201-1/+2
| | | | | | | | | | | | | | | | | The code this patch removes was there to make sure the text sections went before the dwarf sections. That is necessary because MachO uses offsets relative to the start of the file, so adding a section can change relaxations. The dwarf sections were being printed at the start just to produce symbols pointing at the start of those sections. The underlying issue was fixed in r231898. The dwarf sections are now printed when they are about to be used, which is after we printed the text sections. To make sure we don't regress, the patch makes the MachO streamer assert if CodeGen puts anything unexpected after the DWARF sections. llvm-svn: 232842
* Pass in a "const Triple &T" instead of a raw StringRef.Rafael Espindola2015-03-161-1/+2
| | | | llvm-svn: 232429
* Remove the use of the subtarget in MCCodeEmitter creation andEric Christopher2015-03-101-2/+2
| | | | | | | update all ports accordingly. Required a couple of small rewrites in handling subtarget features during creation in PPC. llvm-svn: 231861
* llvm-mc: Use Target::createNullStreamer to fix crashes on target-specific ↵Peter Collingbourne2015-02-191-1/+1
| | | | | | asm directives. llvm-svn: 229798
* Remove unused includes and out of date comment. NFC.Rafael Espindola2014-12-171-1/+0
| | | | llvm-svn: 224413
* Pass output stream to AsLexInput instead of the whole tool_output_file.Craig Topper2014-12-121-46/+46
| | | | llvm-svn: 224109
* Use unique_ptr to remove an explicit delete. Change return type to pass the ↵Craig Topper2014-12-121-5/+4
| | | | | | unique_ptr to caller. llvm-svn: 224108
* Remove the now unused StringRefMemoryObject.h.Rafael Espindola2014-11-121-1/+0
| | | | llvm-svn: 221755
* Pass an ArrayRef to MCDisassembler::getInstruction.Rafael Espindola2014-11-121-3/+2
| | | | | | | | | | | | With this patch MCDisassembler::getInstruction takes an ArrayRef<uint8_t> instead of a MemoryObject. Even on X86 there is a maximum size an instruction can have. Given that, it seems way simpler and more efficient to just pass an ArrayRef to the disassembler instead of a MemoryObject and have it do a virtual call every time it wants some extra bytes. llvm-svn: 221751
* [llvm-mc] Fixing case where if a file ended with non-newline whitespace or a ↵Colin LeMahieu2014-11-111-15/+9
| | | | | | | | comma it would access invalid memory. Cleaned up parse loop. llvm-svn: 221707
* Use StringRefMemoryObject in llvm-mc. NFC.Rafael Espindola2014-11-071-29/+15
| | | | llvm-svn: 221536
* Simplify handling of --noexecstack by using getNonexecutableStackSection.Rafael Espindola2014-10-152-4/+5
| | | | llvm-svn: 219799
* Modernize raw_fd_ostream's constructor a bit.Rafael Espindola2014-08-251-4/+4
| | | | | | | | | | Take a StringRef instead of a "const char *". Take a "std::error_code &" instead of a "std::string &" for error. A create static method would be even better, but this patch is already a bit too big. llvm-svn: 216393
* Explicitly pass ownership of the MemoryBuffer to AddNewSourceBuffer using ↵David Blaikie2014-08-211-2/+2
| | | | | | std::unique_ptr llvm-svn: 216223
* Canonicalize header guards into a common format.Benjamin Kramer2014-08-131-2/+2
| | | | | | | | | | Add header guards to files that were missing guards. Remove #endif comments as they don't seem common in LLVM (we can easily add them back if we decide they're useful) Changes made by clang-tidy with minor tweaks. llvm-svn: 215558
* Update the MemoryBuffer API to use ErrorOr.Rafael Espindola2014-07-061-5/+5
| | | | llvm-svn: 212405
* This only needs a StringRef.Rafael Espindola2014-07-061-1/+1
| | | | llvm-svn: 212401
* SourceMgr: make valid buffer IDs start from oneAlp Toker2014-07-061-1/+1
| | | | | | | | | | Use 0 for the invalid buffer instead of -1/~0 and switch to unsigned representation to enable more idiomatic usage. Also introduce a trivial SourceMgr::getMainFileID() instead of hard-coding 0/1 to identify the main file. llvm-svn: 212398
* Simplify code a bit, no functionality change.Rafael Espindola2014-06-281-3/+3
| | | | llvm-svn: 211985
OpenPOWER on IntegriCloud