1
1
mirror of https://github.com/rui314/mold.git synced 2024-09-17 16:09:43 +03:00
Commit Graph

6706 Commits

Author SHA1 Message Date
leleliu008
d75d9fae21
Merge f06db5e00a into 18da5b654e 2024-07-09 05:47:41 +01:00
Rui Ueyama
18da5b654e Add --no-detach to write to a separate debug file in the foreground
--detach is the default.
2024-07-09 12:06:41 +09:00
Rui Ueyama
97a1e218c5 Simplify crc32_solve()
The code was originally written by Pete Cawley
https://gist.github.com/corsix/bdfc8f2f1dc0f28de39f74de9bf4f060
2024-07-09 10:15:26 +09:00
Rui Ueyama
f9e4cb1a7f Add a missing #include 2024-07-08 10:43:40 +09:00
Rui Ueyama
60760a892a Attempt to fix CI 2024-07-08 09:59:07 +09:00
Rui Ueyama
596ffa959a Add --separate-debug-info
This option is to separate debug info to a different file. The debug
info file's filename is stored to the main output file's .gnu_debuglink
section. gdb can read the section contents and followg the link to
find debug info in another file.

Fixes https://github.com/rui314/mold/issues/1294
2024-07-08 09:28:32 +09:00
Rui Ueyama
cd3b817f13 Make notify_parent idempotent 2024-07-07 22:49:35 +09:00
Rui Ueyama
19de40fed4 Refactor 2024-07-07 22:45:17 +09:00
Rui Ueyama
e78e12b15b Refactor 2024-07-07 22:24:42 +09:00
Rui Ueyama
5b4377842b Fix CI 2024-07-07 21:50:53 +09:00
Rui Ueyama
16ee9f48a4 Fix CI 2024-07-07 17:58:21 +09:00
Rui Ueyama
8e3679e4e5 Refactor 2024-07-06 13:11:09 +09:00
Rui Ueyama
7089304046 Simplify 2024-07-05 19:47:33 +09:00
Rui Ueyama
5ab3708e9f
Merge pull request #1298 from yujincheng08/patch-1
Fix cross-compile lto on MacOS
2024-07-05 19:45:10 +09:00
Rui Ueyama
aa939d7a6a Temporarily disable ASAN tests
It looks like starting with Clang 18.1.3, ASAN began reporting an
error on OneTBB.
2024-07-05 18:27:00 +09:00
Rui Ueyama
a63bbcd7b1 Attempt to fix CI 2024-07-05 17:58:13 +09:00
Rui Ueyama
339f9c485a Attempt to fix CI 2024-07-05 17:42:32 +09:00
LoveSy
4905f6d3f2
Use macos-12 because macos-11 has been removed
https://github.blog/changelog/2024-05-20-actions-upcoming-changes-to-github-hosted-macos-runners/#macos-11-deprecation-and-removal
2024-07-05 15:32:37 +08:00
Rui Ueyama
cb8cc1c8f0 Refactor 2024-07-05 16:00:09 +09:00
Rui Ueyama
c6b54532e9 Refactor 2024-07-04 16:17:25 +09:00
Rui Ueyama
3936134823 Refactor 2024-07-04 15:08:37 +09:00
Rui Ueyama
55ca05bab6 Refactor 2024-07-04 13:59:29 +09:00
LoveSy
7305a5c5dd
Fix cross-compile lto on MacOS 2024-07-03 21:55:22 +08:00
Rui Ueyama
b145377c39
Merge pull request #1296 from marxin/improve-gdb-index-test
Improve --gdb-index test by using readelf --debug=gdb_index
2024-07-01 17:15:51 +09:00
Martin Liska
08f2a74be7 Improve --gdb-index test by using readelf --debug=gdb_index 2024-06-30 16:07:47 +02:00
Rui Ueyama
82fb10fe26 Fix a test 2024-06-28 15:57:10 +09:00
Rui Ueyama
34f4d654d3 Add an entry for AlmaLinnux 2024-06-28 15:54:39 +09:00
Rui Ueyama
091395df33 Link with -ldl for dlopen()
Fixes https://github.com/rui314/mold/issues/1293
2024-06-28 11:00:37 +09:00
Rui Ueyama
a38be94064 Simplify 2024-06-27 19:51:06 +09:00
Rui Ueyama
cf1c02d097 Bump mold version to 2.32.1 2024-06-27 14:04:26 +09:00
Rui Ueyama
3dbe2ac704 Do not write relocation addends for RISC-V
Probably due to a bug in glibc, static PIE binaries crash on startup
in some environment.

Fixes https://github.com/rui314/mold/issues/1291
2024-06-27 13:09:58 +09:00
Rui Ueyama
35d67a3fab Add a missing #include for getenv() 2024-06-26 15:10:54 +09:00
Rui Ueyama
f60fada438 Refactor 2024-06-24 16:09:35 +09:00
Rui Ueyama
c419dcde1b
Merge pull request #1289 from yujincheng08/main
ci: add msys2
2024-06-24 09:49:34 +09:00
LoveSy
ebfe4f13c6 fix mingw compiles 2024-06-23 15:40:28 +00:00
LoveSy
8f9b59cbe6
ci: add msys2 2024-06-23 23:21:50 +08:00
Rui Ueyama
63f26708fd Unbreak daily buildbot 2024-06-23 12:38:59 +09:00
Rui Ueyama
07b09a66d3 Attempt to fix CI 2024-06-22 13:51:30 +09:00
Rui Ueyama
4cc61361f3 Refactor 2024-06-22 13:08:43 +09:00
Rui Ueyama
5535e7a6b7 Style change 2024-06-22 10:56:36 +09:00
Rui Ueyama
06b592683c Make weak undefined symbols to mark shared libraries as "needed"
It is not clearly defined when undefined weak symbols are resolved.
It looks like there are two possible approaches:

 1. Promote all weak undefined symbols to dynamic ones so that they'll
    have another chance to be resolved at load-time, or

 2. Promote weak undefined symbols to dynamic ones only when there are
    definitions in other DSOs at link-time.

(1) provides the maximum flexibility. For example, consider a main program
that has a weak undefined symbol `foo` and there's no DSO that defines it
at link-time. In (1), `foo` gets promoted to a dynamic symbol, so that one
of its depending DSO is upgraded to define `foo`, the main executable's
`foo` is resolved to that symbol at load-time. On the other hand, in (2),
`foo` would have already been converted to an absolute symbol at address
zero at link-time, so you need to rebuild the main executable to use the
new definition of `foo` in the shared library.

However, (1) is not compatible with copy relocations. This is because we
need to know the size of the symbol when creating a copy relocation, but
that information is not available unless we have a definition. It's also
not compatible with canonical PLTs because canonical PLTs have non-zero
addresses and therefore weak undefined symbols would always be resolved to
non-zero addresses.

As a workaround, GNU ld promotes weak undefs to dynamic symbols only when
they don't need copy relocations or canonical PLTs. In other words, weak
undef's behavior is different between -fPIC and -fno-PIC. In the former
case, they become dynamic symbols, and vice versa.

I don't think that workaround is a good one. So, mold took the second
approach.

There is, however, another thing to consider. What if we can find a
defined symbol in a DSO that is specified as `-as-needed`? Previously,
mold did not mark the library as "needed" and converted the weak undef
into an absolute symbol.

However, libstdc++ assumes that if weak undef symbol
`__pthread_key_create` is not resolved, it assumes that multi-threading is
not used in the executable, which resulted in a mis-detection with mold.

Therefore, this patch changes the mold's behavior so that it makes weak
undefs to keep DSOs "needed".

Fixes https://github.com/rui314/mold/issues/1286
2024-06-22 10:46:17 +09:00
Rui Ueyama
0b5e5dcbb5 Fix -Wunused-result 2024-06-22 10:46:17 +09:00
Rui Ueyama
b1695c6018
Merge pull request #1287 from yujincheng08/lto
Support lto on mingw
2024-06-22 07:54:25 +09:00
LoveSy
48ee8e8257
Handle stackoverflow 2024-06-21 17:42:33 +08:00
LoveSy
50bf031d49
Support lto on mingw 2024-06-21 17:42:27 +08:00
Rui Ueyama
bf05198d53
Merge pull request #1285 from yujincheng08/patch-2 2024-06-20 11:17:47 +09:00
Rui Ueyama
f9a37e9dd4 Remove dead code
get_self_path() is used by `mold -run`, which is not available on
macOS or Windows.
2024-06-20 09:31:44 +09:00
LoveSy
cf9e59954b
Use __has_include instead 2024-06-19 23:50:40 +08:00
LoveSy
7cce297318
Only define STDERR_FILENO when not defined 2024-06-19 23:48:14 +08:00
Rui Ueyama
1f94716fce Attempt to fix CI 2024-06-18 22:40:52 +09:00