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

2657 Commits

Author SHA1 Message Date
Rui Ueyama
fbc2ea478e [Mach-O] wip 2021-09-13 19:18:04 +09:00
Rui Ueyama
7ffc3a4545 [Mach-O] Add a feature to dump an executable
This is not a linker feature, but in order to learn how Mach-O
executables are constructed, I'll implement a dump feature.
I'll remove the feature once I understand the structure of Mach-O
binaries.
2021-09-13 18:16:13 +09:00
Rui Ueyama
e051ad2a9a Do not define _GNU_SOURCE
We should not depend on glibc-specific features.
2021-09-13 17:29:49 +09:00
Rui Ueyama
02b9744d5d Add -g compiler option only when DEBUG=1 2021-09-12 19:42:25 +09:00
Rui Ueyama
08b61f29d2 [ELF] Add --require-defined 2021-09-12 18:34:42 +09:00
Rui Ueyama
1cb750a649 [ELF] Add -Bno-symbolic 2021-09-11 21:41:17 +09:00
Rui Ueyama
730105898b Silence a warning 2021-09-11 14:56:09 +09:00
Rui Ueyama
0a4305f82a Inline a few functions 2021-09-11 14:54:55 +09:00
Rui Ueyama
2e5f480a97 Simplify input file preloading logic 2021-09-10 20:41:20 +09:00
Rui Ueyama
0001cb2818 Simplify 2021-09-10 16:10:28 +09:00
Rui Ueyama
8558a98bf6 Simplify 2021-09-10 16:05:45 +09:00
Rui Ueyama
c42bd19c49 Add a missing filename 2021-09-08 20:22:51 +09:00
Rui Ueyama
68ff4a8408 Rename functions 2021-09-08 20:15:03 +09:00
Rui Ueyama
dc7e0ca4bf Remove a useless macro 2021-09-08 19:51:02 +09:00
Rui Ueyama
78bddacd5b Move target-independent files to the top directory 2021-09-08 19:49: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
b39a47a759 Promote weak undefs to dynamic symbols if building DSO
475a250ad4 changed mold's behavior on
weak undefined symbols, so that if they are not resolved within the
current ELF module, they are resolved to address zero. Previously,
they would be promoted to dynamic symbols to give then another chance
to be resolved at runtime.

That change caused a regression in Firefox. Firefox uses weak undef
symbols as a mean to export symbols from libxul.so. Quote from
Firefox's mfbt/Types.h:

> On linux mozglue is linked in the program and we link libxul.so with
> -z,defs. Normally that causes the linker to reject undefined references in
> libxul.so, but as a loophole it allows undefined references to weak
> symbols. We add the weak attribute to the import version of the MFBT API
> macros to exploit this.

So, they use this as a "loophole".

This change partially revert 475a250ad4.
Now, remaining weak undefs are resolved to address zero only when we
are creating an executable.

Fixes https://github.com/rui314/mold/issues/114
2021-09-06 20:47:16 +09:00
Rui Ueyama
c21302e28a Do not use strerror
strerror is not guaranteed to be thread-safe
2021-09-05 17:15:15 +09:00
Rui Ueyama
76018da068 Remove dependency to OpenSSL's RAND_bytes 2021-09-05 17:02:08 +09:00
Rui Ueyama
b4953951f0 Remove an unused file 2021-09-03 01:31:33 +09:00
Rui Ueyama
459b5973bb Move code to elf sub-directory 2021-09-02 23:16:49 +09:00
Rui Ueyama
1103b14683 Revert "Remove dependency to openssl/rand.h"
This reverts commit 16d48eae6f.

I don't know why, but that commit broke statically-linked mold.
2021-09-02 23:14:23 +09:00
Rui Ueyama
177dc71335 Move third-party libraries to a separate sub-directory 2021-09-02 22:19:09 +09:00
Rui Ueyama
f7a4aceeae Remove an unused file 2021-09-02 22:14:51 +09:00
Rui Ueyama
fd391b03ef Move everything into mold::elf namespace 2021-09-02 18:19:43 +09:00
Rui Ueyama
1be5d61bb4 Fix a build issue on macOS 2021-09-01 15:40:11 +09:00
Rui Ueyama
4678fcee52 Fix a build issue on macOS 2021-09-01 15:29:45 +09:00
Rui Ueyama
e7537116b3 Fix a build issue on macOS
macOS does not define std::quick_exit.
2021-09-01 14:12:05 +09:00
Rui Ueyama
16d48eae6f Remove dependency to openssl/rand.h 2021-09-01 13:37:11 +09:00
Rui Ueyama
0ce0ceb2c2 Fix a build issue on macOS 2021-09-01 13:26:32 +09:00
Rui Ueyama
0bac54baaa Remove dependency to endian.h
This header file is not there on macOS.
2021-08-31 23:45:38 +09:00
Rui Ueyama
d994020807 Add missing include 2021-08-31 23:42:52 +09:00
Rui Ueyama
6a33e7eaa1 Refactor 2021-08-31 17:43:38 +09:00
Rui Ueyama
2a2da35c25 Remove unused declaration 2021-08-30 22:01:49 +09:00
Rui Ueyama
b3d0ee093b Report the "recompile with -fPIC' error correctly 2021-08-30 21:07:27 +09:00
Rui Ueyama
d3577550d2 Fix filename typo 2021-08-30 20:52:28 +09:00
Rui Ueyama
16c02c2cc3 Refactor 2021-08-30 18:41:27 +09:00
Rui Ueyama
92855aa6ee Refactor 2021-08-30 18:01:27 +09:00
Rui Ueyama
e69182d7bc Refactor 2021-08-30 17:32:08 +09:00
Rui Ueyama
4734007ec9 [AArch64] Improve error message 2021-08-30 00:10:43 +09:00
Rui Ueyama
ed230a12cc [i386] Add relocation overflow check 2021-08-30 00:05:07 +09:00
Rui Ueyama
0b2584018d Refactor 2021-08-29 23:43:52 +09:00