summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCParser/ELFAsmParser.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [ELF][gcc compatibility]: support section names with special characters ↵Marina Yatsina2016-03-221-8/+9
| | | | | | | | | | | | (e.g. "/") Adding support for section names with special characters in them (e.g. "/"). GCC successfully compiles such section names. This also fixes PR24520. Differential Revision: http://reviews.llvm.org/D15678 llvm-svn: 264038
* Stop producing .data.rel sections.Rafael Espindola2015-11-181-8/+6
| | | | | | | | | | | | | | | | | If a section is rw, it is irrelevant if the dynamic linker will write to it or not. It looks like llvm implemented this because gcc was doing it. It looks like gcc implemented this in the hope that it would put all the relocated items close together and speed up the dynamic linker. There are two problem with this: * It doesn't work. Both bfd and gold will map .data.rel to .data and concatenate the input sections in the order they are seen. * If we want a feature like that, it can be implemented directly in the linker since it knowns where the dynamic relocations are. llvm-svn: 253436
* Drop prelink support.Rafael Espindola2015-11-171-8/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The way prelink used to work was * The compiler decides if a given section only has relocations that are know to point to the same DSO. If so, it names it .data.rel.ro.local<something>. * The static linker puts all of these together. * The prelinker program assigns addresses to each library and resolves the local relocations. There are many problems with this: * It is incompatible with address space randomization. * The information passed by the compiler is redundant. The linker knows if a given relocation is in the same DSO or not. If could sort by that if so desired. * There are newer ways of speeding up DSO (gnu hash for example). * Even if we want to implement this again in the compiler, the previous implementation is pretty broken. It talks about relocations that are "resolved by the static linker". If they are resolved, there are none left for the prelinker. What one needs to track is if an expression will require only dynamic relocations that point to the same DSO. At this point it looks like the prelinker is an historical curiosity. For example, fedora has retired it because it failed to build for two releases (http://pkgs.fedoraproject.org/cgit/prelink.git/commit/?id=eb43100a8331d91c801ee3dcdb0a0bb9babfdc1f) This patch removes support for it. That is, it stops printing the ".local" sections. llvm-svn: 253280
* Fix PR23872: Integrated assembler error message when using .type directive ↵Gabor Ballabas2015-07-011-4/+10
| | | | | | | | | | | with @ in AArch32 assembly. The AArch32 assembler parses the '@' as a comment symbol, so the error message shouldn't suggest that '@<type>' is a valid replacement when assembling for AArch32 target. Differential Revision: http://reviews.llvm.org/D10651 llvm-svn: 241149
* Revert r240137 (Fixed/added namespace ending comments using clang-tidy. NFC)Alexander Kornienko2015-06-231-1/+1
| | | | | | Apparently, the style needs to be agreed upon first. llvm-svn: 240390
* Fixed/added namespace ending comments using clang-tidy. NFCAlexander Kornienko2015-06-191-1/+1
| | | | | | | | | | | | | The patch is generated using this command: tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \ -checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \ llvm/lib/ Thanks to Eugene Kosov for the original patch! llvm-svn: 240137
* Create a MCSymbolELF.Rafael Espindola2015-06-021-3/+3
| | | | | | | | | This create a MCSymbolELF class and moves SymbolSize since only ELF needs a size expression. This reduces the size of MCSymbol from 56 to 48 bytes. llvm-svn: 238801
* MC: Clean up MCExpr naming. NFC.Jim Grosbach2015-05-301-1/+1
| | | | llvm-svn: 238634
* There is only one current section.Rafael Espindola2015-05-271-3/+5
| | | | | | | | | | | | | | | | | Both MCStreamer and MCObjectStreamer were maintaining a current section variable and they were slightly out of sync. I don't think this was observable, but was inefficient and error prone. Changing this requires a few cascading changes: * SwitchSection has to call ChangeSection earlier for ChangeSection to see the old section. * With that change, ChangeSection cannot call EmitLabel, since during ChangeSection we are still in the old section. * When the object streamer requires a begin label, just reused the existing generic support for begin labels instead of calling EmitLabel directly. llvm-svn: 238357
* Move alignment from MCSectionData to MCSection.Rafael Espindola2015-05-211-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | This starts merging MCSection and MCSectionData. There are a few issues with the current split between MCSection and MCSectionData. * It optimizes the the not as important case. We want the production of .o files to be really fast, but the split puts the information used for .o emission in a separate data structure. * The ELF/COFF/MachO hierarchy is not represented in MCSectionData, leading to some ad-hoc ways to represent the various flags. * It makes it harder to remember where each item is. The attached patch starts merging the two by moving the alignment from MCSectionData to MCSection. Most of the patch is actually just dropping 'const', since MCSectionData is mutable, but MCSection was not. llvm-svn: 237936
* Remove yet another method of creating begin and end symbol for sections.Rafael Espindola2015-05-211-3/+3
| | | | | | I missed this one when first unifying how we handle begin and end symbols. llvm-svn: 237912
* Use existing helper for adding a section. NFC.Rafael Espindola2015-05-211-3/+1
| | | | llvm-svn: 237909
* MC: Clean up method names in MCContext.Jim Grosbach2015-05-181-8/+8
| | | | | | | The naming was a mish-mash of old and new style. Update to be consistent with the new. NFC. llvm-svn: 237594
* Use a comma after the unique keyword.Rafael Espindola2015-04-061-0/+3
| | | | | | | | H.J. Lu noted that all .section options are separated by a comma. This patch changes the syntax of unique to require one. llvm-svn: 234174
* Implement unique sections with an unique ID.Rafael Espindola2015-04-041-3/+8
| | | | | | | | | | | This allows the compiler/assembly programmer to switch back to a section. This in turn fixes the bootstrap failure on powerpc (tested on gcc110) without changing the ppc codegen at all. I will try to cleanup the various getELFSection overloads in a followup patch. Just using a default argument now would lead to ambiguities. llvm-svn: 234099
* Add r228980 back.Rafael Espindola2015-02-171-2/+12
| | | | | | | | | | Add support for having multiple sections with the same name and comdat. Using this in combination with -ffunction-sections allows LLVM to output a .o file with mulitple sections named .text. This saves space by avoiding long unique names of the form .text.<C++ mangled name>. llvm-svn: 229541
* Revert a series of commits starting at r228886 which is triggering someChandler Carruth2015-02-131-12/+2
| | | | | | | | | | | | | | | | regressions for LLDB on Linux. Rafael indicated on lldb-dev that we should just go ahead and revert these but that he wasn't at a computer. The patches backed out are as follows: r228980: Add support for having multiple sections with the name and ... r228889: Invert the section relocation map. r228888: Use the existing SymbolTableIndex intsead of doing a lookup. r228886: Create the Section -> Rel Section map when it is first needed. These patches look pretty nice to me, so hoping its not too hard to get them re-instated. =D llvm-svn: 229080
* Add support for having multiple sections with the same name and comdat.Rafael Espindola2015-02-121-2/+12
| | | | | | | | Using this in combination with -ffunction-sections allows LLVM to output a .o file with mulitple sections named .text. This saves space by avoiding long unique names of the form .text.<C++ mangled name>. llvm-svn: 228980
* Compute the ELF SectionKind from the flags.Rafael Espindola2015-01-291-42/+4
| | | | | | | | | | | | Any code creating an MCSectionELF knows ELF and already provides the flags. SectionKind is an abstraction used by common code that uses a plain MCSection. Use the flags to compute the SectionKind. This removes a lot of guessing and boilerplate from the MCSectionELF construction. llvm-svn: 227476
* Downgrade DWARF2 section limit error to a warningOliver Stannard2014-09-221-1/+1
| | | | | | | | | We currently emit an error when trying to assemble a file with more than one section using DWARF2 debug info. This should be a warning instead, as the resulting file will still be usable, but with a degraded debug illusion. llvm-svn: 218241
* Emit DWARF info for all code section in an assembly fileOliver Stannard2014-06-191-9/+23
| | | | | | | | Currently, when using llvm as an assembler, DWARF debug information is only generated for the .text section. This patch modifies this so that DWARF info is emitted for all executable sections. llvm-svn: 211273
* MC: make ELF .type handling more GNU AS compatibleSaleem Abdulrasool2014-06-081-38/+34
| | | | | | | | | | | | | | 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
* [C++] Use 'nullptr'.Craig Topper2014-04-241-4/+4
| | | | llvm-svn: 207083
* Map ELf flags back to more specific section kinds.Rafael Espindola2014-03-281-2/+28
| | | | | | With that, convert another llc -filetype=obj test. llvm-svn: 205031
* [C++11] Add 'override' keyword to virtual methods that override their base ↵Craig Topper2014-03-081-1/+1
| | | | | | class. llvm-svn: 203342
* Add support for parsing sun-style section flags in ELFAsmParser.Venkatraman Govindaraju2014-03-011-6/+43
| | | | llvm-svn: 202573
* Fix parsing of .symver directive on ARMDavid Peixotto2014-01-151-0/+7
| | | | | | | | | | | | | | | ARM assembly syntax uses @ for a comment, execpt for the second parameter of the .symver directive which requires @ as part of the symbol name. This commit fixes the parsing of this directive by adding a special case for ARM for this one argumnet. To make the change we had to move the AllowAtInIdentifier variable to the MCAsmLexer interface (from AsmLexer) and expose a setter for the value. The ELFAsmParser then toggles this value when parsing the second argument to the .symver directive for a target that uses @ as a comment symbol llvm-svn: 199339
* Move .ident handling to MCStreamer.Rafael Espindola2013-10-161-22/+4
| | | | | | | | No functionality change, but exposes the API so that codegen can use it too. Patch by Katya Romanova. llvm-svn: 192757
* ELF: Parse types in directives like binutils gasDavid Majnemer2013-09-211-20/+43
| | | | | | | | | | Allow binutils .type and .section directives to take the following forms: - @<type> - %<type> - "<type>" llvm-svn: 191134
* ELF: Add support for the exclude section bit for gas compat.Benjamin Kramer2013-09-151-5/+8
| | | | llvm-svn: 190769
* MC: Add support for '?' flags in .section directivesDavid Majnemer2013-09-151-2/+20
| | | | | | | | | | | | | | | | | | | Summary: The '?' flag uses the last section group if the last had a section group. We treat combining an explicit section group and the '?' as a hard error. This fixes PR17198. Reviewers: rafael, bkramer Reviewed By: bkramer CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1686 llvm-svn: 190768
* Remove unused StringRef that no compiler warned about, I wonder why.Benjamin Kramer2013-09-141-1/+0
| | | | llvm-svn: 190759
* Add support for subsections to the ELF assembler. Fixes PR8717.Peter Collingbourne2013-04-171-9/+44
| | | | | | Differential Revision: http://llvm-reviews.chandlerc.com/D598 llvm-svn: 179725
* MCParser: Update method names per coding guidelines.Jim Grosbach2013-02-201-41/+41
| | | | | | | | | | | | | | | | | | | s/AddDirectiveHandler/addDirectiveHandler/ s/ParseMSInlineAsm/parseMSInlineAsm/ s/ParseIdentifier/parseIdentifier/ s/ParseStringToEndOfStatement/parseStringToEndOfStatement/ s/ParseEscapedString/parseEscapedString/ s/EatToEndOfStatement/eatToEndOfStatement/ s/ParseExpression/parseExpression/ s/ParseParenExpression/parseParenExpression/ s/ParseAbsoluteExpression/parseAbsoluteExpression/ s/CheckForValidSection/checkForValidSection/ http://llvm.org/docs/CodingStandards.html#name-types-functions-variables-and-enumerators-properly No functional change intended. llvm-svn: 175675
* Derive ELF section type from the name in some cases where GNU as doesJoerg Sonnenberger2013-02-161-1/+10
| | | | | | so. llvm-svn: 175327
* Use the ExtensionDirectiveHandler type in other places where it makes sense.Eli Bendersky2013-01-161-3/+5
| | | | | | | Since we already have this type it's a shame to keep dragging a pair of object and method around explicitly. llvm-svn: 172584
* These functions have default arguments of 0 for the last arg. UseEric Christopher2013-01-091-2/+2
| | | | | | them. llvm-svn: 171933
* Remove redundant semicolons which are null statements.Dmitri Gribenko2012-09-101-1/+1
| | | | llvm-svn: 163547
* ELF: Add support for the asm .version directive.Benjamin Kramer2012-05-121-0/+28
| | | | llvm-svn: 156712
* Add support for gnu_indirect_function.Roman Divacky2011-12-121-0/+1
| | | | llvm-svn: 146377
* Move some ELF directives into ELF asm parser.Jim Grosbach2011-07-251-0/+44
| | | | | | | | | | | | | | The .local, .hidden, .internal, and .protected are not legal for all supported file formats (in particular, they're invalid for MachO). Move the parsing for them into the ELF assembly parser since that's the format they're for. Similarly, .weak is used by COFF and ELF, but not MachO, so move the parsing to the COFF and ELF asm parsers. Previously, using any of these directives on Darwin would result in an assertion failure in the parser; now we get a diagnostic as we should. rdar://9827089 llvm-svn: 135921
* Tidy up. 80 columns.Jim Grosbach2011-07-251-5/+10
| | | | llvm-svn: 135917
* Restore r125595 (reverted in r126336) with modifications:Joerg Sonnenberger2011-02-241-1/+3
| | | | | | | Introduce a variable in the AsmParserExtension whether [] is valid in an expression. If it is true, parse them like (). Enable this for ELF only. llvm-svn: 126443
* Bug#9172: Don't use static in file scope, use an attribute on theJoerg Sonnenberger2011-02-221-5/+5
| | | | | | parser. llvm-svn: 126225
* Add support for pushsection and popsection. Patch by Joerg Sonnenberger.Rafael Espindola2011-02-161-4/+26
| | | | llvm-svn: 125629
* Handle strings in section names the same way as gas:Rafael Espindola2011-01-241-3/+14
| | | | | | | * If the name is a single string, we remove the quotes * If the name starts without a quote, we include any quotes in the name llvm-svn: 124127
* Delay the creation of eh_frame so that the user can change the defaults.Rafael Espindola2011-01-231-0/+2
| | | | | | Add support for SHT_X86_64_UNWIND. llvm-svn: 124059
* Remove more duplicated code.Rafael Espindola2011-01-231-35/+35
| | | | llvm-svn: 124056
* Remove duplicated code.Rafael Espindola2011-01-231-18/+19
| | | | llvm-svn: 124054
* Add support for @note. Patch by Jörg Sonnenberger.Rafael Espindola2010-12-261-0/+2
| | | | llvm-svn: 122568
OpenPOWER on IntegriCloud