summaryrefslogtreecommitdiffstats
path: root/lld/ELF/ScriptParser.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [lld][ELF] Mark empty NOLOAD output sections SHT_NOBITS instead of SHT_PROGBITSMatt Schulte2020-06-161-0/+1
| | | | | | | | | | | This fixes PR# 45336. Output sections described in a linker script as NOLOAD with no input sections would be marked as SHT_PROGBITS. Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D76981 (cherry picked from commit fdc41aa22c60958e6b6df461174b814a4aae3384)
* [ELF] Wrap things in `namespace lld { namespace elf {`, NFCFangrui Song2019-10-071-9/+10
| | | | | | | | | | | 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
* [ELF] Replace error() with errorOrWarn() for the ASSERT commandFangrui Song2019-09-061-1/+1
| | | | | | | | | | | | | | | Summary: ld.bfd produces an output with --noinhibit-exec when an ASSERT fails. Use errorOrWarn() so that we can produce an output as well. An interesting case is that symbol assignments may execute multiple times, so we probably want to suppress errors for non-final runs. Reviewed By: peter.smith Differential Revision: https://reviews.llvm.org/D67285 llvm-svn: 371225
* [ELF] Consistently prioritize non-* wildcards overs "*" in version scriptsFangrui Song2019-08-051-22/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We prioritize non-* wildcards overs VER_NDX_LOCAL/VER_NDX_GLOBAL "*". This patch generalizes the rule to "*" of other versions and thus fixes PR40176. I don't feel strongly about this GNU linkers' behavior but the generalization simplifies code. Delete `config->defaultSymbolVersion` which was used to special case VER_NDX_LOCAL/VER_NDX_GLOBAL "*". In `SymbolTable::scanVersionScript`, custom versions are handled the same way as VER_NDX_LOCAL/VER_NDX_GLOBAL. So merge `config->versionScript{Locals,Globals}` into `config->versionDefinitions`. Overall this seems to simplify the code. In `SymbolTable::assign{Exact,Wildcard}Versions`, `sym->verdefIndex == config->defaultSymbolVersion` is changed to `verdefIndex == UINT32_C(-1)`. This allows us to give duplicate assignment diagnostics for `{ global: foo; };` `V1 { global: foo; };` In test/linkerscript/version-script.s: vs_index of an undefined symbol changes from 0 to 1. This doesn't matter (arguably 1 is better because the binding is STB_GLOBAL) because vs_index of an undefined symbol is ignored. Reviewed By: ruiu Differential Revision: https://reviews.llvm.org/D65716 llvm-svn: 367869
* Fix parameter name comments using clang-tidy. NFC.Rui Ueyama2019-07-161-6/+6
| | | | | | | | | | | | | | | | | | | | | This patch applies clang-tidy's bugprone-argument-comment tool to LLVM, clang and lld source trees. Here is how I created this patch: $ git clone https://github.com/llvm/llvm-project.git $ cd llvm-project $ mkdir build $ cd build $ cmake -GNinja -DCMAKE_BUILD_TYPE=Debug \ -DLLVM_ENABLE_PROJECTS='clang;lld;clang-tools-extra' \ -DCMAKE_EXPORT_COMPILE_COMMANDS=On -DLLVM_ENABLE_LLD=On \ -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ ../llvm $ ninja $ parallel clang-tidy -checks='-*,bugprone-argument-comment' \ -config='{CheckOptions: [{key: StrictMode, value: 1}]}' -fix \ ::: ../llvm/lib/**/*.{cpp,h} ../clang/lib/**/*.{cpp,h} ../lld/**/*.{cpp,h} llvm-svn: 366177
* [Coding style change][lld] Rename variables for non-ELF portsRui Ueyama2019-07-111-3/+3
| | | | | | | | | | | This patch does the same thing as r365595 to other subdirectories, which completes the naming style change for the entire lld directory. With this, the naming style conversion is complete for lld. Differential Revision: https://reviews.llvm.org/D64473 llvm-svn: 365730
* [LLD][ELF] - Linkerscript: fix FILL() expressions handling.George Rimar2019-07-101-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | D64130 introduced a bug described in the following message: https://reviews.llvm.org/D64130#1571560 The problem can happen with the following script: SECTIONS { .out : { ... FILL(0x10101010) *(.aaa) ... } The current code tries to read (0x10101010) as an expression and does not break when meets *, what results in a script parsing error. In this patch, I verify that FILL command's expression always wrapped in (). And at the same time =<fillexp> expression can be both wrapped or unwrapped. I checked it matches to bfd/gold. Differential revision: https://reviews.llvm.org/D64476 llvm-svn: 365635
* [Coding style change] Rename variables so that they start with a lowercase ↵Rui Ueyama2019-07-101-609/+609
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-23/+17
| | | | | | | | | | | | | | | | | | | 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
* Avoid identifiers that are different only in case. NFC.Rui Ueyama2019-07-031-17/+15
| | | | | | | | Some variables in lld have the same name as functions ignoring case. This patch gives them different names, so that my next patch is easier to read. llvm-svn: 365003
* [ELF][RISCV] Parse BFD names elf{32,64}-littleriscvFangrui Song2019-06-101-0/+2
| | | | | | | | | | e.g. glibc libc.so on riscv64 uses `OUTPUT_FORMAT(elf64-littleriscv)`. Reviewed By: ruiu Differential Revision: https://reviews.llvm.org/D63070 llvm-svn: 362922
* [ELF] Full support for -n (--nmagic) and -N (--omagic) via common pagePeter Smith2019-05-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | The -n (--nmagic) disables page alignment, and acts as a -Bstatic The -N (--omagic) does what -n does but also marks the executable segment as writeable. As page alignment is disabled headers are not allocated unless explicit in the linker script. To disable page alignment in LLD we choose to set the page sizes to 1 so that any alignment based on the page size does nothing. To set the Target->PageSize to 1 we implement -z common-page-size, which has the side effect of allowing the user to set the value as well. Setting the page alignments to 1 does mean that any use of CONSTANT(MAXPAGESIZE) or CONSTANT(COMMONPAGESIZE) in a linker script will return 1, unlike in ld.bfd. However given that -n and -N disable paging these probably shouldn't be used in a linker script where -n or -N is in use. Differential Revision: https://reviews.llvm.org/D61688 llvm-svn: 360593
* [LLD][ELF] - Do not remove empty sections referenced in LOADADDR/ADDR commands.George Rimar2019-04-261-0/+2
| | | | | | | | | | | | | | | This is https://bugs.llvm.org//show_bug.cgi?id=38750. If script references empty sections in LOADADDR/ADDR commands .empty : { *(.empty ) } .text : AT(LOADADDR (.empty) + SIZEOF (.empty)) { *(.text) } then an empty section will be removed and LOADADDR/ADDR will evaluate to null. It is not that user may expect from using of the generic script, what is a common case. Differential revision: https://reviews.llvm.org/D54621 llvm-svn: 359279
* [ELF] Delete a redundant SHT_NOBITS -> SHT_PROGBITS after D60131Fangrui Song2019-04-241-1/+0
| | | | | | Differential Revision: https://reviews.llvm.org/D61006 llvm-svn: 359099
* [LLD][ELF] - Handle quoted strings in the linker scripts correctly.George Rimar2019-04-221-1/+1
| | | | | | | | | | | | | | This is the https://bugs.llvm.org/show_bug.cgi?id=41356, Seems it is kind of unusual case but it is possible to have sections that require quotes for their namings. Like "aaa bbb". This patch adds support for those. Differential revision: https://reviews.llvm.org/D60901 llvm-svn: 358874
* [ELF] Respect NonAlloc when copying flags from the previous sectionsFangrui Song2019-04-181-0/+1
| | | | | | | | | | | | | | | | Summary: If the output section contains only symbol assignments, we copy flags from the previous sections. Don't set SHF_ALLOC if NonAlloc is true. We also have to change the type from SHT_NOBITS to SHT_PROGBITS. In ld.bfd, bfd_elf_get_default_section_type maps non-alloctable sections to SHT_PROGBITS. Non-alloctable SHT_NOBITS sections do not make sense. Fixes PR38626 Differential Revision: https://reviews.llvm.org/D59986 llvm-svn: 358650
* Recover elf32-bigmips and elf32-powerpc support in LLDRui Ueyama2019-02-131-1/+2
| | | | | | | | | | | | | This fixes a 7.0 -> 8.0 regression when parsing OUTPUT_FORMAT("elf32-powerpc"); or elf32-bigmips directive in ldscripts as well as an unknown emulation error when lld is invoked by clang due to missed elf32ppclinux case. Patch by vit9696 Differential Revision: https://reviews.llvm.org/D58005 llvm-svn: 353968
* lld: unquote possibly quoted `EXTERN("symbol")` entry in linker script.Rui Ueyama2019-02-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | gold accepts quoted strings. binutils requires quoted strings for some kinds of symbols, e.g.: it accepts quoted symbols with @ in name: $ echo 'EXTERN("__libc_start_main@@GLIBC_2.2.5")' > a.script $ g++ a.script /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crt1.o: In function `_start': (.text+0x20): undefined reference to `main' collect2: error: ld returned 1 exit status but rejects them if unquoted: $ echo 'EXTERN(__libc_start_main@@GLIBC_2.2.5)' > a.script $ g++ a.script a.script: file not recognized: File format not recognized collect2: error: ld returned 1 exit status To maintain compatibility with existing linker scripts support quoted strings in lld as well. Patch by Lucian Adrian Grijincu. Differential Revision: https://reviews.llvm.org/D57987 llvm-svn: 353756
* Recognize FreeBSD specific BFD names in OUTPUT_FORMATDimitry Andric2019-01-301-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: After rLLD344952 ("Add OUTPUT_FORMAT linker script directive support"), using BFD names such as `elf64-x86-64-freebsd` the `OUTPUT_FORMAT` linker script command does not work anymore, resulting in errors like: ``` ld: error: /home/dim/src/clang800-import/stand/efi/loader/arch/amd64/ldscript.amd64:2: unknown output format name: elf64-x86-64-freebsd >>> OUTPUT_FORMAT("elf64-x86-64-freebsd", "elf64-x86-64-freebsd", "elf64-x86-64-freebsd") >>> ^ ``` To fix this, recognize a `-freebsd` suffix in BFD names, and also set `Configuration::OSABI` to `ELFOSABI_FREEBSD` for those cases. Add and/or update several test cases to check for the correct results of these new `OUTPUT_FORMAT` arguments. Reviewers: ruiu, atanasyan, grimar, hokein, emaste, espindola Reviewed By: ruiu Subscribers: nemanjai, javed.absar, arichardson, krytarowski, kristof.beyls, kbarton, llvm-commits Differential Revision: https://reviews.llvm.org/D57283 llvm-svn: 352606
* [ELF] - Remove dead `readBfdName` declaration. NFC.George Rimar2019-01-291-1/+0
| | | | | | `readBfdName` was removed recently. llvm-svn: 352482
* Attempt to fix build failure with GCC 5.4.Rui Ueyama2019-01-281-2/+2
| | | | llvm-svn: 352435
* Refactoring. NFC.Rui Ueyama2019-01-281-36/+24
| | | | llvm-svn: 352407
* 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][ELF] - Use auto. NFC.George Rimar2018-12-061-1/+1
| | | | | | This addresses the missed review comment. llvm-svn: 348480
* [LLD][ELF] - Linker script: accept using a file name without a list of sections.George Rimar2018-12-061-1/+6
| | | | | | | | | | | | | | | | This is a part of https://bugs.llvm.org/show_bug.cgi?id=39885 Linker script specification says: "You can specify a file name to include sections from a particular file. You would do this if one or more of your files contain special data that needs to be at a particular location in memory." LLD did not accept this syntax. The patch implements it. Differential revision: https://reviews.llvm.org/D55324 llvm-svn: 348463
* Fix a typo.Haojian Wu2018-11-281-1/+1
| | | | llvm-svn: 347751
* Fix build error.Haojian Wu2018-11-281-15/+15
| | | | llvm-svn: 347750
* [ELF][MIPS] Handle mips in the OUTPUT_FORMAT directiveSimon Atanasyan2018-11-281-16/+26
| | | | | | Differential Revision: http://reviews.llvm.org/D54920 llvm-svn: 347742
* [LLD][ELF] - Do not crash when parsing the -defsym option from a error state.George Rimar2018-11-261-0/+2
| | | | | | | | | | | | | | When we are in a error state, script parser will not parse the -defsym expression and hence will not tokenize it. Then ScriptLexer::Pos will be 0 and LLD will assert and crash here: MemoryBufferRef ScriptLexer::getCurrentMB() { assert(!MBs.empty() && Pos > 0); // Bang ! Solution - stop parsing the defsym in a error state. That is consistent with the regular case (when we parse the linker script). llvm-svn: 347549
* [ELF] Make TrapInstr and Filler byte arrays. NFC.Simon Atanasyan2018-11-141-7/+7
| | | | | | | | | | | | The uint32_t type does not clearly convey that these fields are interpreted in the target endianness. Converting them to byte arrays should make this more obvious and less error-prone. Patch by James Clarke Differential Revision: http://reviews.llvm.org/D54207 llvm-svn: 346893
* Handle OUTPUT_FORMAT arguments in quotation marksGalina Kistanova2018-11-031-1/+1
| | | | llvm-svn: 346068
* [PPC64] Handle powerpc64 in OUTPUT_FORMAT.Sean Fertile2018-10-301-0/+4
| | | | | | Differential Revision: https://reviews.llvm.org/D53652 llvm-svn: 345604
* [ELF] Handle elf32-littlearm in OUTPUT_FORMATShoaib Meenai2018-10-221-0/+2
| | | | | | | | | We need this to support 32-bit ARM. Add test cases for emulation handling for this architecture as well. Differential Revision: https://reviews.llvm.org/D53539 llvm-svn: 344976
* Add OUTPUT_FORMAT linker script directive support.Rui Ueyama2018-10-221-2/+27
| | | | | | | | | | | | | | | | | | | | | | This patch adds a support for OUTPUT_FORMAT linker script directive. Since I'm not 100% confident with BFD names you can use in the directive for all architectures, I added only a few in this patch. We can add other names for other archtiectures later. We still do not support triple-style OUTPUT_FORMAT directive, namely, OUTPUT_FORMAT(bfdname, big, little). If you pass -EL (little endian) or -EB (big endian) to the linker, GNU linkers pick up big or little as a BFD name, correspondingly, so that you can use a single linker script for bi-endian processor. I'm not sure if we really need to support that, so I'll leave it alone for now. Note that -m takes precedence over OUTPUT_FORAMT, but we always parse a BFD name given to OUTPUT_FORMAT for error checking. You cannot write an invalid name in the OUTPUT_FORMAT directive. Differential Revision: https://reviews.llvm.org/D53495 llvm-svn: 344952
* [lld] Add more complete support for the INCLUDE command.Rui Ueyama2018-10-121-5/+13
| | | | | | | | | | | | | Patch by Ian Tessier. This change adds INCLUDE support to the MEMORY and SECTION commands, and to output sections, as per: https://sourceware.org/binutils/docs/ld/File-Commands.html#File-Commands Differential Revision: https://reviews.llvm.org/D52951 llvm-svn: 344368
* [LLD][ELD] - Do not reject INFO output section type when used with a start ↵George Rimar2018-08-281-21/+26
| | | | | | | | | | | | | | | | | | | | 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
* Add TARGET(foo) linker script directive.Rui Ueyama2018-08-061-0/+20
| | | | | | | | | | | | | | | | | | GNU ld's manual says that TARGET(foo) is basically an alias for `--format foo` where foo is a BFD target name such as elf64-x86-64. Unlike GNU linkers, lld doesn't allow arbitrary BFD target name for --format. We accept only "default", "elf" or "binary". This makes situation a bit tricky because we can't simply make TARGET an alias for --target. A quick code search revealed that the usage number of TARGET is very small, and the only meaningful usage is to switch to the binary mode. Thus, in this patch, we handle only TARGET(elf.*) and TARGET(binary). Differential Revision: https://reviews.llvm.org/D48153 llvm-svn: 339060
* [ELF] Use search paths for --version-script=Fangrui Song2018-07-251-1/+1
| | | | | | | | | | | | Summary: This behavior matches ld.bfd -Ld --version-script=t.script a.o Reviewers: ruiu, espindola Subscribers: emaste, arichardson, llvm-commits Differential Revision: https://reviews.llvm.org/D49820 llvm-svn: 337969
* [ELF] - Add support for '||' and '&&' in linker scripts.George Rimar2018-07-031-6/+12
| | | | | | | This is https://bugs.llvm.org//show_bug.cgi?id=37976, we had no support, but seems someone faced it. llvm-svn: 336197
* [ELF] - Implement linker script OVERLAYs.George Rimar2018-06-271-0/+62
| | | | | | | | | | | | | | | | | | This is PR36768. Linker script OVERLAYs are described in 4.6.9. Overlay Description of the spec: https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/4/html/Using_ld_the_GNU_Linker/sections.html They are used to allow output sections which have different LMAs but the same VAs and used for embedded programming. Currently, LLD restricts overlapping of sections and that seems to be the most desired behaviour for defaults. My thoughts about possible approaches for PR36768 are on the bug page, this patch implements OVERLAY keyword and allows VAs overlapping for sections that within the overlay. Differential revision: https://reviews.llvm.org/D44780 llvm-svn: 335714
* [ELF] - Eliminate the AssertCommand.George Rimar2018-04-251-30/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | Currently, LLD supports ASSERT as a separate command. We support two forms now. Assign expression-form: . = ASSERT(0x100) (old GNU ld required it and some scripts in the wild are still using something like . = ASSERT((_end - _text <= (512 * 1024 * 1024)), "kernel image bigger than KERNEL_IMAGE_SIZE"); Nowadays above is not a mandatory form and command-like form is commonly used: ASSERT(<expr>, "text); The return value of the ASSERT is Dot. That was implemented in D30171. It looks like (2) is just a short version of (1) then. GNU ld does *not* list ASSERT as a SECTIONS command: https://sourceware.org/binutils/docs/ld/SECTIONS.html#SECTIONS Given above we probably can change ASSERT to be an assignment to Dot. That makes the rest of the code much simpler. Patch do that. Differential revision: https://reviews.llvm.org/D45434 llvm-svn: 330814
* [ELF] Increase NextGroupId with --end-groupFangrui Song2018-04-191-0/+2
| | | | | | | | | | Reviewers: ruiu, espindola Subscribers: emaste, arichardson, llvm-commits Differential Revision: https://reviews.llvm.org/D45846 llvm-svn: 330379
* Add --warn-backrefs to maintain compatibility with other linkersRui Ueyama2018-04-091-8/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I'm proposing a new command line flag, --warn-backrefs in this patch. The flag and the feature proposed below don't exist in GNU linkers nor the current lld. --warn-backrefs is an option to detect reverse or cyclic dependencies between static archives, and it can be used to keep your program compatible with GNU linkers after you switch to lld. I'll explain the feature and why you may find it useful below. lld's symbol resolution semantics is more relaxed than traditional Unix linkers. Therefore, ld.lld foo.a bar.o succeeds even if bar.o contains an undefined symbol that have to be resolved by some object file in foo.a. Traditional Unix linkers don't allow this kind of backward reference, as they visit each file only once from left to right in the command line while resolving all undefined symbol at the moment of visiting. In the above case, since there's no undefined symbol when a linker visits foo.a, no files are pulled out from foo.a, and because the linker forgets about foo.a after visiting, it can't resolve undefined symbols that could have been resolved otherwise. That lld accepts more relaxed form means (besides it makes more sense) that you can accidentally write a command line or a build file that works only with lld, even if you have a plan to distribute it to wider users who may be using GNU linkers. With --check-library-dependency, you can detect a library order that doesn't work with other Unix linkers. The option is also useful to detect cyclic dependencies between static archives. Again, lld accepts ld.lld foo.a bar.a even if foo.a and bar.a depend on each other. With --warn-backrefs it is handled as an error. Here is how the option works. We assign a group ID to each file. A file with a smaller group ID can pull out object files from an archive file with an equal or greater group ID. Otherwise, it is a reverse dependency and an error. A file outside --{start,end}-group gets a fresh ID when instantiated. All files within the same --{start,end}-group get the same group ID. E.g. ld.lld A B --start-group C D --end-group E A and B form group 0, C, D and their member object files form group 1, and E forms group 2. I think that you can see how this group assignment rule simulates the traditional linker's semantics. Differential Revision: https://reviews.llvm.org/D45195 llvm-svn: 329636
* [ELF] - Reveal more information in -Map file about assignments.George Rimar2018-04-051-14/+13
| | | | | | | | | | | | | | | | | Currently, LLD print symbol assignment commands to the map file, but it does not do that for assignments that are outside of the section descriptions. Such assignments can affect the layout though. The patch implements the following: * Teaches LLD to print symbol assignments outside of section declaration. * Teaches LLD to print PROVIDE/HIDDEN/PROVIDE hidden commands. In case when symbol is not provided, nothing will be printed. Differential revision: https://reviews.llvm.org/D44894 llvm-svn: 329272
* [ELF] - Linkerscript: support MIN and MAX.George Rimar2018-03-281-0/+10
| | | | | | | | | | | | | | Sample for the OVERLAY command from the spec (https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/4/html/Using_ld_the_GNU_Linker/sections.html) uses MAX command that we do not support currently: . = 0x1000 + MAX (SIZEOF (.text0), SIZEOF (.text1)); This patch implements support for MIN and MAX. Differential revision: https://reviews.llvm.org/D44734 llvm-svn: 328696
* Fix linker script operator precedence.Rui Ueyama2018-03-151-5/+6
| | | | | | | | | | | "&" should have higher priority than "|" [1]. Previously, they had the same priority. [1] https://sourceware.org/binutils/docs/ld/Operators.html Differential Revision: https://reviews.llvm.org/D43880 llvm-svn: 327684
* [ELF] - Show data and assignment commands in the map file.George Rimar2018-03-151-3/+15
| | | | | | | | | Patch teaches LLD to print BYTE/SHORT/LONG/QUAD and location move commands to the map file. Differential revision: https://reviews.llvm.org/D44004 llvm-svn: 327612
* [ELF] - Implement INSERT BEFORE.George Rimar2018-03-131-3/+9
| | | | | | | | | | | This finishes PR35877. INSERT BEFORE used similar to INSERT AFTER, it inserts sections before the given target section. Differential revision: https://reviews.llvm.org/D44380 llvm-svn: 327378
* [ELF] - Removed excessive lookup. NFC.George Rimar2018-03-121-3/+2
| | | | llvm-svn: 327272
* [ELF] - Change consume()->expect() in INSERT AFTER parsing.George Rimar2018-03-121-1/+1
| | | | | | | | AFTER keyword is mandatory and consume() was used by mistake here. We accepted broken script before this patch, testcase shows the issue. llvm-svn: 327260
OpenPOWER on IntegriCloud