mirror of
https://github.com/ziglang/zig.git
synced 2025-12-12 17:23:09 +00:00
Prior to this change we would assume the ABI for Apple targets to be GNU which could result in subtle errors in LLVM emitting calls to non-existent system libc provided functions such as `_sincosf` which is a GNU extension and as such is not provided by macOS for example. This would result in linker errors where the linker would not be able to find the said symbol in `libSystem.tbd`. With this change, we now correctly identify macOS (and other Apple platforms) as having ABI `unknown` which translates to unspecified in LLVM under-the-hood: ``` // main.ll target triple = "aarch64-unknown-macos-unknown" ``` Note however that we never suffix the target OS with target version such as `macos11` or `macos12` which means we fail to instruct LLVM of potential optimisations provided by the OS such as the availability of function `___sincosf_stret`. I suggest we investigate that in a follow-up commit.
25 lines
837 B
C
Vendored
25 lines
837 B
C
Vendored
/*
|
|
* Copyright (c) 2006-2007 Apple Inc. All rights reserved.
|
|
*/
|
|
|
|
#ifndef _ARM__PARAM_H_
|
|
#define _ARM__PARAM_H_
|
|
|
|
#if defined (__arm__) || defined (__arm64__)
|
|
|
|
#include <arm/_types.h>
|
|
|
|
/*
|
|
* Round p (pointer or byte index) up to a correctly-aligned value for all
|
|
* data types (int, long, ...). The result is unsigned int and must be
|
|
* cast to any desired pointer type.
|
|
*/
|
|
#define __DARWIN_ALIGNBYTES (sizeof(__darwin_size_t) - 1)
|
|
#define __DARWIN_ALIGN(p) ((__darwin_size_t)((__darwin_size_t)(p) + __DARWIN_ALIGNBYTES) &~ __DARWIN_ALIGNBYTES)
|
|
|
|
#define __DARWIN_ALIGNBYTES32 (sizeof(__uint32_t) - 1)
|
|
#define __DARWIN_ALIGN32(p) ((__darwin_size_t)((__darwin_size_t)(p) + __DARWIN_ALIGNBYTES32) &~ __DARWIN_ALIGNBYTES32)
|
|
|
|
#endif /* defined (__arm__) || defined (__arm64__) */
|
|
|
|
#endif /* _ARM__PARAM_H_ */ |