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

6695 Commits

Author SHA1 Message Date
Muhammad Mominul Huque
663b15496d
Merge f05e32df4a into 7089304046 2024-07-06 02:14:41 +01: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
Rui Ueyama
863893057e Allow numbers other than 1 for MOLD_JOBS 2024-06-18 18:28:28 +09:00
Rui Ueyama
b83b1950c0
Merge pull request #1281 from ziyao233/outgoing/fix-static-flag 2024-06-17 08:10:20 +09:00
Yao Zi
d2774b0da9 Use $CXX to detect cxxflags
Use $CXX instead of $CC to detect whether C++ programs could be built
statically. Add function test_cxxflags for convenience.

Fix test error in an environment where C++ programs cannot be built
statically, with error like:

  mold: fatal: library not found: c++

Signed-off-by: Yao Zi <ziyao@disroot.org>
2024-06-16 20:16:34 +00:00
Rui Ueyama
cff858bad5 Attempt to fix CI 2024-06-13 16:47:50 +09:00
Rui Ueyama
7669a3ce67 Attempt to fix CI 2024-06-13 16:11:48 +09:00
Rui Ueyama
3ad387f20c Refactor 2024-06-13 13:33:45 +09:00
Rui Ueyama
af6d356468 Attempt to fix CI 2024-06-11 14:49:53 +09:00
Rui Ueyama
768f1dffdd Attempt to fix CI 2024-06-11 14:43:54 +09:00
Rui Ueyama
2a25c81834 Refactor 2024-06-11 13:37:21 +09:00
Rui Ueyama
24b8941f60 Refactor 2024-06-10 20:36:40 +09:00
LoveSy
841a186346
Fix corrupted .riscv.attributes ISA string (#1276)
Fix corrupted .riscv.attributes ISA string
extension name can contain digits
2024-06-10 19:56:40 +09:00