Skip to content

Commit

Permalink
Add initial support for iOS targets (#2237)
Browse files Browse the repository at this point in the history
* Add iOS C int sizes... try to hack in iOS DebugInfo

* Get rid of ios link check for now

* Remove macos linkversion check
  • Loading branch information
mpiannucci authored and andrewrk committed Apr 11, 2019
1 parent b59c65e commit 27cd830
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
10 changes: 0 additions & 10 deletions src/link.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1562,16 +1562,6 @@ static void construct_linker_job_macho(LinkJob *lj) {
lj->args.append("dynamic_lookup");
}

if (platform.kind == MacOS) {
if (darwin_version_lt(&platform, 10, 5)) {
lj->args.append("-lgcc_s.10.4");
} else if (darwin_version_lt(&platform, 10, 6)) {
lj->args.append("-lgcc_s.10.5");
}
} else {
zig_panic("TODO");
}

This comment has been minimized.

Copy link
@justinbalexander

justinbalexander Apr 11, 2019

Contributor

This causes an error for me when building Zig statically using the docker container:

/home/zig-build/export/zig/src/link.cpp:1429:13: error: 'bool darwin_version_lt(DarwinPlatform*, int, int)' defined but not used [-Werror=unused-function] static bool darwin_version_lt(DarwinPlatform *platform, int major, int minor) {

This comment has been minimized.

Copy link
@andrewrk

andrewrk Apr 11, 2019

Member

Fixed in a895c59

for (size_t i = 0; i < g->darwin_frameworks.length; i += 1) {
lj->args.append("-framework");
lj->args.append(buf_ptr(g->darwin_frameworks.at(i)));
Expand Down
17 changes: 16 additions & 1 deletion src/target.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -894,10 +894,25 @@ uint32_t target_c_type_size_in_bits(const ZigTarget *target, CIntType id) {
case CIntTypeCount:
zig_unreachable();
}
case OsIOS:
switch (id) {
case CIntTypeShort:
case CIntTypeUShort:
return 16;
case CIntTypeInt:
case CIntTypeUInt:
return 32;
case CIntTypeLong:
case CIntTypeULong:
case CIntTypeLongLong:
case CIntTypeULongLong:
return 64;
case CIntTypeCount:
zig_unreachable();
}
case OsAnanas:
case OsCloudABI:
case OsDragonFly:
case OsIOS:
case OsKFreeBSD:
case OsLv2:
case OsSolaris:
Expand Down
2 changes: 1 addition & 1 deletion std/debug.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1178,7 +1178,7 @@ pub const DwarfInfo = struct {
};

pub const DebugInfo = switch (builtin.os) {
builtin.Os.macosx => struct {
builtin.Os.macosx, builtin.Os.ios => struct {
symbols: []const MachoSymbol,
strings: []const u8,
ofiles: OFileTable,
Expand Down

0 comments on commit 27cd830

Please sign in to comment.