Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into llvm16-2
Browse files Browse the repository at this point in the history
  • Loading branch information
kinke committed Aug 12, 2023
2 parents 340d7cf + cf32bac commit 81ea49d
Show file tree
Hide file tree
Showing 401 changed files with 9,104 additions and 8,325 deletions.
37 changes: 23 additions & 14 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,31 @@ commonSteps: &commonSteps
fi
apt-get -q update
apt-get -yq install \
git-core cmake ninja-build $gcc_pkg \
git-core $gcc_pkg \
zlib1g-dev $libcurl_pkg curl gdb python3 python3-pip tzdata unzip zip \
$EXTRA_APT_PACKAGES
# Download & extract CMake
curl -fL --retry 3 --max-time 300 -o cmake.tar.gz https://github.com/Kitware/CMake/releases/download/v3.27.1/cmake-3.27.1-linux-x86_64.tar.gz
mkdir cmake
tar -xf cmake.tar.gz --strip 1 -C cmake
rm cmake.tar.gz
# Download & extract Ninja
curl -fL --retry 3 --max-time 60 -O https://github.com/symmetryinvestments/ninja/releases/download/v1.11.1-sym1/ninja-linux.zip
mkdir ninja
unzip ninja-linux.zip -d ninja
rm ninja-linux.zip
# Add CMake and Ninja to PATH for future steps
echo "export PATH=$PWD/cmake/bin:$PWD/ninja:$PATH" >> $BASH_ENV
else
# Download & extract CMake
curl -fL --retry 3 --max-time 300 -o cmake.tar.gz https://github.com/Kitware/CMake/releases/download/v3.20.3/cmake-3.20.3-macos-universal.tar.gz
curl -fL --retry 3 --max-time 300 -o cmake.tar.gz https://github.com/Kitware/CMake/releases/download/v3.27.1/cmake-3.27.1-macos-universal.tar.gz
mkdir cmake
tar -xf cmake.tar.gz --strip 3 -C cmake
rm cmake.tar.gz
# Download & extract Ninja
curl -fL --retry 3 --max-time 60 -O https://github.com/ninja-build/ninja/releases/download/v1.10.2/ninja-mac.zip
curl -fL --retry 3 --max-time 60 -O https://github.com/symmetryinvestments/ninja/releases/download/v1.11.1-sym1/ninja-mac.zip
mkdir ninja
tar -xf ninja-mac.zip -C ninja
unzip ninja-mac.zip -d ninja
rm ninja-mac.zip
# Download & extract LDC-flavoured LLVM with enabled assertions
curl -fL --retry 3 --max-time 300 -o llvm.tar.xz https://github.com/ldc-developers/llvm-project/releases/download/ldc-v$LLVM_VERSION/llvm-$LLVM_VERSION-osx-x86_64-withAsserts.tar.xz
Expand Down Expand Up @@ -68,12 +80,7 @@ commonSteps: &commonSteps
-DD_COMPILER=$PWD/../host-ldc/bin/ldmd2 \
-DLDC_LINK_MANUALLY=OFF \
$EXTRA_CMAKE_FLAGS
# Work around out-of-memory errors - retry once with parallelization and one last time serially
targets='all ldc2-unittest all-test-runners'
for i in {1..2}; do
ninja -j$PARALLELISM -k0 $targets && break || true
done
ninja -j1 $targets
ninja -j$PARALLELISM obj/ldc2.o all ldc2-unittest all-test-runners
bin/ldc2 -version
- run:
name: Run LDC D unittests
Expand Down Expand Up @@ -104,20 +111,22 @@ jobs:
<<: *commonSteps
docker:
- image: ubuntu:20.04
resource_class: large
environment:
- PARALLELISM: 2
- PARALLELISM: 4
- CI_OS: linux
- EXTRA_APT_PACKAGES: llvm-dev libclang-common-10-dev
- EXTRA_APT_PACKAGES: llvm-11-dev libclang-common-11-dev
- HOST_LDC_VERSION: 1.24.0
- EXTRA_CMAKE_FLAGS: "-DMULTILIB=ON -DRT_SUPPORT_SANITIZERS=ON -DBUILD_LTO_LIBS=ON"
Ubuntu-20.04-sharedLibsOnly-gdmd:
<<: *commonSteps
docker:
- image: ubuntu:20.04
resource_class: large
environment:
- PARALLELISM: 2
- PARALLELISM: 4
- CI_OS: linux
- EXTRA_APT_PACKAGES: gdmd llvm-dev libclang-common-10-dev
- EXTRA_APT_PACKAGES: gdmd llvm-11-dev libclang-common-11-dev
- HOST_LDC_VERSION: 1.24.0
- EXTRA_CMAKE_FLAGS: "-DBUILD_SHARED_LIBS=ON -DBUILD_LTO_LIBS=ON -DD_COMPILER=gdmd -DLDC_LINK_MANUALLY=ON"
macOS-x64:
Expand Down
44 changes: 35 additions & 9 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ common_steps_template: &COMMON_STEPS_TEMPLATE
-DINCLUDE_INSTALL_DIR=$installDir/import \
-DLDC_LINK_MANUALLY=OFF \
"${extraFlags[@]}"
ninja -j$PARALLELISM all ldc2-unittest all-test-runners
ninja -j$PARALLELISM obj/ldc2.o all ldc2-unittest all-test-runners
bin/ldc2 -version
always:
run_compiler_unittests_script: |
Expand Down Expand Up @@ -65,6 +65,12 @@ common_steps_template: &COMMON_STEPS_TEMPLATE
excludes+='|^std.math.exponential(-shared)?$'
# FIXME: failure
excludes+='|^druntime-test-exceptions-debug$'
# std.path unittests apparently need HOME, which happens not to be set
export HOME=~
echo "Setting HOME to '$HOME'"
elif [[ "$CI_OS-$CI_ARCH" == "osx-arm64" ]]; then
# FIXME: sporadic segfaults/bus errors with enabled optimizations
excludes+='|^core.thread.fiber(-shared)?$'
fi
ctest -j$PARALLELISM --output-on-failure -E "$excludes"
Expand Down Expand Up @@ -184,10 +190,22 @@ install_ubuntu_prerequisites_template: &INSTALL_UBUNTU_PREREQUISITES_TEMPLATE
fi
apt-get -q update
apt-get -yq install \
git-core cmake ninja-build $gcc_pkg \
git-core ninja-build $gcc_pkg \
zlib1g-dev $libcurl_pkg curl gdb python3 python3-pip tzdata unzip zip \
$EXTRA_APT_PACKAGES
python3 --version
# Download & extract CMake
curl -fL --retry 3 --max-time 300 -o cmake.tar.gz https://github.com/Kitware/CMake/releases/download/v3.27.1/cmake-3.27.1-linux-$CI_ARCH.tar.gz
mkdir cmake
tar -xf cmake.tar.gz --strip 1 -C cmake
rm cmake.tar.gz
# Download & extract custom Ninja on x86_64
if [[ "$CI_ARCH" == "x86_64" ]]; then
curl -fL --retry 3 --max-time 60 -O https://github.com/symmetryinvestments/ninja/releases/download/v1.11.1-sym1/ninja-linux.zip
mkdir ninja
unzip ninja-linux.zip -d ninja
rm ninja-linux.zip
fi
# Download & extract host LDC
curl -fL --retry 3 --max-time 300 -o ldc2.tar.xz https://github.com/ldc-developers/ldc/releases/download/v$HOST_LDC_VERSION/ldc2-$HOST_LDC_VERSION-linux-$CI_ARCH.tar.xz
mkdir host-ldc
Expand All @@ -201,12 +219,12 @@ install_macos_prerequisites_template: &INSTALL_MACOS_PREREQUISITES_TEMPLATE
cd $CIRRUS_WORKING_DIR/..
sysctl -n hw.logicalcpu
# Download & extract CMake
curl -fL --retry 3 --max-time 300 -o cmake.tar.gz https://github.com/Kitware/CMake/releases/download/v3.20.3/cmake-3.20.3-macos-universal.tar.gz
curl -fL --retry 3 --max-time 300 -o cmake.tar.gz https://github.com/Kitware/CMake/releases/download/v3.27.1/cmake-3.27.1-macos-universal.tar.gz
mkdir cmake
tar -xf cmake.tar.gz --strip 3 -C cmake
rm cmake.tar.gz
# Download & extract Ninja
curl -fL --retry 3 --max-time 60 -O https://github.com/ninja-build/ninja/releases/download/v1.10.2/ninja-mac.zip
curl -fL --retry 3 --max-time 60 -O https://github.com/symmetryinvestments/ninja/releases/download/v1.11.1-sym1/ninja-mac.zip
mkdir ninja
tar -xf ninja-mac.zip -C ninja
rm ninja-mac.zip
Expand Down Expand Up @@ -244,9 +262,10 @@ task:
environment:
CI_ARCH: x86_64
CI_OS: linux
EXTRA_APT_PACKAGES: "llvm-dev libclang-common-10-dev"
EXTRA_APT_PACKAGES: "llvm-11-dev libclang-common-11-dev"
EXTRA_CMAKE_FLAGS: "-DMULTILIB=ON -DRT_SUPPORT_SANITIZERS=ON -DBUILD_LTO_LIBS=ON"
PARALLELISM: 8
PATH: ${CIRRUS_WORKING_DIR}/../cmake/bin:${CIRRUS_WORKING_DIR}/../ninja:${PATH}
<< : *INSTALL_UBUNTU_PREREQUISITES_TEMPLATE
<< : *COMMON_STEPS_TEMPLATE

Expand All @@ -265,6 +284,7 @@ task:
EXTRA_APT_PACKAGES: "gdmd llvm-dev libclang-common-15-dev"
EXTRA_CMAKE_FLAGS: "-DBUILD_SHARED_LIBS=ON -DBUILD_LTO_LIBS=ON -DD_COMPILER=gdmd -DLDC_LINK_MANUALLY=ON"
PARALLELISM: 8
PATH: ${CIRRUS_WORKING_DIR}/../cmake/bin:${CIRRUS_WORKING_DIR}/../ninja:${PATH}
# for gdmd:
LANG: C.UTF-8
<< : *INSTALL_UBUNTU_PREREQUISITES_TEMPLATE
Expand All @@ -281,9 +301,10 @@ task:
CI_ARCH: x86_64
CI_OS: linux
HOST_LDC_VERSION: 1.9.0
EXTRA_APT_PACKAGES: "llvm-dev libclang-common-10-dev"
EXTRA_APT_PACKAGES: "llvm-11-dev libclang-common-11-dev"
EXTRA_CMAKE_FLAGS: "-DBUILD_LTO_LIBS=ON"
PARALLELISM: 8
PATH: ${CIRRUS_WORKING_DIR}/../cmake/bin:${CIRRUS_WORKING_DIR}/../ninja:${PATH}
<< : *INSTALL_UBUNTU_PREREQUISITES_TEMPLATE
<< : *COMMON_STEPS_TEMPLATE

Expand Down Expand Up @@ -318,10 +339,14 @@ task:

task:
name: Ubuntu 20.04 aarch64
arm_container:
image: ubuntu:20.04
compute_engine_instance:
image_project: ubuntu-os-cloud
image: family/ubuntu-2004-lts-arm64
platform: linux
architecture: arm64
cpu: 4
memory: 8G
disk: 20
timeout_in: 60m
environment:
CI_ARCH: aarch64
Expand All @@ -337,6 +362,7 @@ task:
-DLLVM_ROOT_DIR=$CIRRUS_WORKING_DIR/../llvm
-DD_COMPILER=$CIRRUS_WORKING_DIR/../bootstrap-ldc/bin/ldmd2
PARALLELISM: 4
PATH: ${CIRRUS_WORKING_DIR}/../cmake/bin:${PATH}
CLANG_VERSION: '15.0.3' # 15.0.6 requires a more recent libstdc++.so.6 than shipped with Ubuntu 20
CC: $CIRRUS_WORKING_DIR/../clang/bin/clang
CXX: $CIRRUS_WORKING_DIR/../clang/bin/clang++
Expand Down Expand Up @@ -380,7 +406,7 @@ task:
-DD_COMPILER=$PWD/../host-ldc/bin/ldmd2 \
-DBUILD_SHARED_LIBS=OFF \
-DBUILD_LTO_LIBS=ON
ninja -j$PARALLELISM
ninja -j$PARALLELISM obj/ldc2.o all
bin/ldc2 -version
<< : *COMMON_STEPS_TEMPLATE
<< : *PACKAGING_STEPS_TEMPLATE
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/1-setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ runs:
ld --version
- name: Install ninja
uses: seanmiddleditch/gha-setup-ninja@v3
uses: symmetryinvestments/gha-setup-ninja@v1

- name: Install D host compiler
uses: dlang-community/setup-dlang@v1
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/3-build-cross/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,4 @@ runs:
${{ inputs.cmake_flags }}
${{ inputs.with_pgo == 'true' && '-DDFLAGS_LDC=-fprofile-use=../pgo-ldc/merged.profdata' || '' }}
${{ env.CROSS_CMAKE_FLAGS }}
build_targets: ldc2 ldmd2 ldc-build-runtime ldc-profdata ldc-prune-cache timetrace2txt
build_targets: ldc2 ldmd2 ldc-build-runtime ldc-build-plugin ldc-profdata ldc-prune-cache timetrace2txt
1 change: 1 addition & 0 deletions .github/actions/5-install/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ runs:
else
mkdir -p install/bin
cp build-cross/bin/{ldc2,ldmd2,ldc-build-runtime,ldc-profdata,ldc-prune-cache,timetrace2txt} install/bin/
cp build-cross/bin/ldc-build-plugin install/bin/ || true
cp -R build-cross-libs/lib install/
cp build-cross/lib/{libldc_rt.*,libLTO-ldc.dylib,LLVMgold-ldc.so} install/lib/ || true
mkdir install/etc
Expand Down
6 changes: 3 additions & 3 deletions .github/actions/helper-build-ldc/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ inputs:
default: ''
build_targets:
required: false
default: '' # all
default: 'all'
arch:
required: false # Windows only
runs:
Expand All @@ -39,7 +39,7 @@ runs:
${{ inputs.specify_install_dir == 'true' && '-DINCLUDE_INSTALL_DIR="$installDir/import"' || '' }} \
${{ inputs.cmake_flags }}
ninja ${{ inputs.build_targets }}
ninja obj/ldc2.o ${{ inputs.build_targets }}
# Windows: invoke CMake & ninja in MSVC env
- if: runner.os == 'Windows'
Expand All @@ -62,4 +62,4 @@ runs:
${{ inputs.cmake_flags }}
if %errorlevel% neq 0 exit /b %errorlevel%
ninja ${{ inputs.build_targets }} || exit /b
ninja obj/ldc2.obj ${{ inputs.build_targets }} || exit /b
39 changes: 13 additions & 26 deletions .github/workflows/supported_llvm_versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,46 +23,37 @@ jobs:
os: ubuntu-20.04
host_dc: ldc-beta
llvm_version: 15.0.6
- job_name: Ubuntu 20.04, LLVM 14, latest LDC beta
os: ubuntu-20.04
host_dc: ldc-beta
llvm_version: 14.0.0
# the compiler-rt libs installation is somehow non-standard
cmake_flags: -DLDC_INSTALL_LLVM_RUNTIME_LIBS_OS=x86_64-unknown-linux-gnu -DLDC_INSTALL_LLVM_RUNTIME_LIBS_ARCH=""
- job_name: Ubuntu 20.04, LLVM 12, latest LDC beta
os: ubuntu-20.04
host_dc: ldc-beta
llvm_version: 12.0.1
cmake_flags: -DLIB_SUFFIX=64
- job_name: Ubuntu 20.04, LLVM 11, latest LDC beta
os: ubuntu-20.04
host_dc: ldc-beta
llvm_version: 11.1.0
cmake_flags: -DBUILD_SHARED_LIBS=ON -DRT_SUPPORT_SANITIZERS=ON
- job_name: Ubuntu 20.04, LLVM 9, latest DMD beta
cmake_flags: -DBUILD_SHARED_LIBS=ON -DLIB_SUFFIX=64
- job_name: Ubuntu 20.04, LLVM 11, latest DMD beta
os: ubuntu-20.04
host_dc: dmd-beta
llvm_version: 9.0.1
llvm_version: 11.1.0
cmake_flags: -DBUILD_SHARED_LIBS=OFF -DRT_SUPPORT_SANITIZERS=ON -DLDC_LINK_MANUALLY=ON
- job_name: macOS 11, LLVM 10, latest DMD beta
- job_name: macOS 11, LLVM 13, latest DMD beta
os: macos-11
host_dc: dmd-beta
llvm_version: 10.0.1
cmake_flags: -DBUILD_SHARED_LIBS=ON -DRT_SUPPORT_SANITIZERS=ON -DLDC_LINK_MANUALLY=ON -DCMAKE_CXX_COMPILER=/usr/bin/c++ -DCMAKE_C_COMPILER=/usr/bin/cc -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0
- job_name: macOS 11, LLVM 13, latest LDC beta
llvm_version: 13.0.1
cmake_flags: -DBUILD_SHARED_LIBS=ON -DRT_SUPPORT_SANITIZERS=ON -DLDC_LINK_MANUALLY=ON -DCMAKE_CXX_COMPILER=/usr/bin/c++ -DCMAKE_C_COMPILER=/usr/bin/cc
- job_name: macOS 11, LLVM 14, latest LDC beta
os: macos-11
host_dc: ldc-beta
llvm_version: 13.0.1
cmake_flags: -DBUILD_SHARED_LIBS=OFF -DD_COMPILER_FLAGS=-gcc=/usr/bin/c++ -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0
llvm_version: 14.0.6
cmake_flags: -DBUILD_SHARED_LIBS=OFF -DD_COMPILER_FLAGS=-gcc=/usr/bin/c++
name: ${{ matrix.job_name }}
runs-on: ${{ matrix.os }}
env:
MACOSX_DEPLOYMENT_TARGET: 11.6 # silence `ld: warning: object file (…) was built for newer macOS version (…) than being linked (…)`
steps:
- uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 50
- name: Install ninja
uses: seanmiddleditch/gha-setup-ninja@v3
uses: symmetryinvestments/gha-setup-ninja@v1
- name: Install D host compiler
uses: dlang-community/setup-dlang@v1
with:
Expand Down Expand Up @@ -126,7 +117,7 @@ jobs:
-DLLVM_ROOT_DIR="$PWD/llvm" \
-DLDC_LINK_MANUALLY=OFF \
${{ matrix.cmake_flags }}
ninja all ldc2-unittest all-test-runners
ninja obj/ldc2.o all ldc2-unittest all-test-runners
bin/ldc2 --version
- name: Run LDC D unittests
Expand All @@ -136,10 +127,6 @@ jobs:
if: success() || failure()
run: |
set -eux
# LLVM 9: libclang_rt.fuzzer-x86_64.a not compiled with -fPIC
if [[ '${{ matrix.llvm_version }}' = 9.* ]]; then
echo "config.available_features.remove('Fuzzer')" >> tests/sanitizers/lit.local.cfg
fi
# LLVM 14+ on Linux: don't use vanilla llvm-symbolizer (no support for zlib-compressed debug sections => failing ASan tests)
if [[ '${{ runner.os }}' == 'Linux' && '${{ matrix.llvm_version }}' =~ ^1[4-9]\. ]]; then
mv llvm/bin/llvm-symbolizer llvm/bin/llvm-symbolizer.bak
Expand Down
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,30 @@
# LDC master

#### Big news
- Frontend, druntime and Phobos are at version [2.104.2](https://dlang.org/changelog/2.104.0.html). (#4440)

#### Platform support
- Supports LLVM 11.0 - 15.0.

#### Bug fixes

# LDC 1.33.0 (2023-07-23)

#### Big news
- Frontend, druntime and Phobos are at version [2.103.1](https://dlang.org/changelog/2.103.0.html), incl. new command-line option `-verror-supplements`. (#4345)
- The `--plugin` commandline option now also accepts semantic analysis plugins. Semantic analysis plugins are recognized by exporting the symbol: `extern(C) void runSemanticAnalysis(Module m)`. The plugin's `runSemanticAnalysis` function is called for each module, after all other semantic analysis steps (also after DCompute SemA), just before object codegen. (#4430)
- New tool `ldc-build-plugin` that helps compiling user plugins. It downloads the correct LDC source version (if it's not already available), and calls LDC with the correct commandline flags to build a plugin. (#4430)
- New commandline option `-femit-local-var-lifetime` that enables variable lifetime (scope) annotation to LLVM IR codegen. Lifetime annotation enables stack memory reuse for local variables with non-overlapping scope. (#4395)
- C files are now automatically preprocessed using the external C compiler (configurable via `-gcc` or the `CC` environment variable, and `-Xcc` for extra flags). Extra preprocessor flags (e.g., include dirs and manual defines) can be added via new command-line option `-P`. (#4417)
- Windows: If `clang-cl.exe` is on `PATH`, it is preferred over Microsoft's `cl.exe` by default (e.g., to avoid printing the C source file name to stderr during preprocessing).
- Less pedantic checks for conflicting C(++) function declarations when compiling multiple modules to a single object file ('Error: Function type does not match previously declared function with the same mangled name'). The error now only appears if an object file actually references multiple conflicting functions. (#4420)
- New command-line option `--fcf-protection`, which enables Intel's Control-Flow Enforcement Technology (CET). (#4437)

#### Platform support
- Supports LLVM 9.0 - 15.0.

#### Bug fixes
- Handle potential lambda mangle collisions across separately compiled object files (and the linker then silently picking an arbitrary implementation). Lambdas (and their nested global variables) are now internal to each referencing object file (`static` linkage in C). (#4415)

# LDC 1.32.2 (2023-05-12)

Expand Down
Loading

0 comments on commit 81ea49d

Please sign in to comment.