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

4498 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
123dde1e8f Refactor 2022-08-01 17:13:53 +08:00
Rui Ueyama
172c7f6bb4 Refactor 2022-08-01 17:11:21 +08:00
Rui Ueyama
0ce50e1cf8 Refactor 2022-08-01 16:11:45 +08:00
Rui Ueyama
1121879199 Refactor 2022-08-01 14:09:59 +08:00
Rui Ueyama
d2829e1806 Simplify 2022-08-01 11:03:29 +08:00
Rui Ueyama
0988565c2f Simplify 2022-08-01 10:28:30 +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
Rui Ueyama
8cd699c110 Remove dead code 2022-07-31 17:29:42 +08:00
Rui Ueyama
e3495efad7 Refactor 2022-07-31 16:51:06 +08:00
Rui Ueyama
5414ae7a36
Merge pull request #593 from ishitatsuyuki/issue-592
[elf] Align .symtab's ELF attributes with .dynsym's.
2022-07-31 12:13:19 +08:00
Rui Ueyama
bc81472adb [ELF] Fix TSAN issue
Fixes https://github.com/rui314/mold/issues/594
2022-07-31 10:59:51 +08:00
Tatsuyuki Ishi
b83cb924a5 [elf] Rename write_symtab to export_to_symtab.
write_symtab feels like we're writing to the input file, which isn't the
case. export_to_symtab conveys the meaning clearer.

Signed-off-by: Tatsuyuki Ishi <ishitatsuyuki@gmail.com>
2022-07-30 22:30:57 +09: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
Tatsuyuki Ishi
b19599f81d [elf] Extract computation of output esym into a helper.
Signed-off-by: Tatsuyuki Ishi <ishitatsuyuki@gmail.com>
2022-07-30 22:30:57 +09:00
Tatsuyuki Ishi
bbbda7925e [elf] Add helper to determine if a symbol is STB_LOCAL in output.
Signed-off-by: Tatsuyuki Ishi <ishitatsuyuki@gmail.com>
2022-07-30 22:30:57 +09:00
Rui Ueyama
467294eb17 [Mach-O] Allow only one LC_SEGMENT_64 command 2022-07-30 16:44:58 +08:00
Rui Ueyama
13ef968fb1 [Mach-O] Do not read the same library or framework more than once 2022-07-30 14:59:11 +08:00
Rui Ueyama
3deaafca30 [Mach-O] Improve relaxation 2022-07-30 13:03:38 +08:00
Rui Ueyama
f998104bb0 [Mach-O] Respect N_NO_DEAD_STRIP for executables 2022-07-30 12:39:54 +08:00
Rui Ueyama
4a73ca28ca Fix CI 2022-07-29 21:37:23 +08:00
Rui Ueyama
070907e367 [Mach-O] Allow LC_LINKER_OPTIONS to refer a missing library 2022-07-29 21:24:54 +08:00
Rui Ueyama
ed72ca3509 [Mach-O] Change our tool magic number 2022-07-29 21:24:19 +08:00
Rui Ueyama
5a493d4868 [Mach-O] Use 16 KiB page for code signature on ARM64
Based on https://github.com/rui314/mold/pull/536
2022-07-29 12:51:06 +08:00
Rui Ueyama
b2b16e66b4 [Mach-O] Add -no_function_starts 2022-07-29 10:48:12 +08:00
Rui Ueyama
4ed7d72372 Update a comment 2022-07-29 09:50:24 +08:00
Rui Ueyama
8143fe2fcc [Mach-O] Fix a relaxation bug 2022-07-29 09:13:18 +08:00
Rui Ueyama
65b0aec355 Update comments 2022-07-28 23:47:55 +08:00
Rui Ueyama
12f941c58d [Mach-O] Improve LOH_ARM64_ADRP_LDR_GOT_LDR 2022-07-28 17:15:37 +08:00
Rui Ueyama
08cf940a7a
Merge pull request #590 from alexfanqi/main
[ELF][RISCV] add R_RISCV_SET32 in EhFrameSection
2022-07-28 15:35:27 +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
Alex Fan
68bd00caa7
[ELF][RISCV] add missing R_RISCV_SET32 in EhFrameSection
Signed-off-by: Alex Fan <alex.fan.q@gmail.com>
2022-07-28 16:36:23 +10:00
Rui Ueyama
d10b129b13 Update comments 2022-07-27 20:13:37 +08:00
Rui Ueyama
bedbb1f4e5 [Mach-O] Fix LOH_ARM64_ADRP_ADD 2022-07-27 19:51:14 +08:00
Rui Ueyama
59f4197edb [Mach-O] Add asserts 2022-07-27 19:17:42 +08:00
Rui Ueyama
390d0dc634 Refactor 2022-07-27 18:04:01 +08:00
Rui Ueyama
8fb3082529 [Mach-O] Support LOH_ARM64_ADRP_ADD 2022-07-27 17:43:15 +08:00
Rui Ueyama
f81337cc8b [ELF][RISC-V] Do not assume HI20 relocs appear before LO12 relocs
This re-commits 990b0ac4cd.

As clarified in
https://github.com/riscv-non-isa/riscv-elf-psabi-doc/issues/303,
the order of HI20 and LO12 relocations can be arbitrary.
2022-07-27 17:41:47 +08:00
Rui Ueyama
62ee59ecc6 [Mach-O] Fix bugs in linker relaxation 2022-07-27 16:24:16 +08:00
Rui Ueyama
54399fe567 [Mach-O] Support LOH_ARM64_ADRP_LDR_GOT_LDR 2022-07-27 14:45:13 +08:00
Rui Ueyama
d3d0c81bc6 [Mach-O] Fix typo 2022-07-25 19:54:09 +08:00
Rui Ueyama
18063f3ac9 [Mach-O] Add -mark_dead_strippable_dylib 2022-07-25 18:12:39 +08:00
Rui Ueyama
5b8f9f1a7a [Mach-O] Respect MH_NO_REEXPORTED_DYLIBS 2022-07-25 17:13:47 +08:00
Rui Ueyama
a6d9955a08 Add a comment 2022-07-25 17:02:42 +08:00
Rui Ueyama
92cbaada34 [Mach-O] Improve -dead_strip performance 2022-07-25 16:03:40 +08:00
Rui Ueyama
e9b07df4fb [Mach-O] Parallelize -dead_strip 2022-07-25 15:49:22 +08:00
Rui Ueyama
04909597e9 Fix CI 2022-07-25 12:11:24 +08:00
Rui Ueyama
e2c43dcb5e [Mach-O] Report an error for unknown export types 2022-07-25 11:39:42 +08:00