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

183 Commits

Author SHA1 Message Date
Rui Ueyama
38e8f06def Use trap instructions instead of nop to fill gaps 2024-03-29 15:39:59 +09:00
Rui Ueyama
d21207cc79 Handle sections with an unknown section type as errors
Fixes https://github.com/rui314/mold/issues/1215
2024-03-12 14:13:52 +09:00
Rui Ueyama
cc884d57ca Fix cross building of ARM64 binaries on big-endian machines
It's probably very rare to do so, but mold couldn't create ARM64
binaries on big-endian machines due to a typo in an ELF struct
definition.
2023-12-10 16:06:52 +09:00
Rui Ueyama
7fc43ccc3a Add comments 2023-11-24 08:40:57 +09:00
Rui Ueyama
600ca381fd Reduce the size of Symbol by 2 bytes 2023-11-12 13:39:44 +09:00
Rui Ueyama
c4c506c1cb Make LoongArch range extension thunks shorter 2023-10-31 16:19:20 +09:00
Rui Ueyama
c86a59a511 Fill gaps in executable segments with trap or nop instructions 2023-10-23 12:26:56 +09:00
Rui Ueyama
e6ae83fbf9 Fix POWER10 issues 2023-10-12 21:04:27 +09:00
Rui Ueyama
b3e1092879 Refactor 2023-10-07 14:01:24 +09:00
Rui Ueyama
ead6235470 Emit an endbr64 only for a canonical PLT 2023-10-04 17:17:07 +09:00
Rui Ueyama
a994d71fa1 Use relocations to identify address-taken functions 2023-10-02 17:05:38 +09:00
Rui Ueyama
0eea8f4015 Refactor 2023-09-30 12:04:20 +09:00
Rui Ueyama
2e3b56ee3f Emit DT_AARCH64_VARIANT_PCS if required
Fixes https://github.com/rui314/mold/issues/1115
2023-09-28 20:57:54 +09:00
Rui Ueyama
ac3ee91cbd [RISC-V] Support GP-relative relocations
These relocations are use for embedded programming and are probably
not useful for mold, but we want them for the sake of completeness.
2023-09-26 11:30:02 +09:00
Tatsuyuki Ishi
cd2224742f [ELF] Support RISC-V TLSDESC GOT generation.
Signed-off-by: Tatsuyuki Ishi <ishitatsuyuki@gmail.com>
2023-09-13 13:36:55 +09:00
Tatsuyuki Ishi
0b1d11ed01 [ELF] Add RISC-V TLSDESC relocation constants.
Signed-off-by: Tatsuyuki Ishi <ishitatsuyuki@gmail.com>
2023-09-13 13:36:16 +09:00
Rui Ueyama
db5fa8a8cd Remove incomplete MIPS support
I made a fair amount of effort to try to support MIPS, but it turned out
that it is much harder than expected. I punted it instead of making
further efforts.

The problem is the MIPS ABI is hostile to the linker in the modern
environment. MIPS object files are still compiled for the small code
model in which GOT entries and data in the small data area are expected
to be accessible with a single machine instruction with a 16-bit
displacement. In other words, .got/.sdata/.sbss are expected to be
smaller than 64 KiB. This might have been a reasonable assumption in the
90s, but it's not suitable for modern applications that can be 1000x
larger than the binaries in the 90s.

MIPS requires the linker to implement tons of workarounds for its legacy
ABI assumptions. Our incomplete MIPS support can build binaries that
pass all our unit tests. However, it needed more effort to support
real-world programs that are larger than our test cases.

At this point, I don't think it is productive to implement workarounds
for the old ABI that is stuck in the 90s. It is honestly annoying to
think about workarounds for the code that is intentionally compiled to
be hostile to the linker. The situation is unfortunate, but if the
Open Source community is still serious about MIPS, they should improve
the ABI and the compiler instead of asking us to implement the legacy
ABI.

Closes https://github.com/rui314/mold/issues/1040
2023-09-04 13:12:03 +09:00
Rui Ueyama
8f5c49c655 Play the code-golf with our s390x PLT header 2023-08-23 22:41:41 +09:00
Rui Ueyama
03b5ce7c6f Reduce the size of PLT entry on s390 2023-08-23 21:45:58 +09:00
Rui Ueyama
9a09ead865 Reduce the size of range extension thunk for ARM 2023-08-23 16:40:48 +09:00
Rui Ueyama
51fec5f1ff Avoid reading data from .plt 2023-08-23 14:02:03 +09:00
Rui Ueyama
ac20d8729b Avoid reading data from .plt
With `--execute-only`, the text segment may not be readable.

Fixes https://github.com/rui314/mold/issues/1087
2023-08-23 12:53:27 +09:00
Rui Ueyama
7e9fedd203 Align range extension thunk entry points to 16 byte boundaries
Quote from Arm Cortex-A75 Software Optimization Guide
(PJDOC-466751330-205) p.59:

  Consider aligning subroutine entry points and branch targets to
  16-byte boundaries, within the bounds of the code-density requirements
  of the program. This ensures that the subsequent fetch can maximize
  bandwidth following the taken branch by bringing in all useful
  instructions.
2023-08-22 16:20:12 +09:00
Rui Ueyama
d753ea5bdb Fix CI 2023-08-15 16:10:35 +09:00
Rui Ueyama
6dacc5192a Refactor 2023-08-15 15:08:34 +09:00
Rui Ueyama
3b5ccb9342 Implement range extension thunks for LoongArch 2023-08-11 10:54:19 +09:00
Rui Ueyama
6d809b56e6 Refactor 2023-08-09 21:13:00 +09:00
Rui Ueyama
b711bf2009
Merge pull request #1081 from MQ-mengqing/main
Add loongarch basic support
2023-08-09 20:53:22 +09:00
Rui Ueyama
f631477a68 Set e_flags and .MIPS.abiflags 2023-08-08 19:20:59 +09:00
Jinyang He
03b1a1cc68 Add loongarch basic support
link: https://reviews.llvm.org/D138135
link: https://loongson.github.io/LoongArch-Documentation/LoongArch-ELF-ABI-EN.html
2023-08-07 10:17:29 +08:00
Rui Ueyama
428faa75b2 Create multiple GOT sections for MIPS 2023-08-06 13:36:14 +09:00
Rui Ueyama
e2c6f0c171 Refactor 2023-08-05 14:46:21 +09:00
Rui Ueyama
e0a150a22c Refactor 2023-08-04 19:36:18 +09:00
Rui Ueyama
0df6063d8a Improve MIPS support 2023-08-04 18:48:52 +09:00
Rui Ueyama
85f1dec81d Improve MIPS support 2023-08-03 16:30:48 +09:00
Rui Ueyama
dd56734fda Fix symbol table for very large section indices 2023-07-31 19:38:04 +09:00
Rui Ueyama
aa644914fe Merge .riscv.attributes input sections 2023-07-30 00:56:47 +09:00
Rui Ueyama
761c341c19 Improve MIPS64 support 2023-07-17 11:45:55 +09:00
Rui Ueyama
000e395c07 Improve MIPS64 support 2023-07-16 08:01:42 +09:00
Rui Ueyama
29dc0cf53f Initial MIPS64 support
Although incomplete, this implementation is capable of passing the
following tests:

  TRIPLE=mips64el-linux-gnuabi64 bash -x ../test/elf/hello-dynamic.sh
  TRIPLE=mips64-linux-gnuabi64 bash -x ../test/elf/hello-dynamic.sh
2023-07-14 15:11:53 +09:00
Rui Ueyama
65bd36ba40 Generate a PT_OPENBSD_RANDOMIZE segment 2023-06-14 14:08:40 +09:00
Rui Ueyama
4bffe26bc0 Support R_RISCV_SET_ULEB128 and R_RISCV_SUB_ULEB128
https://github.com/riscv-non-isa/riscv-elf-psabi-doc/pull/361
2023-03-31 10:26:50 +08:00
Rui Ueyama
5065547c4e Support the Power10 ABI 2023-03-04 09:43:42 +08:00
Rui Ueyama
f592b6e167 Refactor 2023-02-16 15:18:25 +08:00
Rui Ueyama
51845ac5fe Support R_RISCV_PLT32
https://github.com/riscv-non-isa/riscv-elf-psabi-doc/pull/363
2023-02-06 12:48:56 +08:00
Rui Ueyama
6caf0867b0 Reorganize files 2023-01-16 15:27:10 +08:00
Rui Ueyama
a4349df0a5 [PPC64v1] Support a PLT section containing more than 32767 entries. 2023-01-16 11:06:34 +08:00
Rui Ueyama
f9fe3d621f Refactor 2023-01-05 21:48:03 +08:00
Rui Ueyama
17a24cdd7e Fix "error: enumerated and non-enumerated type in conditional expression" warning
Fixes https://github.com/rui314/mold/issues/945
2023-01-04 09:02:16 +08:00
Rui Ueyama
9157414cae Make ElfRel trivial type
Fixes https://github.com/rui314/mold/issues/944
2023-01-03 16:47:24 +08:00