From 94ec2190f8d8c41d19b668511bf31fae32bcd095 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Mon, 23 Oct 2017 21:43:18 -0400 Subject: [PATCH 01/24] update to llvm master --- README.md | 8 +- c_headers/__clang_cuda_intrinsics.h | 124 ++++++++ c_headers/__clang_cuda_runtime_wrapper.h | 30 +- c_headers/arm64intr.h | 49 ++++ c_headers/avx2intrin.h | 12 +- c_headers/avx512bwintrin.h | 71 +++-- c_headers/avx512dqintrin.h | 38 +-- c_headers/avx512fintrin.h | 54 ++-- c_headers/avx512vlbwintrin.h | 50 ++-- c_headers/avx512vldqintrin.h | 54 ++-- c_headers/avx512vlintrin.h | 69 +++-- c_headers/clflushoptintrin.h | 2 +- c_headers/clwbintrin.h | 52 ++++ c_headers/cuda_wrappers/new | 51 +++- c_headers/emmintrin.h | 12 +- c_headers/float.h | 14 + c_headers/immintrin.h | 4 + c_headers/intrin.h | 6 +- c_headers/opencl-c.h | 359 ++--------------------- c_headers/unwind.h | 78 +++-- ci/appveyor/build_script.bat | 4 +- ci/travis_linux_install | 2 +- cmake/Findclang.cmake | 8 +- cmake/Findlld.cmake | 11 +- cmake/Findllvm.cmake | 6 +- src/parsec.cpp | 3 + src/target.cpp | 26 +- src/zig_llvm.cpp | 8 +- src/zig_llvm.hpp | 3 + std/special/compiler_rt/index.zig | 19 +- 30 files changed, 675 insertions(+), 552 deletions(-) create mode 100644 c_headers/arm64intr.h create mode 100644 c_headers/clwbintrin.h diff --git a/README.md b/README.md index 42783fab85..2a1ab6bcbf 100644 --- a/README.md +++ b/README.md @@ -141,7 +141,7 @@ These libraries must be installed on your system, with the development files available. The Zig compiler links against them. You have to use the same compiler for these libraries as you do to compile Zig. - * LLVM, Clang, and LLD libraries == 5.x + * LLVM, Clang, and LLD libraries == 6.x ### Debug / Development Build @@ -163,11 +163,11 @@ make install `ZIG_LIBC_LIB_DIR` and `ZIG_LIBC_STATIC_LIB_DIR` are unused. ``` -brew install llvm@5 -brew outdated llvm@5 || brew upgrade llvm@5 +brew install llvm@6 +brew outdated llvm@6 || brew upgrade llvm@6 mkdir build cd build -cmake .. -DCMAKE_PREFIX_PATH=/usr/local/opt/llvm@5/ -DCMAKE_INSTALL_PREFIX=$(pwd) +cmake .. -DCMAKE_PREFIX_PATH=/usr/local/opt/llvm@6/ -DCMAKE_INSTALL_PREFIX=$(pwd) make install ./zig build --build-file ../build.zig test ``` diff --git a/c_headers/__clang_cuda_intrinsics.h b/c_headers/__clang_cuda_intrinsics.h index b43ce21d0b..bc5b876577 100644 --- a/c_headers/__clang_cuda_intrinsics.h +++ b/c_headers/__clang_cuda_intrinsics.h @@ -92,6 +92,130 @@ __MAKE_SHUFFLES(__shfl_xor, __nvvm_shfl_bfly_i32, __nvvm_shfl_bfly_f32, 0x1f); #endif // !defined(__CUDA_ARCH__) || __CUDA_ARCH__ >= 300 +#if CUDA_VERSION >= 9000 +#if (!defined(__CUDA_ARCH__) || __CUDA_ARCH__ >= 300) +// __shfl_sync_* variants available in CUDA-9 +#pragma push_macro("__MAKE_SYNC_SHUFFLES") +#define __MAKE_SYNC_SHUFFLES(__FnName, __IntIntrinsic, __FloatIntrinsic, \ + __Mask) \ + inline __device__ int __FnName(unsigned int __mask, int __val, int __offset, \ + int __width = warpSize) { \ + return __IntIntrinsic(__mask, __val, __offset, \ + ((warpSize - __width) << 8) | (__Mask)); \ + } \ + inline __device__ float __FnName(unsigned int __mask, float __val, \ + int __offset, int __width = warpSize) { \ + return __FloatIntrinsic(__mask, __val, __offset, \ + ((warpSize - __width) << 8) | (__Mask)); \ + } \ + inline __device__ unsigned int __FnName(unsigned int __mask, \ + unsigned int __val, int __offset, \ + int __width = warpSize) { \ + return static_cast( \ + ::__FnName(__mask, static_cast(__val), __offset, __width)); \ + } \ + inline __device__ long long __FnName(unsigned int __mask, long long __val, \ + int __offset, int __width = warpSize) { \ + struct __Bits { \ + int __a, __b; \ + }; \ + _Static_assert(sizeof(__val) == sizeof(__Bits)); \ + _Static_assert(sizeof(__Bits) == 2 * sizeof(int)); \ + __Bits __tmp; \ + memcpy(&__val, &__tmp, sizeof(__val)); \ + __tmp.__a = ::__FnName(__mask, __tmp.__a, __offset, __width); \ + __tmp.__b = ::__FnName(__mask, __tmp.__b, __offset, __width); \ + long long __ret; \ + memcpy(&__ret, &__tmp, sizeof(__tmp)); \ + return __ret; \ + } \ + inline __device__ unsigned long long __FnName( \ + unsigned int __mask, unsigned long long __val, int __offset, \ + int __width = warpSize) { \ + return static_cast(::__FnName( \ + __mask, static_cast(__val), __offset, __width)); \ + } \ + inline __device__ double __FnName(unsigned int __mask, double __val, \ + int __offset, int __width = warpSize) { \ + long long __tmp; \ + _Static_assert(sizeof(__tmp) == sizeof(__val)); \ + memcpy(&__tmp, &__val, sizeof(__val)); \ + __tmp = ::__FnName(__mask, __tmp, __offset, __width); \ + double __ret; \ + memcpy(&__ret, &__tmp, sizeof(__ret)); \ + return __ret; \ + } +__MAKE_SYNC_SHUFFLES(__shfl_sync, __nvvm_shfl_sync_idx_i32, + __nvvm_shfl_sync_idx_f32, 0x1f); +// We use 0 rather than 31 as our mask, because shfl.up applies to lanes >= +// maxLane. +__MAKE_SYNC_SHUFFLES(__shfl_up_sync, __nvvm_shfl_sync_up_i32, + __nvvm_shfl_sync_up_f32, 0); +__MAKE_SYNC_SHUFFLES(__shfl_down_sync, __nvvm_shfl_sync_down_i32, + __nvvm_shfl_sync_down_f32, 0x1f); +__MAKE_SYNC_SHUFFLES(__shfl_xor_sync, __nvvm_shfl_sync_bfly_i32, + __nvvm_shfl_sync_bfly_f32, 0x1f); +#pragma pop_macro("__MAKE_SYNC_SHUFFLES") + +inline __device__ void __syncwarp(unsigned int mask = 0xffffffff) { + return __nvvm_bar_warp_sync(mask); +} + +inline __device__ void __barrier_sync(unsigned int id) { + __nvvm_barrier_sync(id); +} + +inline __device__ void __barrier_sync_count(unsigned int id, + unsigned int count) { + __nvvm_barrier_sync_cnt(id, count); +} + +inline __device__ int __all_sync(unsigned int mask, int pred) { + return __nvvm_vote_all_sync(mask, pred); +} + +inline __device__ int __any_sync(unsigned int mask, int pred) { + return __nvvm_vote_any_sync(mask, pred); +} + +inline __device__ int __uni_sync(unsigned int mask, int pred) { + return __nvvm_vote_uni_sync(mask, pred); +} + +inline __device__ unsigned int __ballot_sync(unsigned int mask, int pred) { + return __nvvm_vote_ballot_sync(mask, pred); +} + +inline __device__ unsigned int __activemask() { return __nvvm_vote_ballot(1); } + +#endif // !defined(__CUDA_ARCH__) || __CUDA_ARCH__ >= 300 + +// Define __match* builtins CUDA-9 headers expect to see. +#if !defined(__CUDA_ARCH__) || __CUDA_ARCH__ >= 700 +inline __device__ unsigned int __match32_any_sync(unsigned int mask, + unsigned int value) { + return __nvvm_match_any_sync_i32(mask, value); +} + +inline __device__ unsigned long long +__match64_any_sync(unsigned int mask, unsigned long long value) { + return __nvvm_match_any_sync_i64(mask, value); +} + +inline __device__ unsigned int +__match32_all_sync(unsigned int mask, unsigned int value, int *pred) { + return __nvvm_match_all_sync_i32p(mask, value, pred); +} + +inline __device__ unsigned long long +__match64_all_sync(unsigned int mask, unsigned long long value, int *pred) { + return __nvvm_match_all_sync_i64p(mask, value, pred); +} +#include "crt/sm_70_rt.hpp" + +#endif // !defined(__CUDA_ARCH__) || __CUDA_ARCH__ >= 700 +#endif // __CUDA_VERSION >= 9000 + // sm_32 intrinsics: __ldg and __funnelshift_{l,lc,r,rc}. // Prevent the vanilla sm_32 intrinsics header from being included. diff --git a/c_headers/__clang_cuda_runtime_wrapper.h b/c_headers/__clang_cuda_runtime_wrapper.h index 931d44b696..b8ffc2ce9f 100644 --- a/c_headers/__clang_cuda_runtime_wrapper.h +++ b/c_headers/__clang_cuda_runtime_wrapper.h @@ -62,7 +62,7 @@ #include "cuda.h" #if !defined(CUDA_VERSION) #error "cuda.h did not define CUDA_VERSION" -#elif CUDA_VERSION < 7000 || CUDA_VERSION > 8000 +#elif CUDA_VERSION < 7000 || CUDA_VERSION > 9000 #error "Unsupported CUDA version!" #endif @@ -86,7 +86,11 @@ #define __COMMON_FUNCTIONS_H__ #undef __CUDACC__ +#if CUDA_VERSION < 9000 #define __CUDABE__ +#else +#define __CUDA_LIBDEVICE__ +#endif // Disables definitions of device-side runtime support stubs in // cuda_device_runtime_api.h #include "driver_types.h" @@ -94,6 +98,7 @@ #include "host_defines.h" #undef __CUDABE__ +#undef __CUDA_LIBDEVICE__ #define __CUDACC__ #include "cuda_runtime.h" @@ -105,7 +110,9 @@ #define __nvvm_memcpy(s, d, n, a) __builtin_memcpy(s, d, n) #define __nvvm_memset(d, c, n, a) __builtin_memset(d, c, n) +#if CUDA_VERSION < 9000 #include "crt/device_runtime.h" +#endif #include "crt/host_runtime.h" // device_runtime.h defines __cxa_* macros that will conflict with // cxxabi.h. @@ -166,7 +173,18 @@ inline __host__ double __signbitd(double x) { // __device__. #pragma push_macro("__forceinline__") #define __forceinline__ __device__ __inline__ __attribute__((always_inline)) + +#pragma push_macro("__float2half_rn") +#if CUDA_VERSION >= 9000 +// CUDA-9 has conflicting prototypes for __float2half_rn(float f) in +// cuda_fp16.h[pp] and device_functions.hpp. We need to get the one in +// device_functions.hpp out of the way. +#define __float2half_rn __float2half_rn_disabled +#endif + #include "device_functions.hpp" +#pragma pop_macro("__float2half_rn") + // math_function.hpp uses the __USE_FAST_MATH__ macro to determine whether we // get the slow-but-accurate or fast-but-inaccurate versions of functions like @@ -247,7 +265,17 @@ static inline __device__ void __brkpt(int __c) { __brkpt(); } #pragma push_macro("__GNUC__") #undef __GNUC__ #define signbit __ignored_cuda_signbit + +// CUDA-9 omits device-side definitions of some math functions if it sees +// include guard from math.h wrapper from libstdc++. We have to undo the header +// guard temporarily to get the definitions we need. +#pragma push_macro("_GLIBCXX_MATH_H") +#if CUDA_VERSION >= 9000 +#undef _GLIBCXX_MATH_H +#endif + #include "math_functions.hpp" +#pragma pop_macro("_GLIBCXX_MATH_H") #pragma pop_macro("__GNUC__") #pragma pop_macro("signbit") diff --git a/c_headers/arm64intr.h b/c_headers/arm64intr.h new file mode 100644 index 0000000000..be52283618 --- /dev/null +++ b/c_headers/arm64intr.h @@ -0,0 +1,49 @@ +/*===---- arm64intr.h - ARM64 Windows intrinsics -------------------------------=== + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + *===-----------------------------------------------------------------------=== + */ + +/* Only include this if we're compiling for the windows platform. */ +#ifndef _MSC_VER +#include_next +#else + +#ifndef __ARM64INTR_H +#define __ARM64INTR_H + +typedef enum +{ + _ARM64_BARRIER_SY = 0xF, + _ARM64_BARRIER_ST = 0xE, + _ARM64_BARRIER_LD = 0xD, + _ARM64_BARRIER_ISH = 0xB, + _ARM64_BARRIER_ISHST = 0xA, + _ARM64_BARRIER_ISHLD = 0x9, + _ARM64_BARRIER_NSH = 0x7, + _ARM64_BARRIER_NSHST = 0x6, + _ARM64_BARRIER_NSHLD = 0x5, + _ARM64_BARRIER_OSH = 0x3, + _ARM64_BARRIER_OSHST = 0x2, + _ARM64_BARRIER_OSHLD = 0x1 +} _ARM64INTR_BARRIER_TYPE; + +#endif /* __ARM64INTR_H */ +#endif /* _MSC_VER */ diff --git a/c_headers/avx2intrin.h b/c_headers/avx2intrin.h index 576f761b25..caf4ced920 100644 --- a/c_headers/avx2intrin.h +++ b/c_headers/avx2intrin.h @@ -145,13 +145,21 @@ _mm256_andnot_si256(__m256i __a, __m256i __b) static __inline__ __m256i __DEFAULT_FN_ATTRS _mm256_avg_epu8(__m256i __a, __m256i __b) { - return (__m256i)__builtin_ia32_pavgb256((__v32qi)__a, (__v32qi)__b); + typedef unsigned short __v32hu __attribute__((__vector_size__(64))); + return (__m256i)__builtin_convertvector( + ((__builtin_convertvector((__v32qu)__a, __v32hu) + + __builtin_convertvector((__v32qu)__b, __v32hu)) + 1) + >> 1, __v32qu); } static __inline__ __m256i __DEFAULT_FN_ATTRS _mm256_avg_epu16(__m256i __a, __m256i __b) { - return (__m256i)__builtin_ia32_pavgw256((__v16hi)__a, (__v16hi)__b); + typedef unsigned int __v16su __attribute__((__vector_size__(64))); + return (__m256i)__builtin_convertvector( + ((__builtin_convertvector((__v16hu)__a, __v16su) + + __builtin_convertvector((__v16hu)__b, __v16su)) + 1) + >> 1, __v16hu); } static __inline__ __m256i __DEFAULT_FN_ATTRS diff --git a/c_headers/avx512bwintrin.h b/c_headers/avx512bwintrin.h index 41958b7214..53da5869d3 100644 --- a/c_headers/avx512bwintrin.h +++ b/c_headers/avx512bwintrin.h @@ -706,57 +706,55 @@ _mm512_maskz_adds_epu16 (__mmask32 __U, __m512i __A, __m512i __B) static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_avg_epu8 (__m512i __A, __m512i __B) { - return (__m512i) __builtin_ia32_pavgb512_mask ((__v64qi) __A, - (__v64qi) __B, - (__v64qi) _mm512_setzero_qi(), - (__mmask64) -1); + typedef unsigned short __v64hu __attribute__((__vector_size__(128))); + return (__m512i)__builtin_convertvector( + ((__builtin_convertvector((__v64qu) __A, __v64hu) + + __builtin_convertvector((__v64qu) __B, __v64hu)) + 1) + >> 1, __v64qu); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_avg_epu8 (__m512i __W, __mmask64 __U, __m512i __A, __m512i __B) { - return (__m512i) __builtin_ia32_pavgb512_mask ((__v64qi) __A, - (__v64qi) __B, - (__v64qi) __W, - (__mmask64) __U); + return (__m512i)__builtin_ia32_selectb_512((__mmask64)__U, + (__v64qi)_mm512_avg_epu8(__A, __B), + (__v64qi)__W); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_avg_epu8 (__mmask64 __U, __m512i __A, __m512i __B) { - return (__m512i) __builtin_ia32_pavgb512_mask ((__v64qi) __A, - (__v64qi) __B, - (__v64qi) _mm512_setzero_qi(), - (__mmask64) __U); + return (__m512i)__builtin_ia32_selectb_512((__mmask64)__U, + (__v64qi)_mm512_avg_epu8(__A, __B), + (__v64qi)_mm512_setzero_qi()); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_avg_epu16 (__m512i __A, __m512i __B) { - return (__m512i) __builtin_ia32_pavgw512_mask ((__v32hi) __A, - (__v32hi) __B, - (__v32hi) _mm512_setzero_hi(), - (__mmask32) -1); + typedef unsigned int __v32su __attribute__((__vector_size__(128))); + return (__m512i)__builtin_convertvector( + ((__builtin_convertvector((__v32hu) __A, __v32su) + + __builtin_convertvector((__v32hu) __B, __v32su)) + 1) + >> 1, __v32hu); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_avg_epu16 (__m512i __W, __mmask32 __U, __m512i __A, __m512i __B) { - return (__m512i) __builtin_ia32_pavgw512_mask ((__v32hi) __A, - (__v32hi) __B, - (__v32hi) __W, - (__mmask32) __U); + return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U, + (__v32hi)_mm512_avg_epu16(__A, __B), + (__v32hi)__W); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_avg_epu16 (__mmask32 __U, __m512i __A, __m512i __B) { - return (__m512i) __builtin_ia32_pavgw512_mask ((__v32hi) __A, - (__v32hi) __B, - (__v32hi) _mm512_setzero_hi(), - (__mmask32) __U); + return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U, + (__v32hi)_mm512_avg_epu16(__A, __B), + (__v32hi) _mm512_setzero_hi()); } static __inline__ __m512i __DEFAULT_FN_ATTRS @@ -2028,18 +2026,17 @@ _mm512_maskz_mov_epi8 (__mmask64 __U, __m512i __A) static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_set1_epi8 (__m512i __O, __mmask64 __M, char __A) { - return (__m512i) __builtin_ia32_pbroadcastb512_gpr_mask (__A, - (__v64qi) __O, - __M); + return (__m512i) __builtin_ia32_selectb_512(__M, + (__v64qi)_mm512_set1_epi8(__A), + (__v64qi) __O); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_set1_epi8 (__mmask64 __M, char __A) { - return (__m512i) __builtin_ia32_pbroadcastb512_gpr_mask (__A, - (__v64qi) - _mm512_setzero_qi(), - __M); + return (__m512i) __builtin_ia32_selectb_512(__M, + (__v64qi) _mm512_set1_epi8(__A), + (__v64qi) _mm512_setzero_si512()); } static __inline__ __mmask64 __DEFAULT_FN_ATTRS @@ -2219,17 +2216,17 @@ _mm512_maskz_broadcastb_epi8 (__mmask64 __M, __m128i __A) static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_set1_epi16 (__m512i __O, __mmask32 __M, short __A) { - return (__m512i) __builtin_ia32_pbroadcastw512_gpr_mask (__A, - (__v32hi) __O, - __M); + return (__m512i) __builtin_ia32_selectw_512(__M, + (__v32hi) _mm512_set1_epi16(__A), + (__v32hi) __O); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_set1_epi16 (__mmask32 __M, short __A) { - return (__m512i) __builtin_ia32_pbroadcastw512_gpr_mask (__A, - (__v32hi) _mm512_setzero_hi(), - __M); + return (__m512i) __builtin_ia32_selectw_512(__M, + (__v32hi) _mm512_set1_epi16(__A), + (__v32hi) _mm512_setzero_si512()); } static __inline__ __m512i __DEFAULT_FN_ATTRS diff --git a/c_headers/avx512dqintrin.h b/c_headers/avx512dqintrin.h index 4fd1add773..2c431d9740 100644 --- a/c_headers/avx512dqintrin.h +++ b/c_headers/avx512dqintrin.h @@ -973,25 +973,26 @@ _mm512_movepi64_mask (__m512i __A) static __inline__ __m512 __DEFAULT_FN_ATTRS _mm512_broadcast_f32x2 (__m128 __A) { - return (__m512) __builtin_ia32_broadcastf32x2_512_mask ((__v4sf) __A, - (__v16sf)_mm512_undefined_ps(), - (__mmask16) -1); + return (__m512)__builtin_shufflevector((__v4sf)__A, + (__v4sf)_mm_undefined_ps(), + 0, 1, 0, 1, 0, 1, 0, 1, + 0, 1, 0, 1, 0, 1, 0, 1); } static __inline__ __m512 __DEFAULT_FN_ATTRS _mm512_mask_broadcast_f32x2 (__m512 __O, __mmask16 __M, __m128 __A) { - return (__m512) __builtin_ia32_broadcastf32x2_512_mask ((__v4sf) __A, - (__v16sf) - __O, __M); + return (__m512)__builtin_ia32_selectps_512((__mmask16)__M, + (__v16sf)_mm512_broadcast_f32x2(__A), + (__v16sf)__O); } static __inline__ __m512 __DEFAULT_FN_ATTRS _mm512_maskz_broadcast_f32x2 (__mmask16 __M, __m128 __A) { - return (__m512) __builtin_ia32_broadcastf32x2_512_mask ((__v4sf) __A, - (__v16sf)_mm512_setzero_ps (), - __M); + return (__m512)__builtin_ia32_selectps_512((__mmask16)__M, + (__v16sf)_mm512_broadcast_f32x2(__A), + (__v16sf)_mm512_setzero_ps()); } static __inline__ __m512 __DEFAULT_FN_ATTRS @@ -1044,25 +1045,26 @@ _mm512_maskz_broadcast_f64x2(__mmask8 __M, __m128d __A) static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_broadcast_i32x2 (__m128i __A) { - return (__m512i) __builtin_ia32_broadcasti32x2_512_mask ((__v4si) __A, - (__v16si)_mm512_setzero_si512(), - (__mmask16) -1); + return (__m512i)__builtin_shufflevector((__v4si)__A, + (__v4si)_mm_undefined_si128(), + 0, 1, 0, 1, 0, 1, 0, 1, + 0, 1, 0, 1, 0, 1, 0, 1); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_broadcast_i32x2 (__m512i __O, __mmask16 __M, __m128i __A) { - return (__m512i) __builtin_ia32_broadcasti32x2_512_mask ((__v4si) __A, - (__v16si) - __O, __M); + return (__m512i)__builtin_ia32_selectd_512((__mmask16)__M, + (__v16si)_mm512_broadcast_i32x2(__A), + (__v16si)__O); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_broadcast_i32x2 (__mmask16 __M, __m128i __A) { - return (__m512i) __builtin_ia32_broadcasti32x2_512_mask ((__v4si) __A, - (__v16si)_mm512_setzero_si512 (), - __M); + return (__m512i)__builtin_ia32_selectd_512((__mmask16)__M, + (__v16si)_mm512_broadcast_i32x2(__A), + (__v16si)_mm512_setzero_si512()); } static __inline__ __m512i __DEFAULT_FN_ATTRS diff --git a/c_headers/avx512fintrin.h b/c_headers/avx512fintrin.h index 4ce6945311..247ac879ea 100644 --- a/c_headers/avx512fintrin.h +++ b/c_headers/avx512fintrin.h @@ -258,30 +258,6 @@ _mm512_maskz_broadcastq_epi64 (__mmask8 __M, __m128i __A) (__v8di) _mm512_setzero_si512()); } -static __inline __m512i __DEFAULT_FN_ATTRS -_mm512_maskz_set1_epi32(__mmask16 __M, int __A) -{ - return (__m512i) __builtin_ia32_pbroadcastd512_gpr_mask (__A, - (__v16si) - _mm512_setzero_si512 (), - __M); -} - -static __inline __m512i __DEFAULT_FN_ATTRS -_mm512_maskz_set1_epi64(__mmask8 __M, long long __A) -{ -#ifdef __x86_64__ - return (__m512i) __builtin_ia32_pbroadcastq512_gpr_mask (__A, - (__v8di) - _mm512_setzero_si512 (), - __M); -#else - return (__m512i) __builtin_ia32_pbroadcastq512_mem_mask (__A, - (__v8di) - _mm512_setzero_si512 (), - __M); -#endif -} static __inline __m512 __DEFAULT_FN_ATTRS _mm512_setzero_ps(void) @@ -340,12 +316,30 @@ _mm512_set1_epi32(int __s) __s, __s, __s, __s, __s, __s, __s, __s }; } +static __inline __m512i __DEFAULT_FN_ATTRS +_mm512_maskz_set1_epi32(__mmask16 __M, int __A) +{ + return (__m512i)__builtin_ia32_selectd_512(__M, + (__v16si)_mm512_set1_epi32(__A), + (__v16si)_mm512_setzero_si512()); +} + static __inline __m512i __DEFAULT_FN_ATTRS _mm512_set1_epi64(long long __d) { return (__m512i)(__v8di){ __d, __d, __d, __d, __d, __d, __d, __d }; } +#ifdef __x86_64__ +static __inline __m512i __DEFAULT_FN_ATTRS +_mm512_maskz_set1_epi64(__mmask8 __M, long long __A) +{ + return (__m512i)__builtin_ia32_selectq_512(__M, + (__v8di)_mm512_set1_epi64(__A), + (__v8di)_mm512_setzero_si512()); +} +#endif + static __inline__ __m512 __DEFAULT_FN_ATTRS _mm512_broadcastss_ps(__m128 __A) { @@ -9040,7 +9034,7 @@ _mm512_stream_si512 (__m512i * __P, __m512i __A) } static __inline__ __m512i __DEFAULT_FN_ATTRS -_mm512_stream_load_si512 (void *__P) +_mm512_stream_load_si512 (void const *__P) { typedef __v8di __v8di_aligned __attribute__((aligned(64))); return (__m512i) __builtin_nontemporal_load((const __v8di_aligned *)__P); @@ -9742,16 +9736,18 @@ _mm_cvtu64_ss (__m128 __A, unsigned long long __B) static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_set1_epi32 (__m512i __O, __mmask16 __M, int __A) { - return (__m512i) __builtin_ia32_pbroadcastd512_gpr_mask (__A, (__v16si) __O, - __M); + return (__m512i) __builtin_ia32_selectd_512(__M, + (__v16si) _mm512_set1_epi32(__A), + (__v16si) __O); } #ifdef __x86_64__ static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_set1_epi64 (__m512i __O, __mmask8 __M, long long __A) { - return (__m512i) __builtin_ia32_pbroadcastq512_gpr_mask (__A, (__v8di) __O, - __M); + return (__m512i) __builtin_ia32_selectq_512(__M, + (__v8di) _mm512_set1_epi64(__A), + (__v8di) __O); } #endif diff --git a/c_headers/avx512vlbwintrin.h b/c_headers/avx512vlbwintrin.h index 3b58d04339..4ab785bdbb 100644 --- a/c_headers/avx512vlbwintrin.h +++ b/c_headers/avx512vlbwintrin.h @@ -2660,35 +2660,33 @@ _mm256_maskz_mov_epi8 (__mmask32 __U, __m256i __A) static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_mask_set1_epi8 (__m128i __O, __mmask16 __M, char __A) { - return (__m128i) __builtin_ia32_pbroadcastb128_gpr_mask (__A, - (__v16qi) __O, - __M); + return (__m128i) __builtin_ia32_selectb_128(__M, + (__v16qi) _mm_set1_epi8(__A), + (__v16qi) __O); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_maskz_set1_epi8 (__mmask16 __M, char __A) { - return (__m128i) __builtin_ia32_pbroadcastb128_gpr_mask (__A, - (__v16qi) - _mm_setzero_si128 (), - __M); + return (__m128i) __builtin_ia32_selectb_128(__M, + (__v16qi) _mm_set1_epi8(__A), + (__v16qi) _mm_setzero_si128()); } static __inline__ __m256i __DEFAULT_FN_ATTRS _mm256_mask_set1_epi8 (__m256i __O, __mmask32 __M, char __A) { - return (__m256i) __builtin_ia32_pbroadcastb256_gpr_mask (__A, - (__v32qi) __O, - __M); + return (__m256i) __builtin_ia32_selectb_256(__M, + (__v32qi) _mm256_set1_epi8(__A), + (__v32qi) __O); } static __inline__ __m256i __DEFAULT_FN_ATTRS _mm256_maskz_set1_epi8 (__mmask32 __M, char __A) { - return (__m256i) __builtin_ia32_pbroadcastb256_gpr_mask (__A, - (__v32qi) - _mm256_setzero_si256 (), - __M); + return (__m256i) __builtin_ia32_selectb_256(__M, + (__v32qi) _mm256_set1_epi8(__A), + (__v32qi) _mm256_setzero_si256()); } static __inline__ __m128i __DEFAULT_FN_ATTRS @@ -3025,33 +3023,33 @@ _mm256_maskz_broadcastw_epi16 (__mmask16 __M, __m128i __A) static __inline__ __m256i __DEFAULT_FN_ATTRS _mm256_mask_set1_epi16 (__m256i __O, __mmask16 __M, short __A) { - return (__m256i) __builtin_ia32_pbroadcastw256_gpr_mask (__A, - (__v16hi) __O, - __M); + return (__m256i) __builtin_ia32_selectw_256 (__M, + (__v16hi) _mm256_set1_epi16(__A), + (__v16hi) __O); } static __inline__ __m256i __DEFAULT_FN_ATTRS _mm256_maskz_set1_epi16 (__mmask16 __M, short __A) { - return (__m256i) __builtin_ia32_pbroadcastw256_gpr_mask (__A, - (__v16hi) _mm256_setzero_si256 (), - __M); + return (__m256i) __builtin_ia32_selectw_256(__M, + (__v16hi)_mm256_set1_epi16(__A), + (__v16hi) _mm256_setzero_si256()); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_mask_set1_epi16 (__m128i __O, __mmask8 __M, short __A) { - return (__m128i) __builtin_ia32_pbroadcastw128_gpr_mask (__A, - (__v8hi) __O, - __M); + return (__m128i) __builtin_ia32_selectw_128(__M, + (__v8hi) _mm_set1_epi16(__A), + (__v8hi) __O); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_maskz_set1_epi16 (__mmask8 __M, short __A) { - return (__m128i) __builtin_ia32_pbroadcastw128_gpr_mask (__A, - (__v8hi) _mm_setzero_si128 (), - __M); + return (__m128i) __builtin_ia32_selectw_128(__M, + (__v8hi) _mm_set1_epi16(__A), + (__v8hi) _mm_setzero_si128()); } static __inline__ __m128i __DEFAULT_FN_ATTRS diff --git a/c_headers/avx512vldqintrin.h b/c_headers/avx512vldqintrin.h index aecd7df34d..d80df9eaff 100644 --- a/c_headers/avx512vldqintrin.h +++ b/c_headers/avx512vldqintrin.h @@ -978,25 +978,25 @@ _mm256_movepi64_mask (__m256i __A) static __inline__ __m256 __DEFAULT_FN_ATTRS _mm256_broadcast_f32x2 (__m128 __A) { - return (__m256) __builtin_ia32_broadcastf32x2_256_mask ((__v4sf) __A, - (__v8sf)_mm256_undefined_ps(), - (__mmask8) -1); + return (__m256)__builtin_shufflevector((__v4sf)__A, + (__v4sf)_mm_undefined_ps(), + 0, 1, 0, 1, 0, 1, 0, 1); } static __inline__ __m256 __DEFAULT_FN_ATTRS _mm256_mask_broadcast_f32x2 (__m256 __O, __mmask8 __M, __m128 __A) { - return (__m256) __builtin_ia32_broadcastf32x2_256_mask ((__v4sf) __A, - (__v8sf) __O, - __M); + return (__m256)__builtin_ia32_selectps_256((__mmask8)__M, + (__v8sf)_mm256_broadcast_f32x2(__A), + (__v8sf)__O); } static __inline__ __m256 __DEFAULT_FN_ATTRS _mm256_maskz_broadcast_f32x2 (__mmask8 __M, __m128 __A) { - return (__m256) __builtin_ia32_broadcastf32x2_256_mask ((__v4sf) __A, - (__v8sf) _mm256_setzero_ps (), - __M); + return (__m256)__builtin_ia32_selectps_256((__mmask8)__M, + (__v8sf)_mm256_broadcast_f32x2(__A), + (__v8sf)_mm256_setzero_ps()); } static __inline__ __m256d __DEFAULT_FN_ATTRS @@ -1025,49 +1025,49 @@ _mm256_maskz_broadcast_f64x2 (__mmask8 __M, __m128d __A) static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_broadcast_i32x2 (__m128i __A) { - return (__m128i) __builtin_ia32_broadcasti32x2_128_mask ((__v4si) __A, - (__v4si)_mm_undefined_si128(), - (__mmask8) -1); + return (__m128i)__builtin_shufflevector((__v4si)__A, + (__v4si)_mm_undefined_si128(), + 0, 1, 0, 1); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_mask_broadcast_i32x2 (__m128i __O, __mmask8 __M, __m128i __A) { - return (__m128i) __builtin_ia32_broadcasti32x2_128_mask ((__v4si) __A, - (__v4si) __O, - __M); + return (__m128i)__builtin_ia32_selectd_128((__mmask8)__M, + (__v4si)_mm_broadcast_i32x2(__A), + (__v4si)__O); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_maskz_broadcast_i32x2 (__mmask8 __M, __m128i __A) { - return (__m128i) __builtin_ia32_broadcasti32x2_128_mask ((__v4si) __A, - (__v4si) _mm_setzero_si128 (), - __M); + return (__m128i)__builtin_ia32_selectd_128((__mmask8)__M, + (__v4si)_mm_broadcast_i32x2(__A), + (__v4si)_mm_setzero_si128()); } static __inline__ __m256i __DEFAULT_FN_ATTRS _mm256_broadcast_i32x2 (__m128i __A) { - return (__m256i) __builtin_ia32_broadcasti32x2_256_mask ((__v4si) __A, - (__v8si)_mm256_undefined_si256(), - (__mmask8) -1); + return (__m256i)__builtin_shufflevector((__v4si)__A, + (__v4si)_mm_undefined_si128(), + 0, 1, 0, 1, 0, 1, 0, 1); } static __inline__ __m256i __DEFAULT_FN_ATTRS _mm256_mask_broadcast_i32x2 (__m256i __O, __mmask8 __M, __m128i __A) { - return (__m256i) __builtin_ia32_broadcasti32x2_256_mask ((__v4si) __A, - (__v8si) __O, - __M); + return (__m256i)__builtin_ia32_selectd_256((__mmask8)__M, + (__v8si)_mm256_broadcast_i32x2(__A), + (__v8si)__O); } static __inline__ __m256i __DEFAULT_FN_ATTRS _mm256_maskz_broadcast_i32x2 (__mmask8 __M, __m128i __A) { - return (__m256i) __builtin_ia32_broadcasti32x2_256_mask ((__v4si) __A, - (__v8si) _mm256_setzero_si256 (), - __M); + return (__m256i)__builtin_ia32_selectd_256((__mmask8)__M, + (__v8si)_mm256_broadcast_i32x2(__A), + (__v8si)_mm256_setzero_si256()); } static __inline__ __m256i __DEFAULT_FN_ATTRS diff --git a/c_headers/avx512vlintrin.h b/c_headers/avx512vlintrin.h index 99bb050de4..7e17cff05f 100644 --- a/c_headers/avx512vlintrin.h +++ b/c_headers/avx512vlintrin.h @@ -5723,59 +5723,72 @@ _mm256_maskz_movedup_pd (__mmask8 __U, __m256d __A) (__v4df)_mm256_setzero_pd()); } +static __inline__ __m128i __DEFAULT_FN_ATTRS +_mm_mask_set1_epi32(__m128i __O, __mmask8 __M, int __A) +{ + return (__m128i)__builtin_ia32_selectd_128(__M, + (__v4si) _mm_set1_epi32(__A), + (__v4si)__O); +} -#define _mm_mask_set1_epi32(O, M, A) __extension__ ({ \ - (__m128i)__builtin_ia32_pbroadcastd128_gpr_mask((int)(A), \ - (__v4si)(__m128i)(O), \ - (__mmask8)(M)); }) +static __inline__ __m128i __DEFAULT_FN_ATTRS +_mm_maskz_set1_epi32( __mmask8 __M, int __A) +{ + return (__m128i)__builtin_ia32_selectd_128(__M, + (__v4si) _mm_set1_epi32(__A), + (__v4si)_mm_setzero_si128()); +} -#define _mm_maskz_set1_epi32(M, A) __extension__ ({ \ - (__m128i)__builtin_ia32_pbroadcastd128_gpr_mask((int)(A), \ - (__v4si)_mm_setzero_si128(), \ - (__mmask8)(M)); }) +static __inline__ __m256i __DEFAULT_FN_ATTRS +_mm256_mask_set1_epi32(__m256i __O, __mmask8 __M, int __A) +{ + return (__m256i)__builtin_ia32_selectd_256(__M, + (__v8si) _mm256_set1_epi32(__A), + (__v8si)__O); +} -#define _mm256_mask_set1_epi32(O, M, A) __extension__ ({ \ - (__m256i)__builtin_ia32_pbroadcastd256_gpr_mask((int)(A), \ - (__v8si)(__m256i)(O), \ - (__mmask8)(M)); }) +static __inline__ __m256i __DEFAULT_FN_ATTRS +_mm256_maskz_set1_epi32( __mmask8 __M, int __A) +{ + return (__m256i)__builtin_ia32_selectd_256(__M, + (__v8si) _mm256_set1_epi32(__A), + (__v8si)_mm256_setzero_si256()); +} -#define _mm256_maskz_set1_epi32(M, A) __extension__ ({ \ - (__m256i)__builtin_ia32_pbroadcastd256_gpr_mask((int)(A), \ - (__v8si)_mm256_setzero_si256(), \ - (__mmask8)(M)); }) #ifdef __x86_64__ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_mask_set1_epi64 (__m128i __O, __mmask8 __M, long long __A) { - return (__m128i) __builtin_ia32_pbroadcastq128_gpr_mask (__A, (__v2di) __O, - __M); + return (__m128i) __builtin_ia32_selectq_128(__M, + (__v2di) _mm_set1_epi64x(__A), + (__v2di) __O); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_maskz_set1_epi64 (__mmask8 __M, long long __A) { - return (__m128i) __builtin_ia32_pbroadcastq128_gpr_mask (__A, - (__v2di) - _mm_setzero_si128 (), - __M); + return (__m128i) __builtin_ia32_selectq_128(__M, + (__v2di) _mm_set1_epi64x(__A), + (__v2di) _mm_setzero_si128()); } static __inline__ __m256i __DEFAULT_FN_ATTRS _mm256_mask_set1_epi64 (__m256i __O, __mmask8 __M, long long __A) { - return (__m256i) __builtin_ia32_pbroadcastq256_gpr_mask (__A, (__v4di) __O, - __M); + return (__m256i) __builtin_ia32_selectq_256(__M, + (__v4di) _mm256_set1_epi64x(__A), + (__v4di) __O) ; } static __inline__ __m256i __DEFAULT_FN_ATTRS _mm256_maskz_set1_epi64 (__mmask8 __M, long long __A) { - return (__m256i) __builtin_ia32_pbroadcastq256_gpr_mask (__A, - (__v4di) - _mm256_setzero_si256 (), - __M); + return (__m256i) __builtin_ia32_selectq_256(__M, + (__v4di) _mm256_set1_epi64x(__A), + (__v4di) _mm256_setzero_si256()); } + #endif #define _mm_fixupimm_pd(A, B, C, imm) __extension__ ({ \ diff --git a/c_headers/clflushoptintrin.h b/c_headers/clflushoptintrin.h index 60e0ead762..f1f1330234 100644 --- a/c_headers/clflushoptintrin.h +++ b/c_headers/clflushoptintrin.h @@ -32,7 +32,7 @@ #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("clflushopt"))) static __inline__ void __DEFAULT_FN_ATTRS -_mm_clflushopt(char * __m) { +_mm_clflushopt(void const * __m) { __builtin_ia32_clflushopt(__m); } diff --git a/c_headers/clwbintrin.h b/c_headers/clwbintrin.h new file mode 100644 index 0000000000..2594a6c387 --- /dev/null +++ b/c_headers/clwbintrin.h @@ -0,0 +1,52 @@ +/*===---- clwbintrin.h - CLWB intrinsic ------------------------------------=== + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + *===-----------------------------------------------------------------------=== + */ + +#ifndef __IMMINTRIN_H +#error "Never use directly; include instead." +#endif + +#ifndef __CLWBINTRIN_H +#define __CLWBINTRIN_H + +/* Define the default attributes for the functions in this file. */ +#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("clwb"))) + +/// \brief Writes back to memory the cache line (if modified) that contains the +/// linear address specified in \a __p from any level of the cache hierarchy in +/// the cache coherence domain +/// +/// \headerfile +/// +/// This intrinsic corresponds to the CLWB instruction. +/// +/// \param __p +/// A pointer to the memory location used to identify the cache line to be +/// written back. +static __inline__ void __DEFAULT_FN_ATTRS +_mm_clwb(void const *__p) { + __builtin_ia32_clwb(__p); +} + +#undef __DEFAULT_FN_ATTRS + +#endif diff --git a/c_headers/cuda_wrappers/new b/c_headers/cuda_wrappers/new index b77131af0e..71b7a52363 100644 --- a/c_headers/cuda_wrappers/new +++ b/c_headers/cuda_wrappers/new @@ -26,7 +26,6 @@ #include_next -// Device overrides for placement new and delete. #pragma push_macro("CUDA_NOEXCEPT") #if __cplusplus >= 201103L #define CUDA_NOEXCEPT noexcept @@ -34,6 +33,55 @@ #define CUDA_NOEXCEPT #endif +// Device overrides for non-placement new and delete. +__device__ inline void *operator new(__SIZE_TYPE__ size) { + if (size == 0) { + size = 1; + } + return ::malloc(size); +} +__device__ inline void *operator new(__SIZE_TYPE__ size, + const std::nothrow_t &) CUDA_NOEXCEPT { + return ::operator new(size); +} + +__device__ inline void *operator new[](__SIZE_TYPE__ size) { + return ::operator new(size); +} +__device__ inline void *operator new[](__SIZE_TYPE__ size, + const std::nothrow_t &) { + return ::operator new(size); +} + +__device__ inline void operator delete(void* ptr) CUDA_NOEXCEPT { + if (ptr) { + ::free(ptr); + } +} +__device__ inline void operator delete(void *ptr, + const std::nothrow_t &) CUDA_NOEXCEPT { + ::operator delete(ptr); +} + +__device__ inline void operator delete[](void* ptr) CUDA_NOEXCEPT { + ::operator delete(ptr); +} +__device__ inline void operator delete[](void *ptr, + const std::nothrow_t &) CUDA_NOEXCEPT { + ::operator delete(ptr); +} + +// Sized delete, C++14 only. +#if __cplusplus >= 201402L +__device__ void operator delete(void *ptr, __SIZE_TYPE__ size) CUDA_NOEXCEPT { + ::operator delete(ptr); +} +__device__ void operator delete[](void *ptr, __SIZE_TYPE__ size) CUDA_NOEXCEPT { + ::operator delete(ptr); +} +#endif + +// Device overrides for placement new and delete. __device__ inline void *operator new(__SIZE_TYPE__, void *__ptr) CUDA_NOEXCEPT { return __ptr; } @@ -42,6 +90,7 @@ __device__ inline void *operator new[](__SIZE_TYPE__, void *__ptr) CUDA_NOEXCEPT } __device__ inline void operator delete(void *, void *) CUDA_NOEXCEPT {} __device__ inline void operator delete[](void *, void *) CUDA_NOEXCEPT {} + #pragma pop_macro("CUDA_NOEXCEPT") #endif // include guard diff --git a/c_headers/emmintrin.h b/c_headers/emmintrin.h index 709815cbb4..3372508a7f 100644 --- a/c_headers/emmintrin.h +++ b/c_headers/emmintrin.h @@ -2258,7 +2258,11 @@ _mm_adds_epu16(__m128i __a, __m128i __b) static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_avg_epu8(__m128i __a, __m128i __b) { - return (__m128i)__builtin_ia32_pavgb128((__v16qi)__a, (__v16qi)__b); + typedef unsigned short __v16hu __attribute__ ((__vector_size__ (32))); + return (__m128i)__builtin_convertvector( + ((__builtin_convertvector((__v16qu)__a, __v16hu) + + __builtin_convertvector((__v16qu)__b, __v16hu)) + 1) + >> 1, __v16qu); } /// \brief Computes the rounded avarages of corresponding elements of two @@ -2278,7 +2282,11 @@ _mm_avg_epu8(__m128i __a, __m128i __b) static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_avg_epu16(__m128i __a, __m128i __b) { - return (__m128i)__builtin_ia32_pavgw128((__v8hi)__a, (__v8hi)__b); + typedef unsigned int __v8su __attribute__ ((__vector_size__ (32))); + return (__m128i)__builtin_convertvector( + ((__builtin_convertvector((__v8hu)__a, __v8su) + + __builtin_convertvector((__v8hu)__b, __v8su)) + 1) + >> 1, __v8hu); } /// \brief Multiplies the corresponding elements of two 128-bit signed [8 x i16] diff --git a/c_headers/float.h b/c_headers/float.h index 502143d4e4..44d4d05494 100644 --- a/c_headers/float.h +++ b/c_headers/float.h @@ -143,4 +143,18 @@ # define LDBL_DECIMAL_DIG __LDBL_DECIMAL_DIG__ #endif +#ifdef __STDC_WANT_IEC_60559_TYPES_EXT__ +# define FLT16_MANT_DIG __FLT16_MANT_DIG__ +# define FLT16_DECIMAL_DIG __FLT16_DECIMAL_DIG__ +# define FLT16_DIG __FLT16_DIG__ +# define FLT16_MIN_EXP __FLT16_MIN_EXP__ +# define FLT16_MIN_10_EXP __FLT16_MIN_10_EXP__ +# define FLT16_MAX_EXP __FLT16_MAX_EXP__ +# define FLT16_MAX_10_EXP __FLT16_MAX_10_EXP__ +# define FLT16_MAX __FLT16_MAX__ +# define FLT16_EPSILON __FLT16_EPSILON__ +# define FLT16_MIN __FLT16_MIN__ +# define FLT16_TRUE_MIN __FLT16_TRUE_MIN__ +#endif /* __STDC_WANT_IEC_60559_TYPES_EXT__ */ + #endif /* __FLOAT_H */ diff --git a/c_headers/immintrin.h b/c_headers/immintrin.h index c5f25bfcb5..d86e0efb82 100644 --- a/c_headers/immintrin.h +++ b/c_headers/immintrin.h @@ -58,6 +58,10 @@ #include #endif +#if !defined(_MSC_VER) || __has_feature(modules) || defined(__CLWB__) +#include +#endif + #if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX__) #include #endif diff --git a/c_headers/intrin.h b/c_headers/intrin.h index 881d05c0d1..b30aa215a4 100644 --- a/c_headers/intrin.h +++ b/c_headers/intrin.h @@ -38,6 +38,10 @@ #include #endif +#if defined(_M_ARM64) +#include +#endif + /* For the definition of jmp_buf. */ #if __STDC_HOSTED__ #include @@ -828,7 +832,7 @@ _InterlockedCompareExchange_nf(long volatile *_Destination, __ATOMIC_SEQ_CST, __ATOMIC_RELAXED); return _Comparand; } -static __inline__ short __DEFAULT_FN_ATTRS +static __inline__ long __DEFAULT_FN_ATTRS _InterlockedCompareExchange_rel(long volatile *_Destination, long _Exchange, long _Comparand) { __atomic_compare_exchange(_Destination, &_Comparand, &_Exchange, 0, diff --git a/c_headers/opencl-c.h b/c_headers/opencl-c.h index 58c8daf3a5..35fb0a82bc 100644 --- a/c_headers/opencl-c.h +++ b/c_headers/opencl-c.h @@ -11381,6 +11381,8 @@ half16 __ovld __cnfn bitselect(half16 a, half16 b, half16 c); * For each component of a vector type, * result[i] = if MSB of c[i] is set ? b[i] : a[i]. * For a scalar type, result = c ? b : a. + * b and a must have the same type. + * c must have the same number of elements and bits as a. */ char __ovld __cnfn select(char a, char b, char c); uchar __ovld __cnfn select(uchar a, uchar b, char c); @@ -11394,60 +11396,7 @@ char8 __ovld __cnfn select(char8 a, char8 b, char8 c); uchar8 __ovld __cnfn select(uchar8 a, uchar8 b, char8 c); char16 __ovld __cnfn select(char16 a, char16 b, char16 c); uchar16 __ovld __cnfn select(uchar16 a, uchar16 b, char16 c); -short __ovld __cnfn select(short a, short b, char c); -ushort __ovld __cnfn select(ushort a, ushort b, char c); -short2 __ovld __cnfn select(short2 a, short2 b, char2 c); -ushort2 __ovld __cnfn select(ushort2 a, ushort2 b, char2 c); -short3 __ovld __cnfn select(short3 a, short3 b, char3 c); -ushort3 __ovld __cnfn select(ushort3 a, ushort3 b, char3 c); -short4 __ovld __cnfn select(short4 a, short4 b, char4 c); -ushort4 __ovld __cnfn select(ushort4 a, ushort4 b, char4 c); -short8 __ovld __cnfn select(short8 a, short8 b, char8 c); -ushort8 __ovld __cnfn select(ushort8 a, ushort8 b, char8 c); -short16 __ovld __cnfn select(short16 a, short16 b, char16 c); -ushort16 __ovld __cnfn select(ushort16 a, ushort16 b, char16 c); -int __ovld __cnfn select(int a, int b, char c); -uint __ovld __cnfn select(uint a, uint b, char c); -int2 __ovld __cnfn select(int2 a, int2 b, char2 c); -uint2 __ovld __cnfn select(uint2 a, uint2 b, char2 c); -int3 __ovld __cnfn select(int3 a, int3 b, char3 c); -uint3 __ovld __cnfn select(uint3 a, uint3 b, char3 c); -int4 __ovld __cnfn select(int4 a, int4 b, char4 c); -uint4 __ovld __cnfn select(uint4 a, uint4 b, char4 c); -int8 __ovld __cnfn select(int8 a, int8 b, char8 c); -uint8 __ovld __cnfn select(uint8 a, uint8 b, char8 c); -int16 __ovld __cnfn select(int16 a, int16 b, char16 c); -uint16 __ovld __cnfn select(uint16 a, uint16 b, char16 c); -long __ovld __cnfn select(long a, long b, char c); -ulong __ovld __cnfn select(ulong a, ulong b, char c); -long2 __ovld __cnfn select(long2 a, long2 b, char2 c); -ulong2 __ovld __cnfn select(ulong2 a, ulong2 b, char2 c); -long3 __ovld __cnfn select(long3 a, long3 b, char3 c); -ulong3 __ovld __cnfn select(ulong3 a, ulong3 b, char3 c); -long4 __ovld __cnfn select(long4 a, long4 b, char4 c); -ulong4 __ovld __cnfn select(ulong4 a, ulong4 b, char4 c); -long8 __ovld __cnfn select(long8 a, long8 b, char8 c); -ulong8 __ovld __cnfn select(ulong8 a, ulong8 b, char8 c); -long16 __ovld __cnfn select(long16 a, long16 b, char16 c); -ulong16 __ovld __cnfn select(ulong16 a, ulong16 b, char16 c); -float __ovld __cnfn select(float a, float b, char c); -float2 __ovld __cnfn select(float2 a, float2 b, char2 c); -float3 __ovld __cnfn select(float3 a, float3 b, char3 c); -float4 __ovld __cnfn select(float4 a, float4 b, char4 c); -float8 __ovld __cnfn select(float8 a, float8 b, char8 c); -float16 __ovld __cnfn select(float16 a, float16 b, char16 c); -char __ovld __cnfn select(char a, char b, short c); -uchar __ovld __cnfn select(uchar a, uchar b, short c); -char2 __ovld __cnfn select(char2 a, char2 b, short2 c); -uchar2 __ovld __cnfn select(uchar2 a, uchar2 b, short2 c); -char3 __ovld __cnfn select(char3 a, char3 b, short3 c); -uchar3 __ovld __cnfn select(uchar3 a, uchar3 b, short3 c); -char4 __ovld __cnfn select(char4 a, char4 b, short4 c); -uchar4 __ovld __cnfn select(uchar4 a, uchar4 b, short4 c); -char8 __ovld __cnfn select(char8 a, char8 b, short8 c); -uchar8 __ovld __cnfn select(uchar8 a, uchar8 b, short8 c); -char16 __ovld __cnfn select(char16 a, char16 b, short16 c); -uchar16 __ovld __cnfn select(uchar16 a, uchar16 b, short16 c); + short __ovld __cnfn select(short a, short b, short c); ushort __ovld __cnfn select(ushort a, ushort b, short c); short2 __ovld __cnfn select(short2 a, short2 b, short2 c); @@ -11460,60 +11409,7 @@ short8 __ovld __cnfn select(short8 a, short8 b, short8 c); ushort8 __ovld __cnfn select(ushort8 a, ushort8 b, short8 c); short16 __ovld __cnfn select(short16 a, short16 b, short16 c); ushort16 __ovld __cnfn select(ushort16 a, ushort16 b, short16 c); -int __ovld __cnfn select(int a, int b, short c); -uint __ovld __cnfn select(uint a, uint b, short c); -int2 __ovld __cnfn select(int2 a, int2 b, short2 c); -uint2 __ovld __cnfn select(uint2 a, uint2 b, short2 c); -int3 __ovld __cnfn select(int3 a, int3 b, short3 c); -uint3 __ovld __cnfn select(uint3 a, uint3 b, short3 c); -int4 __ovld __cnfn select(int4 a, int4 b, short4 c); -uint4 __ovld __cnfn select(uint4 a, uint4 b, short4 c); -int8 __ovld __cnfn select(int8 a, int8 b, short8 c); -uint8 __ovld __cnfn select(uint8 a, uint8 b, short8 c); -int16 __ovld __cnfn select(int16 a, int16 b, short16 c); -uint16 __ovld __cnfn select(uint16 a, uint16 b, short16 c); -long __ovld __cnfn select(long a, long b, short c); -ulong __ovld __cnfn select(ulong a, ulong b, short c); -long2 __ovld __cnfn select(long2 a, long2 b, short2 c); -ulong2 __ovld __cnfn select(ulong2 a, ulong2 b, short2 c); -long3 __ovld __cnfn select(long3 a, long3 b, short3 c); -ulong3 __ovld __cnfn select(ulong3 a, ulong3 b, short3 c); -long4 __ovld __cnfn select(long4 a, long4 b, short4 c); -ulong4 __ovld __cnfn select(ulong4 a, ulong4 b, short4 c); -long8 __ovld __cnfn select(long8 a, long8 b, short8 c); -ulong8 __ovld __cnfn select(ulong8 a, ulong8 b, short8 c); -long16 __ovld __cnfn select(long16 a, long16 b, short16 c); -ulong16 __ovld __cnfn select(ulong16 a, ulong16 b, short16 c); -float __ovld __cnfn select(float a, float b, short c); -float2 __ovld __cnfn select(float2 a, float2 b, short2 c); -float3 __ovld __cnfn select(float3 a, float3 b, short3 c); -float4 __ovld __cnfn select(float4 a, float4 b, short4 c); -float8 __ovld __cnfn select(float8 a, float8 b, short8 c); -float16 __ovld __cnfn select(float16 a, float16 b, short16 c); -char __ovld __cnfn select(char a, char b, int c); -uchar __ovld __cnfn select(uchar a, uchar b, int c); -char2 __ovld __cnfn select(char2 a, char2 b, int2 c); -uchar2 __ovld __cnfn select(uchar2 a, uchar2 b, int2 c); -char3 __ovld __cnfn select(char3 a, char3 b, int3 c); -uchar3 __ovld __cnfn select(uchar3 a, uchar3 b, int3 c); -char4 __ovld __cnfn select(char4 a, char4 b, int4 c); -uchar4 __ovld __cnfn select(uchar4 a, uchar4 b, int4 c); -char8 __ovld __cnfn select(char8 a, char8 b, int8 c); -uchar8 __ovld __cnfn select(uchar8 a, uchar8 b, int8 c); -char16 __ovld __cnfn select(char16 a, char16 b, int16 c); -uchar16 __ovld __cnfn select(uchar16 a, uchar16 b, int16 c); -short __ovld __cnfn select(short a, short b, int c); -ushort __ovld __cnfn select(ushort a, ushort b, int c); -short2 __ovld __cnfn select(short2 a, short2 b, int2 c); -ushort2 __ovld __cnfn select(ushort2 a, ushort2 b, int2 c); -short3 __ovld __cnfn select(short3 a, short3 b, int3 c); -ushort3 __ovld __cnfn select(ushort3 a, ushort3 b, int3 c); -short4 __ovld __cnfn select(short4 a, short4 b, int4 c); -ushort4 __ovld __cnfn select(ushort4 a, ushort4 b, int4 c); -short8 __ovld __cnfn select(short8 a, short8 b, int8 c); -ushort8 __ovld __cnfn select(ushort8 a, ushort8 b, int8 c); -short16 __ovld __cnfn select(short16 a, short16 b, int16 c); -ushort16 __ovld __cnfn select(ushort16 a, ushort16 b, int16 c); + int __ovld __cnfn select(int a, int b, int c); uint __ovld __cnfn select(uint a, uint b, int c); int2 __ovld __cnfn select(int2 a, int2 b, int2 c); @@ -11526,60 +11422,13 @@ int8 __ovld __cnfn select(int8 a, int8 b, int8 c); uint8 __ovld __cnfn select(uint8 a, uint8 b, int8 c); int16 __ovld __cnfn select(int16 a, int16 b, int16 c); uint16 __ovld __cnfn select(uint16 a, uint16 b, int16 c); -long __ovld __cnfn select(long a, long b, int c); -ulong __ovld __cnfn select(ulong a, ulong b, int c); -long2 __ovld __cnfn select(long2 a, long2 b, int2 c); -ulong2 __ovld __cnfn select(ulong2 a, ulong2 b, int2 c); -long3 __ovld __cnfn select(long3 a, long3 b, int3 c); -ulong3 __ovld __cnfn select(ulong3 a, ulong3 b, int3 c); -long4 __ovld __cnfn select(long4 a, long4 b, int4 c); -ulong4 __ovld __cnfn select(ulong4 a, ulong4 b, int4 c); -long8 __ovld __cnfn select(long8 a, long8 b, int8 c); -ulong8 __ovld __cnfn select(ulong8 a, ulong8 b, int8 c); -long16 __ovld __cnfn select(long16 a, long16 b, int16 c); -ulong16 __ovld __cnfn select(ulong16 a, ulong16 b, int16 c); float __ovld __cnfn select(float a, float b, int c); float2 __ovld __cnfn select(float2 a, float2 b, int2 c); float3 __ovld __cnfn select(float3 a, float3 b, int3 c); float4 __ovld __cnfn select(float4 a, float4 b, int4 c); float8 __ovld __cnfn select(float8 a, float8 b, int8 c); float16 __ovld __cnfn select(float16 a, float16 b, int16 c); -char __ovld __cnfn select(char a, char b, long c); -uchar __ovld __cnfn select(uchar a, uchar b, long c); -char2 __ovld __cnfn select(char2 a, char2 b, long2 c); -uchar2 __ovld __cnfn select(uchar2 a, uchar2 b, long2 c); -char3 __ovld __cnfn select(char3 a, char3 b, long3 c); -uchar3 __ovld __cnfn select(uchar3 a, uchar3 b, long3 c); -char4 __ovld __cnfn select(char4 a, char4 b, long4 c); -uchar4 __ovld __cnfn select(uchar4 a, uchar4 b, long4 c); -char8 __ovld __cnfn select(char8 a, char8 b, long8 c); -uchar8 __ovld __cnfn select(uchar8 a, uchar8 b, long8 c); -char16 __ovld __cnfn select(char16 a, char16 b, long16 c); -uchar16 __ovld __cnfn select(uchar16 a, uchar16 b, long16 c); -short __ovld __cnfn select(short a, short b, long c); -ushort __ovld __cnfn select(ushort a, ushort b, long c); -short2 __ovld __cnfn select(short2 a, short2 b, long2 c); -ushort2 __ovld __cnfn select(ushort2 a, ushort2 b, long2 c); -short3 __ovld __cnfn select(short3 a, short3 b, long3 c); -ushort3 __ovld __cnfn select(ushort3 a, ushort3 b, long3 c); -short4 __ovld __cnfn select(short4 a, short4 b, long4 c); -ushort4 __ovld __cnfn select(ushort4 a, ushort4 b, long4 c); -short8 __ovld __cnfn select(short8 a, short8 b, long8 c); -ushort8 __ovld __cnfn select(ushort8 a, ushort8 b, long8 c); -short16 __ovld __cnfn select(short16 a, short16 b, long16 c); -ushort16 __ovld __cnfn select(ushort16 a, ushort16 b, long16 c); -int __ovld __cnfn select(int a, int b, long c); -uint __ovld __cnfn select(uint a, uint b, long c); -int2 __ovld __cnfn select(int2 a, int2 b, long2 c); -uint2 __ovld __cnfn select(uint2 a, uint2 b, long2 c); -int3 __ovld __cnfn select(int3 a, int3 b, long3 c); -uint3 __ovld __cnfn select(uint3 a, uint3 b, long3 c); -int4 __ovld __cnfn select(int4 a, int4 b, long4 c); -uint4 __ovld __cnfn select(uint4 a, uint4 b, long4 c); -int8 __ovld __cnfn select(int8 a, int8 b, long8 c); -uint8 __ovld __cnfn select(uint8 a, uint8 b, long8 c); -int16 __ovld __cnfn select(int16 a, int16 b, long16 c); -uint16 __ovld __cnfn select(uint16 a, uint16 b, long16 c); + long __ovld __cnfn select(long a, long b, long c); ulong __ovld __cnfn select(ulong a, ulong b, long c); long2 __ovld __cnfn select(long2 a, long2 b, long2 c); @@ -11592,12 +11441,7 @@ long8 __ovld __cnfn select(long8 a, long8 b, long8 c); ulong8 __ovld __cnfn select(ulong8 a, ulong8 b, long8 c); long16 __ovld __cnfn select(long16 a, long16 b, long16 c); ulong16 __ovld __cnfn select(ulong16 a, ulong16 b, long16 c); -float __ovld __cnfn select(float a, float b, long c); -float2 __ovld __cnfn select(float2 a, float2 b, long2 c); -float3 __ovld __cnfn select(float3 a, float3 b, long3 c); -float4 __ovld __cnfn select(float4 a, float4 b, long4 c); -float8 __ovld __cnfn select(float8 a, float8 b, long8 c); -float16 __ovld __cnfn select(float16 a, float16 b, long16 c); + char __ovld __cnfn select(char a, char b, uchar c); uchar __ovld __cnfn select(uchar a, uchar b, uchar c); char2 __ovld __cnfn select(char2 a, char2 b, uchar2 c); @@ -11610,60 +11454,7 @@ char8 __ovld __cnfn select(char8 a, char8 b, uchar8 c); uchar8 __ovld __cnfn select(uchar8 a, uchar8 b, uchar8 c); char16 __ovld __cnfn select(char16 a, char16 b, uchar16 c); uchar16 __ovld __cnfn select(uchar16 a, uchar16 b, uchar16 c); -short __ovld __cnfn select(short a, short b, uchar c); -ushort __ovld __cnfn select(ushort a, ushort b, uchar c); -short2 __ovld __cnfn select(short2 a, short2 b, uchar2 c); -ushort2 __ovld __cnfn select(ushort2 a, ushort2 b, uchar2 c); -short3 __ovld __cnfn select(short3 a, short3 b, uchar3 c); -ushort3 __ovld __cnfn select(ushort3 a, ushort3 b, uchar3 c); -short4 __ovld __cnfn select(short4 a, short4 b, uchar4 c); -ushort4 __ovld __cnfn select(ushort4 a, ushort4 b, uchar4 c); -short8 __ovld __cnfn select(short8 a, short8 b, uchar8 c); -ushort8 __ovld __cnfn select(ushort8 a, ushort8 b, uchar8 c); -short16 __ovld __cnfn select(short16 a, short16 b, uchar16 c); -ushort16 __ovld __cnfn select(ushort16 a, ushort16 b, uchar16 c); -int __ovld __cnfn select(int a, int b, uchar c); -uint __ovld __cnfn select(uint a, uint b, uchar c); -int2 __ovld __cnfn select(int2 a, int2 b, uchar2 c); -uint2 __ovld __cnfn select(uint2 a, uint2 b, uchar2 c); -int3 __ovld __cnfn select(int3 a, int3 b, uchar3 c); -uint3 __ovld __cnfn select(uint3 a, uint3 b, uchar3 c); -int4 __ovld __cnfn select(int4 a, int4 b, uchar4 c); -uint4 __ovld __cnfn select(uint4 a, uint4 b, uchar4 c); -int8 __ovld __cnfn select(int8 a, int8 b, uchar8 c); -uint8 __ovld __cnfn select(uint8 a, uint8 b, uchar8 c); -int16 __ovld __cnfn select(int16 a, int16 b, uchar16 c); -uint16 __ovld __cnfn select(uint16 a, uint16 b, uchar16 c); -long __ovld __cnfn select(long a, long b, uchar c); -ulong __ovld __cnfn select(ulong a, ulong b, uchar c); -long2 __ovld __cnfn select(long2 a, long2 b, uchar2 c); -ulong2 __ovld __cnfn select(ulong2 a, ulong2 b, uchar2 c); -long3 __ovld __cnfn select(long3 a, long3 b, uchar3 c); -ulong3 __ovld __cnfn select(ulong3 a, ulong3 b, uchar3 c); -long4 __ovld __cnfn select(long4 a, long4 b, uchar4 c); -ulong4 __ovld __cnfn select(ulong4 a, ulong4 b, uchar4 c); -long8 __ovld __cnfn select(long8 a, long8 b, uchar8 c); -ulong8 __ovld __cnfn select(ulong8 a, ulong8 b, uchar8 c); -long16 __ovld __cnfn select(long16 a, long16 b, uchar16 c); -ulong16 __ovld __cnfn select(ulong16 a, ulong16 b, uchar16 c); -float __ovld __cnfn select(float a, float b, uchar c); -float2 __ovld __cnfn select(float2 a, float2 b, uchar2 c); -float3 __ovld __cnfn select(float3 a, float3 b, uchar3 c); -float4 __ovld __cnfn select(float4 a, float4 b, uchar4 c); -float8 __ovld __cnfn select(float8 a, float8 b, uchar8 c); -float16 __ovld __cnfn select(float16 a, float16 b, uchar16 c); -char __ovld __cnfn select(char a, char b, ushort c); -uchar __ovld __cnfn select(uchar a, uchar b, ushort c); -char2 __ovld __cnfn select(char2 a, char2 b, ushort2 c); -uchar2 __ovld __cnfn select(uchar2 a, uchar2 b, ushort2 c); -char3 __ovld __cnfn select(char3 a, char3 b, ushort3 c); -uchar3 __ovld __cnfn select(uchar3 a, uchar3 b, ushort3 c); -char4 __ovld __cnfn select(char4 a, char4 b, ushort4 c); -uchar4 __ovld __cnfn select(uchar4 a, uchar4 b, ushort4 c); -char8 __ovld __cnfn select(char8 a, char8 b, ushort8 c); -uchar8 __ovld __cnfn select(uchar8 a, uchar8 b, ushort8 c); -char16 __ovld __cnfn select(char16 a, char16 b, ushort16 c); -uchar16 __ovld __cnfn select(uchar16 a, uchar16 b, ushort16 c); + short __ovld __cnfn select(short a, short b, ushort c); ushort __ovld __cnfn select(ushort a, ushort b, ushort c); short2 __ovld __cnfn select(short2 a, short2 b, ushort2 c); @@ -11676,60 +11467,7 @@ short8 __ovld __cnfn select(short8 a, short8 b, ushort8 c); ushort8 __ovld __cnfn select(ushort8 a, ushort8 b, ushort8 c); short16 __ovld __cnfn select(short16 a, short16 b, ushort16 c); ushort16 __ovld __cnfn select(ushort16 a, ushort16 b, ushort16 c); -int __ovld __cnfn select(int a, int b, ushort c); -uint __ovld __cnfn select(uint a, uint b, ushort c); -int2 __ovld __cnfn select(int2 a, int2 b, ushort2 c); -uint2 __ovld __cnfn select(uint2 a, uint2 b, ushort2 c); -int3 __ovld __cnfn select(int3 a, int3 b, ushort3 c); -uint3 __ovld __cnfn select(uint3 a, uint3 b, ushort3 c); -int4 __ovld __cnfn select(int4 a, int4 b, ushort4 c); -uint4 __ovld __cnfn select(uint4 a, uint4 b, ushort4 c); -int8 __ovld __cnfn select(int8 a, int8 b, ushort8 c); -uint8 __ovld __cnfn select(uint8 a, uint8 b, ushort8 c); -int16 __ovld __cnfn select(int16 a, int16 b, ushort16 c); -uint16 __ovld __cnfn select(uint16 a, uint16 b, ushort16 c); -long __ovld __cnfn select(long a, long b, ushort c); -ulong __ovld __cnfn select(ulong a, ulong b, ushort c); -long2 __ovld __cnfn select(long2 a, long2 b, ushort2 c); -ulong2 __ovld __cnfn select(ulong2 a, ulong2 b, ushort2 c); -long3 __ovld __cnfn select(long3 a, long3 b, ushort3 c); -ulong3 __ovld __cnfn select(ulong3 a, ulong3 b, ushort3 c); -long4 __ovld __cnfn select(long4 a, long4 b, ushort4 c); -ulong4 __ovld __cnfn select(ulong4 a, ulong4 b, ushort4 c); -long8 __ovld __cnfn select(long8 a, long8 b, ushort8 c); -ulong8 __ovld __cnfn select(ulong8 a, ulong8 b, ushort8 c); -long16 __ovld __cnfn select(long16 a, long16 b, ushort16 c); -ulong16 __ovld __cnfn select(ulong16 a, ulong16 b, ushort16 c); -float __ovld __cnfn select(float a, float b, ushort c); -float2 __ovld __cnfn select(float2 a, float2 b, ushort2 c); -float3 __ovld __cnfn select(float3 a, float3 b, ushort3 c); -float4 __ovld __cnfn select(float4 a, float4 b, ushort4 c); -float8 __ovld __cnfn select(float8 a, float8 b, ushort8 c); -float16 __ovld __cnfn select(float16 a, float16 b, ushort16 c); -char __ovld __cnfn select(char a, char b, uint c); -uchar __ovld __cnfn select(uchar a, uchar b, uint c); -char2 __ovld __cnfn select(char2 a, char2 b, uint2 c); -uchar2 __ovld __cnfn select(uchar2 a, uchar2 b, uint2 c); -char3 __ovld __cnfn select(char3 a, char3 b, uint3 c); -uchar3 __ovld __cnfn select(uchar3 a, uchar3 b, uint3 c); -char4 __ovld __cnfn select(char4 a, char4 b, uint4 c); -uchar4 __ovld __cnfn select(uchar4 a, uchar4 b, uint4 c); -char8 __ovld __cnfn select(char8 a, char8 b, uint8 c); -uchar8 __ovld __cnfn select(uchar8 a, uchar8 b, uint8 c); -char16 __ovld __cnfn select(char16 a, char16 b, uint16 c); -uchar16 __ovld __cnfn select(uchar16 a, uchar16 b, uint16 c); -short __ovld __cnfn select(short a, short b, uint c); -ushort __ovld __cnfn select(ushort a, ushort b, uint c); -short2 __ovld __cnfn select(short2 a, short2 b, uint2 c); -ushort2 __ovld __cnfn select(ushort2 a, ushort2 b, uint2 c); -short3 __ovld __cnfn select(short3 a, short3 b, uint3 c); -ushort3 __ovld __cnfn select(ushort3 a, ushort3 b, uint3 c); -short4 __ovld __cnfn select(short4 a, short4 b, uint4 c); -ushort4 __ovld __cnfn select(ushort4 a, ushort4 b, uint4 c); -short8 __ovld __cnfn select(short8 a, short8 b, uint8 c); -ushort8 __ovld __cnfn select(ushort8 a, ushort8 b, uint8 c); -short16 __ovld __cnfn select(short16 a, short16 b, uint16 c); -ushort16 __ovld __cnfn select(ushort16 a, ushort16 b, uint16 c); + int __ovld __cnfn select(int a, int b, uint c); uint __ovld __cnfn select(uint a, uint b, uint c); int2 __ovld __cnfn select(int2 a, int2 b, uint2 c); @@ -11742,60 +11480,13 @@ int8 __ovld __cnfn select(int8 a, int8 b, uint8 c); uint8 __ovld __cnfn select(uint8 a, uint8 b, uint8 c); int16 __ovld __cnfn select(int16 a, int16 b, uint16 c); uint16 __ovld __cnfn select(uint16 a, uint16 b, uint16 c); -long __ovld __cnfn select(long a, long b, uint c); -ulong __ovld __cnfn select(ulong a, ulong b, uint c); -long2 __ovld __cnfn select(long2 a, long2 b, uint2 c); -ulong2 __ovld __cnfn select(ulong2 a, ulong2 b, uint2 c); -long3 __ovld __cnfn select(long3 a, long3 b, uint3 c); -ulong3 __ovld __cnfn select(ulong3 a, ulong3 b, uint3 c); -long4 __ovld __cnfn select(long4 a, long4 b, uint4 c); -ulong4 __ovld __cnfn select(ulong4 a, ulong4 b, uint4 c); -long8 __ovld __cnfn select(long8 a, long8 b, uint8 c); -ulong8 __ovld __cnfn select(ulong8 a, ulong8 b, uint8 c); -long16 __ovld __cnfn select(long16 a, long16 b, uint16 c); -ulong16 __ovld __cnfn select(ulong16 a, ulong16 b, uint16 c); float __ovld __cnfn select(float a, float b, uint c); float2 __ovld __cnfn select(float2 a, float2 b, uint2 c); float3 __ovld __cnfn select(float3 a, float3 b, uint3 c); float4 __ovld __cnfn select(float4 a, float4 b, uint4 c); float8 __ovld __cnfn select(float8 a, float8 b, uint8 c); float16 __ovld __cnfn select(float16 a, float16 b, uint16 c); -char __ovld __cnfn select(char a, char b, ulong c); -uchar __ovld __cnfn select(uchar a, uchar b, ulong c); -char2 __ovld __cnfn select(char2 a, char2 b, ulong2 c); -uchar2 __ovld __cnfn select(uchar2 a, uchar2 b, ulong2 c); -char3 __ovld __cnfn select(char3 a, char3 b, ulong3 c); -uchar3 __ovld __cnfn select(uchar3 a, uchar3 b, ulong3 c); -char4 __ovld __cnfn select(char4 a, char4 b, ulong4 c); -uchar4 __ovld __cnfn select(uchar4 a, uchar4 b, ulong4 c); -char8 __ovld __cnfn select(char8 a, char8 b, ulong8 c); -uchar8 __ovld __cnfn select(uchar8 a, uchar8 b, ulong8 c); -char16 __ovld __cnfn select(char16 a, char16 b, ulong16 c); -uchar16 __ovld __cnfn select(uchar16 a, uchar16 b, ulong16 c); -short __ovld __cnfn select(short a, short b, ulong c); -ushort __ovld __cnfn select(ushort a, ushort b, ulong c); -short2 __ovld __cnfn select(short2 a, short2 b, ulong2 c); -ushort2 __ovld __cnfn select(ushort2 a, ushort2 b, ulong2 c); -short3 __ovld __cnfn select(short3 a, short3 b, ulong3 c); -ushort3 __ovld __cnfn select(ushort3 a, ushort3 b, ulong3 c); -short4 __ovld __cnfn select(short4 a, short4 b, ulong4 c); -ushort4 __ovld __cnfn select(ushort4 a, ushort4 b, ulong4 c); -short8 __ovld __cnfn select(short8 a, short8 b, ulong8 c); -ushort8 __ovld __cnfn select(ushort8 a, ushort8 b, ulong8 c); -short16 __ovld __cnfn select(short16 a, short16 b, ulong16 c); -ushort16 __ovld __cnfn select(ushort16 a, ushort16 b, ulong16 c); -int __ovld __cnfn select(int a, int b, ulong c); -uint __ovld __cnfn select(uint a, uint b, ulong c); -int2 __ovld __cnfn select(int2 a, int2 b, ulong2 c); -uint2 __ovld __cnfn select(uint2 a, uint2 b, ulong2 c); -int3 __ovld __cnfn select(int3 a, int3 b, ulong3 c); -uint3 __ovld __cnfn select(uint3 a, uint3 b, ulong3 c); -int4 __ovld __cnfn select(int4 a, int4 b, ulong4 c); -uint4 __ovld __cnfn select(uint4 a, uint4 b, ulong4 c); -int8 __ovld __cnfn select(int8 a, int8 b, ulong8 c); -uint8 __ovld __cnfn select(uint8 a, uint8 b, ulong8 c); -int16 __ovld __cnfn select(int16 a, int16 b, ulong16 c); -uint16 __ovld __cnfn select(uint16 a, uint16 b, ulong16 c); + long __ovld __cnfn select(long a, long b, ulong c); ulong __ovld __cnfn select(ulong a, ulong b, ulong c); long2 __ovld __cnfn select(long2 a, long2 b, ulong2 c); @@ -11808,12 +11499,7 @@ long8 __ovld __cnfn select(long8 a, long8 b, ulong8 c); ulong8 __ovld __cnfn select(ulong8 a, ulong8 b, ulong8 c); long16 __ovld __cnfn select(long16 a, long16 b, ulong16 c); ulong16 __ovld __cnfn select(ulong16 a, ulong16 b, ulong16 c); -float __ovld __cnfn select(float a, float b, ulong c); -float2 __ovld __cnfn select(float2 a, float2 b, ulong2 c); -float3 __ovld __cnfn select(float3 a, float3 b, ulong3 c); -float4 __ovld __cnfn select(float4 a, float4 b, ulong4 c); -float8 __ovld __cnfn select(float8 a, float8 b, ulong8 c); -float16 __ovld __cnfn select(float16 a, float16 b, ulong16 c); + #ifdef cl_khr_fp64 double __ovld __cnfn select(double a, double b, long c); double2 __ovld __cnfn select(double2 a, double2 b, long2 c); @@ -13141,13 +12827,14 @@ void __ovld __conv barrier(cl_mem_fence_flags flags); #if __OPENCL_C_VERSION__ >= CL_VERSION_2_0 -typedef enum memory_scope -{ - memory_scope_work_item, - memory_scope_work_group, - memory_scope_device, - memory_scope_all_svm_devices, - memory_scope_sub_group +typedef enum memory_scope { + memory_scope_work_item = __OPENCL_MEMORY_SCOPE_WORK_ITEM, + memory_scope_work_group = __OPENCL_MEMORY_SCOPE_WORK_GROUP, + memory_scope_device = __OPENCL_MEMORY_SCOPE_DEVICE, + memory_scope_all_svm_devices = __OPENCL_MEMORY_SCOPE_ALL_SVM_DEVICES, +#if defined(cl_intel_subgroups) || defined(cl_khr_subgroups) + memory_scope_sub_group = __OPENCL_MEMORY_SCOPE_SUB_GROUP +#endif } memory_scope; void __ovld __conv work_group_barrier(cl_mem_fence_flags flags, memory_scope scope); @@ -13952,11 +13639,11 @@ unsigned long __ovld atom_xor(volatile __local unsigned long *p, unsigned long v // enum values aligned with what clang uses in EmitAtomicExpr() typedef enum memory_order { - memory_order_relaxed, - memory_order_acquire, - memory_order_release, - memory_order_acq_rel, - memory_order_seq_cst + memory_order_relaxed = __ATOMIC_RELAXED, + memory_order_acquire = __ATOMIC_ACQUIRE, + memory_order_release = __ATOMIC_RELEASE, + memory_order_acq_rel = __ATOMIC_ACQ_REL, + memory_order_seq_cst = __ATOMIC_SEQ_CST } memory_order; // double atomics support requires extensions cl_khr_int64_base_atomics and cl_khr_int64_extended_atomics diff --git a/c_headers/unwind.h b/c_headers/unwind.h index 4f74a34787..345fa4d0c1 100644 --- a/c_headers/unwind.h +++ b/c_headers/unwind.h @@ -76,7 +76,13 @@ typedef intptr_t _sleb128_t; typedef uintptr_t _uleb128_t; struct _Unwind_Context; +#if defined(__arm__) && !(defined(__USING_SJLJ_EXCEPTIONS__) || defined(__ARM_DWARF_EH__)) +struct _Unwind_Control_Block; +typedef struct _Unwind_Control_Block _Unwind_Exception; /* Alias */ +#else struct _Unwind_Exception; +typedef struct _Unwind_Exception _Unwind_Exception; +#endif typedef enum { _URC_NO_REASON = 0, #if defined(__arm__) && !defined(__USING_SJLJ_EXCEPTIONS__) && \ @@ -109,8 +115,42 @@ typedef enum { } _Unwind_Action; typedef void (*_Unwind_Exception_Cleanup_Fn)(_Unwind_Reason_Code, - struct _Unwind_Exception *); + _Unwind_Exception *); +#if defined(__arm__) && !(defined(__USING_SJLJ_EXCEPTIONS__) || defined(__ARM_DWARF_EH__)) +typedef struct _Unwind_Control_Block _Unwind_Control_Block; +typedef uint32_t _Unwind_EHT_Header; + +struct _Unwind_Control_Block { + uint64_t exception_class; + void (*exception_cleanup)(_Unwind_Reason_Code, _Unwind_Control_Block *); + /* unwinder cache (private fields for the unwinder's use) */ + struct { + uint32_t reserved1; /* forced unwind stop function, 0 if not forced */ + uint32_t reserved2; /* personality routine */ + uint32_t reserved3; /* callsite */ + uint32_t reserved4; /* forced unwind stop argument */ + uint32_t reserved5; + } unwinder_cache; + /* propagation barrier cache (valid after phase 1) */ + struct { + uint32_t sp; + uint32_t bitpattern[5]; + } barrier_cache; + /* cleanup cache (preserved over cleanup) */ + struct { + uint32_t bitpattern[4]; + } cleanup_cache; + /* personality cache (for personality's benefit) */ + struct { + uint32_t fnstart; /* function start address */ + _Unwind_EHT_Header *ehtp; /* pointer to EHT entry header word */ + uint32_t additional; /* additional data */ + uint32_t reserved1; + } pr_cache; + long long int : 0; /* force alignment of next item to 8-byte boundary */ +} __attribute__((__aligned__(8))); +#else struct _Unwind_Exception { _Unwind_Exception_Class exception_class; _Unwind_Exception_Cleanup_Fn exception_cleanup; @@ -120,23 +160,24 @@ struct _Unwind_Exception { * aligned". GCC has interpreted this to mean "use the maximum useful * alignment for the target"; so do we. */ } __attribute__((__aligned__)); +#endif typedef _Unwind_Reason_Code (*_Unwind_Stop_Fn)(int, _Unwind_Action, _Unwind_Exception_Class, - struct _Unwind_Exception *, + _Unwind_Exception *, struct _Unwind_Context *, void *); -typedef _Unwind_Reason_Code (*_Unwind_Personality_Fn)( - int, _Unwind_Action, _Unwind_Exception_Class, struct _Unwind_Exception *, - struct _Unwind_Context *); +typedef _Unwind_Reason_Code (*_Unwind_Personality_Fn)(int, _Unwind_Action, + _Unwind_Exception_Class, + _Unwind_Exception *, + struct _Unwind_Context *); typedef _Unwind_Personality_Fn __personality_routine; typedef _Unwind_Reason_Code (*_Unwind_Trace_Fn)(struct _Unwind_Context *, void *); -#if defined(__arm__) && !defined(__APPLE__) - +#if defined(__arm__) && !(defined(__USING_SJLJ_EXCEPTIONS__) || defined(__ARM_DWARF_EH__)) typedef enum { _UVRSC_CORE = 0, /* integer register */ _UVRSC_VFP = 1, /* vfp */ @@ -158,14 +199,12 @@ typedef enum { _UVRSR_FAILED = 2 } _Unwind_VRS_Result; -#if !defined(__USING_SJLJ_EXCEPTIONS__) && !defined(__ARM_DWARF_EH__) typedef uint32_t _Unwind_State; #define _US_VIRTUAL_UNWIND_FRAME ((_Unwind_State)0) #define _US_UNWIND_FRAME_STARTING ((_Unwind_State)1) #define _US_UNWIND_FRAME_RESUME ((_Unwind_State)2) #define _US_ACTION_MASK ((_Unwind_State)3) #define _US_FORCE_UNWIND ((_Unwind_State)8) -#endif _Unwind_VRS_Result _Unwind_VRS_Get(struct _Unwind_Context *__context, _Unwind_VRS_RegClass __regclass, @@ -224,13 +263,12 @@ _Unwind_Ptr _Unwind_GetRegionStart(struct _Unwind_Context *); /* DWARF EH functions; currently not available on Darwin/ARM */ #if !defined(__APPLE__) || !defined(__arm__) - -_Unwind_Reason_Code _Unwind_RaiseException(struct _Unwind_Exception *); -_Unwind_Reason_Code _Unwind_ForcedUnwind(struct _Unwind_Exception *, - _Unwind_Stop_Fn, void *); -void _Unwind_DeleteException(struct _Unwind_Exception *); -void _Unwind_Resume(struct _Unwind_Exception *); -_Unwind_Reason_Code _Unwind_Resume_or_Rethrow(struct _Unwind_Exception *); +_Unwind_Reason_Code _Unwind_RaiseException(_Unwind_Exception *); +_Unwind_Reason_Code _Unwind_ForcedUnwind(_Unwind_Exception *, _Unwind_Stop_Fn, + void *); +void _Unwind_DeleteException(_Unwind_Exception *); +void _Unwind_Resume(_Unwind_Exception *); +_Unwind_Reason_Code _Unwind_Resume_or_Rethrow(_Unwind_Exception *); #endif @@ -241,11 +279,11 @@ typedef struct SjLj_Function_Context *_Unwind_FunctionContext_t; void _Unwind_SjLj_Register(_Unwind_FunctionContext_t); void _Unwind_SjLj_Unregister(_Unwind_FunctionContext_t); -_Unwind_Reason_Code _Unwind_SjLj_RaiseException(struct _Unwind_Exception *); -_Unwind_Reason_Code _Unwind_SjLj_ForcedUnwind(struct _Unwind_Exception *, +_Unwind_Reason_Code _Unwind_SjLj_RaiseException(_Unwind_Exception *); +_Unwind_Reason_Code _Unwind_SjLj_ForcedUnwind(_Unwind_Exception *, _Unwind_Stop_Fn, void *); -void _Unwind_SjLj_Resume(struct _Unwind_Exception *); -_Unwind_Reason_Code _Unwind_SjLj_Resume_or_Rethrow(struct _Unwind_Exception *); +void _Unwind_SjLj_Resume(_Unwind_Exception *); +_Unwind_Reason_Code _Unwind_SjLj_Resume_or_Rethrow(_Unwind_Exception *); void *_Unwind_FindEnclosingFunction(void *); diff --git a/ci/appveyor/build_script.bat b/ci/appveyor/build_script.bat index 839c5a7ff8..3fa82a9b54 100644 --- a/ci/appveyor/build_script.bat +++ b/ci/appveyor/build_script.bat @@ -7,13 +7,13 @@ SET "PATH=C:\msys64\mingw64\bin;C:\msys64\usr\bin;%PATH%" SET "MSYSTEM=MINGW64" SET "APPVEYOR_CACHE_ENTRY_ZIP_ARGS=-m0=Copy" -bash -lc "cd ${APPVEYOR_BUILD_FOLDER} && if [ -s ""llvm+clang-5.0.0-win64-msvc-release.tar.xz"" ]; then echo 'skipping LLVM download'; else wget 'https://s3.amazonaws.com/superjoe/temp/llvm%%2bclang-5.0.0-win64-msvc-release.tar.xz'; fi && tar xf llvm+clang-5.0.0-win64-msvc-release.tar.xz" || exit /b +bash -lc "cd ${APPVEYOR_BUILD_FOLDER} && if [ -s ""llvm+clang-6.0.0-win64-msvc-release.tar.xz"" ]; then echo 'skipping LLVM download'; else wget 'https://s3.amazonaws.com/superjoe/temp/llvm%%2bclang-6.0.0-win64-msvc-release.tar.xz'; fi && tar xf llvm+clang-6.0.0-win64-msvc-release.tar.xz" || exit /b SET "PATH=%PREVPATH%" SET "MSYSTEM=%PREVMSYSTEM%" SET "ZIGBUILDDIR=%APPVEYOR_BUILD_FOLDER%\build-msvc-release" -SET "ZIGPREFIXPATH=%APPVEYOR_BUILD_FOLDER%\llvm+clang-5.0.0-win64-msvc-release" +SET "ZIGPREFIXPATH=%APPVEYOR_BUILD_FOLDER%\llvm+clang-6.0.0-win64-msvc-release" mkdir %ZIGBUILDDIR% cd %ZIGBUILDDIR% diff --git a/ci/travis_linux_install b/ci/travis_linux_install index 0dfbe8aa21..02d0d6d2e8 100755 --- a/ci/travis_linux_install +++ b/ci/travis_linux_install @@ -4,4 +4,4 @@ set -x sudo apt-get remove -y llvm-* sudo rm -rf /usr/local/* -sudo apt-get install -y clang-5.0 libclang-5.0 libclang-5.0-dev llvm-5.0 llvm-5.0-dev liblld-5.0 liblld-5.0-dev cmake wine1.6-amd64 +sudo apt-get install -y clang-6.0 libclang-6.0 libclang-6.0-dev llvm-6.0 llvm-6.0-dev liblld-6.0 liblld-6.0-dev cmake wine1.6-amd64 diff --git a/cmake/Findclang.cmake b/cmake/Findclang.cmake index 4c4a13e6ce..26617d36fc 100644 --- a/cmake/Findclang.cmake +++ b/cmake/Findclang.cmake @@ -26,16 +26,16 @@ if(MSVC) else() find_path(CLANG_INCLUDE_DIRS NAMES clang/Frontend/ASTUnit.h PATHS - /usr/lib/llvm/5/include - /usr/lib/llvm-5.0/include + /usr/lib/llvm/6/include + /usr/lib/llvm-6.0/include /mingw64/include) macro(FIND_AND_ADD_CLANG_LIB _libname_) string(TOUPPER ${_libname_} _prettylibname_) find_library(CLANG_${_prettylibname_}_LIB NAMES ${_libname_} PATHS - /usr/lib/llvm/5/lib - /usr/lib/llvm-5.0/lib + /usr/lib/llvm/6/lib + /usr/lib/llvm-6.0/lib /mingw64/lib /c/msys64/mingw64/lib c:\\msys64\\mingw64\\lib) diff --git a/cmake/Findlld.cmake b/cmake/Findlld.cmake index 911bb876b9..d3c9011205 100644 --- a/cmake/Findlld.cmake +++ b/cmake/Findlld.cmake @@ -6,12 +6,12 @@ # LLD_INCLUDE_DIRS # LLD_LIBRARIES -find_path(LLD_INCLUDE_DIRS NAMES lld/Driver/Driver.h +find_path(LLD_INCLUDE_DIRS NAMES lld/Common/Driver.h PATHS - /usr/lib/llvm-5.0/include + /usr/lib/llvm-6.0/include /mingw64/include) -find_library(LLD_LIBRARY NAMES lld-5.0 lld PATHS /usr/lib/llvm-5.0/lib) +find_library(LLD_LIBRARY NAMES lld-6.0 lld PATHS /usr/lib/llvm-6.0/lib) if(EXISTS ${LLD_LIBRARY}) set(LLD_LIBRARIES ${LLD_LIBRARY}) else() @@ -19,7 +19,7 @@ else() string(TOUPPER ${_libname_} _prettylibname_) find_library(LLD_${_prettylibname_}_LIB NAMES ${_libname_} PATHS - /usr/lib/llvm-5.0/lib + /usr/lib/llvm-6.0/lib /mingw64/lib /c/msys64/mingw64/lib c:/msys64/mingw64/lib) @@ -29,13 +29,14 @@ else() endmacro(FIND_AND_ADD_LLD_LIB) FIND_AND_ADD_LLD_LIB(lldDriver) + FIND_AND_ADD_LLD_LIB(lldMinGW) FIND_AND_ADD_LLD_LIB(lldELF) FIND_AND_ADD_LLD_LIB(lldCOFF) FIND_AND_ADD_LLD_LIB(lldMachO) FIND_AND_ADD_LLD_LIB(lldReaderWriter) FIND_AND_ADD_LLD_LIB(lldCore) FIND_AND_ADD_LLD_LIB(lldYAML) - FIND_AND_ADD_LLD_LIB(lldConfig) + FIND_AND_ADD_LLD_LIB(lldCommon) endif() include(FindPackageHandleStandardArgs) diff --git a/cmake/Findllvm.cmake b/cmake/Findllvm.cmake index 87e80f24bc..d0a4a3cba8 100644 --- a/cmake/Findllvm.cmake +++ b/cmake/Findllvm.cmake @@ -8,12 +8,12 @@ # LLVM_LIBDIRS find_program(LLVM_CONFIG_EXE - NAMES llvm-config-5.0 llvm-config + NAMES llvm-config-6.0 llvm-config PATHS "/mingw64/bin" "/c/msys64/mingw64/bin" "c:/msys64/mingw64/bin" - "C:/Libraries/llvm-5.0.0/bin") + "C:/Libraries/llvm-6.0.0/bin") if(NOT(CMAKE_BUILD_TYPE STREQUAL "Debug")) execute_process( @@ -62,7 +62,7 @@ execute_process( set(LLVM_LIBRARIES ${LLVM_LIBRARIES} ${LLVM_SYSTEM_LIBS}) if(NOT LLVM_LIBRARIES) - find_library(LLVM_LIBRARIES NAMES LLVM LLVM-5.0 LLVM-5) + find_library(LLVM_LIBRARIES NAMES LLVM LLVM-6.0 LLVM-6) endif() link_directories("${CMAKE_PREFIX_PATH}/lib") diff --git a/src/parsec.cpp b/src/parsec.cpp index 09f5be0fa7..01334fb24c 100644 --- a/src/parsec.cpp +++ b/src/parsec.cpp @@ -570,6 +570,8 @@ static AstNode *trans_type(Context *c, const Type *ty, const SourceLocation &sou return trans_create_node_symbol_str(c, "f64"); case BuiltinType::Float128: return trans_create_node_symbol_str(c, "f128"); + case BuiltinType::Float16: + return trans_create_node_symbol_str(c, "f16"); case BuiltinType::LongDouble: return trans_create_node_symbol_str(c, "c_longdouble"); case BuiltinType::WChar_U: @@ -856,6 +858,7 @@ static AstNode *trans_type(Context *c, const Type *ty, const SourceLocation &sou case Type::Pipe: case Type::ObjCTypeParam: case Type::DeducedTemplateSpecialization: + case Type::DependentAddressSpace: emit_warning(c, source_loc, "unsupported type: '%s'", ty->getTypeClassName()); return nullptr; } diff --git a/src/target.cpp b/src/target.cpp index de7509f4ae..6d424aaacf 100644 --- a/src/target.cpp +++ b/src/target.cpp @@ -13,6 +13,7 @@ #include static const ArchType arch_list[] = { + {ZigLLVM_arm, ZigLLVM_ARMSubArch_v8_3a}, {ZigLLVM_arm, ZigLLVM_ARMSubArch_v8_2a}, {ZigLLVM_arm, ZigLLVM_ARMSubArch_v8_1a}, {ZigLLVM_arm, ZigLLVM_ARMSubArch_v8}, @@ -33,9 +34,30 @@ static const ArchType arch_list[] = { {ZigLLVM_arm, ZigLLVM_ARMSubArch_v5te}, {ZigLLVM_arm, ZigLLVM_ARMSubArch_v4t}, - {ZigLLVM_armeb, ZigLLVM_NoSubArch}, + {ZigLLVM_armeb, ZigLLVM_ARMSubArch_v8_3a}, + {ZigLLVM_armeb, ZigLLVM_ARMSubArch_v8_2a}, + {ZigLLVM_armeb, ZigLLVM_ARMSubArch_v8_1a}, + {ZigLLVM_armeb, ZigLLVM_ARMSubArch_v8}, + {ZigLLVM_armeb, ZigLLVM_ARMSubArch_v8r}, + {ZigLLVM_armeb, ZigLLVM_ARMSubArch_v8m_baseline}, + {ZigLLVM_armeb, ZigLLVM_ARMSubArch_v8m_mainline}, + {ZigLLVM_armeb, ZigLLVM_ARMSubArch_v7}, + {ZigLLVM_armeb, ZigLLVM_ARMSubArch_v7em}, + {ZigLLVM_armeb, ZigLLVM_ARMSubArch_v7m}, + {ZigLLVM_armeb, ZigLLVM_ARMSubArch_v7s}, + {ZigLLVM_armeb, ZigLLVM_ARMSubArch_v7k}, + {ZigLLVM_armeb, ZigLLVM_ARMSubArch_v7ve}, + {ZigLLVM_armeb, ZigLLVM_ARMSubArch_v6}, + {ZigLLVM_armeb, ZigLLVM_ARMSubArch_v6m}, + {ZigLLVM_armeb, ZigLLVM_ARMSubArch_v6k}, + {ZigLLVM_armeb, ZigLLVM_ARMSubArch_v6t2}, + {ZigLLVM_armeb, ZigLLVM_ARMSubArch_v5}, + {ZigLLVM_armeb, ZigLLVM_ARMSubArch_v5te}, + {ZigLLVM_armeb, ZigLLVM_ARMSubArch_v4t}, + {ZigLLVM_aarch64, ZigLLVM_NoSubArch}, {ZigLLVM_aarch64_be, ZigLLVM_NoSubArch}, + {ZigLLVM_arc, ZigLLVM_NoSubArch}, {ZigLLVM_avr, ZigLLVM_NoSubArch}, {ZigLLVM_bpfel, ZigLLVM_NoSubArch}, {ZigLLVM_bpfeb, ZigLLVM_NoSubArch}, @@ -345,6 +367,7 @@ void resolve_target_object_format(ZigTarget *target) { case ZigLLVM_amdil: case ZigLLVM_amdil64: case ZigLLVM_armeb: + case ZigLLVM_arc: case ZigLLVM_avr: case ZigLLVM_bpfeb: case ZigLLVM_bpfel: @@ -407,6 +430,7 @@ static int get_arch_pointer_bit_width(ZigLLVM_ArchType arch) { case ZigLLVM_msp430: return 16; + case ZigLLVM_arc: case ZigLLVM_arm: case ZigLLVM_armeb: case ZigLLVM_hexagon: diff --git a/src/zig_llvm.cpp b/src/zig_llvm.cpp index 0e1a067bc6..074fa4c712 100644 --- a/src/zig_llvm.cpp +++ b/src/zig_llvm.cpp @@ -37,7 +37,7 @@ #include #include -#include +#include using namespace llvm; @@ -605,11 +605,13 @@ static_assert((Triple::ArchType)ZigLLVM_LastArchType == Triple::LastArchType, "" static_assert((Triple::VendorType)ZigLLVM_LastVendorType == Triple::LastVendorType, ""); static_assert((Triple::OSType)ZigLLVM_LastOSType == Triple::LastOSType, ""); static_assert((Triple::EnvironmentType)ZigLLVM_LastEnvironmentType == Triple::LastEnvironmentType, ""); +static_assert((Triple::SubArchType)ZigLLVM_KalimbaSubArch_v5 == Triple::KalimbaSubArch_v5, ""); static_assert((Triple::ObjectFormatType)ZigLLVM_UnknownObjectFormat == Triple::UnknownObjectFormat, ""); static_assert((Triple::ObjectFormatType)ZigLLVM_COFF == Triple::COFF, ""); static_assert((Triple::ObjectFormatType)ZigLLVM_ELF == Triple::ELF, ""); static_assert((Triple::ObjectFormatType)ZigLLVM_MachO == Triple::MachO, ""); +static_assert((Triple::ObjectFormatType)ZigLLVM_Wasm == Triple::Wasm, ""); const char *ZigLLVMGetArchTypeName(ZigLLVM_ArchType arch) { return (const char*)Triple::getArchTypeName((Triple::ArchType)arch).bytes_begin(); @@ -648,6 +650,8 @@ const char *ZigLLVMGetSubArchTypeName(ZigLLVM_SubArchType sub_arch) { switch (sub_arch) { case ZigLLVM_NoSubArch: return "(none)"; + case ZigLLVM_ARMSubArch_v8_3a: + return "v8_3a"; case ZigLLVM_ARMSubArch_v8_2a: return "v8_2a"; case ZigLLVM_ARMSubArch_v8_1a: @@ -775,7 +779,7 @@ bool ZigLLDLink(ZigLLVM_ObjectFormatType oformat, const char **args, size_t arg_ zig_unreachable(); case ZigLLVM_COFF: - return lld::coff::link(array_ref_args); + return lld::coff::link(array_ref_args, false); case ZigLLVM_ELF: return lld::elf::link(array_ref_args, false, diag); diff --git a/src/zig_llvm.hpp b/src/zig_llvm.hpp index e8df900a10..8c05b60d16 100644 --- a/src/zig_llvm.hpp +++ b/src/zig_llvm.hpp @@ -177,6 +177,7 @@ enum ZigLLVM_ArchType { ZigLLVM_armeb, // ARM (big endian): armeb ZigLLVM_aarch64, // AArch64 (little endian): aarch64 ZigLLVM_aarch64_be, // AArch64 (big endian): aarch64_be + ZigLLVM_arc, // ARC: Synopsys ARC ZigLLVM_avr, // AVR: Atmel AVR microcontroller ZigLLVM_bpfel, // eBPF or extended BPF or 64-bit BPF (little endian) ZigLLVM_bpfeb, // eBPF or extended BPF or 64-bit BPF (big endian) @@ -229,6 +230,7 @@ enum ZigLLVM_ArchType { enum ZigLLVM_SubArchType { ZigLLVM_NoSubArch, + ZigLLVM_ARMSubArch_v8_3a, ZigLLVM_ARMSubArch_v8_2a, ZigLLVM_ARMSubArch_v8_1a, ZigLLVM_ARMSubArch_v8, @@ -318,6 +320,7 @@ enum ZigLLVM_EnvironmentType { ZigLLVM_UnknownEnvironment, ZigLLVM_GNU, + ZigLLVM_GNUABIN32, ZigLLVM_GNUABI64, ZigLLVM_GNUEABI, ZigLLVM_GNUEABIHF, diff --git a/std/special/compiler_rt/index.zig b/std/special/compiler_rt/index.zig index bea06a0b41..b9f93a601a 100644 --- a/std/special/compiler_rt/index.zig +++ b/std/special/compiler_rt/index.zig @@ -93,7 +93,24 @@ fn isArmArch() -> bool { builtin.Arch.armv5, builtin.Arch.armv5te, builtin.Arch.armv4t, - builtin.Arch.armeb => true, + builtin.Arch.armebv8_2a, + builtin.Arch.armebv8_1a, + builtin.Arch.armebv8, + builtin.Arch.armebv8r, + builtin.Arch.armebv8m_baseline, + builtin.Arch.armebv8m_mainline, + builtin.Arch.armebv7, + builtin.Arch.armebv7em, + builtin.Arch.armebv7m, + builtin.Arch.armebv7s, + builtin.Arch.armebv7k, + builtin.Arch.armebv6, + builtin.Arch.armebv6m, + builtin.Arch.armebv6k, + builtin.Arch.armebv6t2, + builtin.Arch.armebv5, + builtin.Arch.armebv5te, + builtin.Arch.armebv4t => true, else => false, }; } From 9a99bd3a71f1b20afd155f440c8dedd69273e8cb Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Tue, 24 Oct 2017 02:14:55 -0400 Subject: [PATCH 02/24] use llvm named structs for const values when possible normally we want to use llvm types for constants. but union constants (which are found inside enums) when they are initialized with the non-most-aligned-member must be unnamed structs. these bubble up to all aggregate types. if a constant of an aggregate type contains, recursively, a union constant with a non-most-aligned-member initialized, the aggregate typed constant must be unnamed too. this fixes all the asserts that were coming in from llvm master branch. --- src/target.cpp | 1 + src/zig_llvm.hpp | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/target.cpp b/src/target.cpp index 6d424aaacf..38421a8921 100644 --- a/src/target.cpp +++ b/src/target.cpp @@ -183,6 +183,7 @@ static const ZigLLVM_EnvironmentType environ_list[] = { ZigLLVM_AMDOpenCL, ZigLLVM_CoreCLR, ZigLLVM_OpenCL, + ZigLLVM_Simulator, }; static const ZigLLVM_ObjectFormatType oformat_list[] = { diff --git a/src/zig_llvm.hpp b/src/zig_llvm.hpp index 8c05b60d16..93ae462a28 100644 --- a/src/zig_llvm.hpp +++ b/src/zig_llvm.hpp @@ -339,8 +339,9 @@ enum ZigLLVM_EnvironmentType { ZigLLVM_AMDOpenCL, ZigLLVM_CoreCLR, ZigLLVM_OpenCL, + ZigLLVM_Simulator, // Simulator variants of other systems, e.g., Apple's iOS - ZigLLVM_LastEnvironmentType = ZigLLVM_OpenCL + ZigLLVM_LastEnvironmentType = ZigLLVM_Simulator }; enum ZigLLVM_ObjectFormatType { From 188fd47a51aa735f60169513acee316e6c44f700 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Tue, 31 Oct 2017 20:57:49 -0400 Subject: [PATCH 03/24] add missing environment --- src/target.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/target.cpp b/src/target.cpp index 38421a8921..eb14330e22 100644 --- a/src/target.cpp +++ b/src/target.cpp @@ -166,6 +166,7 @@ static const ZigLLVM_EnvironmentType environ_list[] = { ZigLLVM_UnknownEnvironment, ZigLLVM_GNU, + ZigLLVM_GNUABIN32, ZigLLVM_GNUABI64, ZigLLVM_GNUEABI, ZigLLVM_GNUEABIHF, From 4a82c2d124881512548254f5cdff3009b2f424df Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Thu, 2 Nov 2017 21:53:50 -0400 Subject: [PATCH 04/24] fix incorrect debug info for empty structs now all tests pass for llvm master branch --- src/analyze.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/analyze.cpp b/src/analyze.cpp index 0bc3343f6c..4258a4d7d6 100644 --- a/src/analyze.cpp +++ b/src/analyze.cpp @@ -1712,8 +1712,21 @@ static void resolve_struct_type(CodeGen *g, TypeTableEntry *struct_type) { if (struct_type->zero_bits) { struct_type->type_ref = LLVMVoidType(); - ZigLLVMReplaceTemporary(g->dbuilder, struct_type->di_type, g->builtin_types.entry_void->di_type); - struct_type->di_type = g->builtin_types.entry_void->di_type; + + ImportTableEntry *import = get_scope_import(scope); + uint64_t debug_size_in_bits = 0; + uint64_t debug_align_in_bits = 0; + ZigLLVMDIType **di_element_types = nullptr; + size_t debug_field_count = 0; + ZigLLVMDIType *replacement_di_type = ZigLLVMCreateDebugStructType(g->dbuilder, + ZigLLVMFileToScope(import->di_file), + buf_ptr(&struct_type->name), + import->di_file, (unsigned)(decl_node->line + 1), + debug_size_in_bits, + debug_align_in_bits, + 0, nullptr, di_element_types, (int)debug_field_count, 0, nullptr, ""); + ZigLLVMReplaceTemporary(g->dbuilder, struct_type->di_type, replacement_di_type); + struct_type->di_type = replacement_di_type; return; } assert(struct_type->di_type); From b3b4786c245d7e49241ab65a56af0e4ac83d080b Mon Sep 17 00:00:00 2001 From: dimenus Date: Mon, 13 Nov 2017 16:37:46 -0600 Subject: [PATCH 05/24] Fixed duplicate decl detection for typedefs/enums --- src/link.cpp | 9 +++++++-- src/parsec.cpp | 6 +++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/link.cpp b/src/link.cpp index 1a166a444f..bc84b27b89 100644 --- a/src/link.cpp +++ b/src/link.cpp @@ -485,8 +485,13 @@ static void construct_linker_job_coff(LinkJob *lj) { continue; } if (link_lib->provided_explicitly) { - Buf *arg = buf_sprintf("-l%s", buf_ptr(link_lib->name)); - lj->args.append(buf_ptr(arg)); + if (lj->codegen->zig_target.env_type == ZigLLVM_GNU) { + Buf *arg = buf_sprintf("-l%s", buf_ptr(link_lib->name)); + lj->args.append(buf_ptr(arg)); + } + else { + lj->args.append(buf_ptr(link_lib->name)); + } } else { buf_resize(def_contents, 0); buf_appendf(def_contents, "LIBRARY %s\nEXPORTS\n", buf_ptr(link_lib->name)); diff --git a/src/parsec.cpp b/src/parsec.cpp index 01334fb24c..fbd3f21948 100644 --- a/src/parsec.cpp +++ b/src/parsec.cpp @@ -2572,11 +2572,10 @@ static AstNode *resolve_typdef_as_builtin(Context *c, const TypedefNameDecl *typ } static AstNode *resolve_typedef_decl(Context *c, const TypedefNameDecl *typedef_decl) { - auto existing_entry = c->decl_table.maybe_get((void*)typedef_decl); + auto existing_entry = c->decl_table.maybe_get((void*)typedef_decl->getCanonicalDecl()); if (existing_entry) { return existing_entry->value; } - QualType child_qt = typedef_decl->getUnderlyingType(); Buf *type_name = buf_create_from_str(decl_name(typedef_decl)); @@ -2619,7 +2618,7 @@ static AstNode *resolve_typedef_decl(Context *c, const TypedefNameDecl *typedef_ add_global_var(c, type_name, type_node); AstNode *symbol_node = trans_create_node_symbol(c, type_name); - c->decl_table.put(typedef_decl, symbol_node); + c->decl_table.put(typedef_decl->getCanonicalDecl(), symbol_node); return symbol_node; } @@ -2745,6 +2744,7 @@ static AstNode *resolve_enum_decl(Context *c, const EnumDecl *enum_decl) { AstNode *symbol_node = trans_create_node_symbol(c, full_type_name); add_global_weak_alias(c, bare_name, full_type_name); add_global_var(c, full_type_name, enum_node); + c->decl_table.put(enum_decl->getCanonicalDecl(), symbol_node); return symbol_node; } } From 3740bfa3bffa4087c8d3fe052c85bbe8d55ffad0 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Wed, 15 Nov 2017 22:32:57 -0500 Subject: [PATCH 06/24] update fast math flags for latest llvm --- src/zig_llvm.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/zig_llvm.cpp b/src/zig_llvm.cpp index 46ac45caff..4ab11875b9 100644 --- a/src/zig_llvm.cpp +++ b/src/zig_llvm.cpp @@ -577,7 +577,7 @@ ZigLLVMDILocation *ZigLLVMGetDebugLoc(unsigned line, unsigned col, ZigLLVMDIScop void ZigLLVMSetFastMath(LLVMBuilderRef builder_wrapped, bool on_state) { if (on_state) { FastMathFlags fmf; - fmf.setUnsafeAlgebra(); + fmf.setFast(); unwrap(builder_wrapped)->setFastMathFlags(fmf); } else { unwrap(builder_wrapped)->clearFastMathFlags(); From d4cd4a35d5cf236359b22eaf5b64793b89507fbd Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Wed, 29 Nov 2017 19:11:34 -0500 Subject: [PATCH 07/24] update fast math llvm API to latest --- src/zig_llvm.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/zig_llvm.cpp b/src/zig_llvm.cpp index a74a683358..03a1475062 100644 --- a/src/zig_llvm.cpp +++ b/src/zig_llvm.cpp @@ -581,7 +581,7 @@ ZigLLVMDILocation *ZigLLVMGetDebugLoc(unsigned line, unsigned col, ZigLLVMDIScop void ZigLLVMSetFastMath(LLVMBuilderRef builder_wrapped, bool on_state) { if (on_state) { FastMathFlags fmf; - fmf.setUnsafeAlgebra(); + fmf.setFast(); unwrap(builder_wrapped)->setFastMathFlags(fmf); } else { unwrap(builder_wrapped)->clearFastMathFlags(); From 74a12d818d2b90823313d7f5b77de1f497d9fc99 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Sat, 23 Dec 2017 19:42:19 -0500 Subject: [PATCH 08/24] std.os.path.resolve handles an absolute path that is missing the drive --- std/os/path.zig | 370 ++++++++++++++++++++++++++++++++++-------------- 1 file changed, 261 insertions(+), 109 deletions(-) diff --git a/std/os/path.zig b/std/os/path.zig index 59e9a53027..db514add9c 100644 --- a/std/os/path.zig +++ b/std/os/path.zig @@ -111,6 +111,7 @@ test "os.path.isAbsoluteWindows" { testIsAbsoluteWindows("C:cwd\\another", false); testIsAbsoluteWindows("directory/directory", false); testIsAbsoluteWindows("directory\\directory", false); + testIsAbsoluteWindows("/usr/local", true); } test "os.path.isAbsolutePosix" { @@ -128,53 +129,115 @@ fn testIsAbsolutePosix(path: []const u8, expected_result: bool) { assert(isAbsolutePosix(path) == expected_result); } -pub fn drive(path: []const u8) -> ?[]const u8 { - if (path.len < 2) - return null; - if (path[1] != ':') - return null; - return path[0..2]; -} +pub const WindowsPath = struct { + is_abs: bool, + kind: Kind, + disk_designator: []const u8, -pub fn networkShare(path: []const u8) -> ?[]const u8 { - if (path.len < "//a/b".len) - return null; + pub const Kind = enum { + None, + Drive, + NetworkShare, + }; +}; + +pub fn windowsParsePath(path: []const u8) -> WindowsPath { + if (path.len >= 2 and path[1] == ':') { + return WindowsPath { + .is_abs = isAbsoluteWindows(path), + .kind = WindowsPath.Kind.Drive, + .disk_designator = path[0..2], + }; + } + if (path.len >= 1 and (path[0] == '/' or path[0] == '\\') and + (path.len == 1 or (path[1] != '/' and path[1] != '\\'))) + { + return WindowsPath { + .is_abs = true, + .kind = WindowsPath.Kind.None, + .disk_designator = path[0..0], + }; + } + const relative_path = WindowsPath { + .kind = WindowsPath.Kind.None, + .disk_designator = []u8{}, + .is_abs = false, + }; + if (path.len < "//a/b".len) { + return relative_path; + } // TODO when I combined these together with `inline for` the compiler crashed { const this_sep = '/'; const two_sep = []u8{this_sep, this_sep}; if (mem.startsWith(u8, path, two_sep)) { - if (path[2] == this_sep) - return null; + if (path[2] == this_sep) { + return relative_path; + } var it = mem.split(path, []u8{this_sep}); - _ = (it.next() ?? return null); - _ = (it.next() ?? return null); - return path[0..it.index]; + _ = (it.next() ?? return relative_path); + _ = (it.next() ?? return relative_path); + return WindowsPath { + .is_abs = isAbsoluteWindows(path), + .kind = WindowsPath.Kind.NetworkShare, + .disk_designator = path[0..it.index], + }; } } { const this_sep = '\\'; const two_sep = []u8{this_sep, this_sep}; if (mem.startsWith(u8, path, two_sep)) { - if (path[2] == this_sep) - return null; + if (path[2] == this_sep) { + return relative_path; + } var it = mem.split(path, []u8{this_sep}); - _ = (it.next() ?? return null); - _ = (it.next() ?? return null); - return path[0..it.index]; + _ = (it.next() ?? return relative_path); + _ = (it.next() ?? return relative_path); + return WindowsPath { + .is_abs = isAbsoluteWindows(path), + .kind = WindowsPath.Kind.NetworkShare, + .disk_designator = path[0..it.index], + }; } } - return null; + return relative_path; } -test "os.path.networkShare" { - assert(mem.eql(u8, ??networkShare("//a/b"), "//a/b")); - assert(mem.eql(u8, ??networkShare("\\\\a\\b"), "\\\\a\\b")); - - assert(networkShare("\\\\a\\") == null); +test "os.path.windowsParsePath" { + { + const parsed = windowsParsePath("//a/b"); + assert(parsed.is_abs); + assert(parsed.kind == WindowsPath.Kind.NetworkShare); + assert(mem.eql(u8, parsed.disk_designator, "//a/b")); + } + { + const parsed = windowsParsePath("\\\\a\\b"); + assert(parsed.is_abs); + assert(parsed.kind == WindowsPath.Kind.NetworkShare); + assert(mem.eql(u8, parsed.disk_designator, "\\\\a\\b")); + } + { + const parsed = windowsParsePath("\\\\a\\"); + assert(!parsed.is_abs); + assert(parsed.kind == WindowsPath.Kind.None); + assert(mem.eql(u8, parsed.disk_designator, "")); + } + { + const parsed = windowsParsePath("/usr/local"); + assert(parsed.is_abs); + assert(parsed.kind == WindowsPath.Kind.None); + assert(mem.eql(u8, parsed.disk_designator, "")); + } + { + const parsed = windowsParsePath("c:../"); + assert(!parsed.is_abs); + assert(parsed.kind == WindowsPath.Kind.Drive); + assert(mem.eql(u8, parsed.disk_designator, "c:")); + } } pub fn diskDesignator(path: []const u8) -> []const u8 { @@ -186,10 +249,9 @@ pub fn diskDesignator(path: []const u8) -> []const u8 { } pub fn diskDesignatorWindows(path: []const u8) -> []const u8 { - return drive(path) ?? (networkShare(path) ?? []u8{}); + return windowsParsePath(path).disk_designator; } -// TODO ASCII is wrong, we actually need full unicode support to compare paths. fn networkShareServersEql(ns1: []const u8, ns2: []const u8) -> bool { const sep1 = ns1[0]; const sep2 = ns2[0]; @@ -197,9 +259,33 @@ fn networkShareServersEql(ns1: []const u8, ns2: []const u8) -> bool { var it1 = mem.split(ns1, []u8{sep1}); var it2 = mem.split(ns2, []u8{sep2}); + // TODO ASCII is wrong, we actually need full unicode support to compare paths. return asciiEqlIgnoreCase(??it1.next(), ??it2.next()); } +fn compareDiskDesignators(kind: WindowsPath.Kind, p1: []const u8, p2: []const u8) -> bool { + switch (kind) { + WindowsPath.Kind.None => { + assert(p1.len == 0); + assert(p2.len == 0); + return true; + }, + WindowsPath.Kind.Drive => { + return asciiUpper(p1[0]) == asciiUpper(p2[0]); + }, + WindowsPath.Kind.NetworkShare => { + const sep1 = p1[0]; + const sep2 = p2[0]; + + var it1 = mem.split(p1, []u8{sep1}); + var it2 = mem.split(p2, []u8{sep2}); + + // TODO ASCII is wrong, we actually need full unicode support to compare paths. + return asciiEqlIgnoreCase(??it1.next(), ??it2.next()) and asciiEqlIgnoreCase(??it1.next(), ??it2.next()); + }, + } +} + fn asciiUpper(byte: u8) -> u8 { return switch (byte) { 'a' ... 'z' => 'A' + (byte - 'a'), @@ -249,120 +335,157 @@ pub fn resolveWindows(allocator: &Allocator, paths: []const []const u8) -> %[]u8 return os.getCwd(allocator); } - // determine which drive we want to result with - var result_drive_upcase: ?u8 = null; - var have_abs = false; + // determine which disk designator we will result with, if any + var result_drive_buf = "_:"; + var result_disk_designator: []const u8 = ""; + var have_drive_kind = WindowsPath.Kind.None; + var have_abs_path = false; var first_index: usize = 0; var max_size: usize = 0; for (paths) |p, i| { - const is_abs = isAbsoluteWindows(p); - if (is_abs) { - have_abs = true; + const parsed = windowsParsePath(p); + if (parsed.is_abs) { + have_abs_path = true; first_index = i; - max_size = 0; + max_size = result_disk_designator.len; } - if (drive(p)) |d| { - result_drive_upcase = asciiUpper(d[0]); - } else if (networkShare(p)) |_| { - result_drive_upcase = null; + switch (parsed.kind) { + WindowsPath.Kind.Drive => { + result_drive_buf[0] = asciiUpper(parsed.disk_designator[0]); + result_disk_designator = result_drive_buf[0..]; + have_drive_kind = WindowsPath.Kind.Drive; + }, + WindowsPath.Kind.NetworkShare => { + result_disk_designator = parsed.disk_designator; + have_drive_kind = WindowsPath.Kind.NetworkShare; + }, + WindowsPath.Kind.None => {}, } max_size += p.len + 1; } - // if we will result with a drive, loop again to determine - // which is the first time the drive is absolutely specified, if any - // and count up the max bytes for paths related to this drive - if (result_drive_upcase) |res_dr| { - have_abs = false; + // if we will result with a disk designator, loop again to determine + // which is the last time the disk designator is absolutely specified, if any + // and count up the max bytes for paths related to this disk designator + if (have_drive_kind != WindowsPath.Kind.None) { + have_abs_path = false; first_index = 0; - max_size = "_:".len; - var correct_drive = false; + max_size = result_disk_designator.len; + var correct_disk_designator = false; for (paths) |p, i| { - if (drive(p)) |dr| { - correct_drive = asciiUpper(dr[0]) == res_dr; - } else if (networkShare(p)) |_| { + const parsed = windowsParsePath(p); + if (parsed.kind != WindowsPath.Kind.None) { + if (parsed.kind == have_drive_kind) { + correct_disk_designator = compareDiskDesignators(have_drive_kind, + result_disk_designator, parsed.disk_designator); + } else { + continue; + } + } + if (!correct_disk_designator) { continue; } - if (!correct_drive) { - continue; - } - const is_abs = isAbsoluteWindows(p); - if (is_abs) { + if (parsed.is_abs) { first_index = i; - max_size = "_:".len; - have_abs = true; + max_size = result_disk_designator.len; + have_abs_path = true; } max_size += p.len + 1; } } - var drive_buf = "_:"; + + // Allocate result and fill in the disk designator, calling getCwd if we have to. var result: []u8 = undefined; var result_index: usize = 0; - var root_slice: []const u8 = undefined; - if (have_abs) { - result = %return allocator.alloc(u8, max_size); + if (have_abs_path) { + switch (have_drive_kind) { + WindowsPath.Kind.Drive => { + result = %return allocator.alloc(u8, max_size); - if (result_drive_upcase) |res_dr| { - drive_buf[0] = res_dr; - root_slice = drive_buf[0..]; + mem.copy(u8, result, result_disk_designator); + result_index += result_disk_designator.len; + }, + WindowsPath.Kind.NetworkShare => { + result = %return allocator.alloc(u8, max_size); + var it = mem.split(paths[first_index], "/\\"); + const server_name = ??it.next(); + const other_name = ??it.next(); - mem.copy(u8, result, root_slice); - result_index += root_slice.len; - } else { - // We know it looks like //a/b or \\a\b because of earlier code - var it = mem.split(paths[first_index], "/\\"); - const server_name = ??it.next(); - const other_name = ??it.next(); - - result[result_index] = '\\'; - result_index += 1; - result[result_index] = '\\'; - result_index += 1; - mem.copy(u8, result[result_index..], server_name); - result_index += server_name.len; - result[result_index] = '\\'; - result_index += 1; - mem.copy(u8, result[result_index..], other_name); - result_index += other_name.len; - - root_slice = result[0..result_index]; + result[result_index] = '\\'; + result_index += 1; + result[result_index] = '\\'; + result_index += 1; + mem.copy(u8, result[result_index..], server_name); + result_index += server_name.len; + result[result_index] = '\\'; + result_index += 1; + mem.copy(u8, result[result_index..], other_name); + result_index += other_name.len; + + result_disk_designator = result[0..result_index]; + }, + WindowsPath.Kind.None => { + assert(is_windows); // resolveWindows called on non windows can't use getCwd + const cwd = %return os.getCwd(allocator); + defer allocator.free(cwd); + const parsed_cwd = windowsParsePath(cwd); + result = %return allocator.alloc(u8, max_size + parsed_cwd.disk_designator.len + 1); + mem.copy(u8, result, parsed_cwd.disk_designator); + result_index += parsed_cwd.disk_designator.len; + result_disk_designator = result[0..parsed_cwd.disk_designator.len]; + if (parsed_cwd.kind == WindowsPath.Kind.Drive) { + result[0] = asciiUpper(result[0]); + } + have_drive_kind = parsed_cwd.kind; + }, } } else { assert(is_windows); // resolveWindows called on non windows can't use getCwd - // TODO get cwd for result_drive if applicable + // TODO call get cwd for the result_disk_designator instead of the global one const cwd = %return os.getCwd(allocator); defer allocator.free(cwd); + result = %return allocator.alloc(u8, max_size + cwd.len + 1); + mem.copy(u8, result, cwd); result_index += cwd.len; - - root_slice = diskDesignatorWindows(result[0..result_index]); + const parsed_cwd = windowsParsePath(result[0..result_index]); + result_disk_designator = parsed_cwd.disk_designator; + if (parsed_cwd.kind == WindowsPath.Kind.Drive) { + result[0] = asciiUpper(result[0]); + } + have_drive_kind = parsed_cwd.kind; } %defer allocator.free(result); - var correct_drive = true; + // Now we know the disk designator to use, if any, and what kind it is. And our result + // is big enough to append all the paths to. + var correct_disk_designator = true; for (paths[first_index..]) |p, i| { - if (result_drive_upcase) |res_dr| { - if (drive(p)) |dr| { - correct_drive = asciiUpper(dr[0]) == res_dr; - } else if (networkShare(p)) |_| { - continue; - } - if (!correct_drive) { + const parsed = windowsParsePath(p); + + if (parsed.kind != WindowsPath.Kind.None) { + if (parsed.kind == have_drive_kind) { + correct_disk_designator = compareDiskDesignators(have_drive_kind, + result_disk_designator, parsed.disk_designator); + } else { continue; } } - var it = mem.split(p[diskDesignatorWindows(p).len..], "/\\"); + if (!correct_disk_designator) { + continue; + } + var it = mem.split(p[parsed.disk_designator.len..], "/\\"); while (it.next()) |component| { if (mem.eql(u8, component, ".")) { continue; } else if (mem.eql(u8, component, "..")) { while (true) { - if (result_index == 0 or result_index == root_slice.len) + if (result_index == 0 or result_index == result_disk_designator.len) break; result_index -= 1; if (result[result_index] == '\\' or result[result_index] == '/') @@ -377,7 +500,7 @@ pub fn resolveWindows(allocator: &Allocator, paths: []const []const u8) -> %[]u8 } } - if (result_index == root_slice.len) { + if (result_index == result_disk_designator.len) { result[result_index] = '\\'; result_index += 1; } @@ -455,6 +578,9 @@ pub fn resolvePosix(allocator: &Allocator, paths: []const []const u8) -> %[]u8 { test "os.path.resolve" { const cwd = %%os.getCwd(debug.global_allocator); if (is_windows) { + if (windowsParsePath(cwd).kind == WindowsPath.Kind.Drive) { + cwd[0] = asciiUpper(cwd[0]); + } assert(mem.eql(u8, testResolveWindows([][]const u8{"."}), cwd)); } else { assert(mem.eql(u8, testResolvePosix([][]const u8{"a/b/c/", "../../.."}), cwd)); @@ -463,6 +589,29 @@ test "os.path.resolve" { } test "os.path.resolveWindows" { + if (is_windows) { + const cwd = %%os.getCwd(debug.global_allocator); + const parsed_cwd = windowsParsePath(cwd); + { + const result = testResolveWindows([][]const u8{"/usr/local", "lib\\zig\\std\\array_list.zig"}); + const expected = %%join(debug.global_allocator, + parsed_cwd.disk_designator, "usr\\local\\lib\\zig\\std\\array_list.zig"); + if (parsed_cwd.kind == WindowsPath.Kind.Drive) { + expected[0] = asciiUpper(parsed_cwd.disk_designator[0]); + } + assert(mem.eql(u8, result, expected)); + } + { + const result = testResolveWindows([][]const u8{"usr/local", "lib\\zig"}); + const expected = %%join(debug.global_allocator, cwd, "usr\\local\\lib\\zig"); + if (parsed_cwd.kind == WindowsPath.Kind.Drive) { + expected[0] = asciiUpper(parsed_cwd.disk_designator[0]); + } + assert(mem.eql(u8, result, expected)); + } + } + + assert(mem.eql(u8, testResolveWindows([][]const u8{"c:\\a\\b\\c", "/hi", "ok"}), "C:\\hi\\ok")); assert(mem.eql(u8, testResolveWindows([][]const u8{"c:/blah\\blah", "d:/games", "c:../a"}), "C:\\blah\\a")); assert(mem.eql(u8, testResolveWindows([][]const u8{"c:/blah\\blah", "d:/games", "C:../a"}), "C:\\blah\\a")); assert(mem.eql(u8, testResolveWindows([][]const u8{"c:/ignore", "d:\\a/b\\c/d", "\\e.exe"}), "D:\\e.exe")); @@ -749,18 +898,21 @@ pub fn relativeWindows(allocator: &Allocator, from: []const u8, to: []const u8) const resolved_to = %return resolveWindows(allocator, [][]const u8{to}); defer if (clean_up_resolved_to) allocator.free(resolved_to); - const result_is_to = if (drive(resolved_to)) |to_drive| - if (drive(resolved_from)) |from_drive| - asciiUpper(from_drive[0]) != asciiUpper(to_drive[0]) - else - true - else if (networkShare(resolved_to)) |to_ns| - if (networkShare(resolved_from)) |from_ns| - !networkShareServersEql(to_ns, from_ns) - else - true - else - unreachable; + const parsed_from = windowsParsePath(resolved_from); + const parsed_to = windowsParsePath(resolved_to); + const result_is_to = x: { + if (parsed_from.kind != parsed_to.kind) { + break :x true; + } else switch (parsed_from.kind) { + WindowsPath.Kind.NetworkShare => { + break :x !networkShareServersEql(parsed_to.disk_designator, parsed_from.disk_designator); + }, + WindowsPath.Kind.Drive => { + break :x asciiUpper(parsed_from.disk_designator[0]) != asciiUpper(parsed_to.disk_designator[0]); + }, + else => unreachable, + } + }; if (result_is_to) { clean_up_resolved_to = false; From 3cbc244e982da2189acfe1de9d60b478d2e60de4 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Sat, 23 Dec 2017 20:21:57 -0500 Subject: [PATCH 09/24] build: add --search-prefix option --- build.zig | 17 ++++++++++++----- std/build.zig | 21 +++++++++++++++++++++ std/special/build_runner.zig | 7 +++++++ 3 files changed, 40 insertions(+), 5 deletions(-) diff --git a/build.zig b/build.zig index 96638659be..285c124f8f 100644 --- a/build.zig +++ b/build.zig @@ -80,9 +80,12 @@ fn dependOnLib(lib_exe_obj: &std.build.LibExeObjStep, dep: &const LibraryDep) { for (dep.libdirs.toSliceConst()) |lib_dir| { lib_exe_obj.addLibPath(lib_dir); } - for (dep.libs.toSliceConst()) |lib| { + for (dep.system_libs.toSliceConst()) |lib| { lib_exe_obj.linkSystemLibrary(lib); } + for (dep.libs.toSliceConst()) |lib| { + lib_exe_obj.addObjectFile(lib); + } for (dep.includes.toSliceConst()) |include_path| { lib_exe_obj.addIncludeDir(include_path); } @@ -91,6 +94,7 @@ fn dependOnLib(lib_exe_obj: &std.build.LibExeObjStep, dep: &const LibraryDep) { const LibraryDep = struct { libdirs: ArrayList([]const u8), libs: ArrayList([]const u8), + system_libs: ArrayList([]const u8), includes: ArrayList([]const u8), }; @@ -98,11 +102,11 @@ fn findLLVM(b: &Builder) -> ?LibraryDep { const llvm_config_exe = b.findProgram( [][]const u8{"llvm-config-5.0", "llvm-config"}, [][]const u8{ - "/usr/local/opt/llvm@5/bin", - "/mingw64/bin", + "C:/Libraries/llvm-5.0.0/bin", "/c/msys64/mingw64/bin", "c:/msys64/mingw64/bin", - "C:/Libraries/llvm-5.0.0/bin", + "/usr/local/opt/llvm@5/bin", + "/mingw64/bin", }) %% |err| { warn("unable to find llvm-config: {}\n", err); @@ -114,6 +118,7 @@ fn findLLVM(b: &Builder) -> ?LibraryDep { var result = LibraryDep { .libs = ArrayList([]const u8).init(b.allocator), + .system_libs = ArrayList([]const u8).init(b.allocator), .includes = ArrayList([]const u8).init(b.allocator), .libdirs = ArrayList([]const u8).init(b.allocator), }; @@ -121,7 +126,9 @@ fn findLLVM(b: &Builder) -> ?LibraryDep { var it = mem.split(libs_output, " \n"); while (it.next()) |lib_arg| { if (mem.startsWith(u8, lib_arg, "-l")) { - %%result.libs.append(lib_arg[2..]); + %%result.system_libs.append(lib_arg[2..]); + } else { + %%result.libs.append(lib_arg); } } } diff --git a/std/build.zig b/std/build.zig index 0a23a77f80..3a2079db15 100644 --- a/std/build.zig +++ b/std/build.zig @@ -47,6 +47,7 @@ pub const Builder = struct { env_map: BufMap, top_level_steps: ArrayList(&TopLevelStep), prefix: []const u8, + search_prefixes: ArrayList([]const u8), lib_dir: []const u8, exe_dir: []const u8, installed_files: ArrayList([]const u8), @@ -114,6 +115,7 @@ pub const Builder = struct { .default_step = undefined, .env_map = %%os.getEnvMap(allocator), .prefix = undefined, + .search_prefixes = ArrayList([]const u8).init(allocator), .lib_dir = undefined, .exe_dir = undefined, .installed_files = ArrayList([]const u8).init(allocator), @@ -671,7 +673,22 @@ pub const Builder = struct { } pub fn findProgram(self: &Builder, names: []const []const u8, paths: []const []const u8) -> %[]const u8 { + // TODO report error for ambiguous situations const exe_extension = (Target { .Native = {}}).exeFileExt(); + for (self.search_prefixes.toSliceConst()) |search_prefix| { + for (names) |name| { + if (os.path.isAbsolute(name)) { + return name; + } + const full_path = %return os.path.join(self.allocator, search_prefix, "bin", + self.fmt("{}{}", name, exe_extension)); + if (os.path.real(self.allocator, full_path)) |real_path| { + return real_path; + } else |_| { + continue; + } + } + } if (self.env_map.get("PATH")) |PATH| { for (names) |name| { if (os.path.isAbsolute(name)) { @@ -727,6 +744,10 @@ pub const Builder = struct { }, } } + + pub fn addSearchPrefix(self: &Builder, search_prefix: []const u8) { + %%self.search_prefixes.append(search_prefix); + } }; const Version = struct { diff --git a/std/special/build_runner.zig b/std/special/build_runner.zig index e54d85e6ef..0ae76a560b 100644 --- a/std/special/build_runner.zig +++ b/std/special/build_runner.zig @@ -84,6 +84,12 @@ pub fn main() -> %void { warn("Expected argument after --prefix\n\n"); return usageAndErr(&builder, false, %return stderr_stream); }); + } else if (mem.eql(u8, arg, "--search-prefix")) { + const search_prefix = %return unwrapArg(arg_it.next(allocator) ?? { + warn("Expected argument after --search-prefix\n\n"); + return usageAndErr(&builder, false, %return stderr_stream); + }); + builder.addSearchPrefix(search_prefix); } else if (mem.eql(u8, arg, "--verbose-tokenize")) { builder.verbose_tokenize = true; } else if (mem.eql(u8, arg, "--verbose-ast")) { @@ -145,6 +151,7 @@ fn usage(builder: &Builder, already_ran_build: bool, out_stream: &io.OutStream) \\ --help Print this help and exit \\ --verbose Print commands before executing them \\ --prefix [path] Override default install prefix + \\ --search-prefix [path] Add a path to look for binaries, libraries, headers \\ \\Project-Specific Options: \\ From c8302a5a0e01268b4655983fcfe5267b86f98036 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Sat, 23 Dec 2017 21:19:48 -0500 Subject: [PATCH 10/24] build: findLLVM correctly handles system libraries --- build.zig | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/build.zig b/build.zig index 285c124f8f..dbb54f8c3e 100644 --- a/build.zig +++ b/build.zig @@ -128,7 +128,11 @@ fn findLLVM(b: &Builder) -> ?LibraryDep { if (mem.startsWith(u8, lib_arg, "-l")) { %%result.system_libs.append(lib_arg[2..]); } else { - %%result.libs.append(lib_arg); + if (os.path.isAbsolute(lib_arg)) { + %%result.libs.append(lib_arg); + } else { + %%result.system_libs.append(lib_arg); + } } } } From 87ba004d461f90032660a6f89479caee718bb378 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Sat, 23 Dec 2017 21:20:38 -0500 Subject: [PATCH 11/24] translate-c: set up debug scope for translated functions --- src/codegen.cpp | 4 +++- src/ir.cpp | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/codegen.cpp b/src/codegen.cpp index 0aecacb0b2..339c643425 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -590,8 +590,10 @@ static ZigLLVMDIScope *get_di_scope(CodeGen *g, Scope *scope) { bool is_optimized = g->build_mode != BuildModeDebug; bool is_internal_linkage = (fn_table_entry->body_node != nullptr && fn_table_entry->export_list.length == 0); + ZigLLVMDIScope *fn_di_scope = get_di_scope(g, scope->parent); + assert(fn_di_scope != nullptr); ZigLLVMDISubprogram *subprogram = ZigLLVMCreateFunction(g->dbuilder, - get_di_scope(g, scope->parent), buf_ptr(&fn_table_entry->symbol_name), "", + fn_di_scope, buf_ptr(&fn_table_entry->symbol_name), "", import->di_file, line_number, fn_table_entry->type_entry->di_type, is_internal_linkage, is_definition, scope_line, flags, is_optimized, nullptr); diff --git a/src/ir.cpp b/src/ir.cpp index a0f5a9be47..8698456379 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -14051,6 +14051,8 @@ static TypeTableEntry *ir_analyze_instruction_c_import(IrAnalyze *ira, IrInstruc child_import->package = new_anonymous_package(); child_import->package->package_table.put(buf_create_from_str("builtin"), ira->codegen->compile_var_package); child_import->package->package_table.put(buf_create_from_str("std"), ira->codegen->std_package); + child_import->di_file = ZigLLVMCreateFile(ira->codegen->dbuilder, + buf_ptr(buf_create_from_str("cimport.h")), buf_ptr(buf_create_from_str("."))); ZigList errors = {0}; From 2200c2de6f29845b2a41491fda663289fdc786d3 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Fri, 5 Jan 2018 13:53:04 -0500 Subject: [PATCH 12/24] translate-c: update to clang 6.0.0 which has more binary operators --- src/translate_c.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/translate_c.cpp b/src/translate_c.cpp index 407115b104..93e4810b95 100644 --- a/src/translate_c.cpp +++ b/src/translate_c.cpp @@ -1214,6 +1214,9 @@ static AstNode *trans_binary_operator(Context *c, ResultUsed result_used, TransS case BO_PtrMemI: emit_warning(c, stmt->getLocStart(), "TODO handle more C binary operators: BO_PtrMemI"); return nullptr; + case BO_Cmp: + emit_warning(c, stmt->getLocStart(), "TODO handle more C binary operators: BO_Cmp"); + return nullptr; case BO_Mul: return trans_create_bin_op(c, scope, stmt->getLHS(), qual_type_has_wrapping_overflow(c, stmt->getType()) ? BinOpTypeMultWrap : BinOpTypeMult, @@ -1476,6 +1479,9 @@ static AstNode *trans_compound_assign_operator(Context *c, ResultUsed result_use case BO_RemAssign: emit_warning(c, stmt->getLocStart(), "TODO handle more C compound assign operators: BO_RemAssign"); return nullptr; + case BO_Cmp: + emit_warning(c, stmt->getLocStart(), "TODO handle more C compound assign operators: BO_Cmp"); + return nullptr; case BO_AddAssign: if (qual_type_has_wrapping_overflow(c, stmt->getType())) return trans_create_compound_assign(c, result_used, scope, stmt, BinOpTypeAssignPlusWrap, BinOpTypeAddWrap); From 4aed7ea6f89a091aede10ccf0fb45b3ce12c710d Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Wed, 17 Jan 2018 17:29:21 -0500 Subject: [PATCH 13/24] update embedded LLD to 6.0.0rc1 --- CMakeLists.txt | 173 +- deps/lld-prebuilt/COFF/Options.inc | 85 +- deps/lld-prebuilt/DarwinLdOptions.inc | 7 + deps/lld-prebuilt/ELF/Options.inc | 170 +- deps/lld-prebuilt/MinGW/Options.inc | 114 + .../lld/{Config => Common}/Version.inc | 6 +- deps/lld-prebuilt/wasm/Options.inc | 106 + deps/lld/.arcconfig | 2 +- deps/lld/CMakeLists.txt | 8 +- deps/lld/CODE_OWNERS.TXT | 3 + deps/lld/COFF/CMakeLists.txt | 12 +- deps/lld/COFF/Chunks.cpp | 99 +- deps/lld/COFF/Chunks.h | 66 +- deps/lld/COFF/Config.h | 28 +- deps/lld/COFF/DLL.cpp | 67 +- deps/lld/COFF/Driver.cpp | 546 ++-- deps/lld/COFF/Driver.h | 50 +- deps/lld/COFF/DriverUtils.cpp | 238 +- deps/lld/COFF/Error.cpp | 115 - deps/lld/COFF/Error.h | 64 - deps/lld/COFF/ICF.cpp | 51 +- deps/lld/COFF/InputFiles.cpp | 398 ++- deps/lld/COFF/InputFiles.h | 70 +- deps/lld/COFF/LTO.cpp | 59 +- deps/lld/COFF/LTO.h | 3 +- deps/lld/COFF/MapFile.cpp | 10 +- deps/lld/COFF/MarkLive.cpp | 18 +- deps/lld/COFF/Memory.h | 52 - deps/lld/COFF/MinGW.cpp | 146 + deps/lld/COFF/MinGW.h | 38 + deps/lld/COFF/Options.td | 66 +- deps/lld/COFF/PDB.cpp | 553 +++- deps/lld/COFF/PDB.h | 7 +- deps/lld/COFF/Strings.cpp | 2 +- deps/lld/COFF/Strings.h | 2 +- deps/lld/COFF/SymbolTable.cpp | 276 +- deps/lld/COFF/SymbolTable.h | 35 +- deps/lld/COFF/Symbols.cpp | 30 +- deps/lld/COFF/Symbols.h | 146 +- deps/lld/COFF/Writer.cpp | 331 +- deps/lld/COFF/Writer.h | 6 +- deps/lld/Common/Args.cpp | 62 + deps/lld/Common/CMakeLists.txt | 32 + .../Error.cpp => Common/ErrorHandler.cpp} | 130 +- deps/lld/Common/Memory.cpp | 23 + deps/lld/{lib/Core => Common}/Reproduce.cpp | 18 +- deps/lld/Common/Strings.cpp | 32 + .../TargetOptionsCommandFlags.cpp | 12 +- deps/lld/Common/Threads.cpp | 12 + deps/lld/{lib/Config => Common}/Version.cpp | 4 +- deps/lld/ELF/AArch64ErrataFix.cpp | 648 ++++ deps/lld/ELF/AArch64ErrataFix.h | 52 + deps/lld/ELF/Arch/AArch64.cpp | 94 +- deps/lld/ELF/Arch/AMDGPU.cpp | 34 +- deps/lld/ELF/Arch/ARM.cpp | 199 +- deps/lld/ELF/Arch/AVR.cpp | 18 +- deps/lld/ELF/Arch/Mips.cpp | 471 ++- deps/lld/ELF/Arch/MipsArchTree.cpp | 54 +- deps/lld/ELF/Arch/PPC.cpp | 36 +- deps/lld/ELF/Arch/PPC64.cpp | 16 +- deps/lld/ELF/Arch/SPARCV9.cpp | 13 +- deps/lld/ELF/Arch/X86.cpp | 155 +- deps/lld/ELF/Arch/X86_64.cpp | 68 +- deps/lld/ELF/Bits.h | 35 + deps/lld/ELF/CMakeLists.txt | 17 +- deps/lld/ELF/Config.h | 40 +- deps/lld/ELF/Driver.cpp | 488 +-- deps/lld/ELF/Driver.h | 5 +- deps/lld/ELF/DriverUtils.cpp | 68 +- deps/lld/ELF/EhFrame.cpp | 42 +- deps/lld/ELF/EhFrame.h | 6 +- deps/lld/ELF/Error.h | 78 - deps/lld/ELF/Filesystem.cpp | 45 +- deps/lld/ELF/Filesystem.h | 3 +- deps/lld/ELF/GdbIndex.cpp | 96 +- deps/lld/ELF/GdbIndex.h | 89 +- deps/lld/ELF/ICF.cpp | 103 +- deps/lld/ELF/InputFiles.cpp | 623 ++-- deps/lld/ELF/InputFiles.h | 118 +- deps/lld/ELF/InputSection.cpp | 534 ++-- deps/lld/ELF/InputSection.h | 201 +- deps/lld/ELF/LTO.cpp | 61 +- deps/lld/ELF/LTO.h | 4 +- deps/lld/ELF/LinkerScript.cpp | 1402 ++++----- deps/lld/ELF/LinkerScript.h | 267 +- deps/lld/ELF/MapFile.cpp | 95 +- deps/lld/ELF/MapFile.h | 6 +- deps/lld/ELF/MarkLive.cpp | 191 +- deps/lld/ELF/Options.td | 177 +- deps/lld/ELF/OutputSections.cpp | 499 ++- deps/lld/ELF/OutputSections.h | 109 +- deps/lld/ELF/Relocations.cpp | 1151 ++++--- deps/lld/ELF/Relocations.h | 64 +- deps/lld/ELF/ScriptLexer.cpp | 54 +- deps/lld/ELF/ScriptLexer.h | 3 +- deps/lld/ELF/ScriptParser.cpp | 303 +- deps/lld/ELF/ScriptParser.h | 5 +- deps/lld/ELF/Strings.cpp | 31 +- deps/lld/ELF/Strings.h | 6 +- deps/lld/ELF/SymbolTable.cpp | 621 ++-- deps/lld/ELF/SymbolTable.h | 103 +- deps/lld/ELF/Symbols.cpp | 249 +- deps/lld/ELF/Symbols.h | 400 ++- deps/lld/ELF/SyntheticSections.cpp | 1678 +++++----- deps/lld/ELF/SyntheticSections.h | 360 ++- deps/lld/ELF/Target.cpp | 36 +- deps/lld/ELF/Target.h | 115 +- deps/lld/ELF/Thunks.cpp | 255 +- deps/lld/ELF/Thunks.h | 18 +- deps/lld/ELF/Writer.cpp | 1670 +++++----- deps/lld/ELF/Writer.h | 16 +- deps/lld/MinGW/CMakeLists.txt | 23 + deps/lld/MinGW/Driver.cpp | 247 ++ deps/lld/MinGW/Options.td | 68 + deps/lld/README.md | 12 +- deps/lld/cmake/modules/AddLLD.cmake | 12 +- deps/lld/docs/Driver.rst | 2 +- deps/lld/docs/NewLLD.rst | 139 +- deps/lld/docs/ReleaseNotes.rst | 173 +- deps/lld/docs/WebAssembly.rst | 36 + deps/lld/docs/_templates/indexsidebar.html | 2 +- deps/lld/docs/conf.py | 4 +- deps/lld/docs/index.rst | 51 +- deps/lld/docs/sphinx_intro.rst | 36 +- deps/lld/include/lld/Common/Args.h | 35 + .../include/lld/{Driver => Common}/Driver.h | 16 +- deps/lld/include/lld/Common/ErrorHandler.h | 112 + deps/lld/include/lld/{Core => Common}/LLVM.h | 4 +- deps/lld/{ELF => include/lld/Common}/Memory.h | 15 +- .../include/lld/{Core => Common}/Reproduce.h | 8 +- deps/lld/include/lld/Common/Strings.h | 23 + .../TargetOptionsCommandFlags.h | 3 +- .../lld/{ELF => include/lld/Common}/Threads.h | 24 +- .../include/lld/{Config => Common}/Version.h | 4 +- .../lld/{Config => Common}/Version.inc.in | 0 deps/lld/include/lld/Core/Atom.h | 2 +- deps/lld/include/lld/Core/DefinedAtom.h | 2 +- deps/lld/include/lld/Core/Error.h | 2 +- deps/lld/include/lld/Core/LinkingContext.h | 4 +- deps/lld/include/lld/Core/PassManager.h | 2 +- deps/lld/include/lld/Core/Reader.h | 2 +- deps/lld/include/lld/Core/SymbolTable.h | 2 +- deps/lld/include/lld/Core/Writer.h | 2 +- .../include/lld/ReaderWriter/YamlContext.h | 3 +- deps/lld/lib/CMakeLists.txt | 1 - deps/lld/lib/Config/CMakeLists.txt | 9 - deps/lld/lib/Core/CMakeLists.txt | 2 - deps/lld/lib/Core/Resolver.cpp | 6 +- deps/lld/lib/Core/SymbolTable.cpp | 2 +- deps/lld/lib/Driver/CMakeLists.txt | 4 +- deps/lld/lib/Driver/DarwinLdDriver.cpp | 6 +- deps/lld/lib/ReaderWriter/CMakeLists.txt | 1 - deps/lld/lib/ReaderWriter/FileArchive.cpp | 2 +- deps/lld/lib/ReaderWriter/MachO/ArchHandler.h | 2 +- .../ReaderWriter/MachO/ArchHandler_x86_64.cpp | 1 + .../lld/lib/ReaderWriter/MachO/CMakeLists.txt | 2 +- .../ReaderWriter/MachO/CompactUnwindPass.cpp | 2 +- .../ReaderWriter/MachO/FlatNamespaceFile.h | 2 + deps/lld/lib/ReaderWriter/MachO/GOTPass.cpp | 2 +- .../MachO/MachOLinkingContext.cpp | 2 +- .../ReaderWriter/MachO/MachONormalizedFile.h | 11 +- .../MachO/MachONormalizedFileBinaryReader.cpp | 7 +- .../MachO/MachONormalizedFileBinaryUtils.h | 2 +- .../MachO/MachONormalizedFileBinaryWriter.cpp | 11 +- .../MachO/MachONormalizedFileFromAtoms.cpp | 2 +- .../MachO/MachONormalizedFileToAtoms.cpp | 2 +- .../MachO/MachONormalizedFileYAML.cpp | 8 +- deps/lld/lib/ReaderWriter/MachO/ObjCPass.cpp | 2 +- deps/lld/lib/ReaderWriter/MachO/ShimPass.cpp | 2 +- deps/lld/lib/ReaderWriter/MachO/StubsPass.cpp | 2 +- .../ReaderWriter/YAML/ReaderWriterYAML.cpp | 6 +- deps/lld/test/CMakeLists.txt | 15 +- deps/lld/test/COFF/Inputs/alpha.ll | 9 + deps/lld/test/COFF/Inputs/beta.ll | 7 + deps/lld/test/COFF/Inputs/except_handler3.lib | Bin 0 -> 1364 bytes .../test/COFF/Inputs/far-arm-thumb-abs20.s | 2 + deps/lld/test/COFF/Inputs/gamma.ll | 14 + deps/lld/test/COFF/Inputs/library2-arm64.lib | Bin 0 -> 1720 bytes deps/lld/test/COFF/Inputs/library2.def | 3 + .../test/COFF/Inputs/locally-imported-def.s | 4 + .../test/COFF/Inputs/locally-imported-imp.s | 2 + deps/lld/test/COFF/Inputs/lto-cache.ll | 10 + deps/lld/test/COFF/Inputs/pdb-globals.yaml | 593 ++++ deps/lld/test/COFF/Inputs/pdb-hashes-1.yaml | 540 ++++ .../COFF/Inputs/pdb-hashes-2-missing.yaml | 321 ++ deps/lld/test/COFF/Inputs/pdb-hashes-2.yaml | 355 +++ deps/lld/test/COFF/Inputs/pdb-scopes-a.yaml | 116 +- deps/lld/test/COFF/Inputs/pdb-scopes-b.yaml | 100 +- deps/lld/test/COFF/Inputs/pdb_comdat_bar.yaml | 116 +- .../lld/test/COFF/Inputs/pdb_comdat_main.yaml | 116 +- deps/lld/test/COFF/Inputs/pdb_lines_1.yaml | 118 +- deps/lld/test/COFF/Inputs/pdb_lines_2.yaml | 70 +- deps/lld/test/COFF/arm-thumb-branch20-error.s | 10 + deps/lld/test/COFF/arm64-dynamicbase.s | 8 + deps/lld/test/COFF/arm64-import2.test | 85 + deps/lld/test/COFF/arm64-relocs-imports.test | 153 +- deps/lld/test/COFF/armnt-blx23t.test | 2 +- deps/lld/test/COFF/armnt-branch24t.test | 2 +- deps/lld/test/COFF/armnt-dynamicbase.test | 3 + deps/lld/test/COFF/armnt-imports.test | 2 +- deps/lld/test/COFF/armnt-mov32t-exec.test | 2 +- deps/lld/test/COFF/armnt-movt32t.test | 2 +- deps/lld/test/COFF/common-alignment.test | 78 + deps/lld/test/COFF/ctors_dtors_priority.s | 30 + deps/lld/test/COFF/debug-dwarf.test | 19 + deps/lld/test/COFF/def-export-stdcall.s | 78 +- deps/lld/test/COFF/delayimports-armnt.yaml | 106 + deps/lld/test/COFF/delayimports32.test | 4 +- deps/lld/test/COFF/dllexport-mingw.s | 24 + deps/lld/test/COFF/driver.test | 3 + deps/lld/test/COFF/duplicate.test | 12 + deps/lld/test/COFF/entry-drectve.test | 24 + deps/lld/test/COFF/entry-inference.test | 8 +- deps/lld/test/COFF/export-all.s | 86 + deps/lld/test/COFF/export-arm64.yaml | 70 + deps/lld/test/COFF/export-armnt.yaml | 95 + deps/lld/test/COFF/export32.test | 5 + deps/lld/test/COFF/filename-casing.s | 14 + deps/lld/test/COFF/force.test | 7 +- deps/lld/test/COFF/guardcf.test | 6 + deps/lld/test/COFF/hello32.test | 6 +- deps/lld/test/COFF/icf-associative.test | 2 +- deps/lld/test/COFF/icf-executable.s | 18 + deps/lld/test/COFF/icf-simple.test | 27 +- deps/lld/test/COFF/icf-xdata.s | 86 + deps/lld/test/COFF/ignore4217.yaml | 72 + deps/lld/test/COFF/include.test | 13 + deps/lld/test/COFF/libpath.test | 12 +- deps/lld/test/COFF/linkrepro-manifest.test | 12 + deps/lld/test/COFF/linkrepro-pdb.test | 9 + deps/lld/test/COFF/linkrepro-res.test | 12 + deps/lld/test/COFF/loadcfg.test | 21 +- .../lld/test/COFF/locally-imported-arm64.test | 61 + .../COFF/locally-imported-warn-multiple.s | 14 + deps/lld/test/COFF/locally-imported.test | 4 +- deps/lld/test/COFF/long-section-name.test | 23 +- deps/lld/test/COFF/lto-cache.ll | 21 + deps/lld/test/COFF/lto-opt-level.ll | 12 +- deps/lld/test/COFF/lto-reloc-model.ll | 19 + deps/lld/test/COFF/lto.ll | 16 +- deps/lld/test/COFF/manifest.test | 16 +- deps/lld/test/COFF/manifestinput-error.test | 10 + .../test/COFF/manifestinput-nowarning.test | 11 + deps/lld/test/COFF/manifestinput.test | 4 +- deps/lld/test/COFF/msvclto-archive.ll | 6 +- deps/lld/test/COFF/msvclto-order.ll | 2 +- deps/lld/test/COFF/msvclto.ll | 2 +- deps/lld/test/COFF/nodefaultlib.test | 6 +- deps/lld/test/COFF/nopdb.test | 14 - deps/lld/test/COFF/options.test | 8 +- deps/lld/test/COFF/pdata-arm64.yaml | 87 + deps/lld/test/COFF/pdb-comdat.test | 43 +- deps/lld/test/COFF/pdb-diff.test | 17 +- deps/lld/test/COFF/pdb-global-gc.yaml | 22 +- deps/lld/test/COFF/pdb-global-hashes.test | 93 + deps/lld/test/COFF/pdb-globals.test | 42 + deps/lld/test/COFF/pdb-heapsite.yaml | 1561 ++++++++++ deps/lld/test/COFF/pdb-import-gc.yaml | 20 +- deps/lld/test/COFF/pdb-invalid-func-type.yaml | 2 +- deps/lld/test/COFF/pdb-lib.s | 6 +- deps/lld/test/COFF/pdb-linker-module.test | 38 +- deps/lld/test/COFF/pdb-none.test | 3 +- deps/lld/test/COFF/pdb-options.test | 2 +- deps/lld/test/COFF/pdb-procid-remapping.test | 29 + deps/lld/test/COFF/pdb-publics-import.test | 42 + deps/lld/test/COFF/pdb-safeseh.yaml | 11 +- deps/lld/test/COFF/pdb-same-name.test | 23 + deps/lld/test/COFF/pdb-scopes.test | 6 +- deps/lld/test/COFF/pdb-secrel-absolute.yaml | 11 +- deps/lld/test/COFF/pdb-source-lines.test | 35 +- deps/lld/test/COFF/pdb-symbol-types.yaml | 20 +- deps/lld/test/COFF/pdb-thunk.yaml | 2747 +++++++++++++++++ .../lld/test/COFF/pdb-type-server-simple.test | 24 +- deps/lld/test/COFF/pdb.test | 160 +- deps/lld/test/COFF/reloc-arm.test | 16 +- deps/lld/test/COFF/reloc-discarded-dwarf.s | 2 + deps/lld/test/COFF/reloc-discarded-early.s | 8 + deps/lld/test/COFF/reloc-discarded-early2.s | 9 + deps/lld/test/COFF/reloc-discarded.s | 1 - deps/lld/test/COFF/responsefile.test | 20 +- deps/lld/test/COFF/rsds.test | 40 +- deps/lld/test/COFF/safeseh-md.s | 34 + deps/lld/test/COFF/safeseh.s | 15 +- deps/lld/test/COFF/section-size.s | 14 + deps/lld/test/COFF/seh-comdat.test | 66 + deps/lld/test/COFF/strtab-size.s | 216 ++ deps/lld/test/COFF/subsystem-drectve.test | 21 + deps/lld/test/COFF/symtab.test | 6 +- deps/lld/test/COFF/thinlto.ll | 2 +- deps/lld/test/COFF/wholearchive.s | 19 + deps/lld/test/COFF/wx.s | 17 + deps/lld/test/ELF/Inputs/amdgpu-kernel-0.s | 6 + deps/lld/test/ELF/Inputs/amdgpu-kernel-1.s | 6 + deps/lld/test/ELF/Inputs/amdgpu-kernel-2.o | Bin 0 -> 408 bytes deps/lld/test/ELF/Inputs/compress-debug.s | 5 + deps/lld/test/ELF/Inputs/copy-rel-abs.s | 13 + deps/lld/test/ELF/Inputs/copy-rel-large.s | 4 + deps/lld/test/ELF/Inputs/copy-rel-pie.s | 1 + .../ELF/Inputs/corrupt-version-reference.so | Bin 0 -> 134272 bytes .../ELF/Inputs/dynamic-list-weak-archive.s | 2 + deps/lld/test/ELF/Inputs/eh-frame.s | 3 + deps/lld/test/ELF/Inputs/gc-sections-shared.s | 3 + .../lld/test/ELF/Inputs/gc-sections-shared2.s | 3 + .../test/ELF/Inputs/local-symbol-in-dso.so | Bin 0 -> 5128 bytes deps/lld/test/ELF/Inputs/map-file5.s | 23 + deps/lld/test/ELF/Inputs/mips-micro.s | 12 + deps/lld/test/ELF/Inputs/shared3.s | 2 +- .../lld/test/ELF/Inputs/shlib-undefined-ref.s | 4 + deps/lld/test/ELF/Inputs/undefined-error.s | 1 + deps/lld/test/ELF/Inputs/verdef-defaultver.s | 3 + deps/lld/test/ELF/Inputs/verneed.so.sh | 58 - deps/lld/test/ELF/Inputs/verneed1.s | 32 + deps/lld/test/ELF/Inputs/verneed1.so | Bin 2632 -> 0 bytes deps/lld/test/ELF/Inputs/verneed2.s | 5 + deps/lld/test/ELF/Inputs/verneed2.so | Bin 2200 -> 0 bytes deps/lld/test/ELF/Inputs/weak-undef-lazy.s | 3 + deps/lld/test/ELF/Inputs/wrap-no-real.s | 3 + deps/lld/test/ELF/Inputs/wrap-no-real2.s | 2 + deps/lld/test/ELF/Inputs/wrap.s | 5 +- .../test/ELF/Inputs/writable-sec-plt-reloc.s | 4 + .../ELF/Inputs/znotext-copy-relocations.s | 5 + .../znotext-plt-relocations-protected.s | 5 + .../test/ELF/Inputs/znotext-plt-relocations.s | 10 + deps/lld/test/ELF/aarch64-abs16.s | 2 +- deps/lld/test/ELF/aarch64-abs32.s | 2 +- deps/lld/test/ELF/aarch64-call26-error.s | 11 - deps/lld/test/ELF/aarch64-call26-thunk.s | 21 + .../ELF/aarch64-cortex-a53-843419-address.s | 180 ++ .../test/ELF/aarch64-cortex-a53-843419-cli.s | 10 + .../ELF/aarch64-cortex-a53-843419-large.s | 115 + .../ELF/aarch64-cortex-a53-843419-nopatch.s | 338 ++ .../ELF/aarch64-cortex-a53-843419-recognize.s | 563 ++++ .../ELF/aarch64-cortex-a53-843419-thunk.s | 57 + deps/lld/test/ELF/aarch64-gnu-ifunc-plt.s | 2 +- deps/lld/test/ELF/aarch64-gnu-ifunc.s | 2 +- deps/lld/test/ELF/aarch64-got-reloc.s | 4 +- deps/lld/test/ELF/aarch64-got-relocations.s | 2 +- deps/lld/test/ELF/aarch64-jump26-error.s | 11 - deps/lld/test/ELF/aarch64-jump26-thunk.s | 20 + .../test/ELF/aarch64-ldprel-lo19-invalid.s | 11 + deps/lld/test/ELF/aarch64-lo12-alignment.s | 45 + deps/lld/test/ELF/aarch64-load-alignment.s | 11 + deps/lld/test/ELF/aarch64-prel16.s | 2 +- deps/lld/test/ELF/aarch64-prel32.s | 2 +- deps/lld/test/ELF/aarch64-thunk-pi.s | 91 + deps/lld/test/ELF/aarch64-thunk-script.s | 41 + .../test/ELF/aarch64-thunk-section-location.s | 41 + deps/lld/test/ELF/aarch64-tls-gdie.s | 2 +- deps/lld/test/ELF/aarch64-tls-ie.s | 2 +- deps/lld/test/ELF/aarch64-tls-static.s | 2 +- deps/lld/test/ELF/aarch64-tlsdesc.s | 2 +- deps/lld/test/ELF/aarch64-undefined-weak.s | 6 +- deps/lld/test/ELF/abs-hidden.s | 2 +- deps/lld/test/ELF/allow-multiple-definition.s | 5 + deps/lld/test/ELF/amdgpu-elf-flags-err.s | 7 + deps/lld/test/ELF/amdgpu-elf-flags.s | 10 + deps/lld/test/ELF/amdgpu-relocs.s | 15 +- deps/lld/test/ELF/arm-bl-v6.s | 51 + deps/lld/test/ELF/arm-blx-v4t.s | 30 + deps/lld/test/ELF/arm-branch-error.s | 19 - deps/lld/test/ELF/arm-branch-rangethunk.s | 34 + .../ELF/arm-branch-undef-weak-plt-thunk.s | 35 + deps/lld/test/ELF/arm-copy.s | 2 +- .../test/ELF/arm-exidx-dedup-and-sentinel.s | 29 + deps/lld/test/ELF/arm-exidx-dedup.s | 126 + deps/lld/test/ELF/arm-exidx-gc.s | 2 +- deps/lld/test/ELF/arm-exidx-order.s | 4 +- deps/lld/test/ELF/arm-exidx-sentinel-orphan.s | 2 +- deps/lld/test/ELF/arm-exidx-shared.s | 6 +- deps/lld/test/ELF/arm-gnu-ifunc-plt.s | 56 +- deps/lld/test/ELF/arm-gnu-ifunc.s | 41 +- deps/lld/test/ELF/arm-got-relative.s | 2 +- deps/lld/test/ELF/arm-icf-exidx.s | 2 +- deps/lld/test/ELF/arm-pie-relative.s | 2 +- deps/lld/test/ELF/arm-plt-reloc.s | 264 +- deps/lld/test/ELF/arm-static-defines.s | 2 +- deps/lld/test/ELF/arm-thumb-branch-error.s | 19 - .../test/ELF/arm-thumb-branch-rangethunk.s | 36 + .../lld/test/ELF/arm-thumb-condbranch-thunk.s | 117 + .../lld/test/ELF/arm-thumb-interwork-shared.s | 37 +- .../test/ELF/arm-thumb-mix-range-thunk-os.s | 195 ++ .../test/ELF/arm-thumb-no-undefined-thunk.s | 2 +- .../test/ELF/arm-thumb-plt-range-thunk-os.s | 92 + deps/lld/test/ELF/arm-thumb-plt-reloc.s | 70 +- deps/lld/test/ELF/arm-thumb-range-thunk-os.s | 159 + .../lld/test/ELF/arm-thumb-thunk-empty-pass.s | 32 + deps/lld/test/ELF/arm-thumb-thunk-symbols.s | 6 +- deps/lld/test/ELF/arm-thunk-edgecase.s | 37 + deps/lld/test/ELF/arm-thunk-largesection.s | 42 + .../test/ELF/arm-thunk-linkerscript-dotexpr.s | 77 + .../test/ELF/arm-thunk-linkerscript-large.s | 176 ++ .../test/ELF/arm-thunk-linkerscript-orphan.s | 63 + .../test/ELF/arm-thunk-linkerscript-sort.s | 71 + deps/lld/test/ELF/arm-thunk-linkerscript.s | 78 + deps/lld/test/ELF/arm-thunk-multipass.s | 96 + deps/lld/test/ELF/arm-thunk-re-add.s | 123 + deps/lld/test/ELF/arm-thunk-toolargesection.s | 19 + deps/lld/test/ELF/arm-tls-gd-nonpreemptible.s | 2 +- deps/lld/test/ELF/arm-tls-gd32.s | 2 +- deps/lld/test/ELF/arm-tls-ie32.s | 2 +- deps/lld/test/ELF/arm-tls-ldm32.s | 2 +- deps/lld/test/ELF/arm-tls-norelax-gd-ie.s | 2 +- deps/lld/test/ELF/arm-tls-norelax-gd-le.s | 6 +- deps/lld/test/ELF/arm-tls-norelax-ie-le.s | 2 +- deps/lld/test/ELF/arm-tls-norelax-ld-le.s | 2 +- deps/lld/test/ELF/arm-undefined-weak.s | 2 +- deps/lld/test/ELF/as-needed.s | 4 + deps/lld/test/ELF/assignment-archive.s | 27 + .../test/ELF/avoid-empty-program-headers.s | 6 +- deps/lld/test/ELF/basic-aarch64.s | 16 +- deps/lld/test/ELF/basic-mips.s | 4 +- deps/lld/test/ELF/basic-ppc.s | 4 +- deps/lld/test/ELF/basic-sparcv9.s | 16 +- deps/lld/test/ELF/basic.s | 18 +- deps/lld/test/ELF/basic32.s | 16 +- deps/lld/test/ELF/basic64be.s | 2 +- deps/lld/test/ELF/build-id.s | 21 +- deps/lld/test/ELF/chroot.s | 12 + deps/lld/test/ELF/comment-gc.s | 3 +- deps/lld/test/ELF/common-gc.s | 41 + deps/lld/test/ELF/common-gc2.s | 15 + deps/lld/test/ELF/common-gc3.s | 18 + deps/lld/test/ELF/common.s | 10 +- .../test/ELF/compress-debug-sections-reloc.s | 26 + deps/lld/test/ELF/compress-debug-sections.s | 7 +- deps/lld/test/ELF/compressed-debug-conflict.s | 29 + deps/lld/test/ELF/compressed-debug-input.s | 16 +- deps/lld/test/ELF/conflict-debug-variable.s | 144 + deps/lld/test/ELF/conflict-debug-variable2.s | 160 + deps/lld/test/ELF/copy-errors.s | 3 + deps/lld/test/ELF/copy-rel-abs.s | 47 + deps/lld/test/ELF/copy-rel-large.s | 20 + deps/lld/test/ELF/copy-rel-pie.s | 2 +- .../test/ELF/corrupted-version-reference.s | 14 + deps/lld/test/ELF/debug-gc.s | 4 +- deps/lld/test/ELF/defsym-dynamic.s | 10 + deps/lld/test/ELF/defsym.s | 42 +- deps/lld/test/ELF/driver-access.test | 2 +- deps/lld/test/ELF/driver.test | 4 +- deps/lld/test/ELF/duplicated-synthetic-sym.s | 3 +- deps/lld/test/ELF/dynamic-got.s | 2 +- deps/lld/test/ELF/dynamic-list-empty.s | 18 + deps/lld/test/ELF/dynamic-list-preempt.s | 76 + deps/lld/test/ELF/dynamic-list-weak-archive.s | 18 + deps/lld/test/ELF/dynamic-list-wildcard.s | 53 + deps/lld/test/ELF/dynamic-list.s | 22 +- deps/lld/test/ELF/dynamic-no-rosegment.s | 15 + deps/lld/test/ELF/dynamic-reloc-in-ro.s | 6 +- deps/lld/test/ELF/dynamic-reloc.s | 2 +- deps/lld/test/ELF/dynstr-no-rosegment.s | 12 + deps/lld/test/ELF/dynsym-no-rosegment.s | 27 + deps/lld/test/ELF/dynsym-pie.s | 52 +- deps/lld/test/ELF/edata-etext.s | 2 +- deps/lld/test/ELF/edata-no-bss.s | 18 + deps/lld/test/ELF/eh-align-cie.s | 2 +- deps/lld/test/ELF/eh-frame-hdr-augmentation.s | 2 +- deps/lld/test/ELF/eh-frame-hdr-icf-fde.s | 95 + deps/lld/test/ELF/eh-frame-hdr-icf.s | 15 +- deps/lld/test/ELF/eh-frame-hdr.s | 12 +- deps/lld/test/ELF/eh-frame-merge.s | 2 +- .../test/ELF/eh-frame-padding-no-rosegment.s | 2 +- deps/lld/test/ELF/eh-frame.s | 12 + deps/lld/test/ELF/emit-relocs-gc.s | 30 + deps/lld/test/ELF/emit-relocs-merge.s | 2 +- .../lld/test/ELF/emit-relocs-mergeable-i386.s | 66 + deps/lld/test/ELF/emit-relocs-mergeable.s | 53 + deps/lld/test/ELF/emit-relocs-shared.s | 2 +- deps/lld/test/ELF/emit-relocs.s | 13 +- deps/lld/test/ELF/exclude-libs.s | 6 + .../test/ELF/executable-undefined-ignoreall.s | 13 + ...executable-undefined-protected-ignoreall.s | 8 + deps/lld/test/ELF/file-access.s | 13 + deps/lld/test/ELF/fill-trap.s | 25 + deps/lld/test/ELF/filter.s | 6 +- deps/lld/test/ELF/format-binary-non-ascii.s | 15 + deps/lld/test/ELF/gc-collect-undefined.s | 19 + deps/lld/test/ELF/gc-merge-local-sym.s | 2 +- .../ELF/gc-sections-linker-defined-symbol.s | 18 + deps/lld/test/ELF/gc-sections-merge-addend.s | 2 +- .../ELF/gc-sections-merge-implicit-addend.s | 2 +- deps/lld/test/ELF/gc-sections-merge.s | 4 +- deps/lld/test/ELF/gc-sections-print.s | 6 + deps/lld/test/ELF/gc-sections-shared.s | 93 +- deps/lld/test/ELF/gc-sections-undefined.s | 10 + deps/lld/test/ELF/gdb-index-base-addr.s | 70 + deps/lld/test/ELF/gdb-index-dup-types.s | 2 +- deps/lld/test/ELF/gdb-index-empty.s | 4 +- deps/lld/test/ELF/gdb-index-gc-sections.s | 2 +- deps/lld/test/ELF/gdb-index-noranges.s | 49 + deps/lld/test/ELF/gdb-index-ranges.s | 2 +- deps/lld/test/ELF/gdb-index-tls.s | 91 + deps/lld/test/ELF/gdb-index.s | 30 +- .../global-offset-table-position-aarch64.s | 2 +- .../ELF/global-offset-table-position-arm.s | 2 +- .../ELF/global-offset-table-position-i386.s | 2 +- .../test/ELF/global-offset-table-position.s | 2 +- .../lld/test/ELF/global_offset_table_shared.s | 2 +- deps/lld/test/ELF/gnu-hash-table-copy.s | 30 + deps/lld/test/ELF/gnu-hash-table-many.s | 55 + deps/lld/test/ELF/gnu-hash-table-rwsegment.s | 20 + deps/lld/test/ELF/gnu-hash-table.s | 79 +- deps/lld/test/ELF/gnu-ifunc-dynsym.s | 19 + deps/lld/test/ELF/gnu-ifunc-dyntags.s | 41 + deps/lld/test/ELF/gnu-ifunc-gotpcrel.s | 2 +- deps/lld/test/ELF/gnu-ifunc-i386.s | 6 +- deps/lld/test/ELF/gnu-ifunc-plt-i386.s | 2 +- deps/lld/test/ELF/gnu-ifunc-plt.s | 2 +- deps/lld/test/ELF/gnu-ifunc-shared.s | 2 +- deps/lld/test/ELF/gnu-ifunc.s | 6 +- deps/lld/test/ELF/got-aarch64.s | 2 +- deps/lld/test/ELF/got.s | 2 +- deps/lld/test/ELF/got32-i386-pie-rw.s | 17 + deps/lld/test/ELF/got32-i386.s | 2 +- deps/lld/test/ELF/got32x-i386.s | 4 +- deps/lld/test/ELF/gotpc-relax-nopic.s | 6 +- deps/lld/test/ELF/gotpc-relax-und-dso.s | 2 +- deps/lld/test/ELF/gotpcrelx.s | 2 +- deps/lld/test/ELF/help.s | 5 + deps/lld/test/ELF/i386-debug-noabs.test | 33 + deps/lld/test/ELF/i386-got-and-copy.s | 2 +- deps/lld/test/ELF/i386-got-value.s | 33 + deps/lld/test/ELF/i386-gotoff-shared.s | 2 +- deps/lld/test/ELF/i386-gotpc-dynamic.s | 2 +- deps/lld/test/ELF/i386-gotpc.s | 2 +- deps/lld/test/ELF/i386-pc8-pc16-addend.s | 2 +- deps/lld/test/ELF/i386-reloc-16.s | 2 +- deps/lld/test/ELF/i386-reloc-8.s | 2 +- deps/lld/test/ELF/i386-reloc-range.s | 2 +- .../lld/test/ELF/i386-reloc8-reloc16-addend.s | 2 +- deps/lld/test/ELF/i386-tls-ie-shared.s | 2 +- .../test/ELF/i386-tls-initial-exec-local.s | 36 + deps/lld/test/ELF/icf-absolute.s | 2 +- deps/lld/test/ELF/icf-comdat.s | 2 +- deps/lld/test/ELF/icf-i386.s | 2 +- deps/lld/test/ELF/icf-merge-sec.s | 2 +- deps/lld/test/ELF/icf-merge.s | 6 +- deps/lld/test/ELF/icf-non-mergeable.s | 4 +- deps/lld/test/ELF/icf-none.s | 2 +- deps/lld/test/ELF/icf-symbol-type.s | 26 + deps/lld/test/ELF/icf1.s | 2 +- deps/lld/test/ELF/icf2.s | 2 +- deps/lld/test/ELF/icf3.s | 2 +- deps/lld/test/ELF/icf4.s | 2 +- deps/lld/test/ELF/icf5.s | 2 +- deps/lld/test/ELF/icf6.s | 2 +- deps/lld/test/ELF/icf7.s | 2 +- deps/lld/test/ELF/icf9.s | 22 +- deps/lld/test/ELF/image-base.s | 7 +- deps/lld/test/ELF/init_fini_priority.s | 24 +- deps/lld/test/ELF/invalid-linkerscript.test | 2 +- .../test/ELF/invalid-local-symbol-in-dso.s | 13 + .../ELF/invalid-undef-section-symbol.test | 27 + .../ELF/invalid/Inputs/section-index2.elf | Bin 474 -> 0 bytes .../invalid/invalid-debug-relocations.test | 3 +- deps/lld/test/ELF/invalid/invalid-elf.test | 4 - .../ELF/invalid/invalid-relocation-x64.test | 18 +- deps/lld/test/ELF/libsearch.s | 1 + .../linkerscript/Inputs/common-filespec1.s | 2 + .../linkerscript/Inputs/common-filespec2.s | 2 + .../Inputs/copy-rel-symbol-value.s | 5 + .../ELF/linkerscript/Inputs/provide-shared.s | 5 + .../Inputs/symbol-reserved.script | 5 + deps/lld/test/ELF/linkerscript/absolute2.s | 17 + .../ELF/linkerscript/align-section-offset.s | 11 + .../lld/test/ELF/linkerscript/align-section.s | 6 + deps/lld/test/ELF/linkerscript/align.s | 45 + .../test/ELF/linkerscript/arm-exidx-order.s | 19 + .../arm-exidx-sentinel-and-assignment.s | 41 + deps/lld/test/ELF/linkerscript/at-addr.s | 4 - deps/lld/test/ELF/linkerscript/at.s | 25 - .../test/ELF/linkerscript/common-exclude.s | 86 + .../test/ELF/linkerscript/common-filespec.s | 105 + deps/lld/test/ELF/linkerscript/common.s | 8 +- .../compress-debug-sections-custom.s | 35 + .../linkerscript/compress-debug-sections.s | 4 +- .../linkerscript/copy-rel-symbol-value-err.s | 12 + .../ELF/linkerscript/copy-rel-symbol-value.s | 27 + .../lld/test/ELF/linkerscript/data-commands.s | 36 + .../ELF/linkerscript/data-segment-relro.s | 4 +- deps/lld/test/ELF/linkerscript/diagnostic.s | 14 +- .../ELF/linkerscript/discard-section-err.s | 2 + .../ELF/linkerscript/early-assign-symbol.s | 24 +- .../eh-frame-reloc-out-of-range.s | 2 +- .../linkerscript/emit-reloc-section-names.s | 22 + deps/lld/test/ELF/linkerscript/emit-reloc.s | 2 +- .../ELF/linkerscript/emit-relocs-multiple.s | 2 +- .../test/ELF/linkerscript/extend-pt-load.s | 13 +- .../lld/test/ELF/linkerscript/filename-spec.s | 47 +- deps/lld/test/ELF/linkerscript/header-addr.s | 22 +- deps/lld/test/ELF/linkerscript/header-phdr.s | 13 + deps/lld/test/ELF/linkerscript/image-base.s | 18 + .../linkerscript/implicit-program-header.s | 2 +- .../lld/test/ELF/linkerscript/include-cycle.s | 15 + .../linker-script-in-search-path.s | 19 + deps/lld/test/ELF/linkerscript/linkerscript.s | 4 +- deps/lld/test/ELF/linkerscript/memory-at.s | 46 + deps/lld/test/ELF/linkerscript/memory-err.s | 16 + deps/lld/test/ELF/linkerscript/memory.s | 4 +- deps/lld/test/ELF/linkerscript/memory2.s | 14 + deps/lld/test/ELF/linkerscript/memory3.s | 23 + .../test/ELF/linkerscript/merge-sections.s | 2 +- deps/lld/test/ELF/linkerscript/no-space.s | 4 +- .../lld/test/ELF/linkerscript/nobits-offset.s | 18 + deps/lld/test/ELF/linkerscript/noload.s | 4 +- deps/lld/test/ELF/linkerscript/non-alloc.s | 2 +- deps/lld/test/ELF/linkerscript/operators.s | 8 + .../test/ELF/linkerscript/orphan-discard.s | 25 + deps/lld/test/ELF/linkerscript/orphan-end.s | 57 + deps/lld/test/ELF/linkerscript/orphan-phdrs.s | 34 + .../lld/test/ELF/linkerscript/orphan-report.s | 54 + deps/lld/test/ELF/linkerscript/out-of-order.s | 2 +- deps/lld/test/ELF/linkerscript/phdr-check.s | 4 +- deps/lld/test/ELF/linkerscript/phdrs.s | 4 +- .../test/ELF/linkerscript/provide-shared.s | 13 + deps/lld/test/ELF/linkerscript/region-alias.s | 54 + .../test/ELF/linkerscript/repsection-symbol.s | 2 +- .../lld/test/ELF/linkerscript/sections-sort.s | 2 +- .../test/ELF/linkerscript/segment-headers.s | 26 + .../lld/test/ELF/linkerscript/segment-start.s | 2 +- .../test/ELF/linkerscript/sort-non-script.s | 2 +- deps/lld/test/ELF/linkerscript/subalign.s | 17 + .../test/ELF/linkerscript/symbol-assignexpr.s | 8 +- .../test/ELF/linkerscript/symbol-only-flags.s | 20 + deps/lld/test/ELF/linkerscript/symbol-only.s | 2 +- .../ELF/linkerscript/symbol-ordering-file.s | 23 + .../test/ELF/linkerscript/symbol-reserved.s | 28 + deps/lld/test/ELF/linkerscript/symbols.s | 13 +- .../test/ELF/linkerscript/thunk-gen-mips.s | 40 + .../test/ELF/linkerscript/unused-synthetic.s | 10 + .../ELF/linkerscript/version-linker-symbol.s | 28 + deps/lld/test/ELF/lit.local.cfg | 1 - deps/lld/test/ELF/local-got-pie.s | 2 +- deps/lld/test/ELF/local-got-shared.s | 2 +- deps/lld/test/ELF/local-got.s | 2 +- deps/lld/test/ELF/lto-plugin-ignore.s | 11 + .../test/ELF/lto/Inputs/data-ordering-lto.ll | 6 + .../lto/Inputs/linker-script-symbols-ipo.ll | 9 + .../ELF/lto/Inputs/symbol-ordering-lto.ll | 10 + deps/lld/test/ELF/lto/cache.ll | 14 +- deps/lld/test/ELF/lto/data-ordering-lto.s | 27 + deps/lld/test/ELF/lto/keep-undefined.ll | 20 + .../ELF/lto/linker-script-symbols-assign.ll | 48 + .../test/ELF/lto/linker-script-symbols-ipo.ll | 32 + .../lld/test/ELF/lto/linker-script-symbols.ll | 29 + deps/lld/test/ELF/lto/opt-level.ll | 21 +- deps/lld/test/ELF/lto/opt-remarks.ll | 31 +- deps/lld/test/ELF/lto/relocatable.ll | 55 + deps/lld/test/ELF/lto/save-temps.ll | 7 + deps/lld/test/ELF/lto/section-name.ll | 35 + deps/lld/test/ELF/lto/shlib-undefined.ll | 2 +- deps/lld/test/ELF/lto/symbol-ordering-lto.s | 25 + deps/lld/test/ELF/lto/thinlto.ll | 8 +- deps/lld/test/ELF/lto/verify-invalid.ll | 2 + deps/lld/test/ELF/lto/wrap-1.ll | 2 +- deps/lld/test/ELF/lto/wrap-2.ll | 4 +- deps/lld/test/ELF/many-alloc-sections.s | 3 +- deps/lld/test/ELF/many-sections.s | 7 +- deps/lld/test/ELF/map-file.s | 86 +- deps/lld/test/ELF/merge-align.s | 34 + deps/lld/test/ELF/merge-entsize.s | 27 + deps/lld/test/ELF/merge-reloc.s | 19 +- deps/lld/test/ELF/merge-string.s | 14 +- deps/lld/test/ELF/merge.s | 2 +- deps/lld/test/ELF/mips-26-n32-n64.s | 35 + deps/lld/test/ELF/mips-64-gprel-so.s | 2 +- deps/lld/test/ELF/mips-64-rels.s | 6 +- deps/lld/test/ELF/mips-align-err.s | 2 +- deps/lld/test/ELF/mips-elf-flags-err.s | 10 +- deps/lld/test/ELF/mips-elf-flags.s | 29 + deps/lld/test/ELF/mips-got-page-script.s | 65 + deps/lld/test/ELF/mips-got-relocs.s | 4 +- deps/lld/test/ELF/mips-got-script.s | 47 + deps/lld/test/ELF/mips-gp-disp.s | 2 +- deps/lld/test/ELF/mips-gp-ext.s | 7 + deps/lld/test/ELF/mips-gp-local.s | 2 +- deps/lld/test/ELF/mips-gprel32-relocs-gp0.s | 8 +- deps/lld/test/ELF/mips-gprel32-relocs.s | 8 +- deps/lld/test/ELF/mips-hilo-gp-disp.s | 4 +- deps/lld/test/ELF/mips-hilo-hi-only.s | 2 +- deps/lld/test/ELF/mips-micro-got.s | 46 + deps/lld/test/ELF/mips-micro-got64.s | 48 + deps/lld/test/ELF/mips-micro-jal.s | 155 + deps/lld/test/ELF/mips-micro-plt.s | 91 + deps/lld/test/ELF/mips-micro-relocs.s | 59 + deps/lld/test/ELF/mips-micro-thunks.s | 47 + deps/lld/test/ELF/mips-n32-rels.s | 6 +- .../ELF/mips-out-of-bounds-call16-reloc.s | 29 + deps/lld/test/ELF/no-inhibit-exec.s | 4 + deps/lld/test/ELF/non-abs-reloc.s | 2 +- deps/lld/test/ELF/noplt-pie.s | 2 +- deps/lld/test/ELF/pack-dyn-relocs.s | 210 ++ deps/lld/test/ELF/pie-weak.s | 7 +- deps/lld/test/ELF/ppc-relocs.s | 36 +- deps/lld/test/ELF/ppc64-addr16-error.s | 2 +- deps/lld/test/ELF/pr34660.s | 25 + deps/lld/test/ELF/pr34872.s | 14 + deps/lld/test/ELF/progname.s | 2 +- deps/lld/test/ELF/relocatable-comdat2.s | 35 + deps/lld/test/ELF/relocatable-common.s | 5 +- .../test/ELF/relocatable-compressed-input.s | 10 +- deps/lld/test/ELF/relocatable.s | 2 +- deps/lld/test/ELF/relocation-b-aarch64.test | 48 + deps/lld/test/ELF/relocation-copy-alias.s | 8 +- .../test/ELF/relocation-copy-align-common.s | 2 +- deps/lld/test/ELF/relocation-copy-flags.s | 2 +- deps/lld/test/ELF/relocation-copy-relro.s | 2 +- deps/lld/test/ELF/relocation-i686.s | 2 +- deps/lld/test/ELF/relocation-relative-weak.s | 1 + deps/lld/test/ELF/relocation-size-err.s | 12 + deps/lld/test/ELF/relocation.s | 2 +- deps/lld/test/ELF/relro-copyrel-bss-script.s | 40 + .../ELF/relro-non-contiguous-script-data.s | 25 + deps/lld/test/ELF/relro-non-contiguous.s | 28 + deps/lld/test/ELF/relro-omagic.s | 2 +- deps/lld/test/ELF/relro-script.s | 29 + deps/lld/test/ELF/reproduce-thin-archive.s | 6 + deps/lld/test/ELF/reproduce.s | 31 +- deps/lld/test/ELF/resolution-end.s | 2 +- deps/lld/test/ELF/retain-symbols-file.s | 4 +- deps/lld/test/ELF/section-metadata-err.s | 2 +- deps/lld/test/ELF/segments.s | 5 + deps/lld/test/ELF/shared-lazy.s | 16 + deps/lld/test/ELF/shared.s | 6 +- deps/lld/test/ELF/shlib-undefined-shared.s | 15 + deps/lld/test/ELF/silent-ignore.test | 20 + deps/lld/test/ELF/sort-norosegment.s | 2 +- deps/lld/test/ELF/startstop-gccollect.s | 12 +- deps/lld/test/ELF/startstop.s | 2 +- deps/lld/test/ELF/string-gc.s | 4 +- deps/lld/test/ELF/strip-debug.s | 27 +- deps/lld/test/ELF/symbol-ordering-file2.s | 21 + deps/lld/test/ELF/synthetic-got.s | 4 +- deps/lld/test/ELF/sysroot.s | 2 + deps/lld/test/ELF/sysv-hash-no-rosegment.s | 13 + deps/lld/test/ELF/tls-dynamic-i686.s | 2 +- deps/lld/test/ELF/tls-dynamic.s | 2 +- deps/lld/test/ELF/tls-got.s | 2 +- deps/lld/test/ELF/tls-i686.s | 2 +- deps/lld/test/ELF/tls-initial-exec-local.s | 2 +- deps/lld/test/ELF/tls-opt-gdie.s | 2 +- deps/lld/test/ELF/tls-opt-gdiele-i686.s | 2 +- deps/lld/test/ELF/tls-opt-iele-i686-nopic.s | 2 +- deps/lld/test/ELF/tls-static.s | 16 +- deps/lld/test/ELF/tls-two-relocs.s | 2 +- deps/lld/test/ELF/trace-symbols.s | 14 +- deps/lld/test/ELF/typed-undef.s | 11 + deps/lld/test/ELF/undef-broken-debug.test | 47 + deps/lld/test/ELF/undef-version-script.s | 6 +- deps/lld/test/ELF/unresolved-symbols.s | 3 + deps/lld/test/ELF/verdef-defaultver.s | 4 +- deps/lld/test/ELF/verdef.s | 6 +- deps/lld/test/ELF/verneed-as-needed-weak.s | 6 +- deps/lld/test/ELF/verneed-local.s | 6 +- deps/lld/test/ELF/verneed.s | 8 +- deps/lld/test/ELF/version-script-err.s | 1 - deps/lld/test/ELF/version-script-extern.s | 2 +- deps/lld/test/ELF/version-script-twice.s | 4 + deps/lld/test/ELF/version-script.s | 10 +- deps/lld/test/ELF/weak-entry.s | 13 + deps/lld/test/ELF/weak-undef-export.s | 31 + deps/lld/test/ELF/weak-undef-lazy.s | 11 + deps/lld/test/ELF/weak-undef-rw.s | 12 + deps/lld/test/ELF/weak-undef-val.s | 26 + deps/lld/test/ELF/weak-undef.s | 12 + deps/lld/test/ELF/wrap-no-real.s | 77 + deps/lld/test/ELF/wrap.s | 34 +- deps/lld/test/ELF/writable-sec-plt-reloc.s | 14 + deps/lld/test/ELF/x86-64-dyn-rel-error.s | 6 +- deps/lld/test/ELF/x86-64-dyn-rel-error2.s | 4 +- deps/lld/test/ELF/x86-64-relax-got-abs.s | 2 +- deps/lld/test/ELF/x86-64-reloc-16.s | 2 +- deps/lld/test/ELF/x86-64-reloc-8.s | 2 +- deps/lld/test/ELF/x86-64-reloc-error.s | 4 +- deps/lld/test/ELF/x86-64-reloc-range.s | 2 +- deps/lld/test/ELF/x86-64-tls-gd-local.s | 2 +- deps/lld/test/ELF/znotext-copy-relocation.s | 16 + .../ELF/znotext-plt-relocations-protected.s | 11 + deps/lld/test/ELF/znotext-plt-relocations.s | 20 + deps/lld/test/ELF/znotext-weak-undef.s | 16 + deps/lld/test/MinGW/driver.test | 126 + deps/lld/test/MinGW/lib.test | 21 + deps/lld/test/Unit/{lit.cfg => lit.cfg.py} | 18 +- .../{lit.site.cfg.in => lit.site.cfg.py.in} | 4 +- deps/lld/test/lit.cfg | 270 -- deps/lld/test/lit.cfg.py | 93 + .../{lit.site.cfg.in => lit.site.cfg.py.in} | 5 +- deps/lld/test/wasm/Inputs/archive1.ll | 7 + deps/lld/test/wasm/Inputs/archive2.ll | 7 + deps/lld/test/wasm/Inputs/call-indirect.ll | 17 + deps/lld/test/wasm/Inputs/global-ctor-dtor.ll | 14 + deps/lld/test/wasm/Inputs/hello.ll | 15 + deps/lld/test/wasm/Inputs/hidden.ll | 11 + deps/lld/test/wasm/Inputs/many-funcs.ll | 776 +++++ deps/lld/test/wasm/Inputs/ret32.ll | 6 + deps/lld/test/wasm/Inputs/ret64.ll | 4 + deps/lld/test/wasm/Inputs/weak-alias.ll | 37 + deps/lld/test/wasm/Inputs/weak-symbol1.ll | 11 + deps/lld/test/wasm/Inputs/weak-symbol2.ll | 11 + deps/lld/test/wasm/archive.ll | 31 + deps/lld/test/wasm/call-indirect.ll | 132 + deps/lld/test/wasm/conflict.test | 6 + deps/lld/test/wasm/data-layout.ll | 61 + deps/lld/test/wasm/entry.ll | 19 + deps/lld/test/wasm/function-imports-first.ll | 42 + deps/lld/test/wasm/function-imports.ll | 37 + deps/lld/test/wasm/function-index.test | 18 + deps/lld/test/wasm/import-memory.test | 13 + deps/lld/test/wasm/init-fini.ll | 99 + deps/lld/test/wasm/invalid-stack-size.test | 9 + deps/lld/test/wasm/lit.local.cfg | 4 + deps/lld/test/wasm/load-undefined.ll | 38 + deps/lld/test/wasm/local-symbols.ll | 78 + deps/lld/test/wasm/many-functions.ll | 695 +++++ deps/lld/test/wasm/relocatable.ll | 194 ++ deps/lld/test/wasm/signature-mismatch.ll | 16 + deps/lld/test/wasm/stack-pointer.ll | 64 + deps/lld/test/wasm/strip-debug.test | 6 + deps/lld/test/wasm/symbol-type-mismatch.ll | 9 + deps/lld/test/wasm/undefined-entry.test | 4 + deps/lld/test/wasm/undefined.ll | 20 + deps/lld/test/wasm/version.ll | 13 + deps/lld/test/wasm/visibility-hidden.ll | 46 + deps/lld/test/wasm/weak-alias-overide.ll | 123 + deps/lld/test/wasm/weak-alias.ll | 113 + deps/lld/test/wasm/weak-external.ll | 86 + deps/lld/test/wasm/weak-symbols.ll | 100 + deps/lld/tools/lld/CMakeLists.txt | 7 +- deps/lld/tools/lld/lld.cpp | 20 +- deps/lld/unittests/DriverTests/CMakeLists.txt | 1 + .../DriverTests/DarwinLdDriverTest.cpp | 2 +- deps/lld/unittests/MachOTests/CMakeLists.txt | 1 + deps/lld/utils/benchmark.py | 135 + deps/lld/utils/link.yaml | 39 + deps/lld/wasm/CMakeLists.txt | 26 + deps/lld/wasm/Config.h | 51 + deps/lld/wasm/Driver.cpp | 321 ++ deps/lld/wasm/InputFiles.cpp | 312 ++ deps/lld/wasm/InputFiles.h | 153 + deps/lld/wasm/InputSegment.cpp | 25 + deps/lld/wasm/InputSegment.h | 76 + deps/lld/wasm/Options.td | 103 + deps/lld/wasm/OutputSections.cpp | 348 +++ deps/lld/wasm/OutputSections.h | 136 + deps/lld/wasm/OutputSegment.h | 56 + deps/lld/wasm/SymbolTable.cpp | 237 ++ deps/lld/wasm/SymbolTable.h | 71 + deps/lld/wasm/Symbols.cpp | 114 + deps/lld/wasm/Symbols.h | 128 + deps/lld/wasm/Writer.cpp | 745 +++++ deps/lld/wasm/Writer.h | 21 + deps/lld/wasm/WriterUtils.cpp | 215 ++ deps/lld/wasm/WriterUtils.h | 78 + 852 files changed, 37365 insertions(+), 9800 deletions(-) create mode 100644 deps/lld-prebuilt/MinGW/Options.inc rename deps/lld-prebuilt/lld/{Config => Common}/Version.inc (50%) create mode 100644 deps/lld-prebuilt/wasm/Options.inc delete mode 100644 deps/lld/COFF/Error.cpp delete mode 100644 deps/lld/COFF/Error.h delete mode 100644 deps/lld/COFF/Memory.h create mode 100644 deps/lld/COFF/MinGW.cpp create mode 100644 deps/lld/COFF/MinGW.h create mode 100644 deps/lld/Common/Args.cpp create mode 100644 deps/lld/Common/CMakeLists.txt rename deps/lld/{ELF/Error.cpp => Common/ErrorHandler.cpp} (62%) create mode 100644 deps/lld/Common/Memory.cpp rename deps/lld/{lib/Core => Common}/Reproduce.cpp (83%) create mode 100644 deps/lld/Common/Strings.cpp rename deps/lld/{lib/Core => Common}/TargetOptionsCommandFlags.cpp (74%) create mode 100644 deps/lld/Common/Threads.cpp rename deps/lld/{lib/Config => Common}/Version.cpp (93%) create mode 100644 deps/lld/ELF/AArch64ErrataFix.cpp create mode 100644 deps/lld/ELF/AArch64ErrataFix.h create mode 100644 deps/lld/ELF/Bits.h delete mode 100644 deps/lld/ELF/Error.h create mode 100644 deps/lld/MinGW/CMakeLists.txt create mode 100644 deps/lld/MinGW/Driver.cpp create mode 100644 deps/lld/MinGW/Options.td create mode 100644 deps/lld/docs/WebAssembly.rst create mode 100644 deps/lld/include/lld/Common/Args.h rename deps/lld/include/lld/{Driver => Common}/Driver.h (66%) create mode 100644 deps/lld/include/lld/Common/ErrorHandler.h rename deps/lld/include/lld/{Core => Common}/LLVM.h (97%) rename deps/lld/{ELF => include/lld/Common}/Memory.h (87%) rename deps/lld/include/lld/{Core => Common}/Reproduce.h (87%) create mode 100644 deps/lld/include/lld/Common/Strings.h rename deps/lld/include/lld/{Core => Common}/TargetOptionsCommandFlags.h (86%) rename deps/lld/{ELF => include/lld/Common}/Threads.h (88%) rename deps/lld/include/lld/{Config => Common}/Version.h (86%) rename deps/lld/include/lld/{Config => Common}/Version.inc.in (100%) delete mode 100644 deps/lld/lib/Config/CMakeLists.txt create mode 100644 deps/lld/test/COFF/Inputs/alpha.ll create mode 100644 deps/lld/test/COFF/Inputs/beta.ll create mode 100644 deps/lld/test/COFF/Inputs/except_handler3.lib create mode 100644 deps/lld/test/COFF/Inputs/far-arm-thumb-abs20.s create mode 100644 deps/lld/test/COFF/Inputs/gamma.ll create mode 100644 deps/lld/test/COFF/Inputs/library2-arm64.lib create mode 100644 deps/lld/test/COFF/Inputs/library2.def create mode 100644 deps/lld/test/COFF/Inputs/locally-imported-def.s create mode 100644 deps/lld/test/COFF/Inputs/locally-imported-imp.s create mode 100644 deps/lld/test/COFF/Inputs/lto-cache.ll create mode 100644 deps/lld/test/COFF/Inputs/pdb-globals.yaml create mode 100644 deps/lld/test/COFF/Inputs/pdb-hashes-1.yaml create mode 100644 deps/lld/test/COFF/Inputs/pdb-hashes-2-missing.yaml create mode 100644 deps/lld/test/COFF/Inputs/pdb-hashes-2.yaml create mode 100644 deps/lld/test/COFF/arm-thumb-branch20-error.s create mode 100644 deps/lld/test/COFF/arm64-dynamicbase.s create mode 100644 deps/lld/test/COFF/arm64-import2.test create mode 100644 deps/lld/test/COFF/armnt-dynamicbase.test create mode 100644 deps/lld/test/COFF/common-alignment.test create mode 100644 deps/lld/test/COFF/ctors_dtors_priority.s create mode 100644 deps/lld/test/COFF/debug-dwarf.test create mode 100644 deps/lld/test/COFF/delayimports-armnt.yaml create mode 100644 deps/lld/test/COFF/dllexport-mingw.s create mode 100644 deps/lld/test/COFF/duplicate.test create mode 100644 deps/lld/test/COFF/entry-drectve.test create mode 100644 deps/lld/test/COFF/export-all.s create mode 100644 deps/lld/test/COFF/export-arm64.yaml create mode 100644 deps/lld/test/COFF/export-armnt.yaml create mode 100644 deps/lld/test/COFF/filename-casing.s create mode 100644 deps/lld/test/COFF/icf-executable.s create mode 100644 deps/lld/test/COFF/icf-xdata.s create mode 100644 deps/lld/test/COFF/ignore4217.yaml create mode 100644 deps/lld/test/COFF/linkrepro-manifest.test create mode 100644 deps/lld/test/COFF/linkrepro-pdb.test create mode 100644 deps/lld/test/COFF/linkrepro-res.test create mode 100644 deps/lld/test/COFF/locally-imported-arm64.test create mode 100644 deps/lld/test/COFF/locally-imported-warn-multiple.s create mode 100644 deps/lld/test/COFF/lto-cache.ll create mode 100644 deps/lld/test/COFF/lto-reloc-model.ll create mode 100644 deps/lld/test/COFF/manifestinput-error.test create mode 100644 deps/lld/test/COFF/manifestinput-nowarning.test delete mode 100644 deps/lld/test/COFF/nopdb.test create mode 100644 deps/lld/test/COFF/pdata-arm64.yaml create mode 100644 deps/lld/test/COFF/pdb-global-hashes.test create mode 100644 deps/lld/test/COFF/pdb-globals.test create mode 100644 deps/lld/test/COFF/pdb-heapsite.yaml create mode 100644 deps/lld/test/COFF/pdb-procid-remapping.test create mode 100644 deps/lld/test/COFF/pdb-publics-import.test create mode 100644 deps/lld/test/COFF/pdb-same-name.test create mode 100644 deps/lld/test/COFF/pdb-thunk.yaml create mode 100644 deps/lld/test/COFF/reloc-discarded-early.s create mode 100644 deps/lld/test/COFF/reloc-discarded-early2.s create mode 100644 deps/lld/test/COFF/safeseh-md.s create mode 100644 deps/lld/test/COFF/section-size.s create mode 100644 deps/lld/test/COFF/seh-comdat.test create mode 100644 deps/lld/test/COFF/strtab-size.s create mode 100644 deps/lld/test/COFF/subsystem-drectve.test create mode 100644 deps/lld/test/COFF/wholearchive.s create mode 100644 deps/lld/test/COFF/wx.s create mode 100644 deps/lld/test/ELF/Inputs/amdgpu-kernel-0.s create mode 100644 deps/lld/test/ELF/Inputs/amdgpu-kernel-1.s create mode 100644 deps/lld/test/ELF/Inputs/amdgpu-kernel-2.o create mode 100644 deps/lld/test/ELF/Inputs/compress-debug.s create mode 100644 deps/lld/test/ELF/Inputs/copy-rel-abs.s create mode 100644 deps/lld/test/ELF/Inputs/copy-rel-large.s create mode 100644 deps/lld/test/ELF/Inputs/corrupt-version-reference.so create mode 100644 deps/lld/test/ELF/Inputs/dynamic-list-weak-archive.s create mode 100644 deps/lld/test/ELF/Inputs/eh-frame.s create mode 100644 deps/lld/test/ELF/Inputs/gc-sections-shared.s create mode 100644 deps/lld/test/ELF/Inputs/gc-sections-shared2.s create mode 100755 deps/lld/test/ELF/Inputs/local-symbol-in-dso.so create mode 100644 deps/lld/test/ELF/Inputs/map-file5.s create mode 100644 deps/lld/test/ELF/Inputs/mips-micro.s create mode 100644 deps/lld/test/ELF/Inputs/shlib-undefined-ref.s create mode 100644 deps/lld/test/ELF/Inputs/undefined-error.s delete mode 100755 deps/lld/test/ELF/Inputs/verneed.so.sh create mode 100644 deps/lld/test/ELF/Inputs/verneed1.s delete mode 100755 deps/lld/test/ELF/Inputs/verneed1.so create mode 100644 deps/lld/test/ELF/Inputs/verneed2.s delete mode 100755 deps/lld/test/ELF/Inputs/verneed2.so create mode 100644 deps/lld/test/ELF/Inputs/weak-undef-lazy.s create mode 100644 deps/lld/test/ELF/Inputs/wrap-no-real.s create mode 100644 deps/lld/test/ELF/Inputs/wrap-no-real2.s create mode 100644 deps/lld/test/ELF/Inputs/writable-sec-plt-reloc.s create mode 100644 deps/lld/test/ELF/Inputs/znotext-copy-relocations.s create mode 100644 deps/lld/test/ELF/Inputs/znotext-plt-relocations-protected.s create mode 100644 deps/lld/test/ELF/Inputs/znotext-plt-relocations.s delete mode 100644 deps/lld/test/ELF/aarch64-call26-error.s create mode 100644 deps/lld/test/ELF/aarch64-call26-thunk.s create mode 100644 deps/lld/test/ELF/aarch64-cortex-a53-843419-address.s create mode 100644 deps/lld/test/ELF/aarch64-cortex-a53-843419-cli.s create mode 100644 deps/lld/test/ELF/aarch64-cortex-a53-843419-large.s create mode 100644 deps/lld/test/ELF/aarch64-cortex-a53-843419-nopatch.s create mode 100644 deps/lld/test/ELF/aarch64-cortex-a53-843419-recognize.s create mode 100644 deps/lld/test/ELF/aarch64-cortex-a53-843419-thunk.s delete mode 100644 deps/lld/test/ELF/aarch64-jump26-error.s create mode 100644 deps/lld/test/ELF/aarch64-jump26-thunk.s create mode 100644 deps/lld/test/ELF/aarch64-ldprel-lo19-invalid.s create mode 100644 deps/lld/test/ELF/aarch64-lo12-alignment.s create mode 100644 deps/lld/test/ELF/aarch64-load-alignment.s create mode 100644 deps/lld/test/ELF/aarch64-thunk-pi.s create mode 100644 deps/lld/test/ELF/aarch64-thunk-script.s create mode 100644 deps/lld/test/ELF/aarch64-thunk-section-location.s create mode 100644 deps/lld/test/ELF/amdgpu-elf-flags-err.s create mode 100644 deps/lld/test/ELF/amdgpu-elf-flags.s create mode 100644 deps/lld/test/ELF/arm-bl-v6.s create mode 100644 deps/lld/test/ELF/arm-blx-v4t.s delete mode 100644 deps/lld/test/ELF/arm-branch-error.s create mode 100644 deps/lld/test/ELF/arm-branch-rangethunk.s create mode 100644 deps/lld/test/ELF/arm-branch-undef-weak-plt-thunk.s create mode 100644 deps/lld/test/ELF/arm-exidx-dedup-and-sentinel.s create mode 100644 deps/lld/test/ELF/arm-exidx-dedup.s delete mode 100644 deps/lld/test/ELF/arm-thumb-branch-error.s create mode 100644 deps/lld/test/ELF/arm-thumb-branch-rangethunk.s create mode 100644 deps/lld/test/ELF/arm-thumb-condbranch-thunk.s create mode 100644 deps/lld/test/ELF/arm-thumb-mix-range-thunk-os.s create mode 100644 deps/lld/test/ELF/arm-thumb-plt-range-thunk-os.s create mode 100644 deps/lld/test/ELF/arm-thumb-range-thunk-os.s create mode 100644 deps/lld/test/ELF/arm-thumb-thunk-empty-pass.s create mode 100644 deps/lld/test/ELF/arm-thunk-edgecase.s create mode 100644 deps/lld/test/ELF/arm-thunk-largesection.s create mode 100644 deps/lld/test/ELF/arm-thunk-linkerscript-dotexpr.s create mode 100644 deps/lld/test/ELF/arm-thunk-linkerscript-large.s create mode 100644 deps/lld/test/ELF/arm-thunk-linkerscript-orphan.s create mode 100644 deps/lld/test/ELF/arm-thunk-linkerscript-sort.s create mode 100644 deps/lld/test/ELF/arm-thunk-linkerscript.s create mode 100644 deps/lld/test/ELF/arm-thunk-multipass.s create mode 100644 deps/lld/test/ELF/arm-thunk-re-add.s create mode 100644 deps/lld/test/ELF/arm-thunk-toolargesection.s create mode 100644 deps/lld/test/ELF/assignment-archive.s create mode 100644 deps/lld/test/ELF/chroot.s create mode 100644 deps/lld/test/ELF/common-gc.s create mode 100644 deps/lld/test/ELF/common-gc2.s create mode 100644 deps/lld/test/ELF/common-gc3.s create mode 100644 deps/lld/test/ELF/compress-debug-sections-reloc.s create mode 100644 deps/lld/test/ELF/compressed-debug-conflict.s create mode 100644 deps/lld/test/ELF/conflict-debug-variable.s create mode 100644 deps/lld/test/ELF/conflict-debug-variable2.s create mode 100644 deps/lld/test/ELF/copy-rel-abs.s create mode 100644 deps/lld/test/ELF/copy-rel-large.s create mode 100644 deps/lld/test/ELF/corrupted-version-reference.s create mode 100644 deps/lld/test/ELF/defsym-dynamic.s create mode 100644 deps/lld/test/ELF/dynamic-list-empty.s create mode 100644 deps/lld/test/ELF/dynamic-list-preempt.s create mode 100644 deps/lld/test/ELF/dynamic-list-weak-archive.s create mode 100644 deps/lld/test/ELF/dynamic-list-wildcard.s create mode 100644 deps/lld/test/ELF/dynamic-no-rosegment.s create mode 100644 deps/lld/test/ELF/dynstr-no-rosegment.s create mode 100644 deps/lld/test/ELF/dynsym-no-rosegment.s create mode 100644 deps/lld/test/ELF/edata-no-bss.s create mode 100644 deps/lld/test/ELF/eh-frame-hdr-icf-fde.s create mode 100644 deps/lld/test/ELF/eh-frame.s create mode 100644 deps/lld/test/ELF/emit-relocs-gc.s create mode 100644 deps/lld/test/ELF/emit-relocs-mergeable-i386.s create mode 100644 deps/lld/test/ELF/emit-relocs-mergeable.s create mode 100644 deps/lld/test/ELF/executable-undefined-ignoreall.s create mode 100644 deps/lld/test/ELF/executable-undefined-protected-ignoreall.s create mode 100644 deps/lld/test/ELF/file-access.s create mode 100644 deps/lld/test/ELF/fill-trap.s create mode 100644 deps/lld/test/ELF/format-binary-non-ascii.s create mode 100644 deps/lld/test/ELF/gc-collect-undefined.s create mode 100644 deps/lld/test/ELF/gc-sections-linker-defined-symbol.s create mode 100644 deps/lld/test/ELF/gc-sections-undefined.s create mode 100644 deps/lld/test/ELF/gdb-index-base-addr.s create mode 100644 deps/lld/test/ELF/gdb-index-noranges.s create mode 100644 deps/lld/test/ELF/gdb-index-tls.s create mode 100644 deps/lld/test/ELF/gnu-hash-table-copy.s create mode 100644 deps/lld/test/ELF/gnu-hash-table-many.s create mode 100644 deps/lld/test/ELF/gnu-hash-table-rwsegment.s create mode 100644 deps/lld/test/ELF/gnu-ifunc-dynsym.s create mode 100644 deps/lld/test/ELF/gnu-ifunc-dyntags.s create mode 100644 deps/lld/test/ELF/got32-i386-pie-rw.s create mode 100644 deps/lld/test/ELF/help.s create mode 100644 deps/lld/test/ELF/i386-debug-noabs.test create mode 100644 deps/lld/test/ELF/i386-got-value.s create mode 100644 deps/lld/test/ELF/i386-tls-initial-exec-local.s create mode 100644 deps/lld/test/ELF/icf-symbol-type.s create mode 100644 deps/lld/test/ELF/invalid-local-symbol-in-dso.s create mode 100644 deps/lld/test/ELF/invalid-undef-section-symbol.test delete mode 100644 deps/lld/test/ELF/invalid/Inputs/section-index2.elf create mode 100644 deps/lld/test/ELF/linkerscript/Inputs/common-filespec1.s create mode 100644 deps/lld/test/ELF/linkerscript/Inputs/common-filespec2.s create mode 100644 deps/lld/test/ELF/linkerscript/Inputs/copy-rel-symbol-value.s create mode 100644 deps/lld/test/ELF/linkerscript/Inputs/provide-shared.s create mode 100644 deps/lld/test/ELF/linkerscript/Inputs/symbol-reserved.script create mode 100644 deps/lld/test/ELF/linkerscript/absolute2.s create mode 100644 deps/lld/test/ELF/linkerscript/align-section-offset.s create mode 100644 deps/lld/test/ELF/linkerscript/align-section.s create mode 100644 deps/lld/test/ELF/linkerscript/arm-exidx-order.s create mode 100644 deps/lld/test/ELF/linkerscript/arm-exidx-sentinel-and-assignment.s create mode 100644 deps/lld/test/ELF/linkerscript/common-exclude.s create mode 100644 deps/lld/test/ELF/linkerscript/common-filespec.s create mode 100644 deps/lld/test/ELF/linkerscript/compress-debug-sections-custom.s create mode 100644 deps/lld/test/ELF/linkerscript/copy-rel-symbol-value-err.s create mode 100644 deps/lld/test/ELF/linkerscript/copy-rel-symbol-value.s create mode 100644 deps/lld/test/ELF/linkerscript/emit-reloc-section-names.s create mode 100644 deps/lld/test/ELF/linkerscript/header-phdr.s create mode 100644 deps/lld/test/ELF/linkerscript/image-base.s create mode 100644 deps/lld/test/ELF/linkerscript/include-cycle.s create mode 100644 deps/lld/test/ELF/linkerscript/linker-script-in-search-path.s create mode 100644 deps/lld/test/ELF/linkerscript/memory-at.s create mode 100644 deps/lld/test/ELF/linkerscript/memory-err.s create mode 100644 deps/lld/test/ELF/linkerscript/memory2.s create mode 100644 deps/lld/test/ELF/linkerscript/memory3.s create mode 100644 deps/lld/test/ELF/linkerscript/nobits-offset.s create mode 100644 deps/lld/test/ELF/linkerscript/orphan-discard.s create mode 100644 deps/lld/test/ELF/linkerscript/orphan-end.s create mode 100644 deps/lld/test/ELF/linkerscript/orphan-phdrs.s create mode 100644 deps/lld/test/ELF/linkerscript/orphan-report.s create mode 100644 deps/lld/test/ELF/linkerscript/provide-shared.s create mode 100644 deps/lld/test/ELF/linkerscript/region-alias.s create mode 100644 deps/lld/test/ELF/linkerscript/segment-headers.s create mode 100644 deps/lld/test/ELF/linkerscript/symbol-only-flags.s create mode 100644 deps/lld/test/ELF/linkerscript/symbol-ordering-file.s create mode 100644 deps/lld/test/ELF/linkerscript/thunk-gen-mips.s create mode 100644 deps/lld/test/ELF/linkerscript/version-linker-symbol.s create mode 100644 deps/lld/test/ELF/lto-plugin-ignore.s create mode 100644 deps/lld/test/ELF/lto/Inputs/data-ordering-lto.ll create mode 100644 deps/lld/test/ELF/lto/Inputs/linker-script-symbols-ipo.ll create mode 100644 deps/lld/test/ELF/lto/Inputs/symbol-ordering-lto.ll create mode 100644 deps/lld/test/ELF/lto/data-ordering-lto.s create mode 100644 deps/lld/test/ELF/lto/keep-undefined.ll create mode 100644 deps/lld/test/ELF/lto/linker-script-symbols-assign.ll create mode 100644 deps/lld/test/ELF/lto/linker-script-symbols-ipo.ll create mode 100644 deps/lld/test/ELF/lto/linker-script-symbols.ll create mode 100644 deps/lld/test/ELF/lto/relocatable.ll create mode 100644 deps/lld/test/ELF/lto/section-name.ll create mode 100644 deps/lld/test/ELF/lto/symbol-ordering-lto.s create mode 100644 deps/lld/test/ELF/merge-align.s create mode 100644 deps/lld/test/ELF/merge-entsize.s create mode 100644 deps/lld/test/ELF/mips-26-n32-n64.s create mode 100644 deps/lld/test/ELF/mips-got-page-script.s create mode 100644 deps/lld/test/ELF/mips-got-script.s create mode 100644 deps/lld/test/ELF/mips-micro-got.s create mode 100644 deps/lld/test/ELF/mips-micro-got64.s create mode 100644 deps/lld/test/ELF/mips-micro-jal.s create mode 100644 deps/lld/test/ELF/mips-micro-plt.s create mode 100644 deps/lld/test/ELF/mips-micro-relocs.s create mode 100644 deps/lld/test/ELF/mips-micro-thunks.s create mode 100644 deps/lld/test/ELF/mips-out-of-bounds-call16-reloc.s create mode 100644 deps/lld/test/ELF/pack-dyn-relocs.s create mode 100644 deps/lld/test/ELF/pr34660.s create mode 100644 deps/lld/test/ELF/pr34872.s create mode 100644 deps/lld/test/ELF/relocatable-comdat2.s create mode 100644 deps/lld/test/ELF/relocation-b-aarch64.test create mode 100644 deps/lld/test/ELF/relocation-size-err.s create mode 100644 deps/lld/test/ELF/relro-copyrel-bss-script.s create mode 100644 deps/lld/test/ELF/relro-non-contiguous-script-data.s create mode 100644 deps/lld/test/ELF/relro-non-contiguous.s create mode 100644 deps/lld/test/ELF/relro-script.s create mode 100644 deps/lld/test/ELF/shared-lazy.s create mode 100644 deps/lld/test/ELF/shlib-undefined-shared.s create mode 100644 deps/lld/test/ELF/silent-ignore.test create mode 100644 deps/lld/test/ELF/symbol-ordering-file2.s create mode 100644 deps/lld/test/ELF/sysv-hash-no-rosegment.s create mode 100644 deps/lld/test/ELF/typed-undef.s create mode 100644 deps/lld/test/ELF/undef-broken-debug.test create mode 100644 deps/lld/test/ELF/weak-entry.s create mode 100644 deps/lld/test/ELF/weak-undef-export.s create mode 100644 deps/lld/test/ELF/weak-undef-lazy.s create mode 100644 deps/lld/test/ELF/weak-undef-rw.s create mode 100644 deps/lld/test/ELF/weak-undef-val.s create mode 100644 deps/lld/test/ELF/wrap-no-real.s create mode 100644 deps/lld/test/ELF/writable-sec-plt-reloc.s create mode 100644 deps/lld/test/ELF/znotext-copy-relocation.s create mode 100644 deps/lld/test/ELF/znotext-plt-relocations-protected.s create mode 100644 deps/lld/test/ELF/znotext-plt-relocations.s create mode 100644 deps/lld/test/ELF/znotext-weak-undef.s create mode 100644 deps/lld/test/MinGW/driver.test create mode 100644 deps/lld/test/MinGW/lib.test rename deps/lld/test/Unit/{lit.cfg => lit.cfg.py} (51%) rename deps/lld/test/Unit/{lit.site.cfg.in => lit.site.cfg.py.in} (90%) delete mode 100644 deps/lld/test/lit.cfg create mode 100644 deps/lld/test/lit.cfg.py rename deps/lld/test/{lit.site.cfg.in => lit.site.cfg.py.in} (86%) create mode 100644 deps/lld/test/wasm/Inputs/archive1.ll create mode 100644 deps/lld/test/wasm/Inputs/archive2.ll create mode 100644 deps/lld/test/wasm/Inputs/call-indirect.ll create mode 100644 deps/lld/test/wasm/Inputs/global-ctor-dtor.ll create mode 100644 deps/lld/test/wasm/Inputs/hello.ll create mode 100644 deps/lld/test/wasm/Inputs/hidden.ll create mode 100644 deps/lld/test/wasm/Inputs/many-funcs.ll create mode 100644 deps/lld/test/wasm/Inputs/ret32.ll create mode 100644 deps/lld/test/wasm/Inputs/ret64.ll create mode 100644 deps/lld/test/wasm/Inputs/weak-alias.ll create mode 100644 deps/lld/test/wasm/Inputs/weak-symbol1.ll create mode 100644 deps/lld/test/wasm/Inputs/weak-symbol2.ll create mode 100644 deps/lld/test/wasm/archive.ll create mode 100644 deps/lld/test/wasm/call-indirect.ll create mode 100644 deps/lld/test/wasm/conflict.test create mode 100644 deps/lld/test/wasm/data-layout.ll create mode 100644 deps/lld/test/wasm/entry.ll create mode 100644 deps/lld/test/wasm/function-imports-first.ll create mode 100644 deps/lld/test/wasm/function-imports.ll create mode 100644 deps/lld/test/wasm/function-index.test create mode 100644 deps/lld/test/wasm/import-memory.test create mode 100644 deps/lld/test/wasm/init-fini.ll create mode 100644 deps/lld/test/wasm/invalid-stack-size.test create mode 100644 deps/lld/test/wasm/lit.local.cfg create mode 100644 deps/lld/test/wasm/load-undefined.ll create mode 100644 deps/lld/test/wasm/local-symbols.ll create mode 100644 deps/lld/test/wasm/many-functions.ll create mode 100644 deps/lld/test/wasm/relocatable.ll create mode 100644 deps/lld/test/wasm/signature-mismatch.ll create mode 100644 deps/lld/test/wasm/stack-pointer.ll create mode 100644 deps/lld/test/wasm/strip-debug.test create mode 100644 deps/lld/test/wasm/symbol-type-mismatch.ll create mode 100644 deps/lld/test/wasm/undefined-entry.test create mode 100644 deps/lld/test/wasm/undefined.ll create mode 100644 deps/lld/test/wasm/version.ll create mode 100644 deps/lld/test/wasm/visibility-hidden.ll create mode 100644 deps/lld/test/wasm/weak-alias-overide.ll create mode 100644 deps/lld/test/wasm/weak-alias.ll create mode 100644 deps/lld/test/wasm/weak-external.ll create mode 100644 deps/lld/test/wasm/weak-symbols.ll create mode 100755 deps/lld/utils/benchmark.py create mode 100644 deps/lld/utils/link.yaml create mode 100644 deps/lld/wasm/CMakeLists.txt create mode 100644 deps/lld/wasm/Config.h create mode 100644 deps/lld/wasm/Driver.cpp create mode 100644 deps/lld/wasm/InputFiles.cpp create mode 100644 deps/lld/wasm/InputFiles.h create mode 100644 deps/lld/wasm/InputSegment.cpp create mode 100644 deps/lld/wasm/InputSegment.h create mode 100644 deps/lld/wasm/Options.td create mode 100644 deps/lld/wasm/OutputSections.cpp create mode 100644 deps/lld/wasm/OutputSections.h create mode 100644 deps/lld/wasm/OutputSegment.h create mode 100644 deps/lld/wasm/SymbolTable.cpp create mode 100644 deps/lld/wasm/SymbolTable.h create mode 100644 deps/lld/wasm/Symbols.cpp create mode 100644 deps/lld/wasm/Symbols.h create mode 100644 deps/lld/wasm/Writer.cpp create mode 100644 deps/lld/wasm/Writer.h create mode 100644 deps/lld/wasm/WriterUtils.cpp create mode 100644 deps/lld/wasm/WriterUtils.h diff --git a/CMakeLists.txt b/CMakeLists.txt index fd39dd30da..95796385ca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,97 +64,118 @@ else() include_directories(${LLVM_INCLUDE_DIRS}) include_directories(${CLANG_INCLUDE_DIRS}) set(EMBEDDED_LLD_LIB_SOURCES - "${CMAKE_SOURCE_DIR}/deps/lld/lib/Driver/DarwinLdDriver.cpp" - "${CMAKE_SOURCE_DIR}/deps/lld/lib/Config/Version.cpp" - "${CMAKE_SOURCE_DIR}/deps/lld/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp" - "${CMAKE_SOURCE_DIR}/deps/lld/lib/ReaderWriter/MachO/LayoutPass.cpp" - "${CMAKE_SOURCE_DIR}/deps/lld/lib/ReaderWriter/MachO/ArchHandler.cpp" - "${CMAKE_SOURCE_DIR}/deps/lld/lib/ReaderWriter/MachO/ArchHandler_arm64.cpp" - "${CMAKE_SOURCE_DIR}/deps/lld/lib/ReaderWriter/MachO/ObjCPass.cpp" - "${CMAKE_SOURCE_DIR}/deps/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp" - "${CMAKE_SOURCE_DIR}/deps/lld/lib/ReaderWriter/MachO/CompactUnwindPass.cpp" - "${CMAKE_SOURCE_DIR}/deps/lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp" - "${CMAKE_SOURCE_DIR}/deps/lld/lib/ReaderWriter/MachO/TLVPass.cpp" - "${CMAKE_SOURCE_DIR}/deps/lld/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp" - "${CMAKE_SOURCE_DIR}/deps/lld/lib/ReaderWriter/MachO/GOTPass.cpp" - "${CMAKE_SOURCE_DIR}/deps/lld/lib/ReaderWriter/MachO/ArchHandler_x86.cpp" - "${CMAKE_SOURCE_DIR}/deps/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp" - "${CMAKE_SOURCE_DIR}/deps/lld/lib/ReaderWriter/MachO/ArchHandler_x86_64.cpp" - "${CMAKE_SOURCE_DIR}/deps/lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp" - "${CMAKE_SOURCE_DIR}/deps/lld/lib/ReaderWriter/MachO/ShimPass.cpp" - "${CMAKE_SOURCE_DIR}/deps/lld/lib/ReaderWriter/MachO/WriterMachO.cpp" - "${CMAKE_SOURCE_DIR}/deps/lld/lib/ReaderWriter/MachO/StubsPass.cpp" - "${CMAKE_SOURCE_DIR}/deps/lld/lib/ReaderWriter/MachO/ArchHandler_arm.cpp" - "${CMAKE_SOURCE_DIR}/deps/lld/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp" - "${CMAKE_SOURCE_DIR}/deps/lld/lib/ReaderWriter/FileArchive.cpp" - "${CMAKE_SOURCE_DIR}/deps/lld/lib/Core/TargetOptionsCommandFlags.cpp" - "${CMAKE_SOURCE_DIR}/deps/lld/lib/Core/File.cpp" - "${CMAKE_SOURCE_DIR}/deps/lld/lib/Core/Error.cpp" - "${CMAKE_SOURCE_DIR}/deps/lld/lib/Core/SymbolTable.cpp" - "${CMAKE_SOURCE_DIR}/deps/lld/lib/Core/Reader.cpp" - "${CMAKE_SOURCE_DIR}/deps/lld/lib/Core/Reproduce.cpp" - "${CMAKE_SOURCE_DIR}/deps/lld/lib/Core/Writer.cpp" - "${CMAKE_SOURCE_DIR}/deps/lld/lib/Core/LinkingContext.cpp" - "${CMAKE_SOURCE_DIR}/deps/lld/lib/Core/Resolver.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/Common/Args.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/Common/ErrorHandler.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/Common/Memory.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/Common/Reproduce.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/Common/Strings.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/Common/TargetOptionsCommandFlags.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/Common/Threads.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/Common/Version.cpp" "${CMAKE_SOURCE_DIR}/deps/lld/lib/Core/DefinedAtom.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/lib/Core/Error.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/lib/Core/File.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/lib/Core/LinkingContext.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/lib/Core/Reader.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/lib/Core/Resolver.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/lib/Core/SymbolTable.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/lib/Core/Writer.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/lib/Driver/DarwinLdDriver.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/lib/ReaderWriter/FileArchive.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/lib/ReaderWriter/MachO/ArchHandler.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/lib/ReaderWriter/MachO/ArchHandler_arm.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/lib/ReaderWriter/MachO/ArchHandler_arm64.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/lib/ReaderWriter/MachO/ArchHandler_x86.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/lib/ReaderWriter/MachO/ArchHandler_x86_64.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/lib/ReaderWriter/MachO/CompactUnwindPass.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/lib/ReaderWriter/MachO/GOTPass.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/lib/ReaderWriter/MachO/LayoutPass.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/lib/ReaderWriter/MachO/ObjCPass.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/lib/ReaderWriter/MachO/ShimPass.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/lib/ReaderWriter/MachO/StubsPass.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/lib/ReaderWriter/MachO/TLVPass.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/lib/ReaderWriter/MachO/WriterMachO.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp" ) set(EMBEDDED_LLD_ELF_SOURCES - "${CMAKE_SOURCE_DIR}/deps/lld/ELF/ScriptLexer.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/ELF/AArch64ErrataFix.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/ELF/Arch/AArch64.cpp" "${CMAKE_SOURCE_DIR}/deps/lld/ELF/Arch/AMDGPU.cpp" - "${CMAKE_SOURCE_DIR}/deps/lld/ELF/Arch/PPC.cpp" "${CMAKE_SOURCE_DIR}/deps/lld/ELF/Arch/ARM.cpp" "${CMAKE_SOURCE_DIR}/deps/lld/ELF/Arch/AVR.cpp" - "${CMAKE_SOURCE_DIR}/deps/lld/ELF/Arch/SPARCV9.cpp" "${CMAKE_SOURCE_DIR}/deps/lld/ELF/Arch/Mips.cpp" - "${CMAKE_SOURCE_DIR}/deps/lld/ELF/Arch/AArch64.cpp" - "${CMAKE_SOURCE_DIR}/deps/lld/ELF/Arch/X86_64.cpp" - "${CMAKE_SOURCE_DIR}/deps/lld/ELF/Arch/PPC64.cpp" "${CMAKE_SOURCE_DIR}/deps/lld/ELF/Arch/MipsArchTree.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/ELF/Arch/PPC.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/ELF/Arch/PPC64.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/ELF/Arch/SPARCV9.cpp" "${CMAKE_SOURCE_DIR}/deps/lld/ELF/Arch/X86.cpp" - "${CMAKE_SOURCE_DIR}/deps/lld/ELF/GdbIndex.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/ELF/Arch/X86_64.cpp" "${CMAKE_SOURCE_DIR}/deps/lld/ELF/Driver.cpp" - "${CMAKE_SOURCE_DIR}/deps/lld/ELF/Relocations.cpp" - "${CMAKE_SOURCE_DIR}/deps/lld/ELF/Error.cpp" - "${CMAKE_SOURCE_DIR}/deps/lld/ELF/LTO.cpp" - "${CMAKE_SOURCE_DIR}/deps/lld/ELF/Strings.cpp" - "${CMAKE_SOURCE_DIR}/deps/lld/ELF/ScriptParser.cpp" - "${CMAKE_SOURCE_DIR}/deps/lld/ELF/MarkLive.cpp" - "${CMAKE_SOURCE_DIR}/deps/lld/ELF/SyntheticSections.cpp" - "${CMAKE_SOURCE_DIR}/deps/lld/ELF/SymbolTable.cpp" - "${CMAKE_SOURCE_DIR}/deps/lld/ELF/LinkerScript.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/ELF/DriverUtils.cpp" "${CMAKE_SOURCE_DIR}/deps/lld/ELF/EhFrame.cpp" - "${CMAKE_SOURCE_DIR}/deps/lld/ELF/Target.cpp" "${CMAKE_SOURCE_DIR}/deps/lld/ELF/Filesystem.cpp" - "${CMAKE_SOURCE_DIR}/deps/lld/ELF/OutputSections.cpp" - "${CMAKE_SOURCE_DIR}/deps/lld/ELF/Symbols.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/ELF/GdbIndex.cpp" "${CMAKE_SOURCE_DIR}/deps/lld/ELF/ICF.cpp" "${CMAKE_SOURCE_DIR}/deps/lld/ELF/InputFiles.cpp" - "${CMAKE_SOURCE_DIR}/deps/lld/ELF/Thunks.cpp" - "${CMAKE_SOURCE_DIR}/deps/lld/ELF/DriverUtils.cpp" - "${CMAKE_SOURCE_DIR}/deps/lld/ELF/Writer.cpp" "${CMAKE_SOURCE_DIR}/deps/lld/ELF/InputSection.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/ELF/LTO.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/ELF/LinkerScript.cpp" "${CMAKE_SOURCE_DIR}/deps/lld/ELF/MapFile.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/ELF/MarkLive.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/ELF/OutputSections.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/ELF/Relocations.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/ELF/ScriptLexer.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/ELF/ScriptParser.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/ELF/Strings.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/ELF/SymbolTable.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/ELF/Symbols.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/ELF/SyntheticSections.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/ELF/Target.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/ELF/Thunks.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/ELF/Writer.cpp" ) + set(EMBEDDED_LLD_COFF_SOURCES + "${CMAKE_SOURCE_DIR}/deps/lld/COFF/Chunks.cpp" "${CMAKE_SOURCE_DIR}/deps/lld/COFF/DLL.cpp" "${CMAKE_SOURCE_DIR}/deps/lld/COFF/Driver.cpp" - "${CMAKE_SOURCE_DIR}/deps/lld/COFF/Chunks.cpp" - "${CMAKE_SOURCE_DIR}/deps/lld/COFF/PDB.cpp" - "${CMAKE_SOURCE_DIR}/deps/lld/COFF/Error.cpp" - "${CMAKE_SOURCE_DIR}/deps/lld/COFF/LTO.cpp" - "${CMAKE_SOURCE_DIR}/deps/lld/COFF/Strings.cpp" - "${CMAKE_SOURCE_DIR}/deps/lld/COFF/MarkLive.cpp" - "${CMAKE_SOURCE_DIR}/deps/lld/COFF/SymbolTable.cpp" - "${CMAKE_SOURCE_DIR}/deps/lld/COFF/Symbols.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/COFF/DriverUtils.cpp" "${CMAKE_SOURCE_DIR}/deps/lld/COFF/ICF.cpp" "${CMAKE_SOURCE_DIR}/deps/lld/COFF/InputFiles.cpp" - "${CMAKE_SOURCE_DIR}/deps/lld/COFF/DriverUtils.cpp" - "${CMAKE_SOURCE_DIR}/deps/lld/COFF/Writer.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/COFF/LTO.cpp" "${CMAKE_SOURCE_DIR}/deps/lld/COFF/MapFile.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/COFF/MarkLive.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/COFF/MinGW.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/COFF/PDB.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/COFF/Strings.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/COFF/SymbolTable.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/COFF/Symbols.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/COFF/Writer.cpp" + ) + set(EMBEDDED_LLD_MINGW_SOURCES + "${CMAKE_SOURCE_DIR}/deps/lld/MinGW/Driver.cpp" + ) + set(EMBEDDED_LLD_WASM_SOURCES + "${CMAKE_SOURCE_DIR}/deps/lld/wasm/Driver.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/wasm/InputFiles.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/wasm/InputSegment.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/wasm/OutputSections.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/wasm/Symbols.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/wasm/SymbolTable.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/wasm/Writer.cpp" + "${CMAKE_SOURCE_DIR}/deps/lld/wasm/WriterUtils.cpp" ) add_library(embedded_lld_lib ${EMBEDDED_LLD_LIB_SOURCES}) add_library(embedded_lld_elf ${EMBEDDED_LLD_ELF_SOURCES}) add_library(embedded_lld_coff ${EMBEDDED_LLD_COFF_SOURCES}) + add_library(embedded_lld_mingw ${EMBEDDED_LLD_MINGW_SOURCES}) + add_library(embedded_lld_wasm ${EMBEDDED_LLD_WASM_SOURCES}) if(MSVC) set(ZIG_LLD_COMPILE_FLAGS "-std=c++11 -D_CRT_SECURE_NO_WARNINGS /w") else() @@ -172,6 +193,14 @@ else() COMPILE_FLAGS ${ZIG_LLD_COMPILE_FLAGS} LINK_FLAGS " " ) + set_target_properties(embedded_lld_mingw PROPERTIES + COMPILE_FLAGS ${ZIG_LLD_COMPILE_FLAGS} + LINK_FLAGS " " + ) + set_target_properties(embedded_lld_wasm PROPERTIES + COMPILE_FLAGS ${ZIG_LLD_COMPILE_FLAGS} + LINK_FLAGS " " + ) target_include_directories(embedded_lld_lib PUBLIC "${CMAKE_SOURCE_DIR}/deps/lld/include" "${CMAKE_SOURCE_DIR}/deps/lld-prebuilt" @@ -188,13 +217,27 @@ else() "${CMAKE_SOURCE_DIR}/deps/lld-prebuilt/COFF" "${CMAKE_SOURCE_DIR}/deps/lld-prebuilt" ) + target_include_directories(embedded_lld_mingw PUBLIC + "${CMAKE_SOURCE_DIR}/deps/lld/MinGW" + "${CMAKE_SOURCE_DIR}/deps/lld/include" + "${CMAKE_SOURCE_DIR}/deps/lld-prebuilt/MinGW" + "${CMAKE_SOURCE_DIR}/deps/lld-prebuilt" + ) + target_include_directories(embedded_lld_wasm PUBLIC + "${CMAKE_SOURCE_DIR}/deps/lld/wasm" + "${CMAKE_SOURCE_DIR}/deps/lld/include" + "${CMAKE_SOURCE_DIR}/deps/lld-prebuilt/wasm" + "${CMAKE_SOURCE_DIR}/deps/lld-prebuilt" + ) set(LLD_INCLUDE_DIRS "") set(LLD_LIBRARIES embedded_lld_elf embedded_lld_coff + embedded_lld_mingw + embedded_lld_wasm embedded_lld_lib ) - install(TARGETS embedded_lld_elf embedded_lld_coff embedded_lld_lib DESTINATION "${ZIG_CPP_LIB_DIR}") + install(TARGETS embedded_lld_elf embedded_lld_coff embedded_lld_mingw embedded_lld_wasm embedded_lld_lib DESTINATION "${ZIG_CPP_LIB_DIR}") endif() # No patches have been applied to SoftFloat-3d diff --git a/deps/lld-prebuilt/COFF/Options.inc b/deps/lld-prebuilt/COFF/Options.inc index a2a0f3f892..b5414ffa0b 100644 --- a/deps/lld-prebuilt/COFF/Options.inc +++ b/deps/lld-prebuilt/COFF/Options.inc @@ -12,9 +12,10 @@ #ifdef PREFIX #define COMMA , PREFIX(prefix_0, {nullptr}) +PREFIX(prefix_3, {"--" COMMA nullptr}) PREFIX(prefix_2, {"/" COMMA "-" COMMA nullptr}) PREFIX(prefix_1, {"/" COMMA "-" COMMA "-?" COMMA nullptr}) -PREFIX(prefix_3, {"/?" COMMA "-?" COMMA nullptr}) +PREFIX(prefix_4, {"/?" COMMA "-?" COMMA nullptr}) #undef COMMA #endif // PREFIX @@ -30,19 +31,26 @@ OPTION(prefix_0, "", INPUT, Input, INVALID, INVALID, nullptr, 0, 0, nullp OPTION(prefix_0, "", UNKNOWN, Unknown, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) OPTION(prefix_1, "align:", align, Joined, INVALID, INVALID, nullptr, 0, 0, "Section alignment", nullptr, nullptr) +OPTION(prefix_1, "aligncomm:", aligncomm, Joined, INVALID, INVALID, nullptr, 0, 0, + "Set common symbol alignment", nullptr, nullptr) OPTION(prefix_1, "allowbind:no", allowbind_no, Flag, INVALID, INVALID, nullptr, 0, 0, "Disable DLL binding", nullptr, nullptr) -OPTION(prefix_1, "allowbind", allowbind, Flag, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) +OPTION(prefix_1, "allowbind", allowbind, Flag, INVALID, INVALID, nullptr, 0, 0, + "Enable DLL binding (default)", nullptr, nullptr) OPTION(prefix_1, "allowisolation:no", allowisolation_no, Flag, INVALID, INVALID, nullptr, 0, 0, - "Set NO_ISOLATION bit", nullptr, nullptr) -OPTION(prefix_1, "allowisolation", allowisolation, Flag, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) + "Disable DLL isolation", nullptr, nullptr) +OPTION(prefix_1, "allowisolation", allowisolation, Flag, INVALID, INVALID, nullptr, 0, 0, + "Enable DLL isolation (default)", nullptr, nullptr) OPTION(prefix_1, "alternatename:", alternatename, Joined, INVALID, INVALID, nullptr, 0, 0, "Define weak alias", nullptr, nullptr) OPTION(prefix_1, "appcontainer:no", appcontainer_no, Flag, INVALID, INVALID, nullptr, 0, 0, + "Image can run outside an app container (default)", nullptr, nullptr) +OPTION(prefix_1, "appcontainer", appcontainer, Flag, INVALID, INVALID, nullptr, 0, 0, "Image can only be run in an app container", nullptr, nullptr) -OPTION(prefix_1, "appcontainer", appcontainer, Flag, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) OPTION(prefix_1, "base:", base, Joined, INVALID, INVALID, nullptr, 0, 0, "Base address of the program", nullptr, nullptr) +OPTION(prefix_1, "debug:dwarf", debug_dwarf, Flag, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) +OPTION(prefix_1, "debug:ghash", debug_ghash, Flag, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) OPTION(prefix_1, "debugtype:", debugtype, Joined, INVALID, INVALID, nullptr, 0, 0, "Debug Info Options", nullptr, nullptr) OPTION(prefix_1, "debug", debug, Flag, INVALID, INVALID, nullptr, 0, 0, @@ -60,22 +68,25 @@ OPTION(prefix_1, "dll", dll, Flag, INVALID, INVALID, nullptr, 0, 0, OPTION(prefix_1, "driver:", driver, Joined, INVALID, INVALID, nullptr, 0, 0, "Generate a Windows NT Kernel Mode Driver", nullptr, nullptr) OPTION(prefix_1, "dynamicbase:no", dynamicbase_no, Flag, INVALID, INVALID, nullptr, 0, 0, - "Disable address space layout randomization", nullptr, nullptr) -OPTION(prefix_1, "dynamicbase", dynamicbase, Flag, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) + "Disable ASLR (default when /fixed)", nullptr, nullptr) +OPTION(prefix_1, "dynamicbase", dynamicbase, Flag, INVALID, INVALID, nullptr, 0, 0, + "Enable ASLR (default unless /fixed)", nullptr, nullptr) OPTION(prefix_1, "editandcontinue", editandcontinue, Flag, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) OPTION(prefix_1, "entry:", entry, Joined, INVALID, INVALID, nullptr, 0, 0, "Name of entry point symbol", nullptr, nullptr) OPTION(prefix_1, "errorlimit:", errorlimit, Joined, INVALID, INVALID, nullptr, 0, 0, "Maximum number of errors to emit before stopping (0 = no limit)", nullptr, nullptr) OPTION(prefix_1, "errorreport:", errorreport, Joined, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) +OPTION(prefix_1, "export-all-symbols", export_all_symbols, Flag, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) OPTION(prefix_1, "export:", export, Joined, INVALID, INVALID, nullptr, 0, 0, "Export a function", nullptr, nullptr) OPTION(prefix_1, "failifmismatch:", failifmismatch, Joined, INVALID, INVALID, nullptr, 0, 0, "", nullptr, nullptr) OPTION(prefix_1, "fastfail", fastfail, Flag, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) OPTION(prefix_1, "fixed:no", fixed_no, Flag, INVALID, INVALID, nullptr, 0, 0, - "Enable base relocations", nullptr, nullptr) -OPTION(prefix_1, "fixed", fixed, Flag, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) + "Enable base relocations (default)", nullptr, nullptr) +OPTION(prefix_1, "fixed", fixed, Flag, INVALID, INVALID, nullptr, 0, 0, + "Disable base relocations", nullptr, nullptr) OPTION(prefix_1, "force:unresolved", force_unresolved, Flag, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) OPTION(prefix_1, "force", force, Flag, INVALID, INVALID, nullptr, 0, 0, "Allow undefined symbols when creating executables", nullptr, nullptr) @@ -85,10 +96,12 @@ OPTION(prefix_1, "heap:", heap, Joined, INVALID, INVALID, nullptr, 0, 0, "Size of the heap", nullptr, nullptr) OPTION(prefix_1, "help", help, Flag, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) OPTION(prefix_1, "highentropyva:no", highentropyva_no, Flag, INVALID, INVALID, nullptr, 0, 0, - "Set HIGH_ENTROPY_VA bit", nullptr, nullptr) -OPTION(prefix_1, "highentropyva", highentropyva, Flag, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) + "Disable 64-bit ASLR", nullptr, nullptr) +OPTION(prefix_1, "highentropyva", highentropyva, Flag, INVALID, INVALID, nullptr, 0, 0, + "Enable 64-bit ASLR (default on 64-bit)", nullptr, nullptr) OPTION(prefix_1, "idlout:", idlout, Joined, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) -OPTION(prefix_1, "ignore:", ignore, Joined, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) +OPTION(prefix_1, "ignore:", ignore, Joined, INVALID, INVALID, nullptr, 0, 0, + "Specify warning codes to ignore", nullptr, nullptr) OPTION(prefix_1, "ignoreidl", ignoreidl, Flag, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) OPTION(prefix_1, "implib:", implib, Joined, INVALID, INVALID, nullptr, 0, 0, "Import library name", nullptr, nullptr) @@ -97,14 +110,20 @@ OPTION(prefix_2, "include:", incl, Joined, INVALID, INVALID, nullptr, 0, 0, OPTION(prefix_1, "incremental:no", no_incremental, Flag, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) OPTION(prefix_1, "incremental", incremental, Flag, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) OPTION(prefix_1, "largeaddressaware:no", largeaddressaware_no, Flag, INVALID, INVALID, nullptr, 0, 0, - "Disable large addresses", nullptr, nullptr) -OPTION(prefix_1, "largeaddressaware", largeaddressaware, Flag, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) + "Disable large addresses (default on 32-bit)", nullptr, nullptr) +OPTION(prefix_1, "largeaddressaware", largeaddressaware, Flag, INVALID, INVALID, nullptr, 0, 0, + "Enable large addresses (default on 64-bit)", nullptr, nullptr) OPTION(prefix_1, "libpath:", libpath, Joined, INVALID, INVALID, nullptr, 0, 0, "Additional library search path", nullptr, nullptr) OPTION(prefix_1, "linkrepro:", linkrepro, Joined, INVALID, INVALID, nullptr, 0, 0, "Dump linker invocation and input files for debugging", nullptr, nullptr) +OPTION(prefix_1, "lldltocache:", lldltocache, Joined, INVALID, INVALID, nullptr, 0, 0, + "Path to ThinLTO cached object file directory", nullptr, nullptr) +OPTION(prefix_1, "lldltocachepolicy:", lldltocachepolicy, Joined, INVALID, INVALID, nullptr, 0, 0, + "Pruning policy for the ThinLTO cache", nullptr, nullptr) OPTION(prefix_2, "lldmap:", lldmap_file, Joined, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) OPTION(prefix_1, "lldmap", lldmap, Flag, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) +OPTION(prefix_1, "lldmingw", lldmingw, Flag, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) OPTION(prefix_1, "lldsavetemps", lldsavetemps, Flag, INVALID, INVALID, nullptr, 0, 0, "Save temporary files instead of deleting them", nullptr, nullptr) OPTION(prefix_1, "machine:", machine, Joined, INVALID, INVALID, nullptr, 0, 0, @@ -126,28 +145,31 @@ OPTION(prefix_1, "merge:", merge, Joined, INVALID, INVALID, nullptr, 0, 0, OPTION(prefix_1, "mllvm:", mllvm, Joined, INVALID, INVALID, nullptr, 0, 0, "Options to pass to LLVM", nullptr, nullptr) OPTION(prefix_1, "msvclto", msvclto, Flag, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) +OPTION(prefix_1, "natvis:", natvis, Joined, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) OPTION(prefix_1, "nodefaultlib:", nodefaultlib, Joined, INVALID, INVALID, nullptr, 0, 0, "Remove a default library", nullptr, nullptr) OPTION(prefix_1, "nodefaultlib", nodefaultlib_all, Flag, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) OPTION(prefix_1, "noentry", noentry, Flag, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) OPTION(prefix_1, "nologo", nologo, Flag, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) -OPTION(prefix_1, "nopdb", nopdb, Flag, INVALID, INVALID, nullptr, 0, 0, - "Disable PDB generation for DWARF users", nullptr, nullptr) -OPTION(prefix_1, "nosymtab", nosymtab, Flag, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) OPTION(prefix_1, "nxcompat:no", nxcompat_no, Flag, INVALID, INVALID, nullptr, 0, 0, "Disable data execution provention", nullptr, nullptr) -OPTION(prefix_1, "nxcompat", nxcompat, Flag, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) +OPTION(prefix_1, "nxcompat", nxcompat, Flag, INVALID, INVALID, nullptr, 0, 0, + "Enable data execution prevention (default)", nullptr, nullptr) OPTION(prefix_1, "opt:", opt, Joined, INVALID, INVALID, nullptr, 0, 0, "Control optimizations", nullptr, nullptr) OPTION(prefix_1, "out:", out, Joined, INVALID, INVALID, nullptr, 0, 0, "Path to file to write output", nullptr, nullptr) +OPTION(prefix_2, "output-def:", output_def, Joined, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) OPTION(prefix_1, "pdb:", pdb, Joined, INVALID, INVALID, nullptr, 0, 0, "PDB file path", nullptr, nullptr) OPTION(prefix_1, "pdbaltpath:", pdbaltpath, Joined, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) OPTION(prefix_1, "profile", profile, Flag, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) +OPTION(prefix_3, "rsp-quoting=", rsp_quoting, Joined, INVALID, INVALID, nullptr, 0, 0, + "Quoting style for response files, 'windows' (default) or 'posix'", nullptr, nullptr) OPTION(prefix_1, "safeseh:no", safeseh_no, Flag, INVALID, INVALID, nullptr, 0, 0, - "Produce an image with Safe Exception Handler", nullptr, nullptr) -OPTION(prefix_1, "safeseh", safeseh, Flag, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) + "Don't produce an image with Safe Exception Handler", nullptr, nullptr) +OPTION(prefix_1, "safeseh", safeseh, Flag, INVALID, INVALID, nullptr, 0, 0, + "Produce an image with Safe Exception Handler (only for x86)", nullptr, nullptr) OPTION(prefix_1, "section:", section, Joined, INVALID, INVALID, nullptr, 0, 0, "Specify section attributes", nullptr, nullptr) OPTION(prefix_1, "stack:", stack, Joined, INVALID, INVALID, nullptr, 0, 0, @@ -163,12 +185,27 @@ OPTION(prefix_1, "tlbid:", tlbid, Joined, INVALID, INVALID, nullptr, 0, 0, nullp OPTION(prefix_1, "tlbout:", tlbout, Joined, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) OPTION(prefix_1, "tsaware:no", tsaware_no, Flag, INVALID, INVALID, nullptr, 0, 0, "Create non-Terminal Server aware executable", nullptr, nullptr) -OPTION(prefix_1, "tsaware", tsaware, Flag, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) +OPTION(prefix_1, "tsaware", tsaware, Flag, INVALID, INVALID, nullptr, 0, 0, + "Create Terminal Server aware executable (default)", nullptr, nullptr) OPTION(prefix_1, "verbose:", verbose_all, Joined, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) OPTION(prefix_1, "verbose", verbose, Flag, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) OPTION(prefix_1, "version:", version, Joined, INVALID, INVALID, nullptr, 0, 0, "Specify a version number in the PE header", nullptr, nullptr) -OPTION(prefix_1, "wx:no", wx_no, Flag, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) -OPTION(prefix_1, "wx", wx, Flag, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) -OPTION(prefix_3, "", help_q, Flag, INVALID, help, nullptr, 0, 0, nullptr, nullptr, nullptr) +OPTION(prefix_3, "version", dash_dash_version, Flag, INVALID, INVALID, nullptr, 0, 0, + "Print version information", nullptr, nullptr) +OPTION(prefix_1, "wholearchive:", wholearchive_file, Joined, INVALID, INVALID, nullptr, 0, 0, + "Include all object files from this archive", nullptr, nullptr) +OPTION(prefix_1, "wholearchive", wholearchive_flag, Flag, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) +OPTION(prefix_1, "WX:no", WX_no, Flag, INVALID, INVALID, nullptr, 0, 0, + "Don't treat warnings as errors", nullptr, nullptr) +OPTION(prefix_1, "WX", WX, Flag, INVALID, INVALID, nullptr, 0, 0, + "Treat warnings as errors", nullptr, nullptr) +OPTION(prefix_4, "", help_q, Flag, INVALID, help, nullptr, 0, 0, nullptr, nullptr, nullptr) #endif // OPTION + +#ifdef OPTTABLE_ARG_INIT +////////// +// Option Values + + +#endif // OPTTABLE_ARG_INIT diff --git a/deps/lld-prebuilt/DarwinLdOptions.inc b/deps/lld-prebuilt/DarwinLdOptions.inc index c70eb2967c..dc4f3dec54 100644 --- a/deps/lld-prebuilt/DarwinLdOptions.inc +++ b/deps/lld-prebuilt/DarwinLdOptions.inc @@ -187,3 +187,10 @@ OPTION(prefix_1, "v", v, Flag, INVALID, INVALID, nullptr, 0, 0, OPTION(prefix_1, "Z", Z, Flag, INVALID, INVALID, nullptr, 0, 0, "Do not search standard directories for libraries or frameworks", nullptr, nullptr) #endif // OPTION + +#ifdef OPTTABLE_ARG_INIT +////////// +// Option Values + + +#endif // OPTTABLE_ARG_INIT diff --git a/deps/lld-prebuilt/ELF/Options.inc b/deps/lld-prebuilt/ELF/Options.inc index 012841973b..640f1bdcc6 100644 --- a/deps/lld-prebuilt/ELF/Options.inc +++ b/deps/lld-prebuilt/ELF/Options.inc @@ -52,19 +52,23 @@ OPTION(prefix_2, "build-id", build_id, Flag, INVALID, INVALID, nullptr, 0, 0, "Generate build ID note", nullptr, nullptr) OPTION(prefix_2, "b", alias_format_b, Separate, INVALID, format, nullptr, 0, 0, nullptr, nullptr, nullptr) OPTION(prefix_2, "call_shared", alias_Bdynamic_call_shared, Flag, INVALID, Bdynamic, nullptr, 0, 0, nullptr, nullptr, nullptr) +OPTION(prefix_2, "chroot", chroot, Separate, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) OPTION(prefix_2, "color-diagnostics=", color_diagnostics_eq, Joined, INVALID, INVALID, nullptr, 0, 0, "Use colors in diagnostics", nullptr, nullptr) OPTION(prefix_2, "color-diagnostics", color_diagnostics, Flag, INVALID, INVALID, nullptr, 0, 0, "Use colors in diagnostics", nullptr, nullptr) -OPTION(prefix_2, "compress-debug-sections=", compress_debug_sections, Joined, INVALID, INVALID, nullptr, 0, 0, +OPTION(prefix_2, "compress-debug-sections=", compress_debug_sections_eq, Joined, INVALID, compress_debug_sections, nullptr, 0, 0, "Compress DWARF debug sections", nullptr, nullptr) -OPTION(prefix_3, "cref", cref, Flag, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) +OPTION(prefix_2, "compress-debug-sections", compress_debug_sections, Separate, INVALID, INVALID, nullptr, 0, 0, + "Compress DWARF debug sections", nullptr, nullptr) +OPTION(prefix_2, "cref", cref, Flag, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) OPTION(prefix_2, "dc", alias_define_common_dc, Flag, INVALID, define_common, nullptr, 0, 0, nullptr, nullptr, nullptr) OPTION(prefix_2, "define-common", define_common, Flag, INVALID, INVALID, nullptr, 0, 0, "Assign space to common symbols", nullptr, nullptr) -OPTION(prefix_2, "defsym=", defsym, Joined, INVALID, INVALID, nullptr, 0, 0, +OPTION(prefix_2, "defsym=", defsym_eq, Joined, INVALID, defsym, nullptr, 0, 0, + "Define a symbol alias", nullptr, nullptr) +OPTION(prefix_2, "defsym", defsym, Separate, INVALID, INVALID, nullptr, 0, 0, "Define a symbol alias", nullptr, nullptr) -OPTION(prefix_2, "defsym", alias_defsym, Separate, INVALID, defsym, nullptr, 0, 0, nullptr, nullptr, nullptr) OPTION(prefix_2, "demangle", demangle, Flag, INVALID, INVALID, nullptr, 0, 0, "Demangle symbol names", nullptr, nullptr) OPTION(prefix_2, "detect-odr-violations", detect_odr_violations, Flag, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) @@ -81,7 +85,8 @@ OPTION(prefix_2, "dn", alias_Bstatic_dn, Flag, INVALID, Bstatic, nullptr, 0, 0, OPTION(prefix_2, "dp", alias_define_common_dp, Flag, INVALID, define_common, nullptr, 0, 0, nullptr, nullptr, nullptr) OPTION(prefix_2, "dynamic-linker", dynamic_linker, Separate, INVALID, INVALID, nullptr, 0, 0, "Which dynamic linker to use", nullptr, nullptr) -OPTION(prefix_2, "dynamic-list=", alias_dynamic_list, Joined, INVALID, dynamic_list, nullptr, 0, 0, nullptr, nullptr, nullptr) +OPTION(prefix_2, "dynamic-list=", dynamic_list_eq, Joined, INVALID, dynamic_list, nullptr, 0, 0, + "Read a list of dynamic symbols", nullptr, nullptr) OPTION(prefix_2, "dynamic-list", dynamic_list, Separate, INVALID, INVALID, nullptr, 0, 0, "Read a list of dynamic symbols", nullptr, nullptr) OPTION(prefix_2, "dy", alias_Bdynamic_dy, Flag, INVALID, Bdynamic, nullptr, 0, 0, nullptr, nullptr, nullptr) @@ -97,18 +102,22 @@ OPTION(prefix_2, "enable-new-dtags", enable_new_dtags, Flag, INVALID, INVALID, n OPTION(prefix_2, "end-group", end_group, Flag, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) OPTION(prefix_2, "end-lib", end_lib, Flag, INVALID, INVALID, nullptr, 0, 0, "End a grouping of objects that should be treated as if they were together in an archive", nullptr, nullptr) -OPTION(prefix_2, "entry=", alias_entry_entry, Joined, INVALID, entry, nullptr, 0, 0, nullptr, nullptr, nullptr) +OPTION(prefix_2, "entry=", entry_eq, Joined, INVALID, entry, nullptr, 0, 0, + "Name of entry point symbol", "", nullptr) OPTION(prefix_2, "entry", entry, Separate, INVALID, INVALID, nullptr, 0, 0, "Name of entry point symbol", "", nullptr) -OPTION(prefix_2, "error-limit=", alias_error_limit, Joined, INVALID, error_limit, nullptr, 0, 0, nullptr, nullptr, nullptr) +OPTION(prefix_2, "error-limit=", error_limit_eq, Joined, INVALID, error_limit, nullptr, 0, 0, + "Maximum number of errors to emit before stopping (0 = no limit)", nullptr, nullptr) OPTION(prefix_2, "error-limit", error_limit, Separate, INVALID, INVALID, nullptr, 0, 0, "Maximum number of errors to emit before stopping (0 = no limit)", nullptr, nullptr) OPTION(prefix_2, "error-unresolved-symbols", error_unresolved_symbols, Flag, INVALID, INVALID, nullptr, 0, 0, "Report unresolved symbols as errors", nullptr, nullptr) -OPTION(prefix_2, "exclude-libs=", alias_exclude_libs, Joined, INVALID, exclude_libs, nullptr, 0, 0, nullptr, nullptr, nullptr) +OPTION(prefix_2, "exclude-libs=", exclude_libs_eq, Joined, INVALID, exclude_libs, nullptr, 0, 0, + "Exclude static libraries from automatic export", nullptr, nullptr) OPTION(prefix_2, "exclude-libs", exclude_libs, Separate, INVALID, INVALID, nullptr, 0, 0, "Exclude static libraries from automatic export", nullptr, nullptr) -OPTION(prefix_2, "export-dynamic-symbol=", alias_export_dynamic_symbol, Joined, INVALID, export_dynamic_symbol, nullptr, 0, 0, nullptr, nullptr, nullptr) +OPTION(prefix_2, "export-dynamic-symbol=", export_dynamic_symbol_eq, Joined, INVALID, export_dynamic_symbol, nullptr, 0, 0, + "Put a symbol in the dynamic symbol table", nullptr, nullptr) OPTION(prefix_2, "export-dynamic-symbol", export_dynamic_symbol, Separate, INVALID, INVALID, nullptr, 0, 0, "Put a symbol in the dynamic symbol table", nullptr, nullptr) OPTION(prefix_2, "export-dynamic", export_dynamic, Flag, INVALID, INVALID, nullptr, 0, 0, @@ -117,12 +126,19 @@ OPTION(prefix_1, "E", alias_export_dynamic_E, Flag, INVALID, export_dynamic, nul OPTION(prefix_1, "e", alias_entry_e, JoinedOrSeparate, INVALID, entry, nullptr, 0, 0, nullptr, nullptr, nullptr) OPTION(prefix_2, "fatal-warnings", fatal_warnings, Flag, INVALID, INVALID, nullptr, 0, 0, "Treat warnings as errors", nullptr, nullptr) -OPTION(prefix_2, "filter=", filter, Joined, INVALID, INVALID, nullptr, 0, 0, +OPTION(prefix_2, "filter=", filter_eq, Joined, INVALID, filter, nullptr, 0, 0, "Set DT_FILTER field to the specified name", nullptr, nullptr) -OPTION(prefix_2, "fini=", alias_fini_fini, Joined, INVALID, fini, nullptr, 0, 0, nullptr, nullptr, nullptr) +OPTION(prefix_2, "filter", filter, Separate, INVALID, INVALID, nullptr, 0, 0, + "Set DT_FILTER field to the specified name", nullptr, nullptr) +OPTION(prefix_2, "fini=", fini_eq, Joined, INVALID, fini, nullptr, 0, 0, + "Specify a finalizer function", "", nullptr) OPTION(prefix_2, "fini", fini, Separate, INVALID, INVALID, nullptr, 0, 0, "Specify a finalizer function", "", nullptr) -OPTION(prefix_2, "format=", format, Joined, INVALID, INVALID, nullptr, 0, 0, +OPTION(prefix_2, "fix-cortex-a53-843419", fix_cortex_a53_843419, Flag, INVALID, INVALID, nullptr, 0, 0, + "Apply fixes for AArch64 Cortex-A53 erratum 843419", nullptr, nullptr) +OPTION(prefix_2, "format=", format_eq, Joined, INVALID, format, nullptr, 0, 0, + "Change the input format of the inputs following this option", "", nullptr) +OPTION(prefix_2, "format", format, Separate, INVALID, INVALID, nullptr, 0, 0, "Change the input format of the inputs following this option", "", nullptr) OPTION(prefix_2, "full-shutdown", full_shutdown, Flag, INVALID, INVALID, nullptr, 0, 0, "Perform a full shutdown instead of calling _exit", nullptr, nullptr) @@ -134,23 +150,36 @@ OPTION(prefix_2, "gdb-index", gdb_index, Flag, INVALID, INVALID, nullptr, 0, 0, "Generate .gdb_index section", nullptr, nullptr) OPTION(prefix_1, "G", G, JoinedOrSeparate, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) OPTION(prefix_1, "g", g, Flag, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) -OPTION(prefix_2, "hash-style=", alias_hash_style_hash_style, Joined, INVALID, hash_style, nullptr, 0, 0, nullptr, nullptr, nullptr) +OPTION(prefix_2, "hash-style=", hash_style_eq, Joined, INVALID, hash_style, nullptr, 0, 0, + "Specify hash style (sysv, gnu or both)", nullptr, nullptr) OPTION(prefix_2, "hash-style", hash_style, Separate, INVALID, INVALID, nullptr, 0, 0, "Specify hash style (sysv, gnu or both)", nullptr, nullptr) OPTION(prefix_2, "help", help, Flag, INVALID, INVALID, nullptr, 0, 0, "Print option help", nullptr, nullptr) OPTION(prefix_1, "h", alias_soname_h, JoinedOrSeparate, INVALID, soname, nullptr, 0, 0, nullptr, nullptr, nullptr) +OPTION(prefix_2, "icf-data", icf_data, Flag, INVALID, INVALID, nullptr, 0, 0, + "Enable ICF to also fold identical read only data", nullptr, nullptr) OPTION(prefix_2, "icf=all", icf_all, Flag, INVALID, INVALID, nullptr, 0, 0, "Enable identical code folding", nullptr, nullptr) OPTION(prefix_2, "icf=none", icf_none, Flag, INVALID, INVALID, nullptr, 0, 0, "Disable identical code folding", nullptr, nullptr) -OPTION(prefix_2, "image-base=", image_base, Joined, INVALID, INVALID, nullptr, 0, 0, +OPTION(prefix_2, "image-base=", image_base_eq, Joined, INVALID, image_base, nullptr, 0, 0, "Set the base address", nullptr, nullptr) -OPTION(prefix_2, "init=", alias_init_init, Joined, INVALID, init, nullptr, 0, 0, nullptr, nullptr, nullptr) +OPTION(prefix_2, "image-base", image_base, Separate, INVALID, INVALID, nullptr, 0, 0, + "Set the base address", nullptr, nullptr) +OPTION(prefix_2, "init=", init_eq, Joined, INVALID, init, nullptr, 0, 0, + "Specify an initializer function", "", nullptr) OPTION(prefix_2, "init", init, Separate, INVALID, INVALID, nullptr, 0, 0, "Specify an initializer function", "", nullptr) -OPTION(prefix_2, "library-path=", alias_L__library_path, Joined, INVALID, L, nullptr, 0, 0, nullptr, nullptr, nullptr) -OPTION(prefix_2, "library=", alias_l__library, Joined, INVALID, l, nullptr, 0, 0, nullptr, nullptr, nullptr) +OPTION(prefix_2, "library-path=", library_path_eq, Joined, INVALID, library_path, nullptr, 0, 0, + "Add a directory to the library search path", "", nullptr) +OPTION(prefix_2, "library-path", library_path, Separate, INVALID, INVALID, nullptr, 0, 0, + "Add a directory to the library search path", "", nullptr) +OPTION(prefix_2, "library=", library_eq, Joined, INVALID, library, nullptr, 0, 0, + "Root name of library to use", "", nullptr) +OPTION(prefix_2, "library", library, Separate, INVALID, INVALID, nullptr, 0, 0, + "Root name of library to use", "", nullptr) +OPTION(prefix_2, "long-plt", long_plt, Flag, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) OPTION(prefix_2, "lto-aa-pipeline=", lto_aa_pipeline, Joined, INVALID, INVALID, nullptr, 0, 0, "AA pipeline to run during LTO. Used in conjunction with -lto-newpm-passes", nullptr, nullptr) OPTION(prefix_2, "lto-newpm-passes=", lto_newpm_passes, Joined, INVALID, INVALID, nullptr, 0, 0, @@ -159,13 +188,14 @@ OPTION(prefix_2, "lto-O", lto_O, Joined, INVALID, INVALID, nullptr, 0, 0, "Optimization level for LTO", "", nullptr) OPTION(prefix_2, "lto-partitions=", lto_partitions, Joined, INVALID, INVALID, nullptr, 0, 0, "Number of LTO codegen partitions", nullptr, nullptr) -OPTION(prefix_1, "L", L, JoinedOrSeparate, INVALID, INVALID, nullptr, 0, 0, - "Add a directory to the library search path", "", nullptr) -OPTION(prefix_1, "l", l, JoinedOrSeparate, INVALID, INVALID, nullptr, 0, 0, - "Root name of library to use", "", nullptr) -OPTION(prefix_2, "Map=", alias_Map_eq, Joined, INVALID, Map, nullptr, 0, 0, nullptr, nullptr, nullptr) -OPTION(prefix_2, "Map", Map, JoinedOrSeparate, INVALID, INVALID, nullptr, 0, 0, +OPTION(prefix_1, "L", alias_library_path, JoinedOrSeparate, INVALID, library_path, nullptr, 0, 0, nullptr, nullptr, nullptr) +OPTION(prefix_1, "l", alias_library, JoinedOrSeparate, INVALID, library, nullptr, 0, 0, nullptr, nullptr, nullptr) +OPTION(prefix_2, "Map=", Map_eq, Joined, INVALID, Map, nullptr, 0, 0, "Print a link map to the specified file", nullptr, nullptr) +OPTION(prefix_2, "Map", Map, Separate, INVALID, INVALID, nullptr, 0, 0, + "Print a link map to the specified file", nullptr, nullptr) +OPTION(prefix_2, "merge-exidx-entries", merge_exidx_entries, Flag, INVALID, INVALID, nullptr, 0, 0, + "Enable merging .ARM.exidx entries", nullptr, nullptr) OPTION(prefix_2, "mllvm", mllvm, Separate, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) OPTION(prefix_1, "M", alias_print_map_M, Flag, INVALID, print_map, nullptr, 0, 0, nullptr, nullptr, nullptr) OPTION(prefix_1, "m", m, JoinedOrSeparate, INVALID, INVALID, nullptr, 0, 0, @@ -176,21 +206,32 @@ OPTION(prefix_2, "no-as-needed", no_as_needed, Flag, INVALID, INVALID, nullptr, "Always DT_NEEDED for shared libraries", nullptr, nullptr) OPTION(prefix_2, "no-color-diagnostics", no_color_diagnostics, Flag, INVALID, INVALID, nullptr, 0, 0, "Do not use colors in diagnostics", nullptr, nullptr) -OPTION(prefix_2, "no-copy-dt-needed-entries", no_copy_dt_needed_entries, Flag, INVALID, no_add_needed, nullptr, 0, 0, nullptr, nullptr, nullptr) +OPTION(prefix_2, "no-copy-dt-needed-entries", no_copy_dt_needed_entries, Flag, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) +OPTION(prefix_2, "no-ctors-in-init-array", no_ctors_in_init_array, Flag, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) OPTION(prefix_2, "no-define-common", no_define_common, Flag, INVALID, INVALID, nullptr, 0, 0, "Do not assign space to common symbols", nullptr, nullptr) OPTION(prefix_2, "no-demangle", no_demangle, Flag, INVALID, INVALID, nullptr, 0, 0, "Do not demangle symbol names", nullptr, nullptr) OPTION(prefix_2, "no-dynamic-linker", no_dynamic_linker, Flag, INVALID, INVALID, nullptr, 0, 0, "Inhibit output of .interp section", nullptr, nullptr) +OPTION(prefix_2, "no-eh-frame-hdr", no_eh_frame_hdr, Flag, INVALID, INVALID, nullptr, 0, 0, + "Do not create .eh_frame_hdr section", nullptr, nullptr) OPTION(prefix_2, "no-export-dynamic", no_export_dynamic, Flag, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) OPTION(prefix_2, "no-fatal-warnings", no_fatal_warnings, Flag, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) OPTION(prefix_2, "no-gc-sections", no_gc_sections, Flag, INVALID, INVALID, nullptr, 0, 0, "Disable garbage collection of unused sections", nullptr, nullptr) +OPTION(prefix_2, "no-gdb-index", no_gdb_index, Flag, INVALID, INVALID, nullptr, 0, 0, + "Do not generate .gdb_index section", nullptr, nullptr) OPTION(prefix_2, "no-gnu-unique", no_gnu_unique, Flag, INVALID, INVALID, nullptr, 0, 0, "Disable STB_GNU_UNIQUE symbol binding", nullptr, nullptr) OPTION(prefix_2, "no-keep-memory", no_keep_memory, Flag, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) +OPTION(prefix_2, "no-merge-exidx-entries", no_merge_exidx_entries, Flag, INVALID, INVALID, nullptr, 0, 0, + "Disable merging .ARM.exidx entries", nullptr, nullptr) OPTION(prefix_2, "no-mmap-output-file", no_mmap_output_file, Flag, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) +OPTION(prefix_3, "no-omagic", no_omagic, Flag, INVALID, INVALID, nullptr, 0, 0, + "Do not set the text data sections to be writable", "", nullptr) +OPTION(prefix_2, "no-print-gc-sections", no_print_gc_sections, Flag, INVALID, INVALID, nullptr, 0, 0, + "Do not list removed unused sections", nullptr, nullptr) OPTION(prefix_2, "no-rosegment", no_rosegment, Flag, INVALID, INVALID, nullptr, 0, 0, "Do not put read-only non-executable sections in their own segment", nullptr, nullptr) OPTION(prefix_2, "no-threads", no_threads, Flag, INVALID, INVALID, nullptr, 0, 0, @@ -219,17 +260,25 @@ OPTION(prefix_3, "opt-remarks-filename", opt_remarks_filename, Separate, INVALID "YAML output file for optimization remarks", nullptr, nullptr) OPTION(prefix_3, "opt-remarks-with-hotness", opt_remarks_with_hotness, Flag, INVALID, INVALID, nullptr, 0, 0, "Include hotness informations in the optimization remarks file", nullptr, nullptr) +OPTION(prefix_2, "orphan-handling=", orphan_handling_eq, Joined, INVALID, orphan_handling, nullptr, 0, 0, + "Control how orphan sections are handled when linker script used", nullptr, nullptr) +OPTION(prefix_2, "orphan-handling", orphan_handling, Separate, INVALID, INVALID, nullptr, 0, 0, + "Control how orphan sections are handled when linker script used", nullptr, nullptr) OPTION(prefix_3, "output=", alias_o_output, Joined, INVALID, o, nullptr, 0, 0, nullptr, nullptr, nullptr) OPTION(prefix_3, "output", alias_o_output2, Separate, INVALID, o, nullptr, 0, 0, nullptr, nullptr, nullptr) -OPTION(prefix_1, "O", O, Joined, INVALID, INVALID, nullptr, 0, 0, +OPTION(prefix_1, "O", O, JoinedOrSeparate, INVALID, INVALID, nullptr, 0, 0, "Optimize output file size", nullptr, nullptr) OPTION(prefix_1, "o", o, JoinedOrSeparate, INVALID, INVALID, nullptr, 0, 0, "Path to file to write output", "", nullptr) +OPTION(prefix_2, "pack-dyn-relocs=", pack_dyn_relocs_eq, Joined, INVALID, INVALID, nullptr, 0, 0, + "Pack dynamic relocations in the given format (none or android)", "", nullptr) OPTION(prefix_2, "pic-executable", alias_pie_pic_executable, Flag, INVALID, pie, nullptr, 0, 0, nullptr, nullptr, nullptr) OPTION(prefix_2, "pie", pie, Flag, INVALID, INVALID, nullptr, 0, 0, "Create a position independent executable", nullptr, nullptr) -OPTION(prefix_2, "plugin-opt=", plugin_opt_eq, Joined, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) -OPTION(prefix_2, "plugin-opt", plugin_opt, Separate, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) +OPTION(prefix_2, "plugin-opt=", plugin_opt_eq, Joined, INVALID, plugin_opt, nullptr, 0, 0, + "specifies LTO options for compatibility with GNU linkers", nullptr, nullptr) +OPTION(prefix_2, "plugin-opt", plugin_opt, Separate, INVALID, INVALID, nullptr, 0, 0, + "specifies LTO options for compatibility with GNU linkers", nullptr, nullptr) OPTION(prefix_2, "plugin=", plugin_eq, Joined, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) OPTION(prefix_2, "plugin", plugin, Separate, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) OPTION(prefix_2, "print-gc-sections", print_gc_sections, Flag, INVALID, INVALID, nullptr, 0, 0, @@ -240,34 +289,42 @@ OPTION(prefix_2, "Qy", Qy, Flag, INVALID, INVALID, nullptr, 0, 0, nullptr, nullp OPTION(prefix_1, "q", alias_emit_relocs, Flag, INVALID, emit_relocs, nullptr, 0, 0, nullptr, nullptr, nullptr) OPTION(prefix_2, "relocatable", relocatable, Flag, INVALID, INVALID, nullptr, 0, 0, "Create relocatable object file", nullptr, nullptr) -OPTION(prefix_2, "reproduce=", alias_reproduce_eq, Joined, INVALID, reproduce, nullptr, 0, 0, nullptr, nullptr, nullptr) +OPTION(prefix_2, "reproduce=", reproduce_eq, Joined, INVALID, reproduce, nullptr, 0, 0, + "Dump linker invocation and input files for debugging", nullptr, nullptr) OPTION(prefix_2, "reproduce", reproduce, Separate, INVALID, INVALID, nullptr, 0, 0, "Dump linker invocation and input files for debugging", nullptr, nullptr) -OPTION(prefix_2, "retain-symbols-file=", retain_symbols_file, Joined, INVALID, INVALID, nullptr, 0, 0, +OPTION(prefix_2, "retain-symbols-file=", retain_symbols_file_eq, Joined, INVALID, retain_symbols_file, nullptr, 0, 0, + "Retain only the symbols listed in the file", "", nullptr) +OPTION(prefix_2, "retain-symbols-file", retain_symbols_file, Separate, INVALID, INVALID, nullptr, 0, 0, "Retain only the symbols listed in the file", "", nullptr) -OPTION(prefix_2, "retain-symbols-file", alias_retain_symbols_file, Separate, INVALID, retain_symbols_file, nullptr, 0, 0, nullptr, nullptr, nullptr) OPTION(prefix_2, "rpath-link=", rpath_link_eq, Joined, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) OPTION(prefix_2, "rpath-link", rpath_link, Separate, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) -OPTION(prefix_2, "rpath=", alias_rpath_rpath, Joined, INVALID, rpath, nullptr, 0, 0, nullptr, nullptr, nullptr) +OPTION(prefix_2, "rpath=", rpath_eq, Joined, INVALID, rpath, nullptr, 0, 0, + "Add a DT_RUNPATH to the output", nullptr, nullptr) OPTION(prefix_2, "rpath", rpath, Separate, INVALID, INVALID, nullptr, 0, 0, "Add a DT_RUNPATH to the output", nullptr, nullptr) -OPTION(prefix_2, "rsp-quoting=", rsp_quoting, Joined, INVALID, INVALID, nullptr, 0, 0, +OPTION(prefix_2, "rsp-quoting=", rsp_quoting_eq, Joined, INVALID, rsp_quoting, nullptr, 0, 0, + "Quoting style for response files. Values supported: windows|posix", nullptr, nullptr) +OPTION(prefix_2, "rsp-quoting", rsp_quoting, Separate, INVALID, INVALID, nullptr, 0, 0, "Quoting style for response files. Values supported: windows|posix", nullptr, nullptr) OPTION(prefix_1, "R", alias_rpath_R, JoinedOrSeparate, INVALID, rpath, nullptr, 0, 0, nullptr, nullptr, nullptr) OPTION(prefix_1, "r", alias_relocatable_r, Flag, INVALID, relocatable, nullptr, 0, 0, nullptr, nullptr, nullptr) OPTION(prefix_2, "save-temps", save_temps, Flag, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) -OPTION(prefix_2, "script=", alias_script, Joined, INVALID, script, nullptr, 0, 0, nullptr, nullptr, nullptr) +OPTION(prefix_2, "script=", script_eq, Joined, INVALID, script, nullptr, 0, 0, + "Read linker script", nullptr, nullptr) OPTION(prefix_2, "script", script, Separate, INVALID, INVALID, nullptr, 0, 0, "Read linker script", nullptr, nullptr) OPTION(prefix_2, "section-start", section_start, Separate, INVALID, INVALID, nullptr, 0, 0, "Set address of section", "
", nullptr) OPTION(prefix_2, "shared", shared, Flag, INVALID, INVALID, nullptr, 0, 0, "Build a shared object", nullptr, nullptr) -OPTION(prefix_2, "soname=", soname, Joined, INVALID, INVALID, nullptr, 0, 0, +OPTION(prefix_2, "soname=", soname_eq, Joined, INVALID, soname, nullptr, 0, 0, + "Set DT_SONAME", nullptr, nullptr) +OPTION(prefix_2, "soname", soname, Separate, INVALID, INVALID, nullptr, 0, 0, "Set DT_SONAME", nullptr, nullptr) -OPTION(prefix_2, "soname", alias_soname_soname, Separate, INVALID, soname, nullptr, 0, 0, nullptr, nullptr, nullptr) OPTION(prefix_2, "sort-common", sort_common, Flag, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) -OPTION(prefix_2, "sort-section=", alias_sort_section, Joined, INVALID, sort_section, nullptr, 0, 0, nullptr, nullptr, nullptr) +OPTION(prefix_2, "sort-section=", sort_section_eq, Joined, INVALID, sort_section, nullptr, 0, 0, + "Specifies sections sorting rule when linkerscript is used", nullptr, nullptr) OPTION(prefix_2, "sort-section", sort_section, Separate, INVALID, INVALID, nullptr, 0, 0, "Specifies sections sorting rule when linkerscript is used", nullptr, nullptr) OPTION(prefix_2, "start-group", start_group, Flag, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) @@ -281,7 +338,9 @@ OPTION(prefix_2, "strip-debug", strip_debug, Flag, INVALID, INVALID, nullptr, 0, "Strip debugging information", nullptr, nullptr) OPTION(prefix_2, "symbol-ordering-file", symbol_ordering_file, Separate, INVALID, INVALID, nullptr, 0, 0, "Layout sections in the order specified by symbol file", nullptr, nullptr) -OPTION(prefix_2, "sysroot=", sysroot, Joined, INVALID, INVALID, nullptr, 0, 0, +OPTION(prefix_2, "sysroot=", sysroot_eq, Joined, INVALID, sysroot, nullptr, 0, 0, + "Set the system root", nullptr, nullptr) +OPTION(prefix_2, "sysroot", sysroot, Separate, INVALID, INVALID, nullptr, 0, 0, "Set the system root", nullptr, nullptr) OPTION(prefix_1, "S", alias_strip_debug_S, Flag, INVALID, strip_debug, nullptr, 0, 0, nullptr, nullptr, nullptr) OPTION(prefix_1, "s", alias_strip_all, Flag, INVALID, strip_all, nullptr, 0, 0, nullptr, nullptr, nullptr) @@ -289,12 +348,16 @@ OPTION(prefix_2, "target1-abs", target1_abs, Flag, INVALID, INVALID, nullptr, 0, "Interpret R_ARM_TARGET1 as R_ARM_ABS32", nullptr, nullptr) OPTION(prefix_2, "target1-rel", target1_rel, Flag, INVALID, INVALID, nullptr, 0, 0, "Interpret R_ARM_TARGET1 as R_ARM_REL32", nullptr, nullptr) -OPTION(prefix_2, "target2=", target2, Joined, INVALID, INVALID, nullptr, 0, 0, +OPTION(prefix_2, "target2=", target2_eq, Joined, INVALID, target2, nullptr, 0, 0, "Interpret R_ARM_TARGET2 as , where is one of rel, abs, or got-rel", "", nullptr) -OPTION(prefix_2, "Tbss=", alias_Tbss, Joined, INVALID, Tbss, nullptr, 0, 0, nullptr, nullptr, nullptr) +OPTION(prefix_2, "target2", target2, Separate, INVALID, INVALID, nullptr, 0, 0, + "Interpret R_ARM_TARGET2 as , where is one of rel, abs, or got-rel", "", nullptr) +OPTION(prefix_2, "Tbss=", Tbss_eq, Joined, INVALID, Tbss, nullptr, 0, 0, + "Same as --section-start with .bss as the sectionname", nullptr, nullptr) OPTION(prefix_2, "Tbss", Tbss, Separate, INVALID, INVALID, nullptr, 0, 0, "Same as --section-start with .bss as the sectionname", nullptr, nullptr) -OPTION(prefix_2, "Tdata=", alias_Tdata, Joined, INVALID, Tdata, nullptr, 0, 0, nullptr, nullptr, nullptr) +OPTION(prefix_2, "Tdata=", Tdata_eq, Joined, INVALID, Tdata, nullptr, 0, 0, + "Same as --section-start with .data as the sectionname", nullptr, nullptr) OPTION(prefix_2, "Tdata", Tdata, Separate, INVALID, INVALID, nullptr, 0, 0, "Same as --section-start with .data as the sectionname", nullptr, nullptr) OPTION(prefix_2, "thinlto-cache-dir=", thinlto_cache_dir, Joined, INVALID, INVALID, nullptr, 0, 0, @@ -305,27 +368,33 @@ OPTION(prefix_2, "thinlto-jobs=", thinlto_jobs, Joined, INVALID, INVALID, nullpt "Number of ThinLTO jobs", nullptr, nullptr) OPTION(prefix_2, "threads", threads, Flag, INVALID, INVALID, nullptr, 0, 0, "Run the linker multi-threaded", nullptr, nullptr) -OPTION(prefix_2, "trace-symbol=", trace_trace_symbol_eq, Joined, INVALID, trace_symbol, nullptr, 0, 0, nullptr, nullptr, nullptr) +OPTION(prefix_2, "trace-symbol=", trace_symbol_eq, Joined, INVALID, trace_symbol, nullptr, 0, 0, + "Trace references to symbols", nullptr, nullptr) OPTION(prefix_2, "trace-symbol", trace_symbol, Separate, INVALID, INVALID, nullptr, 0, 0, "Trace references to symbols", nullptr, nullptr) OPTION(prefix_2, "trace", trace, Flag, INVALID, INVALID, nullptr, 0, 0, "Print the names of the input files", nullptr, nullptr) OPTION(prefix_2, "Ttext-segment=", alias_Ttext_segment_eq, Joined, INVALID, Ttext, nullptr, 0, 0, nullptr, nullptr, nullptr) OPTION(prefix_2, "Ttext-segment", alias_Ttext_segment, Separate, INVALID, Ttext, nullptr, 0, 0, nullptr, nullptr, nullptr) -OPTION(prefix_2, "Ttext=", alias_Ttext, Joined, INVALID, Ttext, nullptr, 0, 0, nullptr, nullptr, nullptr) +OPTION(prefix_2, "Ttext=", Ttext_eq, Joined, INVALID, Ttext, nullptr, 0, 0, + "Same as --section-start with .text as the sectionname", nullptr, nullptr) OPTION(prefix_2, "Ttext", Ttext, Separate, INVALID, INVALID, nullptr, 0, 0, "Same as --section-start with .text as the sectionname", nullptr, nullptr) OPTION(prefix_1, "T", alias_script_T, JoinedOrSeparate, INVALID, script, nullptr, 0, 0, nullptr, nullptr, nullptr) OPTION(prefix_1, "t", alias_trace, Flag, INVALID, trace, nullptr, 0, 0, nullptr, nullptr, nullptr) -OPTION(prefix_2, "undefined=", alias_undefined_eq, Joined, INVALID, undefined, nullptr, 0, 0, nullptr, nullptr, nullptr) +OPTION(prefix_2, "undefined=", undefined_eq, Joined, INVALID, undefined, nullptr, 0, 0, + "Force undefined symbol during linking", nullptr, nullptr) OPTION(prefix_2, "undefined", undefined, Separate, INVALID, INVALID, nullptr, 0, 0, "Force undefined symbol during linking", nullptr, nullptr) -OPTION(prefix_2, "unresolved-symbols=", unresolved_symbols, Joined, INVALID, INVALID, nullptr, 0, 0, +OPTION(prefix_2, "unresolved-symbols=", unresolved_symbols_eq, Joined, INVALID, unresolved_symbols, nullptr, 0, 0, + "Determine how to handle unresolved symbols", nullptr, nullptr) +OPTION(prefix_2, "unresolved-symbols", unresolved_symbols, Separate, INVALID, INVALID, nullptr, 0, 0, "Determine how to handle unresolved symbols", nullptr, nullptr) OPTION(prefix_1, "u", alias_undefined_u, JoinedOrSeparate, INVALID, undefined, nullptr, 0, 0, nullptr, nullptr, nullptr) OPTION(prefix_2, "verbose", verbose, Flag, INVALID, INVALID, nullptr, 0, 0, "Verbose mode", nullptr, nullptr) -OPTION(prefix_2, "version-script=", alias_version_script_eq, Joined, INVALID, version_script, nullptr, 0, 0, nullptr, nullptr, nullptr) +OPTION(prefix_2, "version-script=", version_script_eq, Joined, INVALID, version_script, nullptr, 0, 0, + "Read a version script", nullptr, nullptr) OPTION(prefix_2, "version-script", version_script, Separate, INVALID, INVALID, nullptr, 0, 0, "Read a version script", nullptr, nullptr) OPTION(prefix_2, "version", version, Flag, INVALID, INVALID, nullptr, 0, 0, @@ -336,12 +405,14 @@ OPTION(prefix_1, "v", v, Flag, INVALID, INVALID, nullptr, 0, 0, OPTION(prefix_2, "warn-common", warn_common, Flag, INVALID, INVALID, nullptr, 0, 0, "Warn about duplicate common symbols", nullptr, nullptr) OPTION(prefix_2, "warn-execstack", warn_execstack, Flag, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) +OPTION(prefix_2, "warn-once", warn_once, Flag, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) OPTION(prefix_2, "warn-shared-textrel", warn_shared_textrel, Flag, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr) OPTION(prefix_2, "warn-unresolved-symbols", warn_unresolved_symbols, Flag, INVALID, INVALID, nullptr, 0, 0, "Report unresolved symbols as warnings", nullptr, nullptr) OPTION(prefix_2, "whole-archive", whole_archive, Flag, INVALID, INVALID, nullptr, 0, 0, "Force load of all members in a static library", nullptr, nullptr) -OPTION(prefix_2, "wrap=", alias_wrap_wrap, Joined, INVALID, wrap, nullptr, 0, 0, nullptr, nullptr, nullptr) +OPTION(prefix_2, "wrap=", wrap_eq, Joined, INVALID, wrap, nullptr, 0, 0, + "Use wrapper functions for symbol", "", nullptr) OPTION(prefix_2, "wrap", wrap, Separate, INVALID, INVALID, nullptr, 0, 0, "Use wrapper functions for symbol", "", nullptr) OPTION(prefix_1, "X", alias_discard_locals_X, Flag, INVALID, discard_locals, nullptr, 0, 0, nullptr, nullptr, nullptr) @@ -350,3 +421,10 @@ OPTION(prefix_1, "y", alias_trace_symbol_y, JoinedOrSeparate, INVALID, trace_sym OPTION(prefix_1, "z", z, JoinedOrSeparate, INVALID, INVALID, nullptr, 0, 0, "Linker option extensions", "