summaryrefslogtreecommitdiffstats
path: root/lld/ELF/ScriptLexer.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [ELF] Don't cause assertion failure if --dynamic-list or --version-script ↵Fangrui Song2020-06-161-1/+5
| | | | | | | | | takes an empty file Fixes PR46184 Report line 1 of the last memory buffer. (cherry picked from commit ac6abc99e2794e4674a8498f817fda19b176bbfe)
* [ELF] Wrap things in `namespace lld { namespace elf {`, NFCFangrui Song2019-10-071-2/+5
| | | | | | | | | | | This makes it clear `ELF/**/*.cpp` files define things in the `lld::elf` namespace and simplifies `elf::foo` to `foo`. Reviewed By: atanasyan, grimar, ruiu Differential Revision: https://reviews.llvm.org/D68323 llvm-svn: 373885
* [Coding style change] Rename variables so that they start with a lowercase ↵Rui Ueyama2019-07-101-107/+107
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | letter This patch is mechanically generated by clang-llvm-rename tool that I wrote using Clang Refactoring Engine just for creating this patch. You can see the source code of the tool at https://reviews.llvm.org/D64123. There's no manual post-processing; you can generate the same patch by re-running the tool against lld's code base. Here is the main discussion thread to change the LLVM coding style: https://lists.llvm.org/pipermail/llvm-dev/2019-February/130083.html In the discussion thread, I proposed we use lld as a testbed for variable naming scheme change, and this patch does that. I chose to rename variables so that they are in camelCase, just because that is a minimal change to make variables to start with a lowercase letter. Note to downstream patch maintainers: if you are maintaining a downstream lld repo, just rebasing ahead of this commit would cause massive merge conflicts because this patch essentially changes every line in the lld subdirectory. But there's a remedy. clang-llvm-rename tool is a batch tool, so you can rename variables in your downstream repo with the tool. Given that, here is how to rebase your repo to a commit after the mass renaming: 1. rebase to the commit just before the mass variable renaming, 2. apply the tool to your downstream repo to mass-rename variables locally, and 3. rebase again to the head. Most changes made by the tool should be identical for a downstream repo and for the head, so at the step 3, almost all changes should be merged and disappear. I'd expect that there would be some lines that you need to merge by hand, but that shouldn't be too many. Differential Revision: https://reviews.llvm.org/D64121 llvm-svn: 365595
* [LLD][ELF] - Linkerscript: add a support for expressions for section's fillingGeorge Rimar2019-07-041-3/+6
| | | | | | | | | | | | | | | | | | | Imagine the script: .section: { ... } = FILL_EXPR LLD assumes that FILL_EXPR is a number, and does not allow it to be an expression. Though that is allowed by specification: https://sourceware.org/binutils/docs-2.32/ld/Output-Section-Fill.html This patch adds a support for cases when FILL_EXPR is simple math expression. Fixes https://bugs.llvm.org/show_bug.cgi?id=42482. Differential revision: https://reviews.llvm.org/D64130 llvm-svn: 365143
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* [LLD][ELD] - Do not reject INFO output section type when used with a start ↵George Rimar2018-08-281-0/+9
| | | | | | | | | | | | | | | | | | | | address. This is https://bugs.llvm.org/show_bug.cgi?id=38625 LLD accept this: ".stack (INFO) : {", but not this: ".stack address_expression (INFO) :" The patch fixes it. Differential revision: https://reviews.llvm.org/D51027 llvm-svn: 340804
* [ELF] - Remove dead code #2.George Rimar2018-07-061-4/+1
| | | | | | 'Pos' is never can be 0 here. llvm-svn: 336436
* [ELF] - Remove dead code. NFC.George Rimar2018-07-061-2/+0
| | | | | | 'Pos' can never be 0. llvm-svn: 336435
* [ELF] - Add a comment. NFC.George Rimar2018-07-031-0/+1
| | | | | | | Minor follow up for r336197 "[ELF] - Add support for '||' and '&&' in linker scripts." llvm-svn: 336199
* [ELF] - Add support for '||' and '&&' in linker scripts.George Rimar2018-07-031-1/+1
| | | | | | | This is https://bugs.llvm.org//show_bug.cgi?id=37976, we had no support, but seems someone faced it. llvm-svn: 336197
* Simplify script lexer.Rui Ueyama2017-12-261-1/+9
| | | | | | Differential Revision: https://reviews.llvm.org/D41577 llvm-svn: 321453
* [lld] unified COFF and ELF error handling on new Common/ErrorHandlerBob Haarman2017-10-251-7/+7
| | | | | | | | | | | | | | | | | | | Summary: The COFF linker and the ELF linker have long had similar but separate Error.h and Error.cpp files to implement error handling. This change introduces new error handling code in Common/ErrorHandler.h, changes the COFF and ELF linkers to use it, and removes the old, separate implementations. Reviewers: ruiu Reviewed By: ruiu Subscribers: smeenai, jyknight, emaste, sdardis, nemanjai, nhaehnle, mgorny, javed.absar, kbarton, fedor.sergeev, llvm-commits Differential Revision: https://reviews.llvm.org/D39259 llvm-svn: 316624
* [ELF] - Linkerscript: Add `~` as separate math token.George Rimar2017-10-121-1/+1
| | | | | | | | | | | | | | | | | | Previously we did not support following: foo = ~0xFF; and had to add space before numeric value: foo = ~ 0xFF That was constistent with ld.bfd < 2.30, which shows: script.txt:3: undefined symbol `~2' referenced in expression, but inconsistent with gold. It was fixed for ld.bfd 2.30 as well: https://sourceware.org/bugzilla/show_bug.cgi?id=22267 Differential revision: https://reviews.llvm.org/D36508 llvm-svn: 315569
* [ELF] - Fix out of sync comment. NFC.George Rimar2017-10-111-1/+1
| | | | llvm-svn: 315442
* [ELF] - Do not report multiple errors for single one in ScriptLexer::setError.George Rimar2017-08-231-9/+5
| | | | | | | | | | Previously up to 3 errors were reported at once, with patch we always will report only one, just like in other linker code. Differential revision: https://reviews.llvm.org/D37015 llvm-svn: 311537
* [ELF, LinkerScript] Support ! operator in linker script.Hafiz Abid Qadeer2017-08-101-4/+9
| | | | | | | | | | | | | | Summary: This small patch adds the support for ! operator in linker scripts. Reviewers: ruiu, rafael Reviewed By: ruiu Subscribers: meadori, grimar, emaste, llvm-commits Differential Revision: https://reviews.llvm.org/D36451 llvm-svn: 310607
* [ELF] - Remove ScriptLexer::Error field and check ErrorCount instead.George Rimar2017-08-041-7/+6
| | | | | | | | | | | | D35945 introduces change when there is useless to check Error flag in few places, but ErrorCount must be checked instead. But then we probably can just check ErrorCount always. That should simplify things. Patch do that. Differential revision: https://reviews.llvm.org/D36266 llvm-svn: 310046
* Handle ":" as a regular token character in linker scripts.Rui Ueyama2017-03-091-10/+19
| | | | | | | | | This is an alternative to https://reviews.llvm.org/D30500 to simplify the version definition parser and allow ":" in symbol names. Differential Revision: https://reviews.llvm.org/D30722 llvm-svn: 297402
* Apply different tokenization rules to linker script expressions.Rui Ueyama2017-02-151-12/+56
| | | | | | | | | | | | | | | | The linker script lexer is context-sensitive. In the regular context, arithmetic operator characters are regular characters, but in the expression context, they are independent tokens. This afects how the lexer tokenizes "3*4", for example. (This kind of expression is real; the Linux kernel uses it.) This patch defines function `maybeSplitExpr`. This function splits the current token into multiple expression tokens if the lexer is in the expression context. Differential Revision: https://reviews.llvm.org/D29963 llvm-svn: 295225
* Add file comments for ScriptParser.cpp.Rui Ueyama2017-02-141-2/+31
| | | | llvm-svn: 295023
* Rename ScriptParser.{cpp,h} -> ScriptLexer.{cpp,h}.Rui Ueyama2017-02-141-0/+203
These files contain a lexer, so the new names are better. The parser is in LinkerScript.{cpp,h}. llvm-svn: 295022
OpenPOWER on IntegriCloud