34 Commits

Author SHA1 Message Date
Jakub Konka
66a93ebfbf zld: clean up parsing section by type and attrs 2021-06-14 12:56:53 +02:00
Jakub Konka
03cda80a63 zld: handle aliasing of tentative into regular global 2021-06-10 11:03:14 +02:00
Jakub Konka
66ff56c58f zld: add Symbol.Tentative to denote common symbol 2021-06-10 10:29:57 +02:00
Jakub Konka
96bb81b6ef zld: moving target seg,sect mapping into Object.Section 2021-06-10 09:13:35 +02:00
Jakub Konka
88aec4a1ee zld: work out size and alignment of commons 2021-06-10 07:15:32 +02:00
Jakub Konka
d1f60a63bd zld: fix the linker for 32bit comp targets 2021-06-03 00:23:04 +02:00
Jakub Konka
2b0d322ea0 zld: permit system static libs
This commits permits passing in static archives using the system
lib flag `-la`. With this commit, `zig ld` will now look firstly for
a dynamic library (which always takes precedence), and will fall back
on `liba.a` if the dylib is not found. The static archive is searched
for in the system lib search dirs like the dylibs.
2021-05-22 16:12:45 +02:00
Jakub Konka
88d40fc005 zld: sort tlv offsets by source address 2021-05-06 17:10:05 +02:00
Jakub Konka
ef8a666797 zld: cleanup relocs and flag errors on unhandled symbol types 2021-05-06 17:09:58 +02:00
Jakub Konka
68ebc7cba0 zld: rewrite symbol resolution 2021-05-04 13:09:32 +02:00
Jakub Konka
86ab6ca56c zld: rewrite Object to include pointers to Symbols 2021-05-04 13:09:32 +02:00
Jakub Konka
4ec6d174ad zld: new approach at handling static inits 2021-04-24 08:13:53 +02:00
Jakub Konka
b03983b450 zld: analyze static initializers 2021-04-24 08:13:53 +02:00
Jakub Konka
1119970d22 zld: add x86_64 relocs 2021-04-13 10:56:03 +02:00
Jakub Konka
b1f9db75f3 zld: save locals per TU 2021-04-13 10:56:03 +02:00
Jakub Konka
3b7c9dd6bd zld: differentiate between static and global in stabs 2021-04-13 10:56:03 +02:00
Jakub Konka
717d382871 zld: streamline tags for Symbol 2021-04-13 10:56:03 +02:00
Jakub Konka
6e3f82ef28 zld: fix parsing debug info 2021-04-13 10:56:03 +02:00
Jakub Konka
421102ba72 zld: move parsing debug info into object 2021-04-13 10:56:03 +02:00
Jakub Konka
23bb6fa9f4 zld: flush MachO 2021-04-13 10:56:03 +02:00
Jakub Konka
db44a7803f zld: resolve target addresses for relocs 2021-04-13 10:56:03 +02:00
Jakub Konka
b667fe2c62 zld: resolve stubs and GOT entries 2021-04-13 10:56:03 +02:00
Jakub Konka
46cc214f2d zld: migrate parts of main to new relocs 2021-04-13 10:56:03 +02:00
Jakub Konka
6a866f1a96 zld: preprocess relocs on arm64 2021-04-13 10:56:03 +02:00
Jakub Konka
d5c2f8ed32 zld: store a single global symtab 2021-04-13 10:56:03 +02:00
Jakub Konka
1b5bceec91 zld: start work on reloc preprocessing 2021-04-13 10:56:03 +02:00
Jakub Konka
b0105029ca zld: refactor object and archive parsing 2021-04-13 10:56:03 +02:00
Jakub Konka
988b184d03 zld: redo symbol resolution in objects
Store only globals and undefs at the linker level, while all locals
stay scoped to the actual object file they were defined in. This is
fine since the relocations referencing locals will always be resolved
first using the local symbol table before checking for the reference
within the linker's global symbol table.

This also paves the way for proper symbol resolution from within static
and dynamic libraries.
2021-04-13 10:56:03 +02:00
Jakub Konka
f6ba810f27 zld: apply offset for DICE in archive 2021-03-19 23:37:16 +01:00
Jakub Konka
ac0c669473 zld: add/fix more issues
* fix debug info for static archives
* allow handling of empty object files
* fix some relocs for GOT loads
2021-03-17 19:59:13 +01:00
Jakub Konka
a1b0ec5277 zld: start bringing x64 up to speed 2021-03-17 19:59:13 +01:00
Jakub Konka
066c1386a3 zld: demote logs from warn to debug 2021-03-17 19:59:13 +01:00
Jakub Konka
b0ee480177 zld: merge and sort sections 2021-03-17 19:59:13 +01:00
Jakub Konka
f52f23618d macho: start upstreaming zld 2021-03-17 19:59:13 +01:00