summaryrefslogtreecommitdiff
path: root/lld/COFF/MapFile.cpp
AgeCommit message (Collapse)Author
2025-05-25[lld] Remove unused includes (NFC) (#141421)Kazu Hirata
2025-04-19[lld] Use llvm::unique (NFC) (#136453)Kazu Hirata
2025-01-21[LLD][COFF] Separate EC and native exports for ARM64X (#123652)Jacek Caban
Store exports in SymbolTable instead of Configuration.
2025-01-16[LLD][COFF] Add support for hybrid ARM64X entry points (#123096)Jacek Caban
Store the entry symbol in SymbolTable instead of Configuration, as it differs between symbol tables.
2024-12-05[lld-link] Replace fatal(...) with FatalFangrui Song
2024-09-19[LLD][COFF] Process all ARM64EC import symbols in MapFile's getSymbols (#109118)Jacek Caban
2024-09-19[LLD][COFF] Process all live import symbols in MapFile's getSymbols() (#109117)Jacek Caban
The current logic assumes that the import file is pulled by object files, and the loop for import files only needs to handle cases where the `__imp_` symbol is implicitly pulled by an import thunk. This is fragile, as the symbol may also be pulled through other means, such as the -export argument in tests. Additionally, this logic is insufficient for ARM64EC, which exposes multiple symbols through an import file, and referencing any one of them causes all of them to be defined. With this change, import symbols are added to `syms` more often, but we ensure that output symbols remain unique later in the process
2024-09-18[LLD][COFF] Store __imp_ symbols as Defined in InputFile (#109115)Jacek Caban
2024-09-13[LLD][COFF][NFC] Store live flag in ImportThunkChunk. (#108459)Jacek Caban
Instead of ImportFile. This is a preparation for ARM64EC support, which has both x86 and ARM64EC thunks and each of them needs a separate flag.
2023-10-05[LLD][COFF] Add support for `--time-trace` (#68236)Alexandre Ganea
This adds support for generating Chrome-tracing .json profile traces in the LLD COFF driver. Also add the necessary time scopes, so that the profile trace shows in great detail which tasks are executed. As an example, this is what we see when linking a Unreal Engine executable: ![image](https://github.com/llvm/llvm-project/assets/37383324/b2e26eb4-9d37-4cf9-b002-48b604e7dcb7)
2023-01-09[LLD] Remove global state in lld/COFFAmy Huang
Remove globals from the lldCOFF library, by moving globals into a context class. This patch mostly moves the config object into COFFLinkerContext. See https://lists.llvm.org/pipermail/llvm-dev/2021-June/151184.html for context about removing globals from LLD. Reviewed By: aganea Differential Revision: https://reviews.llvm.org/D110450
2023-01-09Revert "[LLD] Remove global state in lld/COFF"Martin Storsjö
This reverts commit 7370ff624d217b0f8f7512ca5b651a9b8095a411. (and 47fb8ae2f9a4075de05433ef24f459b6befd1730). This commit broke the symbol type in import libraries generated for mingw autoexported symbols, when the source files were built with LTO. I'll commit a testcase that showcases this issue after the revert.
2023-01-08[LLD] Remove global state in lld/COFFAmy Huang
Remove globals from the lldCOFF library, by moving globals into a context class. This patch mostly moves the config object into COFFLinkerContext. See https://lists.llvm.org/pipermail/llvm-dev/2021-June/151184.html for context about removing globals from LLD. Reviewed By: aganea Differential Revision: https://reviews.llvm.org/D110450
2022-09-20[LLD][COFF] Support /MAPINFO flagPengxuan Zheng
This patch adds support for link.exe's /MAPINFO flag to lld-link.exe. Here is a description of the flag from Microsoft (https://learn.microsoft.com/en-us/cpp/build/reference/mapinfo-include-information-in-mapfile?view=msvc-170): The /MAPINFO option tells the linker to include the specified information in a mapfile, which is created if you specify the /MAP option. EXPORTS tells the linker to include exported functions. Reviewed By: rnk Differential Revision: https://reviews.llvm.org/D134247
2022-06-19Rename parallelForEachN to just parallelForNico Weber
Patch created by running: rg -l parallelForEachN | xargs sed -i '' -c 's/parallelForEachN/parallelFor/' No behavior change. Differential Revision: https://reviews.llvm.org/D128140
2021-09-17Reland "[LLD] Remove global state in lld/COFF" after fixing asan and msan ↵Amy Huang
test failures Original commit description: [LLD] Remove global state in lld/COFF This patch removes globals from the lldCOFF library, by moving globals into a context class (COFFLinkingContext) and passing it around wherever it's needed. See https://lists.llvm.org/pipermail/llvm-dev/2021-June/151184.html for context about removing globals from LLD. I also haven't moved the `driver` or `config` variables yet. Differential Revision: https://reviews.llvm.org/D109634 This reverts commit a2fd05ada9030eab2258fff25e77a05adccae128. Original commits were b4fa71eed34d967195514fe9b0a5211fca2bc5bc and e03c7e367adb8f228332e3c2ef8f45484597b719.
2021-09-16Temporarily revert "[LLD] Remove global state in lld/COFF" and "[lld] Add ↵Amy Huang
test to check for timer output" Seems to be causing a number of asan test failures. This reverts commit b4fa71eed34d967195514fe9b0a5211fca2bc5bc and e03c7e367adb8f228332e3c2ef8f45484597b719.
2021-09-16[LLD] Remove global state in lld/COFFAmy Huang
This patch removes globals from the lldCOFF library, by moving globals into a context class (COFFLinkingContext) and passing it around wherever it's needed. See https://lists.llvm.org/pipermail/llvm-dev/2021-June/151184.html for context about removing globals from LLD. I also haven't moved the `driver` or `config` variables yet. Differential Revision: https://reviews.llvm.org/D109634
2020-05-05[Support] Move LLD's parallel algorithm wrappers to supportReid Kleckner
Essentially takes the lld/Common/Threads.h wrappers and moves them to the llvm/Support/Paralle.h algorithm header. The changes are: - Remove policy parameter, since all clients use `par`. - Rename the methods to `parallelSort` etc to match LLVM style, since they are no longer C++17 pstl compatible. - Move algorithms from llvm::parallel:: to llvm::, since they have "parallel" in the name and are no longer overloads of the regular algorithms. - Add range overloads - Use the sequential algorithm directly when 1 thread is requested (skips task grouping) - Fix the index type of parallelForEachN to size_t. Nobody in LLVM was using any other parameter, and it made overload resolution hard for for_each_n(par, 0, foo.size(), ...) because 0 is int, not size_t. Remove Threads.h and update LLD for that. This is a prerequisite for parallel public symbol processing in the PDB library, which is in LLVM. Reviewed By: MaskRay, aganea Differential Revision: https://reviews.llvm.org/D79390
2020-03-24[lld-link] Support /map option, matching link.exe 's /map output formatSylvain Audi
Added support for /map and /map:[filepath]. The output was derived from Microsoft's Link.exe output when using that same option. Note that /MAPINFO support was not added. The previous implementation of MapFile.cpp/.h was meant for /lldmap, and was renamed to LLDMapFile.cpp/.h MapFile.cpp/.h is now for /MAP However, a small fix was added to lldmap, replacing a std::sort with std::stable_sort to enforce reproducibility. Differential Revision: https://reviews.llvm.org/D70557
2020-02-25Remove namespace lld { namespace coff { from COFF LLD cpp filesReid Kleckner
Instead, use `using namespace lld(::coff)`, and fully qualify the names of free functions where they are defined in cpp files. This effectively reverts d79c3be618 to follow the new style guide added in 236fcbc21a7a8872. Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D74882
2019-10-10[COFF] Wrap definitions in namespace lld { namespace coff {. NFCFangrui Song
Similar to D67323, but for COFF. Many lld/COFF/ files already use `namespace lld { namespace coff {`. Only a few need changing. Reviewed By: ruiu Differential Revision: https://reviews.llvm.org/D68772 llvm-svn: 374314
2019-08-22Fight a bit against global initializers. NFC.Benjamin Kramer
llvm-svn: 369695
2019-08-05Rename F_{None,Text,Append} to OF_{None,Text,Append}. NFCFangrui Song
F_{None,Text,Append} are kept for compatibility since r334221. llvm-svn: 367800
2019-07-11Update comments for r365730. NFC.Rui Ueyama
llvm-svn: 365733
2019-07-11[Coding style change][lld] Rename variables for non-ELF portsRui Ueyama
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
2019-05-22Re-land r361206 "[COFF] Store alignment in log2 form, NFC"Reid Kleckner
The previous patch lost the call to PowerOf2Ceil, which causes LLD to crash when handling common symbols with a non-power-of-2 size. I tweaked the existing common.test to make the bsspad16 common symbol be 15 bytes to add coverage for this case. llvm-svn: 361426
2019-05-21Revert r361206 "[COFF] Store alignment in log2 form, NFC"Nico Weber
Makes the linker crash when linking nasm.exe. llvm-svn: 361212
2019-05-20[COFF] Store alignment in log2 form, NFCReid Kleckner
Summary: Valid section or chunk alignments are powers of 2 in the range [1, 8192]. These can be stored more canonically in log2 form to free up some bits in Chunk. Combined with D61696, SectionChunk gets 8 bytes smaller. Reviewers: ruiu, aganea Subscribers: llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D61698 llvm-svn: 361206
2019-04-01Replace `typedef A B` with `using B = A`. NFC.Rui Ueyama
I did this using Perl. Differential Revision: https://reviews.llvm.org/D60003 llvm-svn: 357372
2019-02-27[LLD][COFF] Support /threads[:no] like the ELF driverAlexandre Ganea
Differential review: https://reviews.llvm.org/D58594 llvm-svn: 355029
2019-01-19Update the file headers across all of the LLVM projects in the monorepoChandler Carruth
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
2018-09-25[COFF] Add support for creating range extension thunks for ARMMartin Storsjo
This is a feature that MS link.exe lacks; it currently errors out on such relocations, just like lld did before. This allows linking clang.exe for ARM - practically, any image over 16 MB will likely run into the issue. Differential Revision: https://reviews.llvm.org/D52156 llvm-svn: 342962
2018-03-15COFF: Move assignment of section RVAs to assignAddresses(). NFCI.Peter Collingbourne
This makes the design a little more similar to the ELF linker and should allow for features such as ARM range extension thunks to be implemented more easily. Differential Revision: https://reviews.llvm.org/D44501 llvm-svn: 327667
2018-03-07Rename Indent{1,2} -> Indent{8,16}.Rui Ueyama
llvm-svn: 326912
2018-03-06Do not create temporary strings just to print out spaces. NFC.Rui Ueyama
llvm-svn: 326841
2018-02-20Consistent (non) use of empty lines in include blocksSam Clegg
The profailing style in lld seem to be to not include such empty lines. Clang-tidy/clang-format seem to handle this just fine. Differential Revision: https://reviews.llvm.org/D43528 llvm-svn: 325629
2017-11-20COFF: Remove the SymbolBodies vector, and rename SparseSymbolBodies to Symbols.Peter Collingbourne
Differential Revision: https://reviews.llvm.org/D40237 llvm-svn: 318683
2017-11-03Rename SymbolBody -> SymbolRui Ueyama
Now that we have only SymbolBody as the symbol class. So, "SymbolBody" is a bit strange name now. This is a mechanical change generated by perl -i -pe s/SymbolBody/Symbol/g $(git grep -l SymbolBody lld/ELF lld/COFF) nd clang-format-diff. Differential Revision: https://reviews.llvm.org/D39459 llvm-svn: 317370
2017-10-25[lld] unified COFF and ELF error handling on new Common/ErrorHandlerBob Haarman
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
2017-09-13Remove {get,set}Align accessor functions and use Alignment member variable ↵Rui Ueyama
instead. llvm-svn: 313204
2017-07-27Add {Obj,Import,Bitcode}File::Instances to COFF input files.Rui Ueyama
We did the same thing for ELF in r309152, and I want to maintain COFF and ELF as close as possible. llvm-svn: 309239
2017-07-26Rename ObjectFile ObjFile for COFF as well.Rui Ueyama
llvm-svn: 309228
2017-05-11[Support] Move Parallel algorithms from LLD to LLVM.Zachary Turner
Differential Revision: https://reviews.llvm.org/D33024 llvm-svn: 302748
2017-05-10[Core] Make parallel algorithms match C++ Parallelism TS.Zachary Turner
Differential Revision: https://reviews.llvm.org/D33016 llvm-svn: 302613
2017-04-30Fix comments.Rui Ueyama
llvm-svn: 301778
2017-04-29Port recent changes to ELF/MapFile.cpp to COFF.Rui Ueyama
llvm-svn: 301754
2017-01-31Print alignment in decimal instead of hexadecimal.Rui Ueyama
Previously, we were printing out something like this for sections/symbols with alignment 16 0000000000201000 0000000000000182 10 .data which I think confusing. I think printing it in decimal is better. Differential Revision: https://reviews.llvm.org/D29258 llvm-svn: 293685
2017-01-16[COFF] - Fixed format in writeOutSecLine()George Rimar
The same as https://reviews.llvm.org/rL292102, fixes next testcases under msvs2015/win32: 25> Failing Tests (3): 25> lld :: COFF/lldmap.test 25> lld :: COFF/weak-external.test 25> lld :: COFF/weak-external3.test llvm-svn: 292104
2017-01-15Simplify string output. NFC.Rui Ueyama
llvm-svn: 292042