summaryrefslogtreecommitdiff
path: root/lld/docs
Commit message (Collapse)AuthorAgeFilesLines
* fix typos to cycle botsNico Weber2023-05-101-1/+1
|
* [ELF] Add --remap-inputs= and --remap-inputs-file=Fangrui Song2023-04-262-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | --remap-inputs-file= can be specified multiple times, each naming a remap file that contains `from-glob=to-file` lines or `#`-led comments. ('=' is used a separator a la -fdebug-prefix-map=) --remap-inputs-file= can be used to: * replace an input file. E.g. `"*/libz.so=exp/libz.so"` can replace a resolved `-lz` without updating the input file list or (if used) a response file. When debugging an application where a bug is isolated to one single input file, this option gives a convenient way to test fixes. * remove an input file with `/dev/null` (changed to `NUL` on Windows), e.g. `"a.o=/dev/null"`. A build system may add unneeded dependencies. This option gives a convenient way to test the result removing some inputs. `--remap-inputs=a.o=aa.o` can be specified to provide one pattern without using an extra file. (bash/zsh process substitution is handy for specifying a pattern without using a remap file, e.g. `--remap-inputs-file=<(printf 'a.o=aa.o')`, but it may be unavailable in some systems. An extra file can be inconvenient for a build system.) Exact patterns are tested before wildcard patterns. In case of a tie, the first patterns wins. This is an implementation detail that users should not rely on. Co-authored-by: Marco Elver <elver@google.com> Link: https://discourse.llvm.org/t/rfc-support-exclude-inputs/70070 Reviewed By: melver, peter.smith Differential Revision: https://reviews.llvm.org/D148859
* [LLD][ARM] Handle .ARM.exidx sections at non-zero output sec offsetPeter Smith2023-04-141-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Embedded systems that do not use an ELF loader locate the .ARM.exidx exception table via linker defined __exidx_start and __exidx_end rather than use the PT_ARM_EXIDX program header. This means that some linker scripts such as the picolibc C library's linker script, do not have the .ARM.exidx sections at offset 0 in the OutputSection. For example: .except_unordered : { . = ALIGN(8); PROVIDE(__exidx_start = .); *(.ARM.exidx*) PROVIDE(__exidx_end = .); } >flash AT>flash :text This is within the specification of Arm exception tables, and is handled correctly by ld.bfd. This patch has 2 parts. The first updates the writing of the data of the .ARM.exidx SyntheticSection to account for a non-zero OutputSection offset. The second part makes the PT_ARM_EXIDX program header generation a special case so that it covers only the SyntheticSection and not the parent OutputSection. While not strictly necessary for programs locating the exception tables via the symbols it may cause ELF utilities that locate the exception tables via the PT_ARM_EXIDX program header to fail. This does not seem to be the case for GNU and LLVM readelf which seems to look for the SHT_ARM_EXIDX section. Differential Revision: https://reviews.llvm.org/D148033
* [lld][RISCV] Implement GP relaxation for ↵Craig Topper2023-04-131-0/+2
| | | | | | | | | | | | | | | | | | | R_RISCV_HI20/R_RISCV_LO12_I/R_RISCV_LO12_S. This implements support for relaxing these relocations to use the GP register to compute addresses of globals in the .sdata and .sbss sections. This feature is off by default and must be enabled by passing --relax-gp to the linker. The GP register might not always be the "global pointer". It can be used for other purposes. See discussion here https://github.com/riscv-non-isa/riscv-elf-psabi-doc/pull/371 Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D143673
* [lld][WebAssembly] Initial support for stub librariesSam Clegg2023-03-231-0/+33
| | | | | | | | | | | See the docs in lld/docs/WebAssembly.rst for more on this. This feature unlocks a lot of simplification in the emscripten toolchain since we can represent the JS libraries to wasm-ld as stub libraries. See https://github.com/emscripten-core/emscripten/issues/18875 Differential Revision: https://reviews.llvm.org/D145308
* [ELF][docs] Mention LLD_REPRODUCE and LLD_VERSIONFangrui Song2023-02-091-1/+17
| | | | | | Reviewed By: peter.smith Differential Revision: https://reviews.llvm.org/D143600
* [docs] Update "production quality" targets for lld/ELFFangrui Song2023-02-081-2/+2
| | | | | | | | Add RISC-V and update Arm from (>= v6) to (>= v4). Reviewed By: pirama Differential Revision: https://reviews.llvm.org/D143543
* [lld] fix comment typos to cycle botsNico Weber2023-02-041-1/+1
|
* Bump the trunk major version to 17llvmorg-17-initTom Stellard2023-01-241-46/+0
|
* [docs] Add release notes for news in 16.x done by me, or otherwise relating ↵Martin Storsjö2023-01-231-0/+10
| | | | | | to MinGW targets Differential Revision: https://reviews.llvm.org/D142346
* [lld-macho] Flip string deduplication defaultKeith Smiley2022-12-222-12/+0
| | | | | | | | | | | | | Previously by default, when not using `--ifc=`, lld would not deduplicate string literals. This reveals reliance on undefined behavior where string literal addresses are compared instead of using string equality checks. While ideally you would be able to easily identify and eliminate the reliance on this UB, this can be difficult, especially for third party code, and increases the friction and risk of users migrating to lld. This flips the default to deduplicate strings unless `--no-deduplicate-strings` is passed, matching ld64's behavior. Differential Revision: https://reviews.llvm.org/D140517
* [ELF] Merge SHT_RISCV_ATTRIBUTES sectionsFangrui Song2022-12-081-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently we take the first SHT_RISCV_ATTRIBUTES (.riscv.attributes) as the output. If we link an object without an extension with an object with the extension, the output Tag_RISCV_arch may not contain the extension and some tools like objdump -d will not decode the related instructions. This patch implements Tag_RISCV_stack_align/Tag_RISCV_arch/Tag_RISCV_unaligned_access merge as specified by https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-elf.adoc#attributes For the deprecated Tag_RISCV_priv_spec{,_minor,_revision}, dump the attribute to the output iff all input agree on the value. This is different from GNU ld but our simple approach should be ok for deprecated tags. `RISCVAttributeParser::handler` currently warns about unknown tags. This behavior is retained. In GNU ld arm, tags >= 64 (mod 128) are ignored with a warning. If RISC-V ever wants to do something similar (https://github.com/riscv-non-isa/riscv-elf-psabi-doc/issues/352), consider documenting it in the psABI and changing RISCVAttributeParser. Like GNU ld, zero value integer attributes and empty string attributes are not dumped to the output. Reviewed By: asb, kito-cheng Differential Revision: https://reviews.llvm.org/D138550
* [ELF] Enable --no-undefined-version by defaultDan Albert2022-12-082-2/+5
| | | | | | | | | Allowing incorrect version scripts is not a helpful default. Flip that to help users find their bugs at build time rather than at run time. Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D135402
* [ELF] Produce DT_RISCV_VARIANT_CCFangrui Song2022-12-041-0/+3
| | | | | | | | | | | | | | https://github.com/riscv/riscv-elf-psabi-doc/pull/190 introduced STO_RISCV_VARIANT_CC. The linker should: * Copy the STO_RISCV_VARIANT_CC bit to .symtab/.dynsym: already fulfilled after 82ed93ea0552c8f82df05859ee93e70b71c4e65d * Produce DT_RISCV_VARIANT_CC if at least one R_RISCV_JUMP_SLOT relocation references a symbol with the STO_RISCV_VARIANT_CC bit. Done by this patch. Reviewed By: kito-cheng Differential Revision: https://reviews.llvm.org/D107951
* [LLD][COFF] Survive empty and invalid PCH signatureAlexandre Ganea2022-11-201-0/+3
| | | | | | | | | | Solve two issues that showed up when using LLD with Unreal Engine & FASTBuild: 1. It seems the S_OBJNAME record doesn't always record the "precomp signature". We were relying on that to match the PCH.OBJ with their dependent-OBJ. 2. MSVC link.exe is able to link a PCH.OBJ when the "precomp signatureÈ doesn't match, but LLD was failing. This was occuring since the Unreal Engine Build Tool was compiling the PCH.OBJ, but the dependent-OBJ were compiled & cached through FASTBuild. Upon a clean rebuild, the PCH.OBJs were recompiled by the Unreal Build Tool, thus the "precomp signatures" were changing; however the OBJs were already cached by FASTBuild, thus having an old "precomp signatures". We now ignore "precomp signatures" and properly fallback to cmd-line name lookup, like MSVC link.exe does, and only fail if the PCH.OBJ type stream doesn't match the count expected by the dependent-OBJ. Differential Revision: https://reviews.llvm.org/D136762
* [CodeView] Replace GHASH hasher by BLAKE3Alexandre Ganea2022-11-191-0/+2
| | | | | | | Previously, we used SHA-1 for hashing the CodeView type records. SHA-1 in `GloballyHashedType::hashType()` is coming top in the profiles. By simply replacing with BLAKE3, the link time is reduced in our case from 15 sec to 13 sec. I am only using MSVC .OBJs in this case. As a reference, the resulting .PDB is approx 2.1GiB and .EXE is approx 250MiB. Differential Revision: https://reviews.llvm.org/D137101
* [PDB] Don't include input files in the 'cmd' entry of S_ENVBLOCKSylvain Audi2022-11-141-1/+3
| | | | | | | MSVC records the command line arguments in S_ENVBLOCK, skipping the input file arguments. This patch adds this filtering on lld-link side. Differential Revision: https://reviews.llvm.org/D137723
* Revert "[LLD] Enable --no-undefined-version by default."Jon Chesterfield2022-11-092-5/+2
| | | | This reverts commit eedbe44b8755f7d162eee43cb3e8c9da1e61ebad.
* [LLD] Enable --no-undefined-version by default.Dan Albert2022-11-072-2/+5
| | | | | | | | | Allowing incorrect version scripts is not a helpful default. Flip that to help users find their bugs at build time rather than at run time. Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D135402
* [ELF] Add --no-warnings/-wFangrui Song2022-10-242-0/+5
| | | | | | | | | | | | | | Mach-O ld64 supports -w to suppress warnings. GNU ld 2.40 will support the option as well (https://sourceware.org/bugzilla/show_bug.cgi?id=29654). This feature has some small value. E.g. when analyzing a large executable with relocation overflow issues, we may use --noinhibit-exec --emit-relocs to get an output file with static relocations despite relocation overflow issues. -w can significantly improve the link time as printing the massive warnings is slow. Reviewed By: peter.smith Differential Revision: https://reviews.llvm.org/D136569
* Revert "[Libomp] Do not error on undefined version script symbols"Slava Zakharin2022-10-132-5/+2
| | | | | | | | | | | | | | | This reverts commit 096f93e73dc3f88636cdcb57515e3732385b452d. Revert "[Libomptarget] Make the plugins ingore undefined exported symbols" This reverts commit 3f62314c235bd2475c8e2b5b874b2932a444e823. Revert "[LLD] Enable --no-undefined-version by default." This reverts commit 7ec8b0d162e354c703f5390784287054601f9c69. Three commits are reverted because of the current omp build fail with GNU ld. See discussion here: https://reviews.llvm.org/rG096f93e73dc3
* [LLD] Enable --no-undefined-version by default.Dan Albert2022-10-122-2/+5
| | | | | | | | | Allowing incorrect version scripts is not a helpful default. Flip that to help users find their bugs at build time rather than at run time. Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D135402
* [lld-macho] Flip ZERO_AR_DATE defaultKeith Smiley2022-10-101-0/+8
| | | | | | | | | | Previously unless ZERO_AR_DATE was set to any value, ld64.lld would embed non-hermetic timestamps into the final binary. This flips that default to zero those values unless ZERO_AR_DATE is set explicitly to 0. As far as I know there isn't a downside to this, except that it differs from ld64. Differential Revision: https://reviews.llvm.org/D135529
* [lld-macho] Do not error out on dead stripped duplicate symbolsVincent Lee2022-09-301-0/+9
| | | | | | | | | | | | | Builds that error out on duplicate symbols can still succeed if the symbols will be dead stripped. Currently, this is the current behavior in ld64. https://github.com/apple-oss-distributions/ld64/blob/main/src/ld/Resolver.cpp#L2018. In order to provide an easier to path for adoption, introduce a new flag that will retain compatibility with ld64's behavior (similar to `--deduplicate-literals`). This is turned off by default since we do not encourage this behavior in the linker. Reviewed By: #lld-macho, thakis, int3 Differential Revision: https://reviews.llvm.org/D134794
* [ELF] Make -V an alias for -vFangrui Song2022-09-201-2/+2
| | | | | | | | | | | | | | | In GNU ld, * --version skips linker input processing. * -v and -V keep processing if there is any input file. -V has more information we don't support. We currently make -V an alias for --version which skips input processing. On many `*-freebsd` and `powerpc-*` targets, `gcc -v` passes `-V` to ld and expects to process input. Make -V an alias for -v to provide compatibility. Fix https://github.com/llvm/llvm-project/issues/57859
* [lld-macho][reland] Add support for N_INDR symbolsJez Ng2022-09-151-0/+9
| | | | | | | | | | | | | | | | | | This is similar to the `-alias` CLI option, but it gives finer-grained control in that it allows the aliased symbols to be treated as private externs. While working on this, I realized that our `-alias` handling did not cover the cases where the aliased symbol is a common or dylib symbol, nor the case where we have an undefined that gets treated specially and converted to a defined later on. My N_INDR handling neglects this too for now; I've added checks and TODO messages for these. `N_INDR` symbols cropped up as part of our attempt to link swift-stdlib. Reviewed By: #lld-macho, thakis, thevinster Differential Revision: https://reviews.llvm.org/D133825
* Revert "[lld-macho] Add support for N_INDR symbols"Nico Weber2022-09-151-9/+0
| | | | | This reverts commit 5b8da10b87f7009c06215449e4a9c61dab91697a. Breaks tests, see https://reviews.llvm.org/D133825
* [lld-macho] Add support for N_INDR symbolsJez Ng2022-09-151-0/+9
| | | | | | | | | | | | | | | | | | This is similar to the `-alias` CLI option, but it gives finer-grained control in that it allows the aliased symbols to be treated as private externs. While working on this, I realized that our `-alias` handling did not cover the cases where the aliased symbol is a common or dylib symbol, nor the case where we have an undefined that gets treated specially and converted to a defined later on. My N_INDR handling neglects this too for now; I've added checks and TODO messages for these. `N_INDR` symbols cropped up as part of our attempt to link swift-stdlib. Reviewed By: #lld-macho, thakis, thevinster Differential Revision: https://reviews.llvm.org/D133825
* [lld-macho][docs] Cosmetic changesJez Ng2022-09-122-27/+33
| | | | | | | | | | | | | | | | | 1. Fixed rST hyperlink syntax 2. Renamed LD64 -> ld64 3. Moved up the `-no_deduplicate` section so it is right under the section talking about how our default dedup behavior differs; IMO it makes more sense to read them in that order 4. De-bullet-listed some other sections so we have less whitespace in the rendered page 5. Since the Mach-O LLD Port page has only one sub-page, don't render an entire toctree with just one item. Use a "See also" box instead. 6. Wrap lines at 80 chars. Reviewed By: #lld-macho, thevinster Differential Revision: https://reviews.llvm.org/D133717
* [ELF] Add --compress-debug-sections=zstdFangrui Song2022-09-092-5/+14
| | | | | | | | | | | | | | | `clang -gz=zstd a.o` passes this option to the linker. This option compresses output debug sections with zstd and sets ch_type to ELFCOMPRESS_ZSTD. As of today, very few DWARF consumers recognize ELFCOMPRESS_ZSTD. Use the llvm::zstd::compress API with level llvm::zstd::DefaultCompression (5), which we may tune after we have more experience with zstd output. zstd has built-in parallel compression support (so we don't need to do D117853 for zlib), which is not leveraged yet. Reviewed By: peter.smith Differential Revision: https://reviews.llvm.org/D133548
* [ELF] Support ELFCOMPRESS_ZSTD inputFangrui Song2022-09-091-0/+3
| | | | | | | | | so that lld accepts relocatable object files produced by `clang -c -g -gz=zstd`. We don't want to increase the size of InputSection, so do redundant but cheap ch_type checks instead. Differential Revision: https://reviews.llvm.org/D129406
* [LLD][MinGW] Add --[no-]guard-cf and --[no-]guard-longjmpAlvin Wong2022-09-091-1/+9
| | | | | | | | | | | | | | | | These will be LLD-specific options to support Control Flow Guard for the MinGW target. They are disabled by default, but enabling `--guard-cf` will also enable `--guard-longjmp` unless `--no-guard-longjmp` is also specified. These options maps to `-guard:cf,[no]longjmp`. Note that these features require the `_load_config_used` symbol to contain the load config directory and be filled with the required symbols. While current versions of mingw-w64 do not supply this symbol, the user can provide their own version of it. Reviewed By: MaskRay, rnk Differential Revision: https://reviews.llvm.org/D132808
* Add docs for Mach-O lldMichael Eisel2022-09-063-0/+99
| | | | | | | | I wasn't able to find any docs for Mach-O in `lld/docs`, so here's an attempt at adding basic docs. One of my goals here is to make it easy for users who are unfamiliar with linkers to successfully use lld. Reviewed By: #lld-macho, int3 Differential Revision: https://reviews.llvm.org/D132893
* [docs] Remove lld/ELF release note about --package-metadata= which is in ↵Fangrui Song2022-08-191-2/+0
| | | | release/15.x
* [doc] Remove release notes from the main branch for changes that were ↵Martin Storsjö2022-08-121-5/+1
| | | | backported to 15.x
* [LLD] [COFF] Add support for a new, mingw specific embedded directive ↵Martin Storsjö2022-08-111-0/+3
| | | | | | | | | | | | | | | | -exclude-symbols: This is an entirely new embedded directive - extending the GNU ld command line option --exclude-symbols to be usable in embedded directives too. (GNU ld.bfd also got support for the same new directive, currently in the latest git version, after the 2.39 branch.) This works as an inverse to the regular embedded dllexport directives, for cases when autoexport of all eligible symbols is performed. Differential Revision: https://reviews.llvm.org/D130120
* [LLD] [MinGW] Implement the --exclude-symbols optionMartin Storsjö2022-08-111-1/+2
| | | | | | | | This adds support for the existing GNU ld command line option, which allows excluding individual symbols from autoexport (when linking a DLL and no symbols are marked explicitly as dllexported). Differential Revision: https://reviews.llvm.org/D130118
* [ELF] Support --package-metadataAlex Brachet2022-08-081-0/+2
| | | | | | | | This was recently introduced in GNU linkers and it makes sense for ld.lld to have the same support. This implementation omits checking if the input string is valid json to reduce size bloat. Differential Revision: https://reviews.llvm.org/D131439
* Bump the trunk major version to 16llvmorg-16-initTom Stellard2022-07-261-29/+0
|
* [lld-macho] Enable EH frame relocation / pruningJez Ng2022-07-131-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This just removes the code that gates the logic. The main issue here is perf impact: without {D122258}, LLD takes a significant perf hit because it now has to do a lot more work in the input parsing phase. But with that change to eliminate unnecessary EH frames from input object files, the perf overhead here is minimal. Concretely, here are the numbers for some builds as measured on my 16-core Mac Pro: **chromium_framework** This is without the use of `-femit-dwarf-unwind=no-compact-unwind`: base diff difference (95% CI) sys_time 1.826 ± 0.019 1.962 ± 0.034 [ +6.5% .. +8.4%] user_time 9.306 ± 0.054 9.926 ± 0.082 [ +6.2% .. +7.1%] wall_time 8.225 ± 0.068 8.947 ± 0.128 [ +8.0% .. +9.6%] samples 15 22 With that flag enabled, the regression mostly disappears, as hoped: base diff difference (95% CI) sys_time 1.839 ± 0.062 1.866 ± 0.068 [ -0.9% .. +3.8%] user_time 9.452 ± 0.068 9.490 ± 0.067 [ -0.1% .. +0.9%] wall_time 8.383 ± 0.127 8.452 ± 0.114 [ -0.1% .. +1.8%] samples 17 21 **Unnamed internal app** Without `-femit-dwarf-unwind`, this is the perf hit: base diff difference (95% CI) sys_time 1.372 ± 0.029 1.317 ± 0.024 [ -4.6% .. -3.5%] user_time 2.835 ± 0.028 2.980 ± 0.027 [ +4.8% .. +5.4%] wall_time 3.205 ± 0.079 3.383 ± 0.066 [ +4.9% .. +6.2%] samples 102 83 With `-femit-dwarf-unwind`, the perf hit almost disappears: base diff difference (95% CI) sys_time 1.274 ± 0.026 1.270 ± 0.025 [ -0.9% .. +0.3%] user_time 2.812 ± 0.023 2.822 ± 0.035 [ +0.1% .. +0.7%] wall_time 3.166 ± 0.047 3.174 ± 0.059 [ -0.2% .. +0.7%] samples 95 97 Just for fun, I measured the impact of `-femit-dwarf-unwind` on ld64 (`base` has the extra DWARF unwind info in the input object files, `diff` doesn't): base diff difference (95% CI) sys_time 1.128 ± 0.010 1.124 ± 0.023 [ -1.3% .. +0.6%] user_time 7.176 ± 0.030 7.106 ± 0.094 [ -1.5% .. -0.4%] wall_time 7.874 ± 0.041 7.795 ± 0.121 [ -1.7% .. -0.3%] samples 16 25 And for LLD: base diff difference (95% CI) sys_time 1.315 ± 0.019 1.280 ± 0.019 [ -3.2% .. -2.0%] user_time 2.980 ± 0.022 2.822 ± 0.016 [ -5.5% .. -5.0%] wall_time 3.369 ± 0.038 3.175 ± 0.033 [ -6.2% .. -5.3%] samples 47 47 So parsing the extra EH frames is a lot more expensive for us than for ld64. But given that we are quite a lot faster than ld64 to begin with, I guess this isn't entirely unexpected... Reviewed By: #lld-macho, oontvoo Differential Revision: https://reviews.llvm.org/D129540
* [LLD][ELF] Add FORCE_LLD_DIAGNOSTICS_CRASH to force LLD to crashBen Dunbobbin2022-07-051-0/+2
| | | | | | | | | | Add FORCE_LLD_DIAGNOSTICS_CRASH inspired by the existing FORCE_CLANG_DIAGNOSTICS_CRASH. This is particularly useful for people customizing LLD as they may want to modify the crash reporting behavior. Differential Revision: https://reviews.llvm.org/D128195
* [docs] Remove outdated status update for FreeBSDBrad Smith2022-06-271-9/+0
| | | | | | Reviewed By: emaste, MaskRay Differential Revision: https://reviews.llvm.org/D128592
* [lld, ELF and mac] Add --time-trace=<file>, remove --time-trace-file=<file>Nico Weber2022-06-231-0/+3
| | | | | | | | | | `--time-trace=foo` has the same behavior as `--time-trace --time-trace-file=<file>` had previously. Also, for mac, make --time-trace-granularity *not* imply --time-trace, to match behavior of the ELF port. Differential Revision: https://reviews.llvm.org/D128451
* [lld] Wrap rst file to 80 cols and fix "precense" typoNico Weber2022-06-191-6/+9
|
* [ELF] Remove support for legacy .zdebug sectionsFangrui Song2022-06-021-0/+3
| | | | | | | | | | | | | | | | .zdebug is unlikely used any longer: gcc -gz switched from legacy .zdebug to SHF_COMPRESSED with binutils 2.26 (2016), which has been several years. clang 14 dropped -gz=zlib-gnu support. According to Debian Code Search (`gz=zlib-gnu`), no project uses -gz=zlib-gnu. Remove .zdebug support to (a) simplify code and (b) allow removal of llvm-mc's --compress-debug-sections=zlib-gnu. In case the old object file `a.o` uses .zdebug, run `objcopy --decompress-debug-sections a.o` Reviewed By: peter.smith Differential Revision: https://reviews.llvm.org/D126793
* Revert D125410 "[ELF] Align the end of PT_GNU_RELRO to max-page-size instead ↵Fangrui Song2022-05-121-4/+0
| | | | | | | | | of common-page-size" This reverts commit ebdb9d635a077274e38baa8584f5b0e631b4b1d3. Changing p_memsz is insufficient and may make PT_GNU_RELRO extend beyond the PT_LOAD.
* [ELF] Align the end of PT_GNU_RELRO to max-page-size instead of common-page-sizeFangrui Song2022-05-121-0/+4
| | | | | | | | | | | | | | We picked common-page-size to match GNU ld. Recently, the resolution to GNU ld https://sourceware.org/bugzilla/show_bug.cgi?id=28824 (milestone: 2.39) switched to max-page-size so that the last page can be protected by RELRO in case the system page size is larger than common-page-size. Thanks to our two RW PT_LOAD scheme (D58892), switching to max-page-size does not change file size (while GNU ld's scheme may increase file size). Reviewed By: peter.smith Differential Revision: https://reviews.llvm.org/D125410
* [lld/win] Mention in release notes that /winsysroot: currently requires ↵Nico Weber2022-04-221-2/+4
| | | | | | /machine: Differential Revision: https://reviews.llvm.org/D124254
* [ELF] Default to --no-fortran-commonFangrui Song2022-03-301-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | D86142 introduced --fortran-common and defaulted it to true (matching GNU ld but deviates from gold/macOS ld64). The default state was motivated by transparently supporting some FORTRAN 77 programs (Fortran 90 deprecated common blocks). Now I think it again. I believe we made a mistake to change the default: * this is a weird and legacy rule, though the breakage is very small * --fortran-common introduced complexity to parallel symbol resolution and will slow down it * --fortran-common more likely causes issues when users mix COMMON and STB_GLOBAL definitions (see https://github.com/llvm/llvm-project/issues/48570 and https://maskray.me/blog/2022-02-06-all-about-common-symbols). I have seen several issues in our internal projects and Android. On the other hand, --no-fortran-common is safer since COMMON/STB_GLOBAL have the same semantics related to archive member extraction. Therefore I think we should switch back, not punishing the common uage. A platform wanting --fortran-common can implement ld.lld as a shell script wrapper around `lld -flavor gnu --fortran-common "$@"`. Reviewed By: ikudrin, sfertile Differential Revision: https://reviews.llvm.org/D122450
* [ELF] Move section assignment from initializeSymbols to postParseFangrui Song2022-03-151-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | https://discourse.llvm.org/t/parallel-input-file-parsing/60164 initializeSymbols currently sets Defined::section and handles non-prevailing COMDAT groups. Move the code to the parallel postParse to reduce work from the single-threading code path and make parallel section initialization infeasible. Postpone reporting duplicate symbol errors so that the messages have the section information. (`Defined::section` is assigned in postParse and another thread may not have the information). * duplicated-synthetic-sym.s: BinaryFile duplicate definition (very rare) now has no section information * comdat-binding: `%t/w.o %t/g.o` leads to an undesired undefined symbol. This is not ideal but we report a diagnostic to inform that this is unsupported. (See release note) * comdat-discarded-lazy.s: %tdef.o is unextracted. The new behavior (discarded section error) makes more sense * i386-comdat.s: switched to a better approach working around .gnu.linkonce.t.__x86.get_pc_thunk.bx in glibc<2.32 for x86-32. Drop the ancient no-longer-relevant workaround for __i686.get_pc_thunk.bx Depends on D120640 Differential Revision: https://reviews.llvm.org/D120626