Commit graph

398 commits

Author SHA1 Message Date
Jakub Konka
7200c992ff
linker/macho: ignore setjmp and longjmp since they are only used by roc test 2025-01-06 22:56:50 +01:00
Jakub Konka
4980cd86c3
linker/macho: remove redundant checks for compressed sections 2025-01-04 20:24:18 +01:00
Jakub Konka
ae2159b536
linker/macho: remove now obsolete todo
Signed-off-by: Jakub Konka <kubkon@jakubkonka.com>
2025-01-03 00:13:30 +01:00
Jakub Konka
31e622d5a8
linker/macho: fix load_align_constraint to correct page size values
These are dependent on the CPU architecture and are 4KB for x86_64,
and 16KB for aarch64.
2025-01-02 23:31:15 +01:00
Jakub Konka
19dc28aa34
linker/elf: update relocation handling to new object API 2024-12-31 16:57:10 +01:00
Jakub Konka
e4fc3184a0
linker/macho: update relocation handling to new object API 2024-12-31 16:43:53 +01:00
Jakub Konka
8272f31b42
linker/macho: do not print any todos messages unless --verbose 2024-12-31 11:58:12 +01:00
Jakub Konka
dfbd0f0c66
linker/macho: include Mach-O specific reloc scanning for libc symbols 2024-12-31 11:58:08 +01:00
Jakub Konka
c4c9869a15
linker/macho: include read-only string sections when doing surgery 2024-12-31 11:58:03 +01:00
Jakub Konka
4764b23282
cli: add --verbose flag to CMD_BUILD 2024-12-31 11:57:59 +01:00
Jakub Konka
3b3f79a5d2
linker: pretty-print Mach-O specific reloc types
Signed-off-by: Jakub Konka <kubkon@jakubkonka.com>
2024-12-31 11:57:50 +01:00
Jakub Konka
94e9528c51 compiler: suppress Apple ld linker warnings 2024-12-30 16:29:05 +01:00
Jakub Konka
a4165b3642 linker: introduce SupportLevel to designate completeness
If a linker is `SupportLevel::Full` it can safely be used as a
substitute for the legacy linker. If on the other hand, it's
`SupportLevel::None` then only legacy linker is a viable option.
The third new option is `SupportLevel::Wip` which will enable
surgical linker warning the user that it is a work-in-progress,
your mileage may vary, a lot.
2024-12-30 16:27:50 +01:00
Jakub Konka
b0cd51f089
Revert "Revert "Merge pull request #7424 from kubkon/macho-surgery"" 2024-12-30 16:26:42 +01:00
Anton-4
2dec72a797
Revert "Merge pull request #7424 from kubkon/macho-surgery"
This reverts commit 723e35f11e, reversing
changes made to 0ce43ffd1e.
2024-12-30 14:32:56 +01:00
Jakub Konka
d67371c351 Fix clippy warnings 2024-12-28 23:30:19 +01:00
Jakub Konka
707a6b6f0f macho: recognise some libc imports 2024-12-28 10:04:38 +01:00
Jakub Konka
90fe145900 trim leading _ when searching for symbol in host and app 2024-12-28 10:04:38 +01:00
Jakub Konka
378659dfa9 refactor and log more output 2024-12-28 10:04:38 +01:00
Jakub Konka
88962f9e98 ignore __eh_frame section for the time being in macho surgery 2024-12-28 10:04:38 +01:00
Jakub Konka
32b9274dad refactor collect_roc_definitions for MachO
I don't think we need to check for '@' in symbol naming as versioning
is not done on a symbol level for MachO as far as I remember (unlike for
Linux).
2024-12-28 10:04:38 +01:00
Jakub Konka
f847770f6e abstract away logic for finding symbol by index
I am still not quite sure what exactly I am looking at in this function
but this will have to do for now.

Assuming this function, aka `get_target_offset`, is correct, implement
handling of `RelocationKind::Absolute` which for now assume is `UNSIGNED`
and pointer sized.
2024-12-28 10:04:38 +01:00
Jakub Konka
14ad642296 object::macho forces us to handle MachO relocs low-level 2024-12-28 10:04:38 +01:00
Jakub Konka
322366bab3 save generated app_data to an object file 2024-12-28 10:04:36 +01:00
Asustin Shotero
149b2d5099
add legacy linker recommendation
Signed-off-by: Asustin Shotero <56707055+Elkiders99@users.noreply.github.com>
2024-12-08 21:26:38 -03:00
Richard Feldman
bc0c9250f9
Convert unused dbg!()s to eprintln!()s
This makes it nicer to work with dbg! normally,
because grepping the code base for dbg!() reveals
only the usages of it that are currently active.
2024-12-01 23:10:35 -05:00
Luke Boswell
6c6f6e08a9
replace cargo deps with workspace in linker, packaging, repl_* 2024-11-29 10:53:54 +11:00
Luke Boswell
8a566dc339
WIP 2024-11-11 10:22:58 +11:00
Anton-4
9b7c6c9fe7
cleanup warnings 2024-10-23 19:36:03 +02:00
Anton-4
5953155f70
done with cli_tests 2024-10-19 19:25:50 +02:00
Anton-4
5b451f9288
fixed run_multi_dep_str 2024-10-16 18:24:14 +02:00
Luke Boswell
f515311915
clippy fix 2024-07-09 15:47:56 +10:00
Luke Boswell
287d00df85
remove gen_stub_lib 2024-07-09 15:24:24 +10:00
Luke Boswell
85447ec2cc
replace stray strings with impl on Target 2024-07-09 14:39:36 +10:00
Luke Boswell
dc0902bc92
WIP
WIP

WIP

WIP

ignore some cli tests that are going to move

try fix for linux valgrind tests

try a legacy host for valgrind

fix roc_glue tests
2024-07-09 13:48:09 +10:00
Anton-4
1bcf30391b
Merge pull request #6819 from roc-lang/rust-1-77-2-upgrade
Rust 1.77.2 upgrade
2024-07-06 03:23:54 +02:00
Ryan Barth
3edc551043
chore: cargo fmt 2024-07-01 15:01:32 -07:00
Ryan Barth
43f970f813
fix: count all symbols to err on the side of over allocating 2024-06-30 23:17:20 -07:00
Ryan Barth
3fe2a4cd13
refactor: remove duplicate symbol functions from macho module 2024-06-30 23:01:32 -07:00
Ryan Barth
720ed2a457
fix: calculate windows dll symbols from prebuilt shared library 2024-06-30 22:56:14 -07:00
Luke Boswell
ee84b61360
update preprocess host API 2024-06-28 09:12:45 +10:00
Anton-4
05a61e2210
clippy + fmt 2024-06-19 12:34:10 +02:00
Agus Zubiaga
2da7ea394b
Add --main flag to specify app/package to resolve deps from 2024-06-07 17:09:44 -03:00
Brendan Hansknecht
6dc5bfb1b7
Use roc_target over target_lexicon
Tailors a target class for our needs.
Replaces tons of uses across the entire compiler.
This is a base for later adding new targets like thumb.
2024-03-31 10:50:26 -07:00
Brendan Hansknecht
28e4ae8ae5
update ingested windows compiler-rt symbols 2023-12-09 18:11:22 -08:00
jecaro
d21ea2ea83
Fix zig_host_app on NixOS
That's a problem with the dynamic loader:
https://discourse.nixos.org/t/no-such-file-of-directory-when-trying-to-execute-binary-file/6150

When linking `libapp.so` with `host.zig`, zig puts in the binary the
standard path for the dynamic loader on linux:
`/lib64/ld-linux-x86-64.so.2`

However in NixOS, that file is somewhere else in the nix store (see:
https://nixos.wiki/wiki/Packaging/Binaries#The_Dynamic_Loader). Removing
the `-target` switch makes zig uses the host target for linking and puts
the right path to the dynamic loader in the resulting binary. As we want
to execute that binary file in this test, it makes sense to use the
default target anyway.

Note that this is relevant for the creation of the binary only. For the
creation of the object file, it doesn't really matter. But I removed the
`-target` switch as well there for consistency.

Fix #4180
2023-11-21 11:12:31 +01:00
Brendan Hansknecht
8e86640bd7
add preprocess host cli option 2023-11-06 09:31:22 -08:00
Anton-4
90865c6b51
cleanup CI, fix unrecognized --strip 2023-10-23 13:50:34 -07:00
Folkert
2f88d0579d
fmt 2023-09-03 21:32:56 +02:00
Luke Boswell
8123041d0a
windows linker name matching 2023-09-03 21:32:36 +02:00