Jakub Konka
2cd84b1b3f
stage2 macho: refactor PIE generation on x86_64
2020-11-26 11:50:09 +01:00
Jakub Konka
ef5132c508
stage2 macho: first, rough draft at trampolining
2020-11-26 11:50:09 +01:00
Jakub Konka
80b1041c21
stage2 macho: use RIP-relative for memory-set regs x86_64
2020-11-26 11:50:09 +01:00
Jakub Konka
59fe3d447d
stage2 macho: make file structure compatible with codesign tool
2020-11-26 11:50:09 +01:00
Jakub Konka
e7db372864
stage2 macho: cleanup logs
2020-11-26 11:50:09 +01:00
Jakub Konka
cd79c6dda1
stage2 macho: fix issues with codesigning
2020-11-26 11:50:09 +01:00
Jakub Konka
a6e93da717
stage2 macho: generate a code sig (not valid yet)
2020-11-26 11:50:09 +01:00
Jakub Konka
9dcf7ee9c9
stage2 macho: add info about __TEXT segment
2020-11-26 11:50:09 +01:00
Jakub Konka
79381dc4fb
stage2 macho: add empty CodeDirectory blob
2020-11-26 11:50:09 +01:00
Jakub Konka
d14cd59ef0
stage2 macho: move code signature logic into struct
2020-11-26 11:50:09 +01:00
Jakub Konka
3ac804628f
stage2 macho: write out constants in CS
2020-11-26 11:50:09 +01:00
Jakub Konka
2bd963ad6a
stage2 macho: don't pad out holes between sections
2020-11-26 11:50:09 +01:00
Jakub Konka
403dc50ff7
stage2 macho: preallocate empty code sig space
2020-11-26 11:50:09 +01:00
Jakub Konka
bbc4ee3f17
stage2 macho: refactor
2020-11-26 11:50:09 +01:00
Jakub Konka
a2e0e33249
stage2 macho: bring back incremental symbol commits
2020-11-26 11:50:09 +01:00
Jakub Konka
e1b65ff8d2
stage2 macho: cleanup minimum version command
2020-11-26 11:50:09 +01:00
Jakub Konka
be0d5571d2
stage2 macho: revert required alignment always at 4
2020-11-26 11:50:09 +01:00
Jakub Konka
2972f630a4
stage2 macho: start reverting some tweaks
2020-11-26 11:50:09 +01:00
Jakub Konka
4e3520a2f7
stage2 macho: make page size target cpu arch dependent
2020-11-26 11:50:09 +01:00
Jakub Konka
8450e6f156
stage2 macho: pages need to be 16kb aligned!
2020-11-26 11:50:09 +01:00
Jakub Konka
4a3d757f3e
stage2 MachO: reduce size of __TEXT segment
2020-11-26 11:50:09 +01:00
Jakub Konka
7a407246ed
stage2 MachO: remove discontinuities between segments
2020-11-26 11:50:09 +01:00
Jakub Konka
6ac7e99dad
Write local symbols when flushing
2020-11-26 11:50:09 +01:00
Jakub Konka
b3fdfe5ca0
stage2 MachO: clean up segment protection flags
2020-11-26 11:50:09 +01:00
Jakub Konka
7dd5ce2527
stage2 macOS: make exe flagged as pie
2020-11-26 11:50:09 +01:00
Jakub Konka
1bec531cf2
stage2 MachO: add source version load cmd
2020-11-26 11:50:09 +01:00
Jakub Konka
72310db1da
stage2 MachO: add min OS version load cmd
2020-11-26 11:50:09 +01:00
LemonBoy
58c2bec589
stage1: Fix ICE when generating struct fields with padding
...
Make gen_const_ptr_struct_recursive aware of the possible presence of
some trailing padding by always bitcasting the pointer to its expected
type.
Not an elegant solution but makes LLVM happy and is consistent with how
the other callsites are handling this case.
Fixes #5398
2020-11-25 15:36:33 -08:00
Andrew Kelley
abc717f203
modernize the PIE patch for the latest master branch
...
This is the part of #3960 that has to be rewritten to apply to latest
master branch code.
2020-11-22 17:28:11 -07:00
Andrew Kelley
55ab50efbd
Merge branch 'piepiepie' of https://github.com/LemonBoy/zig into pie
...
Conflicts:
lib/std/dynamic_library.zig (fixed in this commit)
src/all_types.hpp
src/codegen.cpp
src/link.cpp
src/main.cpp
Will manually apply the diffs to these deleted files to the new zig
code in a followup commit.
2020-11-22 12:39:44 -07:00
Andrew Kelley
7dcda5b0e8
Merge pull request #7182 from LemonBoy/externnnn
...
Initial implementation of @extern builtin
2020-11-21 09:41:49 -08:00
LemonBoy
ccdaf946b9
Rename back to extern, extend a stage1 parser hack
...
Make it recognize extern/export symbols prefixed by @ as a builtin
rather than stand-alone keywords.
2020-11-21 09:48:21 +01:00
LemonBoy
6029114f84
stage1: Resolve usingnamespace decls when calling @typeInfo
...
Closes #7176
2020-11-20 17:01:23 -08:00
LemonBoy
9b7d9c72b0
stage1: Initial implementation of @extern
2020-11-20 22:32:43 +01:00
LemonBoy
8eaaa905f7
stage2: Make zig cc more verbose ( #7166 )
...
* stage2: Make zig cc more verbose
Make `zig cc` print more info from Clang itself and from our own linker
invocation, this is needed for CMake to properly discover all the
include directories and library search paths.
Closes #7110
* Update `update_clang_options`
* Typo fixes
Co-authored-by: Jakub Konka <kubkon@jakubkonka.com>
2020-11-19 23:30:16 +01:00
Veikka Tuominen
cf819b95fe
Merge pull request #6829 from tadeokondrak/error-unsupported-callconv
...
stage1: Compile error instead of falling back to C for unsupported cc
2020-11-19 19:03:08 +02:00
Tadeo Kondrak
25ec2dbc1e
Add builtin.Signedness, use it instead of is_signed
2020-11-19 18:59:21 +02:00
Vexu
3a28b659bd
add compile-error tests for unsupported calling convention
2020-11-19 14:25:46 +02:00
Tadeo Kondrak
51b362c350
stage1: Check calling convention correctly for subsystem detection
2020-11-19 14:18:35 +02:00
Tadeo Kondrak
6b9dc82fa5
stage1: Compile error instead of falling back to C for unsupported cc
2020-11-19 13:59:11 +02:00
LemonBoy
2b7781d82a
stage1: Fix undefined assignment for bitfields
...
Prevents silent memory corruption.
Closes #7055
2020-11-18 21:49:39 -08:00
Andrew Kelley
13cccdd92c
add std.heap.raw_c_allocator
...
This API does what `std.heap.c_allocator` previously did. See the new
doc comments for more details.
2020-11-18 22:09:34 -07:00
Andrew Kelley
02a4e5a4bf
Merge pull request #6385 from LemonBoy/callocator
...
std: Make C allocator respect the required alignment
2020-11-18 20:16:57 -08:00
pfg
cf7de64f1a
stage1: improve error for missing a number type on a runtime var
2020-11-18 21:45:51 +02:00
Vexu
da84ef2a9c
make help in commands more consistent
...
Closes #7101
Co-authored-by: pfg <pfg@pfg.pw>
2020-11-18 13:58:27 +02:00
frmdstryr
a39d3155b4
Change error when runtime value passed to comptime arg
2020-11-18 13:33:45 +02:00
LemonBoy
129ccad434
stage1: Reject undefined values when taking union ptr
...
The code rightfully assumes the union_val object to be fully initialized.
Closes #7019
2020-11-18 13:21:36 +02:00
Veikka Tuominen
6d5b76a75d
Merge pull request #7005 from jshholland/deprecate-span
...
Remove ArrayList.span
2020-11-18 13:14:48 +02:00
Timon Kruiper
66d6930b5c
Allow Zig to be built with clang 11 and -Werror
...
This was brought to the horizon when using zig-bootstrap to cross compile
Zig for windows-gnu.
2020-11-18 13:09:44 +02:00
LemonBoy
bef140c0a2
stage1: Add architecture-specific clobbers to asm()
...
We're basically following Clang's lead, add the necessary clobbers to
minimize the risk of generating wrong code.
2020-11-18 13:08:04 +02:00