Skip to content

Commit 35a7247

Browse files
authored
Merge branch 'master' into openbsd-minimal
2 parents 161eb4a + 245d98d commit 35a7247

File tree

252 files changed

+65420
-24712
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

252 files changed

+65420
-24712
lines changed

CMakeLists.txt

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,7 @@ message("Configuring zig version ${ZIG_VERSION}")
5555
set(ZIG_STATIC off CACHE BOOL "Attempt to build a static zig executable (not compatible with glibc)")
5656
set(ZIG_STATIC_LLVM off CACHE BOOL "Prefer linking against static LLVM libraries")
5757
set(ZIG_PREFER_CLANG_CPP_DYLIB off CACHE BOOL "Try to link against -lclang-cpp")
58-
set(ZIG_WORKAROUND_4799 off CACHE BOOL "workaround for https://github.com/ziglang/zig/issues/4799")
59-
set(ZIG_WORKAROUND_POLLY_SO off CACHE STRING "workaround for https://github.com/ziglang/zig/issues/4799")
6058
set(ZIG_USE_CCACHE off CACHE BOOL "Use ccache if available")
61-
set(ZIG_WORKAROUND_6087 off CACHE BOOL "workaround for https://github.com/ziglang/zig/issues/6087")
6259

6360
if(CCACHE_PROGRAM AND ZIG_USE_CCACHE)
6461
SET_PROPERTY(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")
@@ -88,18 +85,12 @@ find_package(lld)
8885

8986
if(APPLE AND ZIG_STATIC)
9087
list(REMOVE_ITEM LLVM_LIBRARIES "-lz")
91-
find_library(ZLIB NAMES z zlib libz)
88+
find_library(ZLIB NAMES libz.a z zlib libz)
9289
list(APPEND LLVM_LIBRARIES "${ZLIB}")
93-
endif()
94-
95-
if(APPLE AND ZIG_WORKAROUND_6087)
96-
list(REMOVE_ITEM LLVM_LIBRARIES "-llibxml2.tbd")
97-
list(APPEND LLVM_LIBRARIES "-lxml2")
98-
endif()
9990

100-
if(APPLE AND ZIG_WORKAROUND_4799)
101-
# eg: ${CMAKE_PREFIX_PATH} could be /usr/local/opt/llvm/
102-
list(APPEND LLVM_LIBRARIES "-Wl,${CMAKE_PREFIX_PATH}/lib/libPolly.a" "-Wl,${CMAKE_PREFIX_PATH}/lib/libPollyPPCG.a" "-Wl,${CMAKE_PREFIX_PATH}/lib/libPollyISL.a")
91+
list(REMOVE_ITEM LLVM_LIBRARIES "-lcurses")
92+
find_library(CURSES NAMES libcurses.a curses libcurses libncurses.a ncurses libncurses)
93+
list(APPEND LLVM_LIBRARIES "${CURSES}")
10394
endif()
10495

10596
set(ZIG_CPP_LIB_DIR "${CMAKE_BINARY_DIR}/zigcpp")
@@ -363,7 +354,7 @@ endif()
363354
if(MSVC)
364355
set(EXE_CFLAGS "${EXE_CFLAGS}")
365356
else()
366-
set(EXE_CFLAGS "${EXE_CFLAGS} -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D_GNU_SOURCE -fvisibility-inlines-hidden -fno-exceptions -fno-rtti -Werror=type-limits -Wno-missing-braces")
357+
set(EXE_CFLAGS "${EXE_CFLAGS} -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D_GNU_SOURCE -fvisibility-inlines-hidden -fno-exceptions -fno-rtti -Werror=type-limits -Wno-missing-braces -Wno-comment")
367358
if(MINGW)
368359
set(EXE_CFLAGS "${EXE_CFLAGS} -Wno-format")
369360
endif()
@@ -415,9 +406,6 @@ target_link_libraries(zigcpp LINK_PUBLIC
415406
${LLVM_LIBRARIES}
416407
${CMAKE_THREAD_LIBS_INIT}
417408
)
418-
if(ZIG_WORKAROUND_POLLY_SO)
419-
target_link_libraries(zigcpp LINK_PUBLIC "-Wl,${ZIG_WORKAROUND_POLLY_SO}")
420-
endif()
421409

422410
add_library(opt_c_util STATIC ${OPTIMIZED_C_SOURCES})
423411
set_target_properties(opt_c_util PROPERTIES

README.md

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ This step must be repeated when you make changes to any of the C++ source code.
3232

3333
* cmake >= 2.8.5
3434
* gcc >= 5.0.0 or clang >= 3.6.0
35-
* LLVM, Clang, LLD development libraries == 10.x, compiled with the same gcc or clang version above
35+
* LLVM, Clang, LLD development libraries == 11.x, compiled with the same gcc or clang version above
3636
- Use the system package manager, or [build from source](https://github.com/ziglang/zig/wiki/How-to-build-LLVM,-libclang,-and-liblld-from-source#posix).
3737

3838
##### Windows
@@ -41,7 +41,7 @@ This step must be repeated when you make changes to any of the C++ source code.
4141
* Microsoft Visual Studio. Supported versions:
4242
- 2017 (version 15.8)
4343
- 2019 (version 16)
44-
* LLVM, Clang, LLD development libraries == 10.x
44+
* LLVM, Clang, LLD development libraries == 11.x
4545
- Use the [pre-built binaries](https://github.com/ziglang/zig/wiki/Building-Zig-on-Windows) or [build from source](https://github.com/ziglang/zig/wiki/How-to-build-LLVM,-libclang,-and-liblld-from-source#windows).
4646

4747
#### Instructions
@@ -68,19 +68,6 @@ cmake .. -DCMAKE_PREFIX_PATH=$(brew --prefix llvm)
6868
make install
6969
```
7070

71-
You will now run into this issue:
72-
[homebrew and llvm 10 packages in apt.llvm.org are broken with undefined reference to getPollyPluginInfo](https://github.com/ziglang/zig/issues/4799)
73-
or
74-
[error: unable to create target: 'Unable to find target for this triple (no targets are registered)'](https://github.com/ziglang/zig/issues/5055),
75-
in which case try `-DZIG_WORKAROUND_4799=ON`
76-
77-
This has been fixed upstream with LLVM 10.0.1.
78-
79-
Building with LLVM 10.0.1 you might run into this problem:
80-
`ld: library not found for -llibxml2.tbd`
81-
[Building with LLVM 10.0.1 installed via Homebrew fails](https://github.com/ziglang/zig/issues/6087),
82-
in which case you can try `-DZIG_WORKAROUND_6087=ON`.
83-
8471
##### Windows
8572

8673
See https://github.com/ziglang/zig/wiki/Building-Zig-on-Windows

ci/azure/linux_script

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ set -e
55

66
BUILDDIR="$(pwd)"
77

8-
sudo sh -c 'echo "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-10 main" >> /etc/apt/sources.list'
8+
sudo sh -c 'echo "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-11 main" >> /etc/apt/sources.list'
99
wget -O - http://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
1010
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
1111
sudo apt-get update -q
1212

1313
sudo apt-get remove -y llvm-*
1414
sudo rm -rf /usr/local/*
15-
sudo apt-get install -y libxml2-dev libclang-10-dev llvm-10 llvm-10-dev liblld-10-dev cmake s3cmd gcc-7 g++-7 ninja-build tidy
15+
sudo apt-get install -y libxml2-dev libclang-11-dev llvm-11 llvm-11-dev liblld-11-dev cmake s3cmd gcc-7 g++-7 ninja-build tidy
1616

1717
QEMUBASE="qemu-linux-x86_64-5.1.0"
1818
wget https://ziglang.org/deps/$QEMUBASE.tar.xz
@@ -44,7 +44,7 @@ VERSION="$(./zig version)"
4444
if [ "${BUILD_REASON}" != "PullRequest" ]; then
4545
ARTIFACTSDIR="$BUILDDIR/artifacts"
4646
mkdir "$ARTIFACTSDIR"
47-
docker run -i --mount type=bind,source="$ARTIFACTSDIR",target=/z ziglang/static-base:llvm10-x86_64-1 -j2 $BUILD_SOURCEVERSION
47+
docker run -i --mount type=bind,source="$ARTIFACTSDIR",target=/z ziglang/static-base:llvm11-x86_64-1 -j2 $BUILD_SOURCEVERSION
4848
TARBALL="$(ls $ARTIFACTSDIR)"
4949
mv "$DOWNLOADSECUREFILE_SECUREFILEPATH" "$HOME/.s3cfg"
5050
s3cmd put -P --add-header="cache-control: public, max-age=31536000, immutable" "$ARTIFACTSDIR/$TARBALL" s3://ziglang.org/builds/

ci/azure/macos_script

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,26 @@
33
set -x
44
set -e
55

6-
system_profiler SPHardwareDataType
7-
8-
brew install s3cmd gcc@9
6+
brew install s3cmd
97

108
ZIGDIR="$(pwd)"
11-
LLVMVER="10.0.1"
129
ARCH="x86_64"
13-
CACHE_BASENAME="llvm+clang+lld-$LLVMVER-$ARCH-macosx-gcc9-release"
10+
CACHE_BASENAME="zig+llvm+lld+clang-$ARCH-macos-gnu-0.6.0+1c9ef63a"
1411
PREFIX="$HOME/$CACHE_BASENAME"
1512
JOBS="-j2"
1613

17-
# I tried using the system default compiler (clang), but it couldn't statically link libc++.
18-
# So we use gcc-9 from homebrew.
19-
export CC=gcc-9
20-
export CXX=g++-9
21-
2214
rm -rf $PREFIX
23-
2415
cd $HOME
25-
wget -nv "https://ziglang.org/builds/$CACHE_BASENAME.tar.xz"
16+
wget -nv "https://ziglang.org/deps/$CACHE_BASENAME.tar.xz"
2617
tar xf "$CACHE_BASENAME.tar.xz"
2718

19+
ZIG="$PREFIX/bin/zig"
20+
NATIVE_LIBC_TXT="$HOME/native_libc.txt"
21+
$ZIG libc > "$NATIVE_LIBC_TXT"
22+
export ZIG_LIBC="$NATIVE_LIBC_TXT"
23+
export CC="$ZIG cc"
24+
export CXX="$ZIG c++"
25+
2826
cd $ZIGDIR
2927

3028
# Make the `zig version` number consistent.
@@ -33,7 +31,21 @@ git config core.abbrev 9
3331

3432
mkdir build
3533
cd build
36-
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=$PREFIX -DCMAKE_INSTALL_PREFIX=$(pwd)/release -DZIG_STATIC=ON
34+
cmake .. \
35+
-DCMAKE_INSTALL_PREFIX="$(pwd)/release" \
36+
-DCMAKE_PREFIX_PATH="$PREFIX" \
37+
-DCMAKE_BUILD_TYPE=Release \
38+
-DZIG_TARGET_TRIPLE="$ARCH-native-gnu" \
39+
-DZIG_TARGET_MCPU="baseline" \
40+
-DZIG_EXECUTABLE="$ZIG" \
41+
-DZIG_STATIC=ON
42+
43+
# Now cmake will use zig as the C/C++ compiler. We reset the environment variables
44+
# so that installation and testing do not get affected by them.
45+
unset CC
46+
unset CXX
47+
unset ZIG_LIBC
48+
3749
make $JOBS install
3850
release/bin/zig build test
3951

ci/azure/pipelines.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
jobs:
22
- job: BuildMacOS
33
pool:
4-
vmImage: 'macOS 10.14'
4+
vmImage: 'macOS-10.15'
55

66
timeoutInMinutes: 360
77

ci/azure/windows_msvc_install

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ pacman -Su --needed --noconfirm
77
pacman -S --needed --noconfirm wget p7zip python3-pip tar xz
88

99
pip install s3cmd
10-
wget -nv "https://ziglang.org/deps/llvm%2bclang%2blld-10.0.0-x86_64-windows-msvc-release-mt.tar.xz"
11-
tar xf llvm+clang+lld-10.0.0-x86_64-windows-msvc-release-mt.tar.xz
10+
wget -nv "https://ziglang.org/deps/llvm%2bclang%2blld-11.0.0-x86_64-windows-msvc-release-mt.tar.xz"
11+
tar xf llvm+clang+lld-11.0.0-x86_64-windows-msvc-release-mt.tar.xz

ci/azure/windows_msvc_script.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ SET "MSYSTEM=%PREVMSYSTEM%"
1111

1212
SET "ZIGBUILDDIR=%SRCROOT%\build"
1313
SET "ZIGINSTALLDIR=%ZIGBUILDDIR%\dist"
14-
SET "ZIGPREFIXPATH=%SRCROOT%\llvm+clang+lld-10.0.0-x86_64-windows-msvc-release-mt"
14+
SET "ZIGPREFIXPATH=%SRCROOT%\llvm+clang+lld-11.0.0-x86_64-windows-msvc-release-mt"
1515

1616
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
1717

ci/drone/drone.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ platform:
77

88
steps:
99
- name: build-and-test
10-
image: ziglang/static-base:llvm10-aarch64-1
10+
image: ziglang/static-base:llvm11-aarch64-1
1111
environment:
1212
SRHT_OAUTH_TOKEN:
1313
from_secret: SRHT_OAUTH_TOKEN

ci/srht/freebsd_script

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ sudo pkg update -fq
77
sudo pkg install -y cmake py27-s3cmd wget curl jq
88

99
ZIGDIR="$(pwd)"
10-
CACHE_BASENAME="llvm+clang+lld-10.0.0-x86_64-freebsd-release"
10+
CACHE_BASENAME="llvm+clang+lld-11.0.0-x86_64-freebsd-release"
1111
PREFIX="$HOME/$CACHE_BASENAME"
1212
JOBS="-j$(sysctl -n hw.ncpu)"
1313

@@ -31,24 +31,7 @@ cd build
3131
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=$PREFIX "-DCMAKE_INSTALL_PREFIX=$(pwd)/release" -DZIG_STATIC=ON
3232
make $JOBS install
3333

34-
release/bin/zig build test-fmt
35-
release/bin/zig build test-behavior
36-
# TODO get these tests passing on freebsd and re-enable
37-
#release/bin/zig build test-std
38-
release/bin/zig build test-compiler-rt
39-
release/bin/zig build test-compare-output
40-
release/bin/zig build test-standalone
41-
release/bin/zig build test-stack-traces
42-
release/bin/zig build test-cli
43-
release/bin/zig build test-asm-link
44-
release/bin/zig build test-runtime-safety
45-
release/bin/zig build test-translate-c
46-
release/bin/zig build test-run-translated-c
47-
# TODO disabled until we are shipping self-hosted
48-
#release/bin/zig build test-gen-h
49-
# TODO disabled to save time and hit that 45 minute limit
50-
#release/bin/zig build test-compile-errors
51-
release/bin/zig build docs
34+
release/bin/zig build test
5235

5336
if [ -f ~/.s3cfg ]; then
5437
mv ../LICENSE release/

cmake/Findclang.cmake

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,27 @@
99

1010
find_path(CLANG_INCLUDE_DIRS NAMES clang/Frontend/ASTUnit.h
1111
PATHS
12-
/usr/lib/llvm/10/include
13-
/usr/lib/llvm-10/include
14-
/usr/lib/llvm-10.0/include
15-
/usr/local/llvm100/include
16-
/usr/local/llvm10/include
12+
/usr/lib/llvm/11/include
13+
/usr/lib/llvm-11/include
14+
/usr/lib/llvm-11.0/include
15+
/usr/local/llvm110/include
16+
/usr/local/llvm11/include
1717
/mingw64/include
1818
)
1919

2020
if(ZIG_PREFER_CLANG_CPP_DYLIB)
2121
find_library(CLANG_LIBRARIES
2222
NAMES
23-
clang-cpp-10.0
24-
clang-cpp100
23+
clang-cpp-11.0
24+
clang-cpp110
2525
clang-cpp
2626
PATHS
2727
${CLANG_LIBDIRS}
28-
/usr/lib/llvm/10/lib
29-
/usr/lib/llvm/10/lib64
30-
/usr/lib/llvm-10/lib
31-
/usr/local/llvm100/lib
32-
/usr/local/llvm10/lib
28+
/usr/lib/llvm/11/lib
29+
/usr/lib/llvm/11/lib64
30+
/usr/lib/llvm-11/lib
31+
/usr/local/llvm110/lib
32+
/usr/local/llvm11/lib
3333
)
3434
endif()
3535

@@ -39,11 +39,11 @@ if(NOT CLANG_LIBRARIES)
3939
find_library(CLANG_${_prettylibname_}_LIB NAMES ${_libname_}
4040
PATHS
4141
${CLANG_LIBDIRS}
42-
/usr/lib/llvm/10/lib
43-
/usr/lib/llvm-10/lib
44-
/usr/lib/llvm-10.0/lib
45-
/usr/local/llvm100/lib
46-
/usr/local/llvm10/lib
42+
/usr/lib/llvm/11/lib
43+
/usr/lib/llvm-11/lib
44+
/usr/lib/llvm-11.0/lib
45+
/usr/local/llvm110/lib
46+
/usr/local/llvm11/lib
4747
/mingw64/lib
4848
/c/msys64/mingw64/lib
4949
c:\\msys64\\mingw64\\lib
@@ -75,6 +75,7 @@ if(NOT CLANG_LIBRARIES)
7575
FIND_AND_ADD_CLANG_LIB(clangRewrite)
7676
FIND_AND_ADD_CLANG_LIB(clangCrossTU)
7777
FIND_AND_ADD_CLANG_LIB(clangIndex)
78+
FIND_AND_ADD_CLANG_LIB(clangToolingCore)
7879
endif()
7980

8081
include(FindPackageHandleStandardArgs)

cmake/Findlld.cmake

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@
88

99
find_path(LLD_INCLUDE_DIRS NAMES lld/Common/Driver.h
1010
PATHS
11-
/usr/lib/llvm-10/include
12-
/usr/local/llvm100/include
13-
/usr/local/llvm10/include
11+
/usr/lib/llvm-11/include
12+
/usr/local/llvm110/include
13+
/usr/local/llvm11/include
1414
/mingw64/include)
1515

16-
find_library(LLD_LIBRARY NAMES lld-10.0 lld100 lld
16+
find_library(LLD_LIBRARY NAMES lld-11.0 lld110 lld
1717
PATHS
18-
/usr/lib/llvm-10/lib
19-
/usr/local/llvm100/lib
20-
/usr/local/llvm10/lib
18+
/usr/lib/llvm-11/lib
19+
/usr/local/llvm110/lib
20+
/usr/local/llvm11/lib
2121
)
2222
if(EXISTS ${LLD_LIBRARY})
2323
set(LLD_LIBRARIES ${LLD_LIBRARY})
@@ -27,9 +27,9 @@ else()
2727
find_library(LLD_${_prettylibname_}_LIB NAMES ${_libname_}
2828
PATHS
2929
${LLD_LIBDIRS}
30-
/usr/lib/llvm-10/lib
31-
/usr/local/llvm100/lib
32-
/usr/local/llvm10/lib
30+
/usr/lib/llvm-11/lib
31+
/usr/local/llvm110/lib
32+
/usr/local/llvm11/lib
3333
/mingw64/lib
3434
/c/msys64/mingw64/lib
3535
c:/msys64/mingw64/lib)

0 commit comments

Comments
 (0)