Jakub Konka
10942e3f86
stage2 macho: Hello, Silicon!
2020-11-26 11:50:09 +01:00
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
e8dd62accd
stage2 macho: fix incorrect rebase
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
Isaac Freund
58365c4e79
std/os: fix prctl constants
2020-11-25 15:45:55 -08:00
Andrew Kelley
a06afa4579
Merge pull request #6411 from LemonBoy/fff
...
More std.fmt goodness
2020-11-25 15:43:19 -08:00
daurnimator
b7b3c1dfae
std: use mem.asBytes in Ip4Address.parse so it works at comptime
2020-11-25 15:40:46 -08:00
Frank Denis
83abb32247
std/crypto - edwards25519 precomp: prefer doublings over adds
...
Doublings are a little bit faster than additions, so use them half
the time during precomputations.
2020-11-25 15:37:43 -08: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
500fbdad57
update stack trace test with new start.zig line number
2020-11-25 00:40:50 -07:00
Andrew Kelley
479f259ea4
make start code more versatile
...
* always align the stack to 16. I saw an instance on x86_64 linux where
it was needed.
* detect at runtime if being interpreted by a dynamic loader and if so
avoid clobbering the fs register.
2020-11-24 19:51:24 -07:00
Jonathan Marler
a1fb10b766
fix for GCC 9.2: -Wno-maybe-uninitialized
2020-11-23 17:55:48 -08:00
Frank Denis
70c8cabb34
Update the minimum cmake version we require
...
Recent versions of cmake complain about it:
<<
CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
Compatibility with CMake < 2.8.12 will be removed from a future version of
CMake.
>>
We don't require anything from version 2.8.5, and version 2.8.12 was
released in 2011, so it is very unlikely that anyone still uses 2.8.5.
2020-11-23 12:44:54 -08:00
Andrew Kelley
9d2fe1682f
Merge pull request #7204 from LemonBoy/piecrash
...
Fix logic for detecting _DYNAMIC symbol
2020-11-23 08:55:34 -08:00
LemonBoy
3e22077d46
Fix the ELF base calculation
...
Find the effective ELF load address in dl_iterate_phdr by computing the
difference between the in-memory phdr and its p_vaddr specified in the
ELF file.
This makes the dl_iterate_phdr test pass and restores the stack traces.
2020-11-23 15:06:07 +01:00
LemonBoy
0a84f85945
Minor code cleanup in start_pie.zig
...
Thanks @daurnimator for catching this.
2020-11-23 12:36:40 +01:00
LemonBoy
bfa7e5c743
Update stack_traces test
2020-11-23 12:36:03 +01:00
LemonBoy
560043dadf
Fix logic for detecting _DYNAMIC symbol
...
Prevent spurious crashes for non-PIE executables.
2020-11-23 12:00:12 +01:00
Andrew Kelley
c7170e4a54
Support PIE (Position Independent Executables)
...
Closes #4503
Revives #3960
Merges branch 'pie' into master
2020-11-22 17:30:34 -07: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
Vexu
98d5bfbd4d
update grammar in langref
2020-11-22 21:30:09 +02:00
Žiga Željko
2fbe9519ac
std: add support for ppoll
2020-11-21 14:06:04 -08:00
LemonBoy
a2e9554699
std: Add test for meta.declarations on opaque{}
2020-11-21 14:03:49 -08:00
Andrew Kelley
7dcda5b0e8
Merge pull request #7182 from LemonBoy/externnnn
...
Initial implementation of @extern builtin
2020-11-21 09:41:49 -08:00