1
1
mirror of https://github.com/rui314/mold.git synced 2024-10-04 16:48:04 +03:00
Commit Graph

781 Commits

Author SHA1 Message Date
Rui Ueyama
d9db6bcf49 [ELF] Add an initial 32-bit RISC-V support 2022-08-02 13:12:05 +08:00
Rui Ueyama
a70b1eb58b Re-submit b23c47ae6d
With a fix for a bug in my previous test script.
2022-08-01 09:38:12 +08:00
Rui Ueyama
bb999c5e93 Revert "[ELF] Garbage-collect C identifier sections"
This reverts commit b23c47ae6d because
it broke CI.
2022-07-31 20:56:37 +08:00
Rui Ueyama
b23c47ae6d [ELF] Garbage-collect C identifier sections
If a section name is valid as a C identifier (i.e. it doesn't start
with '.' and doesn't contain any punctuators), the linker automatically
creates new symbols by prepending `__start_` and `__stop_` to the
section name.

Previously, we conservatively keep such C identifier sections during
garbage collection. However, since `__start_` and `__stop_` symbols
are hidden symbols, if we do not have `__start_foo` or `__stop_foo`,
we can safely discard section `foo`.
2022-07-31 20:26:31 +08:00
Tatsuyuki Ishi
536e0e7dca [elf] Align .symtab's ELF attributes with .dynsym's.
Notably, we previously wrote symbols that have been demoted into STB_LOCAL
as STB_GLOBAL. Fix this by using a logic shared with dynsym to determine
the output attributes.

Also reorder the symbols since the LOCAL ones need to come first.

Found in Mesa test suite.

Signed-off-by: Tatsuyuki Ishi <ishitatsuyuki@gmail.com>
2022-07-30 22:30:57 +09:00
Rui Ueyama
4a73ca28ca Fix CI 2022-07-29 21:37:23 +08:00
Rui Ueyama
b2b16e66b4 [Mach-O] Add -no_function_starts 2022-07-29 10:48:12 +08:00
Rui Ueyama
8143fe2fcc [Mach-O] Fix a relaxation bug 2022-07-29 09:13:18 +08:00
Rui Ueyama
12f941c58d [Mach-O] Improve LOH_ARM64_ADRP_LDR_GOT_LDR 2022-07-28 17:15:37 +08:00
Rui Ueyama
0e1b60dd6e [Mach-O] Fix mis-optimization bug for LOH_ARM64_ADRP_LDR_GOT_LDR 2022-07-28 15:18:14 +08:00
Rui Ueyama
54399fe567 [Mach-O] Support LOH_ARM64_ADRP_LDR_GOT_LDR 2022-07-27 14:45:13 +08:00
Tatsuyuki Ishi
1c8778b6e3 [elf] Add test for globs in --dynamic-list, --export-dynamic-symbol-list.
Glob and function names are inherited from version-script14.sh.

Signed-off-by: Tatsuyuki Ishi <ishitatsuyuki@gmail.com>
2022-07-23 19:21:19 +09:00
Tatsuyuki Ishi
58f393ac8b [elf] Add test for --export-dynamic-symbol[-list].
Piggybacked on existing tests for --dynamic-list.

Signed-off-by: Tatsuyuki Ishi <ishitatsuyuki@gmail.com>
2022-07-23 19:21:19 +09:00
Rui Ueyama
d7b42f29f2 [Mach-O] Define ${section,segment}${start,end}$ symbols. 2022-07-18 19:39:11 +08:00
Rui Ueyama
3ba30f7f09 Create a test workdir for each machine/test pair 2022-07-18 15:25:56 +08:00
Rui Ueyama
29af9b5177 Unmask amd64 2022-07-16 19:51:46 +08:00
Rui Ueyama
ed7e7c7ae0 Merge makefiles for tests into the main makefile 2022-07-12 21:03:54 +08:00
Rui Ueyama
764d7575f7 [ELF] Define __dso_handle
`cxa_finalize` takes `__dso_handle` to uniquify identify an ELF module
in memory. Its actual location doesn't matter but needs to be different
for each ELF module.

Fixes https://github.com/rui314/mold/issues/507
2022-07-11 18:01:23 +08:00
Rui Ueyama
e3e371dcd3 [ELF][x86-64] Always create PLT entries starting with ENDBR64
This change removes the compact PLT and non-IBT PLT and replaces
them with IBT PLT. The compact PLT wasn't compatible with `-z ibtplt`.

Fixes https://github.com/rui314/mold/issues/581
2022-07-11 13:59:32 +08:00
Rui Ueyama
55379e1142 Fix tests for i686
Fixes https://github.com/rui314/mold/issues/579
2022-07-10 12:40:25 +08:00
Peter Wang
31d2a902e5 Fix run.sh failure on musl
The command "mold -run foo.ld" can fail when foo.ld is an empty file.
The musl execvp() call fails with "Exec format error" when the script
to be executed is empty. The fix is to create foo.ld with a valid
Unix shebang.

Signed-off-by: Peter Wang <novalazy@gmail.com>
2022-07-09 17:37:57 +10:00
Rui Ueyama
593f2cfdbc Do not run LTO tests if LTO is not supported
Fixes https://github.com/rui314/mold/issues/577
2022-07-09 15:30:38 +08:00
Rui Ueyama
12c9c53b90 Add a test 2022-07-08 22:51:05 +08:00
Rui Ueyama
5071c42e72 Add a test for Rust demangler
https://github.com/rui314/mold/issues/371
2022-07-05 15:09:44 +08:00
Rui Ueyama
2bfc724e42 [Mach-O] Add -dependency_info 2022-07-05 10:52:15 +08:00
Rui Ueyama
8d29501887 [Mach-O] Ignore OS name part of targets in TBD files 2022-07-02 13:57:12 +08:00
Rui Ueyama
ea308bc77b [Mach-O] Add -add_ast_path 2022-07-02 13:52:19 +08:00
Rui Ueyama
ad427f8629 [ELF] Skip one more test if musl
https://github.com/rui314/mold/issues/565
2022-07-01 19:05:32 +08:00
Rui Ueyama
23b90dfc38 [ELF] Detect musl libc in a more reliably way
Fixes https://github.com/rui314/mold/issues/565
2022-07-01 18:00:19 +08:00
Rui Ueyama
14392e7720 Fix a test for musl 2022-07-01 09:51:32 +08:00
Rui Ueyama
3b75398786 [ELF] Support .preinit_array
It looks like AddressSanitizer depends on this feature.

Fixes https://github.com/rui314/mold/issues/562
2022-06-30 16:29:50 +08:00
Rui Ueyama
ded9cd4ffa Add -application_extension 2022-06-28 19:53:28 +08:00
Rui Ueyama
b0c6aa9a0f [Mach-O] Add -add_empty_section 2022-06-28 15:20:47 +08:00
Rui Ueyama
b81f3c22be Add a test 2022-06-28 11:35:36 +08:00
Rui Ueyama
26d45ed4c1 Fix a test
We passed two input files (/dev/null and "-") to the command which
is plainly wrong.

Fixes https://github.com/rui314/mold/issues/559
2022-06-28 10:42:26 +08:00
Rui Ueyama
b5d7335e35 Revert "Implement `--(no-)allow-shlib-undefined."
This reverts the following commits because it causes a regression.

 - 62be1fcdb0
 - a7b8da9345
 - 21a2d6bb6c

Fixes https://github.com/rui314/mold/issues/559
2022-06-27 20:53:26 +08:00
Rui Ueyama
bdee09ad02 [Mach-O] Handle LC_REEXPORT_DYLIB 2022-06-27 20:49:02 +08:00
Rui Ueyama
335698851b [Mach-O] Add -reexport-l 2022-06-26 18:27:36 +08:00
Rui Ueyama
7b5b1a340b [Mach-O] Handle weak dynamic symbols 2022-06-26 17:21:26 +08:00
Rui Ueyama
3e6f6fe8b5
Merge pull request #557 from wangp/grep-P
Don't use grep -P in tests
2022-06-26 16:42:20 +08:00
Rui Ueyama
1524746a80 [Mach-O] Fix weak undef symbols 2022-06-26 15:57:15 +08:00
Peter Wang
2963ab672c Don't use grep -P in tests
The version of grep being used may not support the -P flag
(Perl-compatible regular expressions).
2022-06-26 15:51:25 +10:00
Rui Ueyama
fe72463f55 [Mach-O] Set mold's version to LC_BUILD_VERSION
I chose 0x6d6f6c64 as a magic number without coordinating with other
tools or Apple, but it should be fine.
2022-06-26 13:14:07 +08:00
Rui Ueyama
831f872886 [Mach-O] Do not emit corrupted unwind table 2022-06-25 19:22:38 +08:00
Rui Ueyama
d9a28221dd [Mach-O] Sort the symtab and fill LC_DYSYMTAB fields 2022-06-24 16:00:50 +08:00
Rui Ueyama
a7b8da9345 Simplify 2022-06-24 10:44:35 +08:00
Robert Bartlensky
21a2d6bb6c
Implement `--(no-)allow-shlib-undefined.
This also fixes the `note-property` test which was hanging on my
machine. Turns out `$CC` was stuck waiting to read from `stdin`,
and as such I decided to write something into it.

Signed-off-by: Robert Bartlensky <bartlensky.robert@gmail.com>
2022-06-23 23:46:15 +01:00
Rui Ueyama
9a3188bcf5 [Mach-O] Compute LC_UUID using the entire code signature section
We used to compute a file UUID using only the hashes in the code
signature section. So we computes the same UUID even if two files
are differnet only in some field of the code signature section.
2022-06-22 20:29:03 +08:00
Rui Ueyama
c214bfc96b [Mach-O] Remove -dump
I added this option for debugging. Since mold is now mature enough,
we no longer need this option.
2022-06-16 20:53:27 +08:00
Rui Ueyama
7b8d7a6417 [Mach-O] Add -order_file 2022-06-16 16:52:25 +08:00