1
1
mirror of https://github.com/rui314/mold.git synced 2024-09-11 13:06:59 +03:00
Commit Graph

6490 Commits

Author SHA1 Message Date
Rui Ueyama
e7dc90dadc Refactor 2024-03-18 17:10:18 +09:00
Rui Ueyama
8375741489
Merge pull request #1201 from nga888/win-mem-map-output-file
Add "basic" support for memory mapping to Windows OutputFile
2024-03-16 11:35:25 +09:00
Rui Ueyama
042b14653e Do not update the man page for branches other than main 2024-03-16 09:18:48 +09:00
Rui Ueyama
c7f6a91da5 Bump mold version to 2.30.0
libtool mistakes mold 2.4.1 as GNU ld 2.4 and wrongly concludes that our
linker does not support anonymous versioning and suppresses some uses of
version scripts. That has been causing subtle compatibility issues with
programs that use libtool to create their .so files.

Here is the code that mistakes our linker as GNU ld:
https://git.savannah.gnu.org/cgit/libtool.git/tree/m4/libtool.m4?h=v2.4.7#n5066

As a workaround, I decided to bump our linker version so that the version
number is sufficiently large. This is admittedly ugly but I think it's the
simplest solution for the problem.
2024-03-15 18:40:46 +09:00
Rui Ueyama
c26260e38d Do not set symbol size to imported dynamic symbols
The dynamic linker does not seem to care about st_size of undefined
dynamic symbols, but semantically it shouldn't be an arbitrary number.
2024-03-15 11:35:48 +09:00
Rui Ueyama
ac04d79ad2 Extend test timeout from 1 hour to 3 hours 2024-03-15 11:35:43 +09:00
Rui Ueyama
052b89e8d6 Copy mold to the top source directory
test/gentoo-test.sh depends on the presence of the file.
2024-03-14 16:15:29 +09:00
Rui Ueyama
c395da1c54 Do not create an unnecessary gap in file for BSS
Fixes https://github.com/rui314/mold/issues/1216
2024-03-13 16:01:04 +09:00
Rui Ueyama
16b0564d49 Fix CI 2024-03-12 14:38:42 +09:00
Rui Ueyama
d21207cc79 Handle sections with an unknown section type as errors
Fixes https://github.com/rui314/mold/issues/1215
2024-03-12 14:13:52 +09:00
Rui Ueyama
c4b69a1077 Re-throw a signal
Previously, mold exists silently when it gets killed by SIGSEGV.
This change makes it verbose; now the parent process would report
an error.
2024-03-11 16:04:55 +09:00
Rui Ueyama
c85dd8881b Refactor 2024-03-10 18:21:04 +09:00
Rui Ueyama
8eae0a33b3 [PPC32] Do not discard .got2 even if --gc-sections is given
Even though .got2 may not be referenced directly, we use that section
when processing relocations.
2024-03-10 18:16:11 +09:00
Rui Ueyama
6356fa09e9 Fix gentoo package name 2024-03-09 16:18:07 +09:00
Rui Ueyama
641e7c2b05 Use madvise instead of munmap
Using madvise(2) is clearer than munmap(2), and the madvise approach
seems to be slightly faster than mmap on my machine.
2024-03-09 13:39:59 +09:00
Rui Ueyama
c60d1d0877 Use xxhash instead of gdb_hash for the internal hashmap for .gdb_index
Our ConcurrentMap uses linear probing to find unused hash table entry.
It gives up if 128 consective slots are occupied, and the whole process
dies with the "ConcurrentMap is full" error message. So our hash
function's quality must be high.

For .gdb_index, we used to use gdb_index() to compute keys for the
ConcurrentMap. It turned out that the function's quality is poor,
generating very similar output for short strings.

This commit changes the hash function to xxhash.

Fixes https://issues.chromium.org/issues/40276991#comment5
2024-03-06 13:12:53 +09:00
Rui Ueyama
c45dd19d47 Do not trap SIGABRT unless older versions of TBB is in use 2024-03-05 10:04:54 +09:00
Rui Ueyama
51f871f43b Silently ignore broken .llvm_addrsig
Fixes https://github.com/rui314/mold/issues/1213
2024-03-04 16:57:12 +09:00
Rui Ueyama
89a4720575 Correctly print out error messages from signal handlers 2024-03-03 14:27:43 +09:00
Rui Ueyama
081e447a1b Simplify 2024-03-02 17:42:57 +09:00
Rui Ueyama
da0ee683a3 Show sha256 checksum 2024-03-02 13:27:27 +09:00
Rui Ueyama
c6e5e2c0a0 Dogfood setup-mold 2024-03-01 20:23:35 +09:00
Rui Ueyama
fb3c166f80 Bump mold version to 2.4.1 2024-03-01 11:30:05 +09:00
Rui Ueyama
39643aaf94 Fix GCC warning
Fixes https://github.com/rui314/mold/issues/1208
2024-03-01 10:44:35 +09:00
Rui Ueyama
50bdf39ba5 Mark shared symbols as weak if all references are weak
Previously, mold marked an imported symbol as a strong one if the
symbol came from a DSO and was exported as a strong symbol by the DSO.
This logic resulted in a miscomputation of the weakness bit, causing a
compatibility issue with other linkers.

Now, an imported symbol is marked as strong only when there's at least
one strong reference to it. In other words, if all references to an
imported symbol are weak, the symbol will be imported as a weak one.

Fixes https://github.com/llvm/llvm-project/issues/83080
2024-02-29 12:57:11 +09:00
Rui Ueyama
1e413d4121 Fix GCC warning
Fixes https://github.com/rui314/mold/issues/1205
2024-02-28 14:03:41 +09:00
Rui Ueyama
fcda712238 Attempt to fix GCC warnings
Fixes https://github.com/rui314/mold/issues/1204
2024-02-27 16:38:45 +09:00
Rui Ueyama
d4ff48a07e [PPC64V2] Emit _savegpr0_*, _restgpr0_*, _savegpr1_* and _restgpr1_* symbols
Fixes https://github.com/rui314/mold/issues/1203
2024-02-27 14:35:19 +09:00
Rui Ueyama
21f25545a8 Update README 2024-02-27 12:02:44 +09:00
Andrew Ng
37f975bf82 Add "basic" support for memory mapping to Windows OutputFile
This is a "basic" implementation that does not make use of intermediate
temporary files.

Has been seen to improve linking performance by up to ~1.78x.
2024-02-26 11:34:33 +00:00
Rui Ueyama
58558e319c RISC-V: Define __global_pointer$ for DSO
Fixes https://github.com/rui314/mold/issues/1182
2024-02-26 14:38:38 +09:00
Rui Ueyama
48f6a08352 Refactor 2024-02-26 12:29:27 +09:00
Rui Ueyama
01e9f42c10
Merge pull request #1198 from nga888/win-build-tidy
Minor fixes for the Windows build
2024-02-26 12:12:11 +09:00
Rui Ueyama
8c3967886c Remove code for the sold linker 2024-02-25 14:29:53 +09:00
Rui Ueyama
8a4fb3b445
Merge pull request #1199 from nga888/win-mem-map-file-handling
Fixes and improvements to Windows file handling and memory mapping
2024-02-25 12:58:08 +09:00
Rui Ueyama
04c9b62660 Update README 2024-02-24 15:08:05 +09:00
Rui Ueyama
4790349f79 Update README 2024-02-24 15:07:25 +09:00
Rui Ueyama
3e6005a1e7 Update benchmark results 2024-02-24 15:04:34 +09:00
Andrew Ng
9e3565027a Fixes and improvements to Windows file handling and memory mapping
Prior to this change, links on Windows were failing with:

  mold: fatal: <input file>: CreateFileMapping failed: 5

"5" is the Windows error code for ERROR_ACCESS_DENIED.

Use native Windows file API in MappedFile. Create read only mapping with
FILE_MAP_COPY view because the file mapping contents may be modified in
process but should not be written back.

On Windows, it is important that files are opened in "binary" mode to
avoid automatic "text" mode conversions which can result in "corrupted"
input/output.
2024-02-23 14:40:39 +00:00
Rui Ueyama
6d8e6afbf2 Fix R_PPC64_DTPREL16_LO_DS
Fixes https://github.com/rui314/mold/issues/1192
2024-02-23 17:14:25 +09:00
Rui Ueyama
5b5f431717 Fix CI 2024-02-22 09:13:26 +09:00
Andrew Ng
796e2556b6 Minor fixes for the Windows build
Removes some Windows build warnings.

Fixes conversion of Windows FILETIME to nsec in get_usage() used by
TimerRecord.
2024-02-21 15:24:07 +00:00
Rui Ueyama
8090737d56 Merge sections with different flags into a single section
Previously, mold didn't merge sections with the same name but different
section flags into a single section. This behavior is different from other
linkers and caused a compatibility issue.

Now, mold merges input sections by their names and types.

Fixes https://github.com/rui314/mold/issues/1196
2024-02-21 18:50:47 +09:00
Rui Ueyama
d39a0c7035 Refactor 2024-02-21 18:21:03 +09:00
Rui Ueyama
de696ba5a4 --repro: Do not try to reopen files with different paths
Fixes https://github.com/rui314/mold/issues/1197
2024-02-21 17:11:04 +09:00
Rui Ueyama
cefa2d9100 Add Red Hat Enterprise Linux
Fixes https://github.com/rui314/mold/issues/1191
2024-02-20 15:11:42 +09:00
Rui Ueyama
9f07fd035c Support R_PPC64_DTPREL16_LO_DS
Fixes https://github.com/rui314/mold/issues/1192
2024-02-20 13:07:02 +09:00
Rui Ueyama
7ead7231c9 Fix CI 2024-02-19 16:50:23 +09:00
Rui Ueyama
b0a3a5ce62 Drop SHF_COMPRESSED when creating a relocatable file
We always uncompress compressed sections when copying, so we should
not propagate the flag.

Fixes https://github.com/rui314/mold/issues/1195
2024-02-19 16:22:39 +09:00
Rui Ueyama
64c2084c8a Pass GCC offload data to the LTO backend
Fixes https://github.com/rui314/mold/issues/1190
2024-02-19 15:12:43 +09:00