Jakub Konka
acd700ac6b
elf: store ar state per input object file
2023-11-04 09:13:18 +01:00
Jakub Konka
ed2984f335
elf: do not align end of archive to 2bytes; fix archive parser
2023-11-04 09:13:07 +01:00
Jakub Konka
33a0a72e87
elf: align ar_hdr to at least 2 bytes
2023-11-04 09:12:26 +01:00
Jakub Konka
3b9455f005
elf: generate pretty rudimentary archive
2023-11-04 09:12:07 +01:00
Jakub Konka
eddf9cc65b
elf: collect exports from ZigObject into AR symtab
2023-11-04 09:11:58 +01:00
Jakub Konka
481ee1b598
elf: enable static-lib flush path
2023-11-04 09:11:47 +01:00
Jakub Konka
ccb2afacc0
elf: postpone creation of .got.zig entry until code emit
2023-11-04 09:11:29 +01:00
Jakub Konka
5affd29b47
elf: use StringTable for strtab management in ZigObject
2023-11-04 09:11:22 +01:00
Jakub Konka
96f221236d
elf: fix r_offset when emitting relocs for the linker
2023-11-04 09:11:14 +01:00
Jakub Konka
7c5c59191e
elf: claim unresolved dangling symbols as undef externs when emitting object
2023-11-04 09:10:43 +01:00
Jakub Konka
dbe13200f1
elf: emit STT_SECTION symbols
2023-11-04 09:10:30 +01:00
Jakub Konka
8055f68765
elf: make sure we never emit .got.zig relocs when linking object files
2023-11-04 09:10:23 +01:00
Jakub Konka
5698be3ef0
elf: write out contents of .rela sections
2023-11-04 09:10:06 +01:00
Jakub Konka
3606b5df3f
elf: improve Symbol to handle emitting relocatable object files
2023-11-04 09:09:57 +01:00
Jakub Konka
ec2671d16b
elf: update .rela section sizes; skip .got.zig when emitting object
2023-11-04 09:09:46 +01:00
Jakub Konka
0ee2ab413f
elf: emit valid section headers table when building an object file
2023-11-04 09:09:26 +01:00
Jakub Konka
abf6c20cb9
elf: rename .rodata to .data.rel.ro and remove allocateAllocSection helper
2023-11-04 09:09:01 +01:00
Jakub Konka
b8c8565e93
elf: implement --gc-sections for non-LLVM Zig source
2023-11-04 09:08:27 +01:00
Jakub Konka
25c53f08a6
elf: redo strings management in the linker
...
* atom names - are stored locally and pulled from defining object's
strtab
* local symbols - same
* global symbols - in principle, we could store them locally, but
for better debugging experience - when things go wrong - we
store the offsets in a global strtab used by the symbol resolver
2023-11-04 09:08:16 +01:00
Andrew Kelley
3fc6fc6812
std.builtin.Endian: make the tags lower case
...
Let's take this breaking change opportunity to fix the style of this
enum.
2023-10-31 21:37:35 -04:00
Jacob Young
d890e81761
mem: fix ub in writeInt
...
Use inline to vastly simplify the exposed API. This allows a
comptime-known endian parameter to be propogated, making extra functions
for a specific endianness completely unnecessary.
2023-10-31 21:37:35 -04:00
Jakub Konka
ea95c74948
elf: encapsulate ZigObject-specific logic in flushModule hook
2023-10-30 20:36:34 +01:00
Jakub Konka
b1a735ac65
elf: put init logic of ZigObject in init function
2023-10-30 19:44:27 +01:00
Jakub Konka
9bdbb6312f
elf: move incremental codegen bits into ZigObject.zig
2023-10-30 19:09:13 +01:00
Jakub Konka
b2e847a41a
elf: rename ZigModule to ZigObject
2023-10-30 19:09:13 +01:00
Jakub Konka
a6a10d9c2b
x86_64: do not hardcode memory passed by Elf linker
2023-10-28 03:48:18 -04:00
Jakub Konka
8087ec8e8c
elf: improve parsing of ld scripts and actually test linking against them
2023-10-24 19:03:00 +02:00
Jakub Konka
6dc45e7d31
Merge pull request #17621 from ziglang/elf-pic-pie
...
elf: actually check for dynamic executables
2023-10-20 22:33:44 +02:00
Jakub Konka
3768c95371
elf: actually check for dynamic executables
2023-10-19 15:57:58 +02:00
Jakub Konka
1448d6b77c
elf: store shndx to Zig module atoms out-of-band
...
This allows us to increase the effective resolution of `st_shndx`
from `u8` to `u32`.
2023-10-18 18:33:35 +02:00
Jakub Konka
9ced0ecbbd
elf: increase resolution of Atom.input_section_index to u32
2023-10-18 17:29:19 +02:00
Jakub Konka
27d7ac88a3
elf: increase resolution of Atom.relocs_section_index to u32
2023-10-18 17:25:28 +02:00
Jakub Konka
52e0ca1312
elf: parse GNU ld script as system lib indirection
2023-10-18 13:54:43 +02:00
Jakub Konka
d2727b808c
elf: fix 32bit build
2023-10-16 19:56:47 +02:00
Jakub Konka
e89155b565
elf: refactor logs
2023-10-16 19:33:06 +02:00
Jakub Konka
7b2cbcf0fe
codegen+elf: check if extern is a variable ref
2023-10-16 19:33:06 +02:00
Jakub Konka
c71a79f618
elf: make .zig.rodata writeable
2023-10-16 19:33:06 +02:00
Jakub Konka
17635e4f2a
x86_64: add -fPIC support targeting ELF
2023-10-16 19:33:06 +02:00
Jakub Konka
b3d98a4b88
elf: emit dynamic base relocs for .zig.got entries when required
2023-10-16 19:33:06 +02:00
Jakub Konka
85d451f96c
elf: re-enable self-hosted backends
2023-10-16 19:33:05 +02:00
Jakub Konka
7be983ac92
elf: create new synthetic section ZigGotSection
2023-10-16 19:33:05 +02:00
Jakub Konka
0b37a9c78d
elf: fix GotSection.write in presence of TLSLD symbol
2023-10-16 19:33:05 +02:00
Jakub Konka
1efc0519ce
elf: make init/fini sorting deterministic
2023-10-16 19:33:05 +02:00
Jakub Konka
1772dbb503
elf: fix generating .plt.got indirection
2023-10-16 19:33:05 +02:00
Jakub Konka
a748ca3725
elf: populate symtab with symbols coming from DSOs
2023-10-16 19:33:05 +02:00
Jakub Konka
def7190e84
elf: hook up common symbols handler
2023-10-16 19:33:04 +02:00
Jakub Konka
4af5caa81f
elf: add missing generators for special dynamic sections
2023-10-16 19:33:04 +02:00
Jakub Konka
5fa90afb64
elf: fix synthetic section handling and actually parse DSOs
2023-10-16 19:33:04 +02:00
Jakub Konka
d1446565a1
elf: re-enable dynamic linking codepaths
2023-10-16 19:33:04 +02:00
Jakub Konka
04a8f217c6
elf: fix COMDAT deduping logic
2023-10-16 19:33:04 +02:00