1
1
mirror of https://github.com/rui314/mold.git synced 2024-09-21 18:08:01 +03:00
Commit Graph

191 Commits

Author SHA1 Message Date
Rui Ueyama
495df9ea00 Change the default install PREFIX from /usr to /usr/local
If not specified, `make install` usually installs binaries to /usr/local.
It's nice to follow that convention.

Fixes https://github.com/rui314/mold/issues/124
2021-10-28 08:06:37 +09:00
Rui Ueyama
45fdfd4e87 Disable C++ exceptions
mold itself doesn't use C++ exceptions, so we can disable C++ exceptions.
Passing `-fno-exceptions` to g++/clang++ makes them to produce smaller code.
2021-10-08 15:04:16 +09:00
Rui Ueyama
9d805f5d26 [Mach-O] Make make test to work on macOS 2021-09-28 18:47:24 +09:00
Rui Ueyama
5e3f526bc1 Refactor 2021-09-28 16:40:07 +09:00
Rui Ueyama
5bd9edeeed Bump mold version to 0.9.6 2021-09-27 20:38:18 +09:00
Rui Ueyama
02b9744d5d Add -g compiler option only when DEBUG=1 2021-09-12 19:42:25 +09:00
Rui Ueyama
c42bd19c49 Add a missing filename 2021-09-08 20:22:51 +09:00
Rui Ueyama
8f10ac5047 [Mach-O] Add a test for mach-o stub 2021-09-08 19:19:07 +09:00
Rui Ueyama
5dab8612c8 Move ELF tests to test/elf directory 2021-09-08 19:13:18 +09:00
Rui Ueyama
bfa24a3205 Create temporary files for tests under out/ 2021-09-08 19:08:52 +09:00
Rui Ueyama
cab0ccf0bd [Mach-O] Add a stub for Mach-O 2021-09-08 19:03:07 +09:00
Rui Ueyama
6cf0a010ec Install mold as ld.mold
This command name is more comsistent with other linkers, i.e.,
ld.bfd, ld.gold and ld.bfd. mold will be a all-in-one linker that
is capable of cross-linking, and it should dispatch according to
argv[0] as follows:

 - mold: a native linker
 - ld or ld.mold: a Unix linker
 - ld64.mold: a macOS linker
 - mold-link: a Windows linker
2021-09-08 17:06:22 +09:00
Rui Ueyama
b7be2e6d3b Remove an unused variable 2021-09-08 15:56:45 +09:00
Rui Ueyama
aed968ebe6 Fix CI failure 2021-09-07 20:35:26 +09:00
Rui Ueyama
087d4300f2 Create object files in out directory 2021-09-07 20:17:31 +09:00
Rui Ueyama
dc672ad821 Bump mold version to 0.9.5 2021-09-06 21:06:34 +09:00
Rui Ueyama
459b5973bb Move code to elf sub-directory 2021-09-02 23:16:49 +09:00
Rui Ueyama
177dc71335 Move third-party libraries to a separate sub-directory 2021-09-02 22:19:09 +09:00
Rui Ueyama
1be5d61bb4 Fix a build issue on macOS 2021-09-01 15:40:11 +09:00
Rui Ueyama
5016240d14 Bump mold version to 0.9.4 2021-08-27 18:23:34 +09:00
Rui Ueyama
046cdbe724 Simplify 2021-08-25 17:43:57 +09:00
Rui Ueyama
be4f2f52b2 Fix indentation 2021-08-25 12:48:41 +09:00
Rui Ueyama
91d14191c7 Fix TSAN build issue 2021-08-19 18:45:19 +09:00
Rui Ueyama
aea7fac8f0
Merge pull request #109 from mqudsi/cmake_unix_makefiles
Explicitly instruct CMake to use Unix Makefiles
2021-08-16 07:34:59 +09:00
Mahmoud Al-Qudsi
4bd77f1d78 Explicitly instruct CMake to use Unix Makefiles
mold currently builds dependencies in its `Makefile` by explicitly
issuing `make -C ...` targeting the CMake build directory; this will
fail if a global `CMAKE_GENERATOR` environment variable is present that
specifies a different CMake build file generator.

Closes #91

Signed-off-by: Mahmoud Al-Qudsi <mqudsi@neosmart.net>
2021-08-15 12:27:01 -05:00
Dylan Araps
f9336832d4
Do not hardcode clang/clang++
Signed-off-by: Dylan Araps <dylan.araps@gmail.com>
2021-08-15 14:51:09 +03:00
Mahmoud Al-Qudsi
f6c92c2eae Disable TBB_STRICT when building TBB (on by default)
This allows mold to build under clang++-14 which catches the write-only
`intptr_t drained` in `tbb/arena.cpp` as an unused parameter that
ultimately triggers `-Werror` to error out and abort the build.

It's 2021 and there are still projects that default to `-Werror` as the
default instead of using it only in the dev and CI environments... smh.

Closes #107.
2021-08-11 18:39:52 -05:00
Rui Ueyama
965da0af4a Use hyphen instead of underscore in filename
Test files are following this convention already, but source files weren't.
2021-07-26 21:34:04 +09:00
Rui Ueyama
0f82b352c7 Compile mold object files as PIE 2021-07-26 16:20:15 +09:00
Rui Ueyama
fbdb8367ef Do not add an -I option if not necessary 2021-07-26 16:18:26 +09:00
Rui Ueyama
ec3319b37f Bump mold version to 0.9.3 2021-07-21 19:44:21 +09:00
Rui Ueyama
dca0e6b7ad Do out-of-tree build for tbb and mimalloc
So that the build directory is less scattered.
2021-07-16 15:10:59 +09:00
Rui Ueyama
1713f6e2f7 Rename oneTBB tbb
"oneTBB" used to be a git submodule, and it is now just a subdirectory.
Using the same directory name makes it difficult to switch between
branches. So I rename it "tbb".
2021-07-16 15:10:59 +09:00
Rui Ueyama
fb100f21b3 Do not print out stacktrace on crash
This commit partially reverts e855b90344
because that change was not portable to non-glibc systems.
2021-07-16 14:33:20 +09:00
Rui Ueyama
41b2fa7375 Optimize string merging
Linking clang-13 with debug info takes ~3.6 seconds on a simulated
10-core/20-threads machine. mold spends most of its time (~2.3 seconds)
merging string literals in .debug_str. Input .debug_str sections contain
70 million string literals in total, which is reduced to 2 million after
de-duplication. The input object files contain a lot of duplicates.
clang-13 with debug info is enormous -- it is ~3.1 GiB after linking.

It looks like TBB's concurrent hashmap doesn't scale well with the
input.

In this patch, I implemented our own concurrent hashmap. The hashmap
is extremely lightweight and support only the key-value insertion
operation. It doesn't even support rehashing. It aborts once the hash
table becomes full.

In order to know the correct size for the hashmap before inserting
strings into it, I also implemented HyperLogLog algorithm in this patch.
HyperLogLog is an algorithm that gives a fairly accurate estimate on
the number of unique elements.

With this patch, mold can link clang-13 in ~2.5 seconds, which is ~30%
faster than before.

https://github.com/rui314/mold/issues/73
2021-07-13 16:54:09 +09:00
Rui Ueyama
e855b90344 Show stacktrace on SEGV and assertion failure 2021-07-09 23:34:39 +09:00
Rui Ueyama
accf96877f Add a stub for AArch64
It can generate an executable, but generated executable won't run
correctly because we don't process relocations at all yet.
2021-07-03 21:39:44 +09:00
Rui Ueyama
d502b6ec60 Initial AARCH64 support 2021-07-03 20:48:38 +09:00
Rui Ueyama
6935272033 Create $PREFIX/bin if not exists 2021-07-03 15:07:26 +09:00
Rui Ueyama
4c4bfca20e Make make clean to remove artifacts of vendored repos 2021-07-03 14:29:01 +09:00
Nehal J Wani
9c541ad461
[oneTBB] build only required target(s)
The 'all' target builds tbbmalloc and tbbmalloc_proxy
which mold does not care about.

Signed-off-by: Nehal J Wani <nehaljw.kkd1@gmail.com>
2021-07-02 12:38:26 -04:00
Rui Ueyama
3e3d58b6f1 Static-link oneTBB by default
oneTBB API is changing rapidly, so even if a oneTBB is installed
into a system already, it is likely that that is not a compatible
version with mold. This makes program building unnecessarily hard.

This change intends to solve the problem once and for all by
including oneTBB as a subdirectory and static-link against it at
build-time.

oneTBB is released under the Apache License 2.0, which is compatible
with AGPL. Therefore, we can still distribute the binary of mold
under AGPL.

If you do not want to static-link oneTBB, pass `SYSTEM_TBB=1`
to `make`.

This change also ports mold from oneTBB v2020.3 to v2021.3.0.

Fixes https://github.com/rui314/mold/issues/66
2021-07-03 00:08:33 +09:00
Artur Sinila
5c846496a2
Makefile: add $(DESTDIR) to strip 2021-07-01 13:05:43 +03:00
Rui Ueyama
18156f3965 Do not set a variable instead of undefine it later 2021-07-01 10:38:30 +09:00
Artur Sinila
da619e8615
Various fixes in Makefile
Signed-off-by: Artur Sinila <freesoftware@logarithmus.dev>
2021-06-30 20:53:49 +03:00
Rui Ueyama
a89df30537
Merge pull request #57 from nehaljwani/mimalloc-static-only
[mimalloc] build only required target(s)
2021-06-30 08:18:32 +09:00
Rui Ueyama
9a09c777d9 Bump mold version to 0.9.1 2021-06-30 08:11:15 +09:00
Nehal J Wani
a1073e69b0
[mimalloc] build only required target(s)
The 'all' target builds the shared library as well as test binaries
which mold doesn't care about

Signed-off-by: Nehal J Wani <nehaljw.kkd1@gmail.com>
2021-06-29 16:34:46 -04:00
Rui Ueyama
4717afacf3 Add mimalloc as a git subtree instead of a submodule 2021-06-27 17:01:59 +09:00
Rui Ueyama
b21ade127c Simplify 2021-06-20 00:51:38 +09:00