summaryrefslogtreecommitdiffstats
path: root/lld/COFF/MarkLive.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [COFF] Don't treat DWARF sections as GC rootsReid Kleckner2020-04-131-2/+4
| | | | | | | | | | | | | | DWARF sections are typically live and not COMDAT, so they would be treated as GC roots. Enabling DWARF would essentially keep all code with debug info alive, preventing any section GC. Fixes PR45273 Reviewed By: mstorsjo, MaskRay Differential Revision: https://reviews.llvm.org/D76935 (cherry picked from commit c579a5b1d92a9bc2046d00ee2d427832e0f5ddec)
* Fix odd variable names.Rui Ueyama2019-07-121-3/+3
| | | | llvm-svn: 365875
* [Coding style change][lld] Rename variables for non-ELF portsRui Ueyama2019-07-111-29/+29
| | | | | | | | | | | 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
* [COFF] Reduce the size of Chunk and SectionChunk, NFCReid Kleckner2019-04-021-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Reorder the fields in both to use padding more efficiently, and add more comments on the purpose of the fields. Replace `std::vector<SectionChunk*> AssociativeChildren` with a singly-linked list. This avoids the separate vector allocation to list associative children, and shrinks the 3 pointers used for the typically empty vector down to 1. In the end, this reduces the sum of heap allocations used to link browser_tests.exe with NO PDB by 13.10%, going from 2,248,728 KB to 1,954,071 KB of heap. These numbers exclude memory mapped files, which are of course a significant factor in LLD's memory usage. Reviewers: ruiu, mstorsjo, aganea Subscribers: jdoerfert, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D59797 llvm-svn: 357535
* 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
* [COFF] When doing automatic dll imports, replace whole .refptr.<var> chunks ↵Martin Storsjo2018-08-311-4/+4
| | | | | | | | | | | | | | | | | | | | with __imp_<var> After fixing up the runtime pseudo relocation, the .refptr.<var> will be a plain pointer with the same value as the IAT entry itself. To save a little binary size and reduce the number of runtime pseudo relocations, redirect references to the IAT entry (via the __imp_<var> symbol) itself and discard the .refptr.<var> chunk (as long as the same section chunk doesn't contain anything else than the single pointer). As there are now cases for both setting the Live variable to true and false externally, remove the accessors and setters and just make the variable public instead. Differential Revision: https://reviews.llvm.org/D51456 llvm-svn: 341175
* COFF: Don't create unnecessary thunks.Peter Collingbourne2018-05-101-1/+1
| | | | | | | | | A thunk is only needed if a relocation points to the undecorated import name. Differential Revision: https://reviews.llvm.org/D46673 llvm-svn: 332019
* [coff] Print detailed timing information with /TIME.Zachary Turner2018-01-171-0/+5
| | | | | | | | | The classes used to print and update time information are in common, so other linkers could use this as well if desired. Differential Revision: https://reviews.llvm.org/D41915 llvm-svn: 322736
* Prefer `ArrayRef` over `const std::vector&`Sam Clegg2017-12-081-1/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D40993 llvm-svn: 320125
* Reland r319090, "COFF: Do not create SectionChunks for discarded comdat ↵Peter Collingbourne2017-11-281-7/+0
| | | | | | | | | | | | | | sections." with a fix for debug sections. If /debug was not specified, readSection will return a null pointer for debug sections. If the debug section is associative with another section, we need to make sure that the section returned from readSection is not a null pointer before adding it as an associative section. Differential Revision: https://reviews.llvm.org/D40533 llvm-svn: 319133
* Revert r319090, "COFF: Do not create SectionChunks for discarded comdat ↵Peter Collingbourne2017-11-271-0/+7
| | | | | | | | | sections." Caused test failures in check-cfi on Windows. http://lab.llvm.org:8011/builders/sanitizer-windows/builds/20284 llvm-svn: 319100
* COFF: Do not create SectionChunks for discarded comdat sections.Peter Collingbourne2017-11-271-7/+0
| | | | | | | | | | | | | | | | | | | | With this change, instead of creating a SectionChunk for each section in the object file, we only create them when we encounter a prevailing comdat section. Also change how symbol resolution occurs between comdat symbols. Now only the comdat leader participates in comdat resolution, and not any other external associated symbols. This is more in line with how COFF semantics are defined, and should allow for a more straightforward implementation of non-ANY comdat types. On my machine, this change reduces our runtime linking a release build of chrome_child.dll with /nopdb from 5.65s to 4.54s (median of 50 runs). Differential Revision: https://reviews.llvm.org/D40238 llvm-svn: 319090
* COFF: Correctly handle relocations against early discarded sections.Peter Collingbourne2017-11-201-1/+2
| | | | | | | | | | | Don't crash if we encounter a reference to an early discarded section (such as .drectve). Instead, handle them the same way as sections discarded by comdat merging, i.e. either print an error message or (for debug sections) silently ignore the relocation. Differential Revision: https://reviews.llvm.org/D40235 llvm-svn: 318689
* Rename SymbolBody -> SymbolRui Ueyama2017-11-031-3/+3
| | | | | | | | | | | | | 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
* [COFF] Allow debug info to relocate against discarded symbolsReid Kleckner2017-06-281-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: In order to do this without switching on the symbol kind multiple times, I created Defined::getChunkAndOffset and use that instead of SymbolBody::getRVA in the inner relocation loop. Now we get the symbol's chunk before switching over relocation types, so we can test if it has been discarded outside the inner relocation type switch. This also simplifies application of section relative relocations. Previously we would switch on symbol kind to compute the RVA, then the relocation type, and then the symbol kind again to get the output section so we could subtract that from the symbol RVA. Now we *always* have an OutputSection, so applying SECREL and SECTION relocations isn't as much of a special case. I'm still not quite happy with the cleanliness of this code. I'm not sure what offsets and bases we should be using during the relocation processing loop: VA, RVA, or OutputSectionOffset. Reviewers: ruiu, pcc Reviewed By: ruiu Subscribers: majnemer, inglorion, llvm-commits, aprantl Differential Revision: https://reviews.llvm.org/D34650 llvm-svn: 306566
* Garbage collect dllimported symbols.Rui Ueyama2017-05-241-5/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | This is a different implementation than r303225 (which was reverted in r303270, re-submitted in r303304 and then re-reverted in r303527). In the previous patch, I tried to add Live bit to each dllimported symbol. It turned out that it didn't work with "oldnames.lib" which contains a lot of weak aliases to dllimported symbols. The way we handle weak aliases is to check if undefined symbols can be resolved using weak aliases, and if so, memcpy the Defined symbols to weak Undefined symbols, so that any references to weak aliases automatically see defined symbols instead of undefined ones. This memcpy happens before MarkLive kicks in. That means we may have multiple copies of dllimported symbols. So turning on one instance's Live bit is not enough. This patch moves the Live bit to dllimport file. Since multiple copies of dllsymbols still point to the same file, we can use it as the central repository to keep track of liveness. Differential Revision: https://reviews.llvm.org/D33520 llvm-svn: 303814
* Revert r303304: Re-submit r303225: Garbage collect dllimported symbols.Rui Ueyama2017-05-221-28/+10
| | | | | | | | This reverts commit r303304 because it looks like the change introduced a crash bug. At least after that change, LLD with thinlto crashes when linking Chromium. llvm-svn: 303527
* Re-submit r303225: Garbage collect dllimported symbols.Rui Ueyama2017-05-171-10/+28
| | | | | | | | | | This reverts re-submits r303225 which was reverted in r303270 because it broke the sanitizer-windows bot. The reason of the failure is that we were writing dead symbols to the symbol table. I fixed the issue. llvm-svn: 303304
* Revert r303225 "Garbage collect dllimported symbols."Hans Wennborg2017-05-171-28/+10
| | | | | | | | | | | | | | | | | | | | | | | | | and follow-up r303226 "Fix Windows buildbots." This broke the sanitizer-windows buildbot. > Previously, the garbage collector (enabled by default or by explicitly > passing /opt:ref) did not kill dllimported symbols. As a result, > dllimported symbols could be added to resulting executables' dllimport > list even if no one was actually using them. > > This patch implements dllexported symbol garbage collection. Just like > COMDAT sections, dllimported symbols now have Live bits to manage their > liveness, and MarkLive marks reachable dllimported symbols. > > Fixes https://bugs.llvm.org/show_bug.cgi?id=32950 > > Reviewers: pcc > > Subscribers: llvm-commits > > Differential Revision: https://reviews.llvm.org/D33264 llvm-svn: 303270
* Garbage collect dllimported symbols.Rui Ueyama2017-05-171-10/+28
| | | | | | | | | | | | | | | | | | | | | | Summary: Previously, the garbage collector (enabled by default or by explicitly passing /opt:ref) did not kill dllimported symbols. As a result, dllimported symbols could be added to resulting executables' dllimport list even if no one was actually using them. This patch implements dllexported symbol garbage collection. Just like COMDAT sections, dllimported symbols now have Live bits to manage their liveness, and MarkLive marks reachable dllimported symbols. Fixes https://bugs.llvm.org/show_bug.cgi?id=32950 Reviewers: pcc Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D33264 llvm-svn: 303225
* COFF: New symbol table design.Peter Collingbourne2016-12-091-3/+3
| | | | | | | | | This ports the ELF linker's symbol table design, introduced in r268178, to the COFF linker. Differential Revision: http://reviews.llvm.org/D21166 llvm-svn: 289280
* COFF: Move markLive() from Writer.cpp to its own file.Rui Ueyama2015-09-191-0/+61
Conceptually, garbage collection is not part of Writer, so move the function out of the file. llvm-svn: 248099
OpenPOWER on IntegriCloud