Commit Graph

270 Commits

Author SHA1 Message Date
Andrew Kelley
5314641e11 zig cc: support more linker args 2020-04-02 17:29:22 -04:00
Andrew Kelley
553f0e0546 fixups and revert a few things 2020-04-01 11:56:39 -04:00
daurnimator
7eb938c909 Use length field as passed in stage2 libc_installation instead of relying on zero termination 2020-04-01 10:36:38 -04:00
Andrew Kelley
839d85e440 fixes to 32-bit handling, to support 32-bit arm 2020-03-31 10:10:31 -04:00
Andrew Kelley
6408766d6b linking: remove check for target_supports_libunwind
I'm not sure why this was ever there. Maybe it was working around a
problem with LLVM 9. Anyway this fixes linking C++ code for 32 bit
arm and riscv.
2020-03-30 15:50:53 -04:00
Andrew Kelley
5aa2812507 linking is now aware -lm is provided by mingw-w64 2020-03-29 13:17:21 -04:00
Andrew Kelley
12e1c6e21c Merge pull request #4835 from squeek502/export-dynamic
-rdynamic/--export-dynamic fixes
2020-03-28 02:16:09 -04:00
Ryan Liptak
1a95f1c2e0 Fix -rdynamic not sending --export-dynamic to the ELF linker 2020-03-27 17:36:43 -07:00
Andrew Kelley
f407109070 zig c++: get it working with musl and mingw-w64 2020-03-27 12:38:52 -04:00
Andrew Kelley
db17c0d88c ability to compile c++ hello world with zig c++
closes #4786
2020-03-26 22:48:37 -04:00
Andrew Kelley
fae6cf0961 improved handling of native system directories
* `-isystem` instead of `-I` for system include directories
   fixes a problem with native system directories interfering with zig's
   bundled libc.
 * separate Stage2Target.is_native into Stage2Target.is_native_os and
   Stage2Target.is_native_cpu.
2020-03-25 20:34:15 -04:00
Andrew Kelley
3869e80331 Merge pull request #4793 from LemonBoy/netbsd-forever
Netbsd forever
2020-03-25 10:19:49 -04:00
LemonBoy
2f21c8f5ba stage1: Link pthread on NetBSD 2020-03-23 18:47:39 +01:00
Andrew Kelley
e5e5196d8e Merge remote-tracking branch 'origin/master' into llvm10 2020-03-22 20:48:21 -04:00
Andrew Kelley
23c263776c Merge remote-tracking branch 'origin/master' into llvm10 2020-03-22 15:09:29 -04:00
Andrew Kelley
a4eaeee720 ability to use zig cc as a drop-in C compiler
The basics are working
2020-03-21 15:39:39 -04:00
Andrew Kelley
7438d0fc31 glibc: include ld symbols and proper soname for ld 2020-03-20 14:39:05 -04:00
Andrew Kelley
53b5aa812b Merge remote-tracking branch 'origin/master' into llvm10 2020-03-19 22:19:24 -04:00
Andrew Kelley
4a8e766ef5 fix mismatch between expected and actual output name 2020-03-14 01:26:49 -04:00
Andrew Kelley
656ba530d8 Merge remote-tracking branch 'origin/master' into llvm10 2020-03-13 15:17:53 -04:00
Andrew Kelley
6e25ac2a2b stage1: update musl libc building code for v1.2.0 2020-03-12 17:45:55 -04:00
Andrew Kelley
96c07674fc Merge remote-tracking branch 'origin/master' into llvm10 2020-03-07 12:18:41 -05:00
Andrew Kelley
c0242f2310 update mingw-w64 source files to v7.0.0 2020-03-05 15:41:28 -05:00
Andrew Kelley
d1cb16aace Merge remote-tracking branch 'origin/master' into llvm10 2020-03-03 09:44:13 -05:00
Andrew Kelley
500dde32d5 dynamic_linker becomes a field of std.zig.CrossTarget 2020-02-28 14:51:56 -05:00
Andrew Kelley
ef24f2dd93 remove special darwin os version min handling
now it is integrated with zig's target OS range.
2020-02-28 14:51:56 -05:00
Andrew Kelley
f33bf48af7 Merge remote-tracking branch 'origin/master' into llvm10 2020-02-25 16:30:40 -05:00
Andrew Kelley
d7968c6d33 improvements which allow zig to emit multiple things at once
example: zig build-obj test.zig -femit-llvm-ir -femit-asm

this will generate all three: test.o test.s test.ll
2020-02-18 21:59:43 -05:00
Andrew Kelley
4b02a39aa9 self-hosted libc detection
* libc_installation.cpp is deleted.
   src-self-hosted/libc_installation.zig is now used for both stage1 and
   stage2 compilers.
 * (breaking) move `std.fs.File.access` to `std.fs.Dir.access`. The API
   now encourages use with an open directory handle.
 * Add `std.os.faccessat` and related functions.
 * Deprecate the "C" suffix naming convention for null-terminated
   parameters. "C" should be used when it is related to libc. However
   null-terminated parameters often have to do with the native system
   ABI rather than libc. "Z" suffix is the new convention. For example,
   `std.os.openC` is deprecated in favor of `std.os.openZ`.
 * Add `std.mem.dupeZ` for using an allocator to copy memory and add a
   null terminator.
 * Remove dead struct field `std.ChildProcess.llnode`.
 * Introduce `std.event.Batch`. This API allows expressing concurrency
   without forcing code to be async. It requires no Allocator and does
   not introduce any failure conditions. However it is not thread-safe.
 * There is now an ongoing experiment to transition away from
   `std.event.Group` in favor of `std.event.Batch`.
 * `std.os.execvpeC` calls `getenvZ` rather than `getenv`. This is
   slightly more efficient on most systems, and works around a
   limitation of `getenv` lack of integration with libc.
 * (breaking) `std.os.AccessError` gains `FileBusy`, `SymLinkLoop`, and
   `ReadOnlyFileSystem`. Previously these error codes were all reported
   as `PermissionDenied`.
 * Add `std.Target.isDragonFlyBSD`.
 * stage2: access to the windows_sdk functions is done with a manually
   maintained .zig binding file instead of `@cImport`.
 * Update src-self-hosted/libc_installation.zig with all the
   improvements that stage1 has seen to src/libc_installation.cpp until
   now. In addition, it now takes advantage of Batch so that evented I/O
   mode takes advantage of concurrency, but it still works in blocking
   I/O mode, which is how it is used in stage1.
2020-02-16 13:25:30 -05:00
Andrew Kelley
a8b36fbe34 Merge remote-tracking branch 'origin/master' into llvm10 2020-02-14 10:27:44 -05:00
LemonBoy
327d40e7a3 Fix a UAF when verbose-llvm-ir is specified
The g->module is long gone when codegen_link is called.
2020-02-12 23:10:08 +01:00
Michael Dusan
edb210905d stage1: memory/report overhaul
- split util_base.hpp from util.hpp
- new namespaces: `mem` and `heap`
- new `mem::Allocator` interface
- new `heap::CAllocator` impl with global `heap::c_allocator`
- new `heap::ArenaAllocator` impl
- new `mem::TypeInfo` extracts names without RTTI
- name extraction is enabled w/ ZIG_ENABLE_MEM_PROFILE=1
- new `mem::List` takes explicit `Allocator&` parameter
- new `mem::HashMap` takes explicit `Allocator&` parameter
- add Codegen.pass1_arena and use for all `ZigValue` allocs
- deinit Codegen.pass1_arena early in `zig_llvm_emit_output()`
2020-02-10 21:08:08 -05:00
Andrew Kelley
cdc5070f21 Merge remote-tracking branch 'origin/master' into llvm10 2020-02-10 00:26:33 -05:00
Jared Miller
b55bc5eb26 Add wWinMain and wWinMainCRTStartup to fix #4376 2020-02-07 22:52:40 -05:00
Andrew Kelley
a95dce15ae Merge remote-tracking branch 'origin/master' into llvm10 2020-01-29 23:33:12 -05:00
LemonBoy
3ec37c979e Build compiler_rt/c with optimizations if possible 2020-01-28 19:28:39 -05:00
Andrew Kelley
79fb486017 link: update to llvm 10 API 2020-01-23 17:28:13 -05:00
Michael Dusan
0a41051955 stage1: move local native_libc.txt to global
Automatic creation of `native_libc.txt` now occurs only in global
cache. Manual creation/placement into local cache is supported.

closes #3975
2020-01-15 13:42:12 -05:00
David Cao
8e57dd57ca add --eh-frame-hdr conditionally 2020-01-07 15:58:40 -05:00
David Cao
599213463d add --eh-frame-hdr arg for linking 2020-01-07 15:58:39 -05:00
Andrew Kelley
dcbd5ad155 remove upstream support for Zen hobby OS
The new plan to support hobby operating systems is #3784.

And what kind of name is "Zen" anyway? There's already a
[Zen programming language](http://zenlang.sourceforge.net/)
and that's just confusing.
2019-12-02 12:01:49 -05:00
Tse
33cc204481 DragonFlyBSD support 2019-10-30 21:21:58 -04:00
Andrew Kelley
f65b1d4680 integrate stage1 progress display with semantic analysis 2019-10-22 17:52:12 -04:00
Andrew Kelley
299991019d rework the progress module and integrate with stage1 2019-10-17 20:20:22 -04:00
Andrew Kelley
10f6176f3d only look for .defs when needed; remove samsrv.dll cross compiling support
previously zig would look for all the .defs even when not needed,
wasting time. also, we only had samsrv definitions for some architectures.
remove cross compiling support for this.
2019-10-16 13:12:35 -04:00
Andrew Kelley
5bfea3f1ea add more cross compiling support for windows system dlls 2019-10-16 12:43:57 -04:00
Andrew Kelley
f81d9d2c84 add cross compiling support for opengl32.dll 2019-10-16 12:16:35 -04:00
LemonBoy
2b624fea84 Add dlltool functionality
Don't need no patched lld --kill-at behaviour now.
2019-10-12 10:56:16 +02:00
LemonBoy
8aa20227ed Fix cross-compilation to i386-windows-msvc
Use Mingw's .def files to build a .lib when possible and show an error
otherwise.
2019-10-11 15:52:55 -04:00
LemonBoy
86e5bbffd7 Patch lld to have a more sensible kill-at implementation
Lift some code from llvm-dlltool, the lld code is meant to follow what
gnu ld does but that's not much useful for our purposes.

Also use the `--kill-at` option when generating the .lib files out of
mingw's .def files: this way our building process closely matches the
one use by the upstream and now finally generates files that allow both
C code and Zig code to link.
2019-10-10 09:38:57 +02:00