{gcc9,gcc10,gcc11,gcc12}: drop (#435019)

This commit is contained in:
Randy Eckenrode
2025-08-23 10:31:11 +08:00
committed by GitHub
47 changed files with 269 additions and 3019 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
# D (Dlang) {#dlang}
Nixpkgs provides multiple D compilers such as `ldc`, `dmd` and `gdc`.
Nixpkgs provides multiple D compilers such as `ldc` and `dmd`.
These can be used like any other package during build time.
However, Nixpkgs provides a build helper for compiling packages using the `dub` package manager.
+2
View File
@@ -20,6 +20,8 @@
- The `offrss` package was removed due to lack of upstream maintenance since 2012. It's recommended for users to migrate to another RSS reader
- GCC 9, 10, 11, and 12 have been removed, as they have reached endoflife upstream and are no longer supported.
- `base16-builder` node package has been removed due to lack of upstream maintenance.
- `gentium` package now provides `Gentium-*.ttf` files, and not `GentiumPlus-*.ttf` files like before. The font identifiers `Gentium Plus*` are available in the `gentium-plus` package, and if you want to use the more recently updated package `gentium` [by sil](https://software.sil.org/gentium/), you should update your configuration files to use the `Gentium` font identifier.
- `space-orbit` package has been removed due to lack of upstream maintenance. Debian upstream stopped tracking it in 2011.
+3 -19
View File
@@ -15,7 +15,6 @@
bintools,
coreutils ? null,
apple-sdk ? null,
zlib ? null,
nativeTools,
noLibc ? false,
nativeLibc,
@@ -534,10 +533,6 @@ stdenvNoCC.mkDerivation {
ln -sf ${cc} $out/nix-support/gprconfig-gnat-unwrapped
''
+ optionalString cc.langD or false ''
wrap ${targetPrefix}gdc $wrapper $ccPath/${targetPrefix}gdc
''
+ optionalString cc.langFortran or false ''
wrap ${targetPrefix}gfortran $wrapper $ccPath/${targetPrefix}gfortran
ln -sv ${targetPrefix}gfortran $out/bin/${targetPrefix}g77
@@ -545,10 +540,6 @@ stdenvNoCC.mkDerivation {
export named_fc=${targetPrefix}gfortran
''
+ optionalString cc.langJava or false ''
wrap ${targetPrefix}gcj $wrapper $ccPath/${targetPrefix}gcj
''
+ optionalString cc.langGo or false ''
wrap ${targetPrefix}gccgo $wrapper $ccPath/${targetPrefix}gccgo
wrap ${targetPrefix}go ${./go-wrapper.sh} $ccPath/${targetPrefix}go
@@ -558,8 +549,7 @@ stdenvNoCC.mkDerivation {
propagatedBuildInputs = [
bintools
]
++ extraTools
++ optionals cc.langD or cc.langJava or false [ zlib ];
++ extraTools;
depsTargetTargetPropagated = optional (libcxx != null) libcxx ++ extraPackages;
setupHooks = [
@@ -672,12 +662,12 @@ stdenvNoCC.mkDerivation {
+ optionalString (!isArocc) ''
echo "-B${libc_lib}${libc.libdir or "/lib/"}" >> $out/nix-support/libc-crt1-cflags
''
+ optionalString (!(cc.langD or false)) ''
+ ''
echo "-${
if isArocc then "I" else "idirafter"
} ${libc_dev}${libc.incdir or "/include"}" >> $out/nix-support/libc-cflags
''
+ optionalString (isGNU && (!(cc.langD or false))) ''
+ optionalString isGNU ''
for dir in "${cc}"/lib/gcc/*/*/include-fixed; do
echo '-idirafter' ''${dir} >> $out/nix-support/libc-cflags
done
@@ -796,9 +786,6 @@ stdenvNoCC.mkDerivation {
ln -s ${cc.man} $man
ln -s ${cc.info} $info
''
+ optionalString (cc.langD or cc.langJava or false && !isArocc) ''
echo "-B${zlib}${zlib.libdir or "/lib/"}" >> $out/nix-support/libc-cflags
''
##
## Hardening support
@@ -857,9 +844,6 @@ stdenvNoCC.mkDerivation {
+ optionalString cc.langAda or false ''
hardening_unsupported_flags+=" format stackprotector strictoverflow"
''
+ optionalString cc.langD or false ''
hardening_unsupported_flags+=" format"
''
+ optionalString cc.langFortran or false ''
hardening_unsupported_flags+=" format"
''
-94
View File
@@ -1,94 +0,0 @@
{
# gcc 11.2 suggested on 3.10.5.2.
# gcc 11.3.0 unsupported yet, investigate gcc support when upgrading
# See https://github.com/arangodb/arangodb/issues/17454
gcc10Stdenv,
git,
lib,
fetchFromGitHub,
openssl,
zlib,
cmake,
python3,
perl,
snappy,
lzo,
which,
targetArchitecture ? null,
asmOptimizations ? gcc10Stdenv.hostPlatform.isx86,
}:
let
defaultTargetArchitecture = if gcc10Stdenv.hostPlatform.isx86 then "haswell" else "core";
targetArch = if targetArchitecture == null then defaultTargetArchitecture else targetArchitecture;
in
gcc10Stdenv.mkDerivation rec {
pname = "arangodb";
version = "3.10.5.2";
src = fetchFromGitHub {
repo = "arangodb";
owner = "arangodb";
tag = "v${version}";
hash = "sha256-64iTxhG8qKTSrTlH/BWDJNnLf8VnaCteCKfQ9D2lGDQ=";
fetchSubmodules = true;
};
nativeBuildInputs = [
cmake
git
perl
python3
which
];
buildInputs = [
openssl
zlib
snappy
lzo
];
# prevent failing with "cmake-3.13.4/nix-support/setup-hook: line 10: ./3rdParty/rocksdb/RocksDBConfig.cmake.in: No such file or directory"
dontFixCmake = true;
env.NIX_CFLAGS_COMPILE = "-Wno-error";
postPatch = ''
sed -i -e 's!/bin/echo!echo!' 3rdParty/V8/gypfiles/*.gypi
# with nixpkgs, it has no sense to check for a version update
substituteInPlace js/client/client.js --replace "require('@arangodb').checkAvailableVersions();" ""
substituteInPlace js/server/server.js --replace "require('@arangodb').checkAvailableVersions();" ""
'';
preConfigure = ''
patchShebangs utils
'';
cmakeBuildType = "RelWithDebInfo";
cmakeFlags = [
"-DUSE_MAINTAINER_MODE=OFF"
"-DUSE_GOOGLE_TESTS=OFF"
# avoid reading /proc/cpuinfo for feature detection
"-DTARGET_ARCHITECTURE=${targetArch}"
]
++ lib.optionals asmOptimizations [
"-DASM_OPTIMIZATIONS=ON"
"-DHAVE_SSE42=${if gcc10Stdenv.hostPlatform.sse4_2Support then "ON" else "OFF"}"
];
meta = with lib; {
homepage = "https://www.arangodb.com";
description = "Native multi-model database with flexible data models for documents, graphs, and key-values";
license = licenses.asl20;
platforms = [ "x86_64-linux" ];
maintainers = with maintainers; [
flosse
jsoo1
];
};
}
-39
View File
@@ -1,39 +0,0 @@
{
fetchFromGitHub,
gcc10Stdenv,
lib,
cmake,
}:
gcc10Stdenv.mkDerivation rec {
pname = "COLLADA2GLTF";
version = "2.1.5";
src = fetchFromGitHub {
owner = "KhronosGroup";
repo = "COLLADA2GLTF";
tag = "v${version}";
hash = "sha256-3Eo1qS6S5vlc/d2WB4iDJTjUnwMUrx9+Ln6n8PYU5qA=";
fetchSubmodules = true;
};
installPhase = ''
runHook preInstall
install -Dm755 COLLADA2GLTF-bin $out/bin/COLLADA2GLTF
runHook postInstall
'';
nativeBuildInputs = [
cmake
];
meta = {
description = "Command-line tool to convert COLLADA (.dae) files to glTF";
homepage = "https://github.com/KhronosGroup/COLLADA2GLTF";
license = lib.licenses.bsd3;
mainProgram = "COLLADA2GLTF";
maintainers = with lib.maintainers; [ shaddydc ];
platforms = with lib.platforms; unix ++ windows;
};
}
@@ -1,11 +0,0 @@
--- a/dmd-script
+++ b/dmd-script
@@ -72,7 +72,7 @@ my @run_args;
# for the target prefix.
basename($0) =~ m/^(.*-)?g?dmd(-.*)?$/;
my $target_prefix = $1?$1:"";
-my $gdc_dir = abs_path(dirname($0));
+my $gdc_dir = "@gdc_dir@";
my $gdc = File::Spec->catfile( $gdc_dir, $target_prefix . "gdc" . ($2?$2:""));
sub osHasEXE() {
-48
View File
@@ -1,48 +0,0 @@
{
lib,
stdenvNoCC,
fetchFromGitHub,
replaceVars,
gdc,
perl,
}:
stdenvNoCC.mkDerivation {
pname = "gdmd";
version = "0.1.0-unstable-2024-05-30";
src = fetchFromGitHub {
owner = "D-Programming-GDC";
repo = "gdmd";
rev = "dc0ad9f739795f3ce5c69825efcd5d1d586bb013";
hash = "sha256-Sw8ExEPDvGqGKcM9VKnOI6MGgXW0tAu51A90Wi4qrRE=";
};
patches = [
(replaceVars ./0001-gdc-store-path.diff {
gdc_dir = "${gdc}/bin";
})
];
buildInputs = [
gdc
perl
];
installFlags = [
"DESTDIR=$(out)"
"prefix="
];
preInstall = ''
install -d $out/bin $out/share/man/man1
'';
meta = {
description = "Wrapper for GDC that emulates DMD's command line";
homepage = "https://gdcproject.org";
license = lib.licenses.gpl3Plus;
platforms = lib.platforms.all;
maintainers = with lib.maintainers; [ jtbx ];
mainProgram = "gdmd";
};
}
-10
View File
@@ -1,10 +0,0 @@
{ wrapCC, gcc10 }:
wrapCC (
gcc10.cc.override {
name = "gfortran";
langFortran = true;
langCC = false;
langC = false;
profiledCompiler = false;
}
)
-10
View File
@@ -1,10 +0,0 @@
{ wrapCC, gcc11 }:
wrapCC (
gcc11.cc.override {
name = "gfortran";
langFortran = true;
langCC = false;
langC = false;
profiledCompiler = false;
}
)
-10
View File
@@ -1,10 +0,0 @@
{ wrapCC, gcc12 }:
wrapCC (
gcc12.cc.override {
name = "gfortran";
langFortran = true;
langCC = false;
langC = false;
profiledCompiler = false;
}
)
-10
View File
@@ -1,10 +0,0 @@
{ wrapCC, gcc9 }:
wrapCC (
gcc9.cc.override {
name = "gfortran";
langFortran = true;
langCC = false;
langC = false;
profiledCompiler = false;
}
)
+1 -1
View File
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
buildInputs = [ dcompiler ];
buildPhase = ''
for candidate in dmd ldmd2 gdmd; do
for candidate in dmd ldmd2; do
echo Checking for DCompiler $candidate ...
dc=$(type -P $candidate || echo "")
if [ ! "$dc" == "" ]; then
@@ -23,7 +23,6 @@
langC,
langCC,
langD ? false,
langFortran,
langAda ? false,
langGo,
@@ -207,7 +206,6 @@ let
lib.concatStringsSep "," (
lib.optional langC "c"
++ lib.optional langCC "c++"
++ lib.optional langD "d"
++ lib.optional langFortran "fortran"
++ lib.optional langAda "ada"
++ lib.optional langGo "go"
@@ -287,21 +285,6 @@ let
++ lib.optionals langJit [
"--enable-host-shared"
]
++ lib.optionals (langD) [
"--with-target-system-zlib=yes"
]
# On mips64-unknown-linux-gnu libsanitizer defines collide with
# glibc's definitions and fail the build. It was fixed in gcc-13+.
++
lib.optionals
(
targetPlatform.isMips
&& targetPlatform.parsed.abi.name == "gnu"
&& lib.versions.major version == "12"
)
[
"--disable-libsanitizer"
]
++ lib.optionals targetPlatform.isAlpha [
# Workaround build failures like:
# cc1: error: fp software completion requires '-mtrap-precision=i' [-Werror]
@@ -76,8 +76,8 @@ in
gmp
mpfr
libmpc
libxcrypt
]
++ optionals (lib.versionAtLeast version "10") [ libxcrypt ]
++ [
targetPackages.stdenv.cc.bintools # For linking code at run-time
]
@@ -2,7 +2,6 @@
lib,
stdenv,
withoutTargetLibc,
langD ? false,
libcCross,
threadsCross,
}:
@@ -18,8 +17,8 @@ in
EXTRA_FLAGS_FOR_TARGET =
let
mkFlags =
dep: langD:
lib.optionals ((!lib.systems.equals targetPlatform hostPlatform) && dep != null && !langD) (
dep:
lib.optionals ((!lib.systems.equals targetPlatform hostPlatform) && dep != null) (
[
"-O2 -idirafter ${lib.getDev dep}${dep.incdir or "/include"}"
]
@@ -28,8 +27,7 @@ in
]
);
in
mkFlags libcCross langD
++ lib.optionals (!withoutTargetLibc) (mkFlags (threadsCross.package or null) langD);
mkFlags libcCross ++ lib.optionals (!withoutTargetLibc) (mkFlags (threadsCross.package or null));
EXTRA_LDFLAGS_FOR_TARGET =
let
+130 -137
View File
@@ -41,145 +41,138 @@ lib.pipe drv
)
]
++
++ (
let
targetPlatformSlash =
if lib.systems.equals hostPlatform targetPlatform then "" else "${targetPlatform.config}/";
# nixpkgs did not add the "libgcc" output until gcc11. In theory
# the following condition can be changed to `true`, but that has not
# been tested.
lib.optionals (lib.versionAtLeast version "11.0")
# If we are building a cross-compiler and the target libc provided
# to us at build time has a libgcc, use that instead of building a
# new one. This avoids having two separate (but identical) libgcc
# outpaths in the closure of most packages, which can be confusing.
useLibgccFromTargetLibc = libcCross != null && libcCross ? passthru.libgcc;
enableLibGccOutput =
(!stdenv.targetPlatform.isWindows || (lib.systems.equals stdenv.targetPlatform stdenv.hostPlatform))
&& !langJit
&& !stdenv.hostPlatform.isDarwin
&& enableShared
&& !useLibgccFromTargetLibc;
# For some reason libgcc_s.so has major-version "2" on m68k but
# "1" everywhere else. Might be worth changing this to "*".
libgcc_s-version-major = if targetPlatform.isM68k then "2" else "1";
in
[
(
let
targetPlatformSlash =
if lib.systems.equals hostPlatform targetPlatform then "" else "${targetPlatform.config}/";
# If we are building a cross-compiler and the target libc provided
# to us at build time has a libgcc, use that instead of building a
# new one. This avoids having two separate (but identical) libgcc
# outpaths in the closure of most packages, which can be confusing.
useLibgccFromTargetLibc = libcCross != null && libcCross ? passthru.libgcc;
enableLibGccOutput =
(!stdenv.targetPlatform.isWindows || (lib.systems.equals stdenv.targetPlatform stdenv.hostPlatform))
&& !langJit
&& !stdenv.hostPlatform.isDarwin
&& enableShared
&& !useLibgccFromTargetLibc;
# For some reason libgcc_s.so has major-version "2" on m68k but
# "1" everywhere else. Might be worth changing this to "*".
libgcc_s-version-major = if targetPlatform.isM68k then "2" else "1";
in
[
(
pkg:
pkg.overrideAttrs (
previousAttrs:
lib.optionalAttrs useLibgccFromTargetLibc {
passthru = (previousAttrs.passthru or { }) // {
inherit (libcCross) libgcc;
};
}
)
)
(
pkg:
pkg.overrideAttrs (
previousAttrs:
lib.optionalAttrs ((!langC) || langJit || enableLibGccOutput) {
outputs = previousAttrs.outputs ++ lib.optionals enableLibGccOutput [ "libgcc" ];
# This is a separate phase because gcc assembles its phase scripts
# in bash instead of nix (we should fix that).
preFixupPhases =
(previousAttrs.preFixupPhases or [ ])
++ lib.optionals ((!langC) || enableLibGccOutput) [ "preFixupLibGccPhase" ];
preFixupLibGccPhase =
# delete extra/unused builds of libgcc_s in non-langC builds
# (i.e. libgccjit, gnat, etc) to avoid potential confusion
lib.optionalString (!langC) ''
rm -f $out/lib/libgcc_s.so*
''
# move `libgcc_s.so` into its own output, `$libgcc`
# We maintain $libgcc/lib/$target/ structure to make sure target
# strip runs over libgcc_s.so and remove debug references to headers:
# https://github.com/NixOS/nixpkgs/issues/316114
+ lib.optionalString enableLibGccOutput (
''
# move libgcc from lib to its own output (libgcc)
mkdir -p $libgcc/${targetPlatformSlash}lib
mv $lib/${targetPlatformSlash}lib/libgcc_s.so $libgcc/${targetPlatformSlash}lib/
mv $lib/${targetPlatformSlash}lib/libgcc_s.so.${libgcc_s-version-major} $libgcc/${targetPlatformSlash}lib/
ln -s $libgcc/${targetPlatformSlash}lib/libgcc_s.so $lib/${targetPlatformSlash}lib/
ln -s $libgcc/${targetPlatformSlash}lib/libgcc_s.so.${libgcc_s-version-major} $lib/${targetPlatformSlash}lib/
''
+ lib.optionalString (targetPlatformSlash != "") ''
ln -s ${targetPlatformSlash}lib $libgcc/lib
''
#
# Nixpkgs ordinarily turns dynamic linking into pseudo-static linking:
# libraries are still loaded dynamically, exactly which copy of each
# library is loaded is permanently fixed at compile time (via RUNPATH).
# For libgcc_s we must revert to the "impure dynamic linking" style found
# in imperative software distributions. We must do this because
# `libgcc_s` calls `malloc()` and therefore has a `DT_NEEDED` for `libc`,
# which creates two problems:
#
# 1. A circular package dependency `glibc`<-`libgcc`<-`glibc`
#
# 2. According to the `-Wl,-rpath` flags added by Nixpkgs' `ld-wrapper`,
# the two versions of `glibc` in the cycle above are actually
# different packages. The later one is compiled by this `gcc`, but
# the earlier one was compiled by the compiler *that compiled* this
# `gcc` (usually the bootstrapFiles). In any event, the `glibc`
# dynamic loader won't honor that specificity without namespaced
# manual loads (`dlmopen()`). Once a `libc` is present in the address
# space of a process, that `libc` will be used to satisfy all
# `DT_NEEDED`s for `libc`, regardless of `RUNPATH`s.
#
# So we wipe the RUNPATH using `patchelf --set-rpath ""`. We can't use
# `patchelf --remove-rpath`, because at least as of patchelf 0.15.0 it
# will leave the old RUNPATH string in the file where the reference
# scanner can still find it:
#
# https://github.com/NixOS/patchelf/issues/453
#
# Note: we might be using the bootstrapFiles' copy of patchelf, so we have
# to keep doing it this way until both the issue is fixed *and* all the
# bootstrapFiles are regenerated, on every platform.
#
# This patchelfing is *not* effectively equivalent to copying
# `libgcc_s` into `glibc`'s outpath. There is one minor and one
# major difference:
#
# 1. (Minor): multiple builds of `glibc` (say, with different
# overrides or parameters) will all reference a single store
# path:
#
# /nix/store/xxx...xxx-gcc-libgcc/lib/libgcc_s.so.1
#
# This many-to-one referrer relationship will be visible in the store's
# dependency graph, and will be available to `nix-store -q` queries.
# Copying `libgcc_s` into each of its referrers would lose that
# information.
#
# 2. (Major): by referencing `libgcc_s.so.1`, rather than copying it, we
# are still able to run `nix-store -qd` on it to find out how it got
# built! Most importantly, we can see from that deriver which compiler
# was used to build it (or if it is part of the unpacked
# bootstrap-files). Copying `libgcc_s.so.1` from one outpath to
# another eliminates the ability to make these queries.
#
+ ''
patchelf --set-rpath "" $libgcc/lib/libgcc_s.so.${libgcc_s-version-major}
''
);
}
)
)
]
pkg:
pkg.overrideAttrs (
previousAttrs:
lib.optionalAttrs useLibgccFromTargetLibc {
passthru = (previousAttrs.passthru or { }) // {
inherit (libcCross) libgcc;
};
}
)
)
(
pkg:
pkg.overrideAttrs (
previousAttrs:
lib.optionalAttrs ((!langC) || langJit || enableLibGccOutput) {
outputs = previousAttrs.outputs ++ lib.optionals enableLibGccOutput [ "libgcc" ];
# This is a separate phase because gcc assembles its phase scripts
# in bash instead of nix (we should fix that).
preFixupPhases =
(previousAttrs.preFixupPhases or [ ])
++ lib.optionals ((!langC) || enableLibGccOutput) [ "preFixupLibGccPhase" ];
preFixupLibGccPhase =
# delete extra/unused builds of libgcc_s in non-langC builds
# (i.e. libgccjit, gnat, etc) to avoid potential confusion
lib.optionalString (!langC) ''
rm -f $out/lib/libgcc_s.so*
''
# move `libgcc_s.so` into its own output, `$libgcc`
# We maintain $libgcc/lib/$target/ structure to make sure target
# strip runs over libgcc_s.so and remove debug references to headers:
# https://github.com/NixOS/nixpkgs/issues/316114
+ lib.optionalString enableLibGccOutput (
''
# move libgcc from lib to its own output (libgcc)
mkdir -p $libgcc/${targetPlatformSlash}lib
mv $lib/${targetPlatformSlash}lib/libgcc_s.so $libgcc/${targetPlatformSlash}lib/
mv $lib/${targetPlatformSlash}lib/libgcc_s.so.${libgcc_s-version-major} $libgcc/${targetPlatformSlash}lib/
ln -s $libgcc/${targetPlatformSlash}lib/libgcc_s.so $lib/${targetPlatformSlash}lib/
ln -s $libgcc/${targetPlatformSlash}lib/libgcc_s.so.${libgcc_s-version-major} $lib/${targetPlatformSlash}lib/
''
+ lib.optionalString (targetPlatformSlash != "") ''
ln -s ${targetPlatformSlash}lib $libgcc/lib
''
#
# Nixpkgs ordinarily turns dynamic linking into pseudo-static linking:
# libraries are still loaded dynamically, exactly which copy of each
# library is loaded is permanently fixed at compile time (via RUNPATH).
# For libgcc_s we must revert to the "impure dynamic linking" style found
# in imperative software distributions. We must do this because
# `libgcc_s` calls `malloc()` and therefore has a `DT_NEEDED` for `libc`,
# which creates two problems:
#
# 1. A circular package dependency `glibc`<-`libgcc`<-`glibc`
#
# 2. According to the `-Wl,-rpath` flags added by Nixpkgs' `ld-wrapper`,
# the two versions of `glibc` in the cycle above are actually
# different packages. The later one is compiled by this `gcc`, but
# the earlier one was compiled by the compiler *that compiled* this
# `gcc` (usually the bootstrapFiles). In any event, the `glibc`
# dynamic loader won't honor that specificity without namespaced
# manual loads (`dlmopen()`). Once a `libc` is present in the address
# space of a process, that `libc` will be used to satisfy all
# `DT_NEEDED`s for `libc`, regardless of `RUNPATH`s.
#
# So we wipe the RUNPATH using `patchelf --set-rpath ""`. We can't use
# `patchelf --remove-rpath`, because at least as of patchelf 0.15.0 it
# will leave the old RUNPATH string in the file where the reference
# scanner can still find it:
#
# https://github.com/NixOS/patchelf/issues/453
#
# Note: we might be using the bootstrapFiles' copy of patchelf, so we have
# to keep doing it this way until both the issue is fixed *and* all the
# bootstrapFiles are regenerated, on every platform.
#
# This patchelfing is *not* effectively equivalent to copying
# `libgcc_s` into `glibc`'s outpath. There is one minor and one
# major difference:
#
# 1. (Minor): multiple builds of `glibc` (say, with different
# overrides or parameters) will all reference a single store
# path:
#
# /nix/store/xxx...xxx-gcc-libgcc/lib/libgcc_s.so.1
#
# This many-to-one referrer relationship will be visible in the store's
# dependency graph, and will be available to `nix-store -q` queries.
# Copying `libgcc_s` into each of its referrers would lose that
# information.
#
# 2. (Major): by referencing `libgcc_s.so.1`, rather than copying it, we
# are still able to run `nix-store -qd` on it to find out how it got
# built! Most importantly, we can see from that deriver which compiler
# was used to build it (or if it is part of the unpacked
# bootstrap-files). Copying `libgcc_s.so.1` from one outpath to
# another eliminates the ability to make these queries.
#
+ ''
patchelf --set-rpath "" $libgcc/lib/libgcc_s.so.${libgcc_s-version-major}
''
);
}
)
)
]
)
)
+60 -117
View File
@@ -11,7 +11,6 @@
langAda ? false,
langObjC ? stdenv.targetPlatform.isDarwin,
langObjCpp ? stdenv.targetPlatform.isDarwin,
langD ? false,
langGo ? false,
reproducibleBuild ? true,
profiledCompiler ? false,
@@ -53,7 +52,6 @@
callPackage,
majorMinorVersion,
apple-sdk,
cctools,
darwin,
}:
@@ -81,16 +79,8 @@ let
majorVersion = versions.major version;
atLeast14 = versionAtLeast version "14";
atLeast13 = versionAtLeast version "13";
atLeast12 = versionAtLeast version "12";
atLeast11 = versionAtLeast version "11";
atLeast10 = versionAtLeast version "10";
is14 = majorVersion == "14";
is13 = majorVersion == "13";
is12 = majorVersion == "12";
is11 = majorVersion == "11";
is10 = majorVersion == "10";
is9 = majorVersion == "9";
# releases have a form: MAJOR.MINOR.MICRO, like 14.2.1
# snapshots have a form like MAJOR.MINOR.MICRO.DATE, like 14.2.1.20250322
@@ -104,7 +94,7 @@ let
# "14.2.0" -> "14.2.0"
baseVersion = lib.concatStringsSep "." (lib.take 3 (lib.splitVersion version));
disableBootstrap = atLeast11 && !stdenv.hostPlatform.isDarwin && (atLeast12 -> !profiledCompiler);
disableBootstrap = !stdenv.hostPlatform.isDarwin && !profiledCompiler;
inherit (stdenv) buildPlatform hostPlatform targetPlatform;
targetConfig =
@@ -159,7 +149,6 @@ let
langAda
langC
langCC
langD
langFortran
langGo
langJit
@@ -200,10 +189,6 @@ assert stdenv.buildPlatform.isDarwin -> gnused != null;
assert langGo -> langCC;
assert langAda -> gnat-bootstrap != null;
# TODO: fixup D bootstrapping, probably by using gdc11 (and maybe other changes).
# error: GDC is required to build d
assert atLeast12 -> !langD;
# threadsCross is just for MinGW
assert threadsCross != { } -> stdenv.targetPlatform.isWindows;
@@ -227,7 +212,7 @@ pipe
"mirror://gcc/snapshots/${majorVersion}-${snapDate}/gcc-${majorVersion}-${snapDate}.tar.xz"
else
"mirror://gcc/releases/gcc-${version}/gcc-${version}.tar.xz";
${if is10 || is11 || is13 then "hash" else "sha256"} = gccVersions.srcHashForVersion version;
${if is13 then "hash" else "sha256"} = gccVersions.srcHashForVersion version;
};
inherit patches;
@@ -247,8 +232,7 @@ pipe
"format"
"pie"
"stackclashprotection"
]
++ optionals (is11 && langAda) [ "fortify3" ];
];
postPatch = ''
configureScripts=$(find . -name configure)
@@ -269,7 +253,7 @@ pipe
# This should kill all the stdinc frameworks that gcc and friends like to
# insert into default search paths.
+ optionalString hostPlatform.isDarwin ''
substituteInPlace gcc/config/darwin-c.c${optionalString atLeast12 "c"} \
substituteInPlace gcc/config/darwin-c.cc \
--replace 'if (stdinc)' 'if (0)'
substituteInPlace libgcc/config/t-slibgcc-darwin \
@@ -326,11 +310,9 @@ pipe
depsTargetTarget
;
preConfigure =
(callFile ./common/pre-configure.nix { })
+ optionalString atLeast10 ''
ln -sf ${libxcrypt}/include/crypt.h libsanitizer/sanitizer_common/crypt.h
'';
preConfigure = (callFile ./common/pre-configure.nix { }) + ''
ln -sf ${libxcrypt}/include/crypt.h libsanitizer/sanitizer_common/crypt.h
'';
dontDisableStatic = true;
@@ -346,22 +328,17 @@ pipe
buildFlags =
# we do not yet have Nix-driven profiling
assert atLeast12 -> (profiledCompiler -> !disableBootstrap);
if atLeast11 then
let
target =
optionalString (profiledCompiler) "profiled"
+ optionalString (
(lib.systems.equals targetPlatform hostPlatform)
&& (lib.systems.equals hostPlatform buildPlatform)
&& !disableBootstrap
) "bootstrap";
in
optional (target != "") target
else
optional (
(lib.systems.equals targetPlatform hostPlatform) && (lib.systems.equals hostPlatform buildPlatform)
) (if profiledCompiler then "profiledbootstrap" else "bootstrap");
assert profiledCompiler -> !disableBootstrap;
let
target =
optionalString (profiledCompiler) "profiled"
+ optionalString (
(lib.systems.equals targetPlatform hostPlatform)
&& (lib.systems.equals hostPlatform buildPlatform)
&& !disableBootstrap
) "bootstrap";
in
optional (target != "") target;
inherit (callFile ./common/strip-attributes.nix { })
stripDebugList
@@ -372,45 +349,38 @@ pipe
# https://gcc.gnu.org/PR109898
enableParallelInstalling = false;
env = mapAttrs (_: v: toString v) (
{
env = mapAttrs (_: v: toString v) {
NIX_NO_SELF_RPATH = true;
NIX_NO_SELF_RPATH = true;
# https://gcc.gnu.org/install/specific.html#x86-64-x-solaris210
${if hostPlatform.system == "x86_64-solaris" then "CC" else null} = "gcc -m64";
# https://gcc.gnu.org/install/specific.html#x86-64-x-solaris210
${if hostPlatform.system == "x86_64-solaris" then "CC" else null} = "gcc -m64";
# Setting $CPATH and $LIBRARY_PATH to make sure both `gcc' and `xgcc' find the
# library headers and binaries, regardless of the language being compiled.
#
# The LTO code doesn't find zlib, so we just add it to $CPATH and
# $LIBRARY_PATH in this case.
#
# Cross-compiling, we need gcc not to read ./specs in order to build the g++
# compiler (after the specs for the cross-gcc are created). Having
# LIBRARY_PATH= makes gcc read the specs from ., and the build breaks.
# Setting $CPATH and $LIBRARY_PATH to make sure both `gcc' and `xgcc' find the
# library headers and binaries, regardless of the language being compiled.
#
# The LTO code doesn't find zlib, so we just add it to $CPATH and
# $LIBRARY_PATH in this case.
#
# Cross-compiling, we need gcc not to read ./specs in order to build the g++
# compiler (after the specs for the cross-gcc are created). Having
# LIBRARY_PATH= makes gcc read the specs from ., and the build breaks.
CPATH = optionals (lib.systems.equals targetPlatform hostPlatform) (
makeSearchPathOutput "dev" "include" ([ ] ++ optional (zlib != null) zlib)
);
CPATH = optionals (lib.systems.equals targetPlatform hostPlatform) (
makeSearchPathOutput "dev" "include" ([ ] ++ optional (zlib != null) zlib)
);
LIBRARY_PATH = optionals (lib.systems.equals targetPlatform hostPlatform) (
makeLibraryPath (optional (zlib != null) zlib)
);
LIBRARY_PATH = optionals (lib.systems.equals targetPlatform hostPlatform) (
makeLibraryPath (optional (zlib != null) zlib)
);
NIX_LDFLAGS = optionalString hostPlatform.isSunOS "-lm";
NIX_LDFLAGS = optionalString hostPlatform.isSunOS "-lm";
inherit (callFile ./common/extra-target-flags.nix { })
EXTRA_FLAGS_FOR_TARGET
EXTRA_LDFLAGS_FOR_TARGET
;
}
//
optionalAttrs (!atLeast12 && stdenv.cc.isClang && (!lib.systems.equals targetPlatform hostPlatform))
{
NIX_CFLAGS_COMPILE = "-Wno-register";
}
);
inherit (callFile ./common/extra-target-flags.nix { })
EXTRA_FLAGS_FOR_TARGET
EXTRA_LDFLAGS_FOR_TARGET
;
};
passthru = {
inherit
@@ -421,21 +391,11 @@ pipe
langAda
langFortran
langGo
langD
version
;
isGNU = true;
hardeningUnsupportedFlags =
optional (!atLeast11) "zerocallusedregs"
++ optionals (!atLeast12) [
"fortify3"
"trivialautovarinit"
]
++ optionals (!atLeast13) [
"strictflexarrays1"
"strictflexarrays3"
]
++ optional (
optional (
!(targetPlatform.isLinux && targetPlatform.isx86_64 && targetPlatform.libc == "glibc")
) "shadowstack"
++ optional (!(targetPlatform.isLinux && targetPlatform.isAarch64)) "pacret"
@@ -457,42 +417,25 @@ pipe
platforms
teams
;
}
// optionalAttrs (!atLeast11) {
badPlatforms = [ "aarch64-darwin" ];
}
// optionalAttrs is10 {
badPlatforms =
if (!lib.systems.equals targetPlatform hostPlatform) then [ "aarch64-darwin" ] else [ ];
};
}
// optionalAttrs (!atLeast10 && stdenv.targetPlatform.isDarwin) {
# GCC <10 requires default cctools `strip` instead of `llvm-strip` used by Darwin bintools.
preBuild = ''
makeFlagsArray+=('STRIP=${getBin cctools}/bin/${stdenv.cc.targetPrefix}strip')
'';
}
// optionalAttrs enableMultilib {
dontMoveLib64 = true;
}
))
(
[
(callPackage ./common/libgcc.nix {
inherit
version
langC
langCC
langJit
targetPlatform
hostPlatform
withoutTargetLibc
enableShared
libcCross
;
})
]
++ optionals atLeast11 [
(callPackage ./common/checksum.nix { inherit langC langCC; })
]
)
([
(callPackage ./common/libgcc.nix {
inherit
version
langC
langCC
langJit
targetPlatform
hostPlatform
withoutTargetLibc
enableShared
libcCross
;
})
(callPackage ./common/checksum.nix { inherit langC langCC; })
])
@@ -8,7 +8,6 @@
langAda ? false,
langC ? true,
langCC ? true,
langD ? false,
langFortran ? false,
langGo ? false,
langJava ? false,
@@ -176,7 +175,6 @@ stdenv.mkDerivation (finalAttrs: {
lib.intersperse "," (
lib.optional langC "c"
++ lib.optional langCC "c++"
++ lib.optional langD "d"
++ lib.optional langFortran "fortran"
++ lib.optional langJava "java"
++ lib.optional langAda "ada"
@@ -1,306 +0,0 @@
From 86f2f767ddffd9f7c6f1470b987ae7b0d251b988 Mon Sep 17 00:00:00 2001
From: Liu Hao <lh_mouse@126.com>
Date: Wed, 25 Apr 2018 21:54:19 +0800
Subject: [PATCH] Added 'mcf' thread model support from mcfgthread.
Signed-off-by: Liu Hao <lh_mouse@126.com>
---
config/gthr.m4 | 1 +
gcc/config.gcc | 3 +++
gcc/config/i386/mingw-mcfgthread.h | 1 +
gcc/config/i386/mingw-w64.h | 2 +-
gcc/config/i386/mingw32.h | 11 ++++++++++-
gcc/configure | 2 +-
gcc/configure.ac | 2 +-
libatomic/configure.tgt | 2 +-
libgcc/config.host | 6 ++++++
libgcc/config/i386/gthr-mcf.h | 1 +
libgcc/config/i386/t-mingw-mcfgthread | 2 ++
libgcc/configure | 1 +
libstdc++-v3/configure | 1 +
libstdc++-v3/libsupc++/atexit_thread.cc | 18 ++++++++++++++++++
libstdc++-v3/libsupc++/guard.cc | 23 +++++++++++++++++++++++
libstdc++-v3/src/c++11/thread.cc | 9 +++++++++
16 files changed, 80 insertions(+), 5 deletions(-)
create mode 100644 gcc/config/i386/mingw-mcfgthread.h
create mode 100644 libgcc/config/i386/gthr-mcf.h
create mode 100644 libgcc/config/i386/t-mingw-mcfgthread
diff --git a/config/gthr.m4 b/config/gthr.m4
index 7b29f1f3327..82e21fe1709 100644
--- a/config/gthr.m4
+++ b/config/gthr.m4
@@ -21,6 +21,7 @@ case $1 in
tpf) thread_header=config/s390/gthr-tpf.h ;;
vxworks) thread_header=config/gthr-vxworks.h ;;
win32) thread_header=config/i386/gthr-win32.h ;;
+ mcf) thread_header=config/i386/gthr-mcf.h ;;
esac
AC_SUBST(thread_header)
])
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 46a9029acec..112c24e95a3 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -1758,6 +1758,9 @@ i[34567]86-*-mingw* | x86_64-*-mingw*)
if test x$enable_threads = xposix ; then
tm_file="${tm_file} i386/mingw-pthread.h"
fi
+ if test x$enable_threads = xmcf ; then
+ tm_file="${tm_file} i386/mingw-mcfgthread.h"
+ fi
tm_file="${tm_file} i386/mingw32.h"
# This makes the logic if mingw's or the w64 feature set has to be used
case ${target} in
diff --git a/gcc/config/i386/mingw-mcfgthread.h b/gcc/config/i386/mingw-mcfgthread.h
new file mode 100644
index 00000000000..ec381a7798f
--- /dev/null
+++ b/gcc/config/i386/mingw-mcfgthread.h
@@ -0,0 +1 @@
+#define TARGET_USE_MCFGTHREAD 1
diff --git a/gcc/config/i386/mingw-w64.h b/gcc/config/i386/mingw-w64.h
index 484dc7a9e9f..a15bbeea500 100644
--- a/gcc/config/i386/mingw-w64.h
+++ b/gcc/config/i386/mingw-w64.h
@@ -48,7 +48,7 @@ along with GCC; see the file COPYING3. If not see
"%{mwindows:-lgdi32 -lcomdlg32} " \
"%{fvtable-verify=preinit:-lvtv -lpsapi; \
fvtable-verify=std:-lvtv -lpsapi} " \
- "-ladvapi32 -lshell32 -luser32 -lkernel32"
+ LIB_MCFGTHREAD "-ladvapi32 -lshell32 -luser32 -lkernel32"
#undef SPEC_32
#undef SPEC_64
diff --git a/gcc/config/i386/mingw32.h b/gcc/config/i386/mingw32.h
index 0612b87199a..76cea94f3b7 100644
--- a/gcc/config/i386/mingw32.h
+++ b/gcc/config/i386/mingw32.h
@@ -32,6 +32,14 @@ along with GCC; see the file COPYING3. If not see
| MASK_STACK_PROBE | MASK_ALIGN_DOUBLE \
| MASK_MS_BITFIELD_LAYOUT)
+#ifndef TARGET_USE_MCFGTHREAD
+#define CPP_MCFGTHREAD() ((void)0)
+#define LIB_MCFGTHREAD ""
+#else
+#define CPP_MCFGTHREAD() (builtin_define("__USING_MCFGTHREAD__"))
+#define LIB_MCFGTHREAD " -lmcfgthread "
+#endif
+
/* See i386/crtdll.h for an alternative definition. _INTEGRAL_MAX_BITS
is for compatibility with native compiler. */
#define EXTRA_OS_CPP_BUILTINS() \
@@ -50,6 +58,7 @@ along with GCC; see the file COPYING3. If not see
builtin_define_std ("WIN64"); \
builtin_define ("_WIN64"); \
} \
+ CPP_MCFGTHREAD(); \
} \
while (0)
@@ -93,7 +102,7 @@ along with GCC; see the file COPYING3. If not see
"%{mwindows:-lgdi32 -lcomdlg32} " \
"%{fvtable-verify=preinit:-lvtv -lpsapi; \
fvtable-verify=std:-lvtv -lpsapi} " \
- "-ladvapi32 -lshell32 -luser32 -lkernel32"
+ LIB_MCFGTHREAD "-ladvapi32 -lshell32 -luser32 -lkernel32"
/* Weak symbols do not get resolved if using a Windows dll import lib.
Make the unwind registration references strong undefs. */
diff --git a/gcc/configure b/gcc/configure
index 6121e163259..52f0e00efe6 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -11693,7 +11693,7 @@ case ${enable_threads} in
target_thread_file='single'
;;
aix | dce | lynx | mipssde | posix | rtems | \
- single | tpf | vxworks | win32)
+ single | tpf | vxworks | win32 | mcf)
target_thread_file=${enable_threads}
;;
*)
diff --git a/gcc/configure.ac b/gcc/configure.ac
index b066cc609e1..4ecdba88de7 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -1612,7 +1612,7 @@ case ${enable_threads} in
target_thread_file='single'
;;
aix | dce | lynx | mipssde | posix | rtems | \
- single | tpf | vxworks | win32)
+ single | tpf | vxworks | win32 | mcf)
target_thread_file=${enable_threads}
;;
*)
diff --git a/libatomic/configure.tgt b/libatomic/configure.tgt
index ea8c34f8c71..23134ad7363 100644
--- a/libatomic/configure.tgt
+++ b/libatomic/configure.tgt
@@ -145,7 +145,7 @@ case "${target}" in
*-*-mingw*)
# OS support for atomic primitives.
case ${target_thread_file} in
- win32)
+ win32 | mcf)
config_path="${config_path} mingw"
;;
posix)
diff --git a/libgcc/config.host b/libgcc/config.host
index 11b4acaff55..9fbd38650bd 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -737,6 +737,9 @@ i[34567]86-*-mingw*)
posix)
tmake_file="i386/t-mingw-pthread $tmake_file"
;;
+ mcf)
+ tmake_file="i386/t-mingw-mcfgthread $tmake_file"
+ ;;
esac
# This has to match the logic for DWARF2_UNWIND_INFO in gcc/config/i386/cygming.h
if test x$ac_cv_sjlj_exceptions = xyes; then
@@ -761,6 +764,9 @@ x86_64-*-mingw*)
posix)
tmake_file="i386/t-mingw-pthread $tmake_file"
;;
+ mcf)
+ tmake_file="i386/t-mingw-mcfgthread $tmake_file"
+ ;;
esac
# This has to match the logic for DWARF2_UNWIND_INFO in gcc/config/i386/cygming.h
if test x$ac_cv_sjlj_exceptions = xyes; then
diff --git a/libgcc/config/i386/gthr-mcf.h b/libgcc/config/i386/gthr-mcf.h
new file mode 100644
index 00000000000..5ea2908361f
--- /dev/null
+++ b/libgcc/config/i386/gthr-mcf.h
@@ -0,0 +1 @@
+#include <mcfgthread/gthread.h>
diff --git a/libgcc/config/i386/t-mingw-mcfgthread b/libgcc/config/i386/t-mingw-mcfgthread
new file mode 100644
index 00000000000..4b9b10e32d6
--- /dev/null
+++ b/libgcc/config/i386/t-mingw-mcfgthread
@@ -0,0 +1,2 @@
+SHLIB_PTHREAD_CFLAG =
+SHLIB_PTHREAD_LDFLAG = -lmcfgthread
diff --git a/libgcc/configure b/libgcc/configure
index b2f3f870844..eff889dc3b3 100644
--- a/libgcc/configure
+++ b/libgcc/configure
@@ -5451,6 +5451,7 @@ case $target_thread_file in
tpf) thread_header=config/s390/gthr-tpf.h ;;
vxworks) thread_header=config/gthr-vxworks.h ;;
win32) thread_header=config/i386/gthr-win32.h ;;
+ mcf) thread_header=config/i386/gthr-mcf.h ;;
esac
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index ba094be6f15..979a5ab9ace 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -15187,6 +15187,7 @@ case $target_thread_file in
tpf) thread_header=config/s390/gthr-tpf.h ;;
vxworks) thread_header=config/gthr-vxworks.h ;;
win32) thread_header=config/i386/gthr-win32.h ;;
+ mcf) thread_header=config/i386/gthr-mcf.h ;;
esac
diff --git a/libstdc++-v3/libsupc++/atexit_thread.cc b/libstdc++-v3/libsupc++/atexit_thread.cc
index de920d714c6..665fb74bd6b 100644
--- a/libstdc++-v3/libsupc++/atexit_thread.cc
+++ b/libstdc++-v3/libsupc++/atexit_thread.cc
@@ -25,6 +25,22 @@
#include <cstdlib>
#include <new>
#include "bits/gthr.h"
+
+#ifdef __USING_MCFGTHREAD__
+
+#include <mcfgthread/gthread.h>
+
+extern "C" int
+__cxxabiv1::__cxa_thread_atexit (void (*dtor)(void *),
+ void *obj, void *dso_handle)
+ _GLIBCXX_NOTHROW
+{
+ return ::_MCFCRT_AtThreadExit((void (*)(_MCFCRT_STD intptr_t))dtor, (_MCFCRT_STD intptr_t)obj) ? 0 : -1;
+ (void)dso_handle;
+}
+
+#else // __USING_MCFGTHREAD__
+
#ifdef _GLIBCXX_THREAD_ATEXIT_WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
@@ -167,3 +183,5 @@ __cxxabiv1::__cxa_thread_atexit (void (*dtor)(void *), void *obj, void */*dso_ha
}
#endif /* _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL */
+
+#endif // __USING_MCFGTHREAD__
diff --git a/libstdc++-v3/libsupc++/guard.cc b/libstdc++-v3/libsupc++/guard.cc
index 3a2ec3ad0d6..8b4cc96199b 100644
--- a/libstdc++-v3/libsupc++/guard.cc
+++ b/libstdc++-v3/libsupc++/guard.cc
@@ -28,6 +28,27 @@
#include <cxxabi.h>
#include <exception>
#include <new>
+
+#ifdef __USING_MCFGTHREAD__
+
+#include <mcfgthread/gthread.h>
+
+namespace __cxxabiv1 {
+
+extern "C" int __cxa_guard_acquire(__guard *g){
+ return ::_MCFCRT_WaitForOnceFlagForever((::_MCFCRT_OnceFlag *)g) == ::_MCFCRT_kOnceResultInitial;
+}
+extern "C" void __cxa_guard_abort(__guard *g) throw() {
+ ::_MCFCRT_SignalOnceFlagAsAborted((::_MCFCRT_OnceFlag *)g);
+}
+extern "C" void __cxa_guard_release(__guard *g) throw() {
+ ::_MCFCRT_SignalOnceFlagAsFinished((::_MCFCRT_OnceFlag *)g);
+}
+
+}
+
+#else // __USING_MCFGTHREAD__
+
#include <ext/atomicity.h>
#include <ext/concurrence.h>
#include <bits/atomic_lockfree_defines.h>
@@ -425,3 +446,5 @@ namespace __cxxabiv1
#endif
}
}
+
+#endif
diff --git a/libstdc++-v3/src/c++11/thread.cc b/libstdc++-v3/src/c++11/thread.cc
index 8238817c2e9..0c6a1f85f6f 100644
--- a/libstdc++-v3/src/c++11/thread.cc
+++ b/libstdc++-v3/src/c++11/thread.cc
@@ -55,6 +55,15 @@ static inline int get_nprocs()
#elif defined(_GLIBCXX_USE_SC_NPROC_ONLN)
# include <unistd.h>
# define _GLIBCXX_NPROCS sysconf(_SC_NPROC_ONLN)
+#elif defined(_WIN32)
+# include <windows.h>
+static inline int get_nprocs()
+{
+ SYSTEM_INFO sysinfo;
+ GetSystemInfo(&sysinfo);
+ return (int)sysinfo.dwNumberOfProcessors;
+}
+# define _GLIBCXX_NPROCS get_nprocs()
#else
# define _GLIBCXX_NPROCS 0
#endif
--
2.17.0
@@ -1,306 +0,0 @@
From 86f2f767ddffd9f7c6f1470b987ae7b0d251b988 Mon Sep 17 00:00:00 2001
From: Liu Hao <lh_mouse@126.com>
Date: Wed, 25 Apr 2018 21:54:19 +0800
Subject: [PATCH] Added 'mcf' thread model support from mcfgthread.
Signed-off-by: Liu Hao <lh_mouse@126.com>
---
config/gthr.m4 | 1 +
gcc/config.gcc | 3 +++
gcc/config/i386/mingw-mcfgthread.h | 1 +
gcc/config/i386/mingw-w64.h | 2 +-
gcc/config/i386/mingw32.h | 11 ++++++++++-
gcc/configure | 2 +-
gcc/configure.ac | 2 +-
libatomic/configure.tgt | 2 +-
libgcc/config.host | 6 ++++++
libgcc/config/i386/gthr-mcf.h | 1 +
libgcc/config/i386/t-mingw-mcfgthread | 2 ++
libgcc/configure | 1 +
libstdc++-v3/configure | 1 +
libstdc++-v3/libsupc++/atexit_thread.cc | 18 ++++++++++++++++++
libstdc++-v3/libsupc++/guard.cc | 23 +++++++++++++++++++++++
libstdc++-v3/src/c++11/thread.cc | 9 +++++++++
16 files changed, 80 insertions(+), 5 deletions(-)
create mode 100644 gcc/config/i386/mingw-mcfgthread.h
create mode 100644 libgcc/config/i386/gthr-mcf.h
create mode 100644 libgcc/config/i386/t-mingw-mcfgthread
diff --git a/config/gthr.m4 b/config/gthr.m4
index 7b29f1f3327..82e21fe1709 100644
--- a/config/gthr.m4
+++ b/config/gthr.m4
@@ -21,6 +21,7 @@ case $1 in
tpf) thread_header=config/s390/gthr-tpf.h ;;
vxworks) thread_header=config/gthr-vxworks.h ;;
win32) thread_header=config/i386/gthr-win32.h ;;
+ mcf) thread_header=config/i386/gthr-mcf.h ;;
esac
AC_SUBST(thread_header)
])
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 46a9029acec..112c24e95a3 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -1758,6 +1758,9 @@ i[34567]86-*-mingw* | x86_64-*-mingw*)
if test x$enable_threads = xposix ; then
tm_file="${tm_file} i386/mingw-pthread.h"
fi
+ if test x$enable_threads = xmcf ; then
+ tm_file="${tm_file} i386/mingw-mcfgthread.h"
+ fi
tm_file="${tm_file} i386/mingw32.h"
# This makes the logic if mingw's or the w64 feature set has to be used
case ${target} in
diff --git a/gcc/config/i386/mingw-mcfgthread.h b/gcc/config/i386/mingw-mcfgthread.h
new file mode 100644
index 00000000000..ec381a7798f
--- /dev/null
+++ b/gcc/config/i386/mingw-mcfgthread.h
@@ -0,0 +1 @@
+#define TARGET_USE_MCFGTHREAD 1
diff --git a/gcc/config/i386/mingw-w64.h b/gcc/config/i386/mingw-w64.h
index 484dc7a9e9f..a15bbeea500 100644
--- a/gcc/config/i386/mingw-w64.h
+++ b/gcc/config/i386/mingw-w64.h
@@ -48,7 +48,7 @@ along with GCC; see the file COPYING3. If not see
"%{mwindows:-lgdi32 -lcomdlg32} " \
"%{fvtable-verify=preinit:-lvtv -lpsapi; \
fvtable-verify=std:-lvtv -lpsapi} " \
- "-ladvapi32 -lshell32 -luser32 -lkernel32"
+ LIB_MCFGTHREAD "-ladvapi32 -lshell32 -luser32 -lkernel32"
#undef SPEC_32
#undef SPEC_64
diff --git a/gcc/config/i386/mingw32.h b/gcc/config/i386/mingw32.h
index 0612b87199a..76cea94f3b7 100644
--- a/gcc/config/i386/mingw32.h
+++ b/gcc/config/i386/mingw32.h
@@ -32,6 +32,14 @@ along with GCC; see the file COPYING3. If not see
| MASK_STACK_PROBE | MASK_ALIGN_DOUBLE \
| MASK_MS_BITFIELD_LAYOUT)
+#ifndef TARGET_USE_MCFGTHREAD
+#define CPP_MCFGTHREAD() ((void)0)
+#define LIB_MCFGTHREAD ""
+#else
+#define CPP_MCFGTHREAD() (builtin_define("__USING_MCFGTHREAD__"))
+#define LIB_MCFGTHREAD " -lmcfgthread "
+#endif
+
/* See i386/crtdll.h for an alternative definition. _INTEGRAL_MAX_BITS
is for compatibility with native compiler. */
#define EXTRA_OS_CPP_BUILTINS() \
@@ -50,6 +58,7 @@ along with GCC; see the file COPYING3. If not see
builtin_define_std ("WIN64"); \
builtin_define ("_WIN64"); \
} \
+ CPP_MCFGTHREAD(); \
} \
while (0)
@@ -93,7 +102,7 @@ along with GCC; see the file COPYING3. If not see
"%{mwindows:-lgdi32 -lcomdlg32} " \
"%{fvtable-verify=preinit:-lvtv -lpsapi; \
fvtable-verify=std:-lvtv -lpsapi} " \
- "-ladvapi32 -lshell32 -luser32 -lkernel32"
+ LIB_MCFGTHREAD "-ladvapi32 -lshell32 -luser32 -lkernel32"
/* Weak symbols do not get resolved if using a Windows dll import lib.
Make the unwind registration references strong undefs. */
diff --git a/gcc/configure b/gcc/configure
index 6121e163259..52f0e00efe6 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -11693,7 +11693,7 @@ case ${enable_threads} in
target_thread_file='single'
;;
aix | dce | lynx | mipssde | posix | rtems | \
- single | tpf | vxworks | win32)
+ single | tpf | vxworks | win32 | mcf)
target_thread_file=${enable_threads}
;;
*)
diff --git a/gcc/configure.ac b/gcc/configure.ac
index b066cc609e1..4ecdba88de7 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -1612,7 +1612,7 @@ case ${enable_threads} in
target_thread_file='single'
;;
aix | dce | lynx | mipssde | posix | rtems | \
- single | tpf | vxworks | win32)
+ single | tpf | vxworks | win32 | mcf)
target_thread_file=${enable_threads}
;;
*)
diff --git a/libatomic/configure.tgt b/libatomic/configure.tgt
index ea8c34f8c71..23134ad7363 100644
--- a/libatomic/configure.tgt
+++ b/libatomic/configure.tgt
@@ -145,7 +145,7 @@ case "${target}" in
*-*-mingw*)
# OS support for atomic primitives.
case ${target_thread_file} in
- win32)
+ win32 | mcf)
config_path="${config_path} mingw"
;;
posix)
diff --git a/libgcc/config.host b/libgcc/config.host
index 11b4acaff55..9fbd38650bd 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -737,6 +737,9 @@ i[34567]86-*-mingw*)
posix)
tmake_file="i386/t-mingw-pthread $tmake_file"
;;
+ mcf)
+ tmake_file="i386/t-mingw-mcfgthread $tmake_file"
+ ;;
esac
# This has to match the logic for DWARF2_UNWIND_INFO in gcc/config/i386/cygming.h
if test x$ac_cv_sjlj_exceptions = xyes; then
@@ -761,6 +764,9 @@ x86_64-*-mingw*)
posix)
tmake_file="i386/t-mingw-pthread $tmake_file"
;;
+ mcf)
+ tmake_file="i386/t-mingw-mcfgthread $tmake_file"
+ ;;
esac
# This has to match the logic for DWARF2_UNWIND_INFO in gcc/config/i386/cygming.h
if test x$ac_cv_sjlj_exceptions = xyes; then
diff --git a/libgcc/config/i386/gthr-mcf.h b/libgcc/config/i386/gthr-mcf.h
new file mode 100644
index 00000000000..5ea2908361f
--- /dev/null
+++ b/libgcc/config/i386/gthr-mcf.h
@@ -0,0 +1 @@
+#include <mcfgthread/gthread.h>
diff --git a/libgcc/config/i386/t-mingw-mcfgthread b/libgcc/config/i386/t-mingw-mcfgthread
new file mode 100644
index 00000000000..4b9b10e32d6
--- /dev/null
+++ b/libgcc/config/i386/t-mingw-mcfgthread
@@ -0,0 +1,2 @@
+SHLIB_PTHREAD_CFLAG =
+SHLIB_PTHREAD_LDFLAG = -lmcfgthread
diff --git a/libgcc/configure b/libgcc/configure
index b2f3f870844..eff889dc3b3 100644
--- a/libgcc/configure
+++ b/libgcc/configure
@@ -5451,6 +5451,7 @@ case $target_thread_file in
tpf) thread_header=config/s390/gthr-tpf.h ;;
vxworks) thread_header=config/gthr-vxworks.h ;;
win32) thread_header=config/i386/gthr-win32.h ;;
+ mcf) thread_header=config/i386/gthr-mcf.h ;;
esac
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index ba094be6f15..979a5ab9ace 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -15187,6 +15187,7 @@ case $target_thread_file in
tpf) thread_header=config/s390/gthr-tpf.h ;;
vxworks) thread_header=config/gthr-vxworks.h ;;
win32) thread_header=config/i386/gthr-win32.h ;;
+ mcf) thread_header=config/i386/gthr-mcf.h ;;
esac
diff --git a/libstdc++-v3/libsupc++/atexit_thread.cc b/libstdc++-v3/libsupc++/atexit_thread.cc
index de920d714c6..665fb74bd6b 100644
--- a/libstdc++-v3/libsupc++/atexit_thread.cc
+++ b/libstdc++-v3/libsupc++/atexit_thread.cc
@@ -25,6 +25,22 @@
#include <cstdlib>
#include <new>
#include "bits/gthr.h"
+
+#ifdef __USING_MCFGTHREAD__
+
+#include <mcfgthread/gthread.h>
+namespace __cxxabiv1 {
+extern "C" int
+__cxa_thread_atexit (void (_GLIBCXX_CDTOR_CALLABI *dtor)(void *),
+ void *obj, void *dso_handle)
+ _GLIBCXX_NOTHROW
+{
+ return ::_MCFCRT_AtThreadExit((void (*)(_MCFCRT_STD intptr_t))dtor, (_MCFCRT_STD intptr_t)obj) ? 0 : -1;
+ (void)dso_handle;
+}
+}
+#else // __USING_MCFGTHREAD__
+
#ifdef _GLIBCXX_THREAD_ATEXIT_WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
@@ -167,3 +183,5 @@ __cxxabiv1::__cxa_thread_atexit (void (*dtor)(void *), void *obj, void */*dso_ha
}
#endif /* _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL */
+
+#endif // __USING_MCFGTHREAD__
diff --git a/libstdc++-v3/libsupc++/guard.cc b/libstdc++-v3/libsupc++/guard.cc
index 3a2ec3ad0d6..8b4cc96199b 100644
--- a/libstdc++-v3/libsupc++/guard.cc
+++ b/libstdc++-v3/libsupc++/guard.cc
@@ -28,6 +28,27 @@
#include <cxxabi.h>
#include <exception>
#include <new>
+
+#ifdef __USING_MCFGTHREAD__
+
+#include <mcfgthread/gthread.h>
+
+namespace __cxxabiv1 {
+
+extern "C" int __cxa_guard_acquire(__guard *g){
+ return ::_MCFCRT_WaitForOnceFlagForever((::_MCFCRT_OnceFlag *)g) == ::_MCFCRT_kOnceResultInitial;
+}
+extern "C" void __cxa_guard_abort(__guard *g) throw() {
+ ::_MCFCRT_SignalOnceFlagAsAborted((::_MCFCRT_OnceFlag *)g);
+}
+extern "C" void __cxa_guard_release(__guard *g) throw() {
+ ::_MCFCRT_SignalOnceFlagAsFinished((::_MCFCRT_OnceFlag *)g);
+}
+
+}
+
+#else // __USING_MCFGTHREAD__
+
#include <ext/atomicity.h>
#include <ext/concurrence.h>
#include <bits/atomic_lockfree_defines.h>
@@ -425,3 +446,5 @@ namespace __cxxabiv1
#endif
}
}
+
+#endif
diff --git a/libstdc++-v3/src/c++11/thread.cc b/libstdc++-v3/src/c++11/thread.cc
index 8238817c2e9..0c6a1f85f6f 100644
--- a/libstdc++-v3/src/c++11/thread.cc
+++ b/libstdc++-v3/src/c++11/thread.cc
@@ -55,6 +55,15 @@ static inline int get_nprocs()
#elif defined(_GLIBCXX_USE_SC_NPROC_ONLN)
# include <unistd.h>
# define _GLIBCXX_NPROCS sysconf(_SC_NPROC_ONLN)
+#elif defined(_WIN32)
+# include <windows.h>
+static inline int get_nprocs()
+{
+ SYSTEM_INFO sysinfo;
+ GetSystemInfo(&sysinfo);
+ return (int)sysinfo.dwNumberOfProcessors;
+}
+# define _GLIBCXX_NPROCS get_nprocs()
#else
# define _GLIBCXX_NPROCS 0
#endif
--
2.17.0
@@ -1,306 +0,0 @@
From 86f2f767ddffd9f7c6f1470b987ae7b0d251b988 Mon Sep 17 00:00:00 2001
From: Liu Hao <lh_mouse@126.com>
Date: Wed, 25 Apr 2018 21:54:19 +0800
Subject: [PATCH] Added 'mcf' thread model support from mcfgthread.
Signed-off-by: Liu Hao <lh_mouse@126.com>
---
config/gthr.m4 | 1 +
gcc/config.gcc | 3 +++
gcc/config/i386/mingw-mcfgthread.h | 1 +
gcc/config/i386/mingw-w64.h | 2 +-
gcc/config/i386/mingw32.h | 11 ++++++++++-
gcc/configure | 2 +-
gcc/configure.ac | 2 +-
libatomic/configure.tgt | 2 +-
libgcc/config.host | 6 ++++++
libgcc/config/i386/gthr-mcf.h | 1 +
libgcc/config/i386/t-mingw-mcfgthread | 2 ++
libgcc/configure | 1 +
libstdc++-v3/configure | 1 +
libstdc++-v3/libsupc++/atexit_thread.cc | 18 ++++++++++++++++++
libstdc++-v3/libsupc++/guard.cc | 23 +++++++++++++++++++++++
libstdc++-v3/src/c++11/thread.cc | 9 +++++++++
16 files changed, 80 insertions(+), 5 deletions(-)
create mode 100644 gcc/config/i386/mingw-mcfgthread.h
create mode 100644 libgcc/config/i386/gthr-mcf.h
create mode 100644 libgcc/config/i386/t-mingw-mcfgthread
diff --git a/config/gthr.m4 b/config/gthr.m4
index 7b29f1f3327..82e21fe1709 100644
--- a/config/gthr.m4
+++ b/config/gthr.m4
@@ -21,6 +21,7 @@ case $1 in
tpf) thread_header=config/s390/gthr-tpf.h ;;
vxworks) thread_header=config/gthr-vxworks.h ;;
win32) thread_header=config/i386/gthr-win32.h ;;
+ mcf) thread_header=config/i386/gthr-mcf.h ;;
esac
AC_SUBST(thread_header)
])
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 46a9029acec..112c24e95a3 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -1758,6 +1758,9 @@ i[34567]86-*-mingw* | x86_64-*-mingw*)
if test x$enable_threads = xposix ; then
tm_file="${tm_file} i386/mingw-pthread.h"
fi
+ if test x$enable_threads = xmcf ; then
+ tm_file="${tm_file} i386/mingw-mcfgthread.h"
+ fi
tm_file="${tm_file} i386/mingw32.h"
# This makes the logic if mingw's or the w64 feature set has to be used
case ${target} in
diff --git a/gcc/config/i386/mingw-mcfgthread.h b/gcc/config/i386/mingw-mcfgthread.h
new file mode 100644
index 00000000000..ec381a7798f
--- /dev/null
+++ b/gcc/config/i386/mingw-mcfgthread.h
@@ -0,0 +1 @@
+#define TARGET_USE_MCFGTHREAD 1
diff --git a/gcc/config/i386/mingw-w64.h b/gcc/config/i386/mingw-w64.h
index 484dc7a9e9f..a15bbeea500 100644
--- a/gcc/config/i386/mingw-w64.h
+++ b/gcc/config/i386/mingw-w64.h
@@ -48,7 +48,7 @@ along with GCC; see the file COPYING3. If not see
"%{mwindows:-lgdi32 -lcomdlg32} " \
"%{fvtable-verify=preinit:-lvtv -lpsapi; \
fvtable-verify=std:-lvtv -lpsapi} " \
- "-ladvapi32 -lshell32 -luser32 -lkernel32"
+ LIB_MCFGTHREAD "-ladvapi32 -lshell32 -luser32 -lkernel32"
#undef SPEC_32
#undef SPEC_64
diff --git a/gcc/config/i386/mingw32.h b/gcc/config/i386/mingw32.h
index 0612b87199a..76cea94f3b7 100644
--- a/gcc/config/i386/mingw32.h
+++ b/gcc/config/i386/mingw32.h
@@ -32,6 +32,14 @@ along with GCC; see the file COPYING3. If not see
| MASK_STACK_PROBE | MASK_ALIGN_DOUBLE \
| MASK_MS_BITFIELD_LAYOUT)
+#ifndef TARGET_USE_MCFGTHREAD
+#define CPP_MCFGTHREAD() ((void)0)
+#define LIB_MCFGTHREAD ""
+#else
+#define CPP_MCFGTHREAD() (builtin_define("__USING_MCFGTHREAD__"))
+#define LIB_MCFGTHREAD " -lmcfgthread "
+#endif
+
/* See i386/crtdll.h for an alternative definition. _INTEGRAL_MAX_BITS
is for compatibility with native compiler. */
#define EXTRA_OS_CPP_BUILTINS() \
@@ -50,6 +58,7 @@ along with GCC; see the file COPYING3. If not see
builtin_define_std ("WIN64"); \
builtin_define ("_WIN64"); \
} \
+ CPP_MCFGTHREAD(); \
} \
while (0)
@@ -93,7 +102,7 @@ along with GCC; see the file COPYING3. If not see
"%{mwindows:-lgdi32 -lcomdlg32} " \
"%{fvtable-verify=preinit:-lvtv -lpsapi; \
fvtable-verify=std:-lvtv -lpsapi} " \
- "-ladvapi32 -lshell32 -luser32 -lkernel32"
+ LIB_MCFGTHREAD "-ladvapi32 -lshell32 -luser32 -lkernel32"
/* Weak symbols do not get resolved if using a Windows dll import lib.
Make the unwind registration references strong undefs. */
diff --git a/gcc/configure b/gcc/configure
index 6121e163259..52f0e00efe6 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -11693,7 +11693,7 @@ case ${enable_threads} in
target_thread_file='single'
;;
aix | dce | lynx | mipssde | posix | rtems | \
- single | tpf | vxworks | win32)
+ single | tpf | vxworks | win32 | mcf)
target_thread_file=${enable_threads}
;;
*)
diff --git a/gcc/configure.ac b/gcc/configure.ac
index b066cc609e1..4ecdba88de7 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -1612,7 +1612,7 @@ case ${enable_threads} in
target_thread_file='single'
;;
aix | dce | lynx | mipssde | posix | rtems | \
- single | tpf | vxworks | win32)
+ single | tpf | vxworks | win32 | mcf)
target_thread_file=${enable_threads}
;;
*)
diff --git a/libatomic/configure.tgt b/libatomic/configure.tgt
index ea8c34f8c71..23134ad7363 100644
--- a/libatomic/configure.tgt
+++ b/libatomic/configure.tgt
@@ -145,7 +145,7 @@ case "${target}" in
*-*-mingw*)
# OS support for atomic primitives.
case ${target_thread_file} in
- win32)
+ win32 | mcf)
config_path="${config_path} mingw"
;;
posix)
diff --git a/libgcc/config.host b/libgcc/config.host
index 11b4acaff55..9fbd38650bd 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -737,6 +737,9 @@ i[34567]86-*-mingw*)
posix)
tmake_file="i386/t-mingw-pthread $tmake_file"
;;
+ mcf)
+ tmake_file="i386/t-mingw-mcfgthread $tmake_file"
+ ;;
esac
# This has to match the logic for DWARF2_UNWIND_INFO in gcc/config/i386/cygming.h
if test x$ac_cv_sjlj_exceptions = xyes; then
@@ -761,6 +764,9 @@ x86_64-*-mingw*)
posix)
tmake_file="i386/t-mingw-pthread $tmake_file"
;;
+ mcf)
+ tmake_file="i386/t-mingw-mcfgthread $tmake_file"
+ ;;
esac
# This has to match the logic for DWARF2_UNWIND_INFO in gcc/config/i386/cygming.h
if test x$ac_cv_sjlj_exceptions = xyes; then
diff --git a/libgcc/config/i386/gthr-mcf.h b/libgcc/config/i386/gthr-mcf.h
new file mode 100644
index 00000000000..5ea2908361f
--- /dev/null
+++ b/libgcc/config/i386/gthr-mcf.h
@@ -0,0 +1 @@
+#include <mcfgthread/gthread.h>
diff --git a/libgcc/config/i386/t-mingw-mcfgthread b/libgcc/config/i386/t-mingw-mcfgthread
new file mode 100644
index 00000000000..4b9b10e32d6
--- /dev/null
+++ b/libgcc/config/i386/t-mingw-mcfgthread
@@ -0,0 +1,2 @@
+SHLIB_PTHREAD_CFLAG =
+SHLIB_PTHREAD_LDFLAG = -lmcfgthread
diff --git a/libgcc/configure b/libgcc/configure
index b2f3f870844..eff889dc3b3 100644
--- a/libgcc/configure
+++ b/libgcc/configure
@@ -5451,6 +5451,7 @@ case $target_thread_file in
tpf) thread_header=config/s390/gthr-tpf.h ;;
vxworks) thread_header=config/gthr-vxworks.h ;;
win32) thread_header=config/i386/gthr-win32.h ;;
+ mcf) thread_header=config/i386/gthr-mcf.h ;;
esac
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index ba094be6f15..979a5ab9ace 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -15187,6 +15187,7 @@ case $target_thread_file in
tpf) thread_header=config/s390/gthr-tpf.h ;;
vxworks) thread_header=config/gthr-vxworks.h ;;
win32) thread_header=config/i386/gthr-win32.h ;;
+ mcf) thread_header=config/i386/gthr-mcf.h ;;
esac
diff --git a/libstdc++-v3/libsupc++/atexit_thread.cc b/libstdc++-v3/libsupc++/atexit_thread.cc
index de920d714c6..665fb74bd6b 100644
--- a/libstdc++-v3/libsupc++/atexit_thread.cc
+++ b/libstdc++-v3/libsupc++/atexit_thread.cc
@@ -25,6 +25,22 @@
#include <cstdlib>
#include <new>
#include "bits/gthr.h"
+
+#ifdef __USING_MCFGTHREAD__
+
+#include <mcfgthread/gthread.h>
+namespace __cxxabiv1 {
+extern "C" int
+__cxa_thread_atexit (void (_GLIBCXX_CDTOR_CALLABI *dtor)(void *),
+ void *obj, void *dso_handle)
+ _GLIBCXX_NOTHROW
+{
+ return ::_MCFCRT_AtThreadExit((void (*)(_MCFCRT_STD intptr_t))dtor, (_MCFCRT_STD intptr_t)obj) ? 0 : -1;
+ (void)dso_handle;
+}
+}
+#else // __USING_MCFGTHREAD__
+
#ifdef _GLIBCXX_THREAD_ATEXIT_WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
@@ -167,3 +183,5 @@ __cxxabiv1::__cxa_thread_atexit (void (*dtor)(void *), void *obj, void */*dso_ha
}
#endif /* _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL */
+
+#endif // __USING_MCFGTHREAD__
diff --git a/libstdc++-v3/libsupc++/guard.cc b/libstdc++-v3/libsupc++/guard.cc
index 3a2ec3ad0d6..8b4cc96199b 100644
--- a/libstdc++-v3/libsupc++/guard.cc
+++ b/libstdc++-v3/libsupc++/guard.cc
@@ -28,6 +28,27 @@
#include <cxxabi.h>
#include <exception>
#include <new>
+
+#ifdef __USING_MCFGTHREAD__
+
+#include <mcfgthread/gthread.h>
+
+namespace __cxxabiv1 {
+
+extern "C" int __cxa_guard_acquire(__guard *g){
+ return ::_MCFCRT_WaitForOnceFlagForever((::_MCFCRT_OnceFlag *)g) == ::_MCFCRT_kOnceResultInitial;
+}
+extern "C" void __cxa_guard_abort(__guard *g) throw() {
+ ::_MCFCRT_SignalOnceFlagAsAborted((::_MCFCRT_OnceFlag *)g);
+}
+extern "C" void __cxa_guard_release(__guard *g) throw() {
+ ::_MCFCRT_SignalOnceFlagAsFinished((::_MCFCRT_OnceFlag *)g);
+}
+
+}
+
+#else // __USING_MCFGTHREAD__
+
#include <ext/atomicity.h>
#include <ext/concurrence.h>
#include <bits/atomic_lockfree_defines.h>
@@ -425,3 +446,5 @@ namespace __cxxabiv1
#endif
}
}
+
+#endif
diff --git a/libstdc++-v3/src/c++11/thread.cc b/libstdc++-v3/src/c++11/thread.cc
index 8238817c2e9..0c6a1f85f6f 100644
--- a/libstdc++-v3/src/c++11/thread.cc
+++ b/libstdc++-v3/src/c++11/thread.cc
@@ -55,6 +55,15 @@ static inline int get_nprocs()
#elif defined(_GLIBCXX_USE_SC_NPROC_ONLN)
# include <unistd.h>
# define _GLIBCXX_NPROCS sysconf(_SC_NPROC_ONLN)
+#elif defined(_WIN32)
+# include <windows.h>
+static inline int get_nprocs()
+{
+ SYSTEM_INFO sysinfo;
+ GetSystemInfo(&sysinfo);
+ return (int)sysinfo.dwNumberOfProcessors;
+}
+# define _GLIBCXX_NPROCS get_nprocs()
#else
# define _GLIBCXX_NPROCS 0
#endif
--
2.17.0
@@ -1,99 +0,0 @@
From 30908556fece379ffd7c0da96c774d8bd297e459 Mon Sep 17 00:00:00 2001
From: Sergei Trofimovich <siarheit@google.com>
Date: Fri, 22 Sep 2023 22:41:49 +0100
Subject: [PATCH] gcc/file-prefix-map.cc: always mangle __FILE__ into invalid
store path
Without the change `__FILE__` used in static inline functions in headers
embed paths to header files into executable images. For local headers
it's not a problem, but for headers in `/nix/store` this causes `-dev`
inputs to be retained in runtime closure.
Typical examples are `nix` -> `nlohmann_json` and `pipewire` ->
`lttng-ust.dev`.
For this reason we want to remove the occurrences of hashes in the
expansion of `__FILE__`. `nuke-references` does it by replacing hashes
by `eeeeee...`. It is handy to be able to invert the transformation to
go back to the original store path. The chosen solution is to make the
hash uppercase:
- it does not trigger runtime references (except for all digit hashes,
which are unlikely enough)
- it visually looks like a bogus store path
- it is easy to find the original store path if required
Ideally we would like to use `-fmacro-prefix-map=` feature of `gcc` as:
-fmacro-prefix-map=/nix/store/$hash1-nlohmann-json-ver=/nix/store/$HASH1-nlohmann-json-ver
-fmacro-prefix-map=/nix/...
In practice it quickly exhausts argument length limit due to `gcc`
deficiency: https://gcc.gnu.org/PR111527
Until it's fixed let's hardcode header mangling if $NIX_STORE variable
is present in the environment.
Tested as:
$ printf "# 0 \"/nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-pppppp-vvvvvvv\" \nconst char * f(void) { return __FILE__; }" | NIX_STORE=/nix/store ./gcc/xgcc -Bgcc -x c - -S -o -
...
.string "/nix/store/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA-pppppp-vvvvvvv"
...
Mangled successfully.
To reverse the effect of the mangle use new `NIX_GCC_DONT_MANGLE_PREFIX_MAP`
environment variable. It should not normally be needed.
--- a/gcc/file-prefix-map.cc
+++ b/gcc/file-prefix-map.cc
@@ -65,7 +65,7 @@ add_prefix_map (file_prefix_map *&maps, const char *arg, const char *opt)
remapping was performed. */
static const char *
-remap_filename (file_prefix_map *maps, const char *filename)
+remap_filename (file_prefix_map *maps, const char *filename, bool mangle_nix_store = false)
{
file_prefix_map *map;
char *s;
@@ -76,7 +76,31 @@ remap_filename (file_prefix_map *maps, const char *filename)
if (filename_ncmp (filename, map->old_prefix, map->old_len) == 0)
break;
if (!map)
- return filename;
+ {
+ if (mangle_nix_store && getenv("NIX_GCC_DONT_MANGLE_PREFIX_MAP") == NULL)
+ {
+ /* Remap the 32 characters after $NIX_STORE/ to uppercase
+ *
+ * That way we avoid argument parameters explosion
+ * and still avoid embedding headers into runtime closure:
+ * https://gcc.gnu.org/PR111527
+ */
+ char * nix_store = getenv("NIX_STORE");
+ size_t nix_store_len = nix_store ? strlen(nix_store) : 0;
+ const char * name = filename;
+ size_t name_len = strlen(name);
+ if (nix_store && name_len >= nix_store_len + 1 + 32 && memcmp(name, nix_store, nix_store_len) == 0)
+ {
+ s = (char *) ggc_alloc_atomic (name_len + 1);
+ memcpy(s, name, name_len + 1);
+ for (size_t i = nix_store_len + 1; i < nix_store_len + 1 + 32; i++) {
+ s[i] = TOUPPER(s[i]);
+ }
+ return s;
+ }
+ }
+ return filename;
+ }
name = filename + map->old_len;
name_len = strlen (name) + 1;
@@ -129,7 +153,7 @@ add_profile_prefix_map (const char *arg)
const char *
remap_macro_filename (const char *filename)
{
- return remap_filename (macro_prefix_maps, filename);
+ return remap_filename (macro_prefix_maps, filename, true);
}
/* Remap using -fdebug-prefix-map. Return the GC-allocated new name
@@ -1,306 +0,0 @@
From 86f2f767ddffd9f7c6f1470b987ae7b0d251b988 Mon Sep 17 00:00:00 2001
From: Liu Hao <lh_mouse@126.com>
Date: Wed, 25 Apr 2018 21:54:19 +0800
Subject: [PATCH] Added 'mcf' thread model support from mcfgthread.
Signed-off-by: Liu Hao <lh_mouse@126.com>
---
config/gthr.m4 | 1 +
gcc/config.gcc | 3 +++
gcc/config/i386/mingw-mcfgthread.h | 1 +
gcc/config/i386/mingw-w64.h | 2 +-
gcc/config/i386/mingw32.h | 11 ++++++++++-
gcc/configure | 2 +-
gcc/configure.ac | 2 +-
libatomic/configure.tgt | 2 +-
libgcc/config.host | 6 ++++++
libgcc/config/i386/gthr-mcf.h | 1 +
libgcc/config/i386/t-mingw-mcfgthread | 2 ++
libgcc/configure | 1 +
libstdc++-v3/configure | 1 +
libstdc++-v3/libsupc++/atexit_thread.cc | 18 ++++++++++++++++++
libstdc++-v3/libsupc++/guard.cc | 23 +++++++++++++++++++++++
libstdc++-v3/src/c++11/thread.cc | 9 +++++++++
16 files changed, 80 insertions(+), 5 deletions(-)
create mode 100644 gcc/config/i386/mingw-mcfgthread.h
create mode 100644 libgcc/config/i386/gthr-mcf.h
create mode 100644 libgcc/config/i386/t-mingw-mcfgthread
diff --git a/config/gthr.m4 b/config/gthr.m4
index 7b29f1f3327..82e21fe1709 100644
--- a/config/gthr.m4
+++ b/config/gthr.m4
@@ -21,6 +21,7 @@ case $1 in
tpf) thread_header=config/s390/gthr-tpf.h ;;
vxworks) thread_header=config/gthr-vxworks.h ;;
win32) thread_header=config/i386/gthr-win32.h ;;
+ mcf) thread_header=config/i386/gthr-mcf.h ;;
esac
AC_SUBST(thread_header)
])
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 46a9029acec..112c24e95a3 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -1758,6 +1758,9 @@ i[34567]86-*-mingw* | x86_64-*-mingw*)
if test x$enable_threads = xposix ; then
tm_file="${tm_file} i386/mingw-pthread.h"
fi
+ if test x$enable_threads = xmcf ; then
+ tm_file="${tm_file} i386/mingw-mcfgthread.h"
+ fi
tm_file="${tm_file} i386/mingw32.h"
# This makes the logic if mingw's or the w64 feature set has to be used
case ${target} in
diff --git a/gcc/config/i386/mingw-mcfgthread.h b/gcc/config/i386/mingw-mcfgthread.h
new file mode 100644
index 00000000000..ec381a7798f
--- /dev/null
+++ b/gcc/config/i386/mingw-mcfgthread.h
@@ -0,0 +1 @@
+#define TARGET_USE_MCFGTHREAD 1
diff --git a/gcc/config/i386/mingw-w64.h b/gcc/config/i386/mingw-w64.h
index 484dc7a9e9f..a15bbeea500 100644
--- a/gcc/config/i386/mingw-w64.h
+++ b/gcc/config/i386/mingw-w64.h
@@ -48,7 +48,7 @@ along with GCC; see the file COPYING3. If not see
"%{mwindows:-lgdi32 -lcomdlg32} " \
"%{fvtable-verify=preinit:-lvtv -lpsapi; \
fvtable-verify=std:-lvtv -lpsapi} " \
- "-ladvapi32 -lshell32 -luser32 -lkernel32"
+ LIB_MCFGTHREAD "-ladvapi32 -lshell32 -luser32 -lkernel32"
#undef SPEC_32
#undef SPEC_64
diff --git a/gcc/config/i386/mingw32.h b/gcc/config/i386/mingw32.h
index 0612b87199a..76cea94f3b7 100644
--- a/gcc/config/i386/mingw32.h
+++ b/gcc/config/i386/mingw32.h
@@ -32,6 +32,14 @@ along with GCC; see the file COPYING3. If not see
| MASK_STACK_PROBE | MASK_ALIGN_DOUBLE \
| MASK_MS_BITFIELD_LAYOUT)
+#ifndef TARGET_USE_MCFGTHREAD
+#define CPP_MCFGTHREAD() ((void)0)
+#define LIB_MCFGTHREAD ""
+#else
+#define CPP_MCFGTHREAD() (builtin_define("__USING_MCFGTHREAD__"))
+#define LIB_MCFGTHREAD " -lmcfgthread "
+#endif
+
/* See i386/crtdll.h for an alternative definition. _INTEGRAL_MAX_BITS
is for compatibility with native compiler. */
#define EXTRA_OS_CPP_BUILTINS() \
@@ -50,6 +58,7 @@ along with GCC; see the file COPYING3. If not see
builtin_define_std ("WIN64"); \
builtin_define ("_WIN64"); \
} \
+ CPP_MCFGTHREAD(); \
} \
while (0)
@@ -93,7 +102,7 @@ along with GCC; see the file COPYING3. If not see
"%{mwindows:-lgdi32 -lcomdlg32} " \
"%{fvtable-verify=preinit:-lvtv -lpsapi; \
fvtable-verify=std:-lvtv -lpsapi} " \
- "-ladvapi32 -lshell32 -luser32 -lkernel32"
+ LIB_MCFGTHREAD "-ladvapi32 -lshell32 -luser32 -lkernel32"
/* Weak symbols do not get resolved if using a Windows dll import lib.
Make the unwind registration references strong undefs. */
diff --git a/gcc/configure b/gcc/configure
index 6121e163259..52f0e00efe6 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -11693,7 +11693,7 @@ case ${enable_threads} in
target_thread_file='single'
;;
aix | dce | lynx | mipssde | posix | rtems | \
- single | tpf | vxworks | win32)
+ single | tpf | vxworks | win32 | mcf)
target_thread_file=${enable_threads}
;;
*)
diff --git a/gcc/configure.ac b/gcc/configure.ac
index b066cc609e1..4ecdba88de7 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -1612,7 +1612,7 @@ case ${enable_threads} in
target_thread_file='single'
;;
aix | dce | lynx | mipssde | posix | rtems | \
- single | tpf | vxworks | win32)
+ single | tpf | vxworks | win32 | mcf)
target_thread_file=${enable_threads}
;;
*)
diff --git a/libatomic/configure.tgt b/libatomic/configure.tgt
index ea8c34f8c71..23134ad7363 100644
--- a/libatomic/configure.tgt
+++ b/libatomic/configure.tgt
@@ -145,7 +145,7 @@ case "${target}" in
*-*-mingw*)
# OS support for atomic primitives.
case ${target_thread_file} in
- win32)
+ win32 | mcf)
config_path="${config_path} mingw"
;;
posix)
diff --git a/libgcc/config.host b/libgcc/config.host
index 11b4acaff55..9fbd38650bd 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -737,6 +737,9 @@ i[34567]86-*-mingw*)
posix)
tmake_file="i386/t-mingw-pthread $tmake_file"
;;
+ mcf)
+ tmake_file="i386/t-mingw-mcfgthread $tmake_file"
+ ;;
esac
# This has to match the logic for DWARF2_UNWIND_INFO in gcc/config/i386/cygming.h
if test x$ac_cv_sjlj_exceptions = xyes; then
@@ -761,6 +764,9 @@ x86_64-*-mingw*)
posix)
tmake_file="i386/t-mingw-pthread $tmake_file"
;;
+ mcf)
+ tmake_file="i386/t-mingw-mcfgthread $tmake_file"
+ ;;
esac
# This has to match the logic for DWARF2_UNWIND_INFO in gcc/config/i386/cygming.h
if test x$ac_cv_sjlj_exceptions = xyes; then
diff --git a/libgcc/config/i386/gthr-mcf.h b/libgcc/config/i386/gthr-mcf.h
new file mode 100644
index 00000000000..5ea2908361f
--- /dev/null
+++ b/libgcc/config/i386/gthr-mcf.h
@@ -0,0 +1 @@
+#include <mcfgthread/gthread.h>
diff --git a/libgcc/config/i386/t-mingw-mcfgthread b/libgcc/config/i386/t-mingw-mcfgthread
new file mode 100644
index 00000000000..4b9b10e32d6
--- /dev/null
+++ b/libgcc/config/i386/t-mingw-mcfgthread
@@ -0,0 +1,2 @@
+SHLIB_PTHREAD_CFLAG =
+SHLIB_PTHREAD_LDFLAG = -lmcfgthread
diff --git a/libgcc/configure b/libgcc/configure
index b2f3f870844..eff889dc3b3 100644
--- a/libgcc/configure
+++ b/libgcc/configure
@@ -5451,6 +5451,7 @@ case $target_thread_file in
tpf) thread_header=config/s390/gthr-tpf.h ;;
vxworks) thread_header=config/gthr-vxworks.h ;;
win32) thread_header=config/i386/gthr-win32.h ;;
+ mcf) thread_header=config/i386/gthr-mcf.h ;;
esac
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index ba094be6f15..979a5ab9ace 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -15187,6 +15187,7 @@ case $target_thread_file in
tpf) thread_header=config/s390/gthr-tpf.h ;;
vxworks) thread_header=config/gthr-vxworks.h ;;
win32) thread_header=config/i386/gthr-win32.h ;;
+ mcf) thread_header=config/i386/gthr-mcf.h ;;
esac
diff --git a/libstdc++-v3/libsupc++/atexit_thread.cc b/libstdc++-v3/libsupc++/atexit_thread.cc
index de920d714c6..665fb74bd6b 100644
--- a/libstdc++-v3/libsupc++/atexit_thread.cc
+++ b/libstdc++-v3/libsupc++/atexit_thread.cc
@@ -25,6 +25,22 @@
#include <cstdlib>
#include <new>
#include "bits/gthr.h"
+
+#ifdef __USING_MCFGTHREAD__
+
+#include <mcfgthread/gthread.h>
+
+extern "C" int
+__cxxabiv1::__cxa_thread_atexit (void (*dtor)(void *),
+ void *obj, void *dso_handle)
+ _GLIBCXX_NOTHROW
+{
+ return ::_MCFCRT_AtThreadExit((void (*)(_MCFCRT_STD intptr_t))dtor, (_MCFCRT_STD intptr_t)obj) ? 0 : -1;
+ (void)dso_handle;
+}
+
+#else // __USING_MCFGTHREAD__
+
#ifdef _GLIBCXX_THREAD_ATEXIT_WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
@@ -167,3 +183,5 @@ __cxxabiv1::__cxa_thread_atexit (void (*dtor)(void *), void *obj, void */*dso_ha
}
#endif /* _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL */
+
+#endif // __USING_MCFGTHREAD__
diff --git a/libstdc++-v3/libsupc++/guard.cc b/libstdc++-v3/libsupc++/guard.cc
index 3a2ec3ad0d6..8b4cc96199b 100644
--- a/libstdc++-v3/libsupc++/guard.cc
+++ b/libstdc++-v3/libsupc++/guard.cc
@@ -28,6 +28,27 @@
#include <cxxabi.h>
#include <exception>
#include <new>
+
+#ifdef __USING_MCFGTHREAD__
+
+#include <mcfgthread/gthread.h>
+
+namespace __cxxabiv1 {
+
+extern "C" int __cxa_guard_acquire(__guard *g){
+ return ::_MCFCRT_WaitForOnceFlagForever((::_MCFCRT_OnceFlag *)g) == ::_MCFCRT_kOnceResultInitial;
+}
+extern "C" void __cxa_guard_abort(__guard *g) throw() {
+ ::_MCFCRT_SignalOnceFlagAsAborted((::_MCFCRT_OnceFlag *)g);
+}
+extern "C" void __cxa_guard_release(__guard *g) throw() {
+ ::_MCFCRT_SignalOnceFlagAsFinished((::_MCFCRT_OnceFlag *)g);
+}
+
+}
+
+#else // __USING_MCFGTHREAD__
+
#include <ext/atomicity.h>
#include <ext/concurrence.h>
#include <bits/atomic_lockfree_defines.h>
@@ -425,3 +446,5 @@ namespace __cxxabiv1
#endif
}
}
+
+#endif
diff --git a/libstdc++-v3/src/c++11/thread.cc b/libstdc++-v3/src/c++11/thread.cc
index 8238817c2e9..0c6a1f85f6f 100644
--- a/libstdc++-v3/src/c++11/thread.cc
+++ b/libstdc++-v3/src/c++11/thread.cc
@@ -55,6 +55,15 @@ static inline int get_nprocs()
#elif defined(_GLIBCXX_USE_SC_NPROC_ONLN)
# include <unistd.h>
# define _GLIBCXX_NPROCS sysconf(_SC_NPROC_ONLN)
+#elif defined(_WIN32)
+# include <windows.h>
+static inline int get_nprocs()
+{
+ SYSTEM_INFO sysinfo;
+ GetSystemInfo(&sysinfo);
+ return (int)sysinfo.dwNumberOfProcessors;
+}
+# define _GLIBCXX_NPROCS get_nprocs()
#else
# define _GLIBCXX_NPROCS 0
#endif
--
2.17.0
@@ -1,105 +0,0 @@
diff --git a/fixincludes/fixincl.x b/fixincludes/fixincl.x
index 47a3578f017..6cf22d19b2a 100644
--- a/fixincludes/fixincl.x
+++ b/fixincludes/fixincl.x
@@ -3480,6 +3480,43 @@ static const char* apzDarwin_Ucred__AtomicPatch[] = {
#endif\n",
(char*)NULL };
+/* * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * Description of Darwin_Nix_Sdk_Availabilityinternal fix
+ */
+tSCC zDarwin_Nix_Sdk_AvailabilityinternalName[] =
+ "darwin_nix_sdk_availabilityinternal";
+
+/*
+ * File name selection pattern
+ */
+tSCC zDarwin_Nix_Sdk_AvailabilityinternalList[] =
+ "AvailabilityInternal.h\0";
+/*
+ * Machine/OS name selection pattern
+ */
+tSCC* apzDarwin_Nix_Sdk_AvailabilityinternalMachs[] = {
+ "*-*-darwin*",
+ (const char*)NULL };
+
+/*
+ * content selection pattern - do fix if pattern found
+ */
+tSCC zDarwin_Nix_Sdk_AvailabilityinternalSelect0[] =
+ "(.*)__has_builtin\\(__is_target_os\\)(.*)";
+
+#define DARWIN_NIX_SDK_AVAILABILITYINTERNAL_TEST_CT 1
+static tTestDesc aDarwin_Nix_Sdk_AvailabilityinternalTests[] = {
+ { TT_EGREP, zDarwin_Nix_Sdk_AvailabilityinternalSelect0, (regex_t*)NULL }, };
+
+/*
+ * Fix Command Arguments for Darwin_Nix_Sdk_Availabilityinternal
+ */
+static const char* apzDarwin_Nix_Sdk_AvailabilityinternalPatch[] = {
+ "format",
+ "%10%2",
+ (char*)NULL };
+
/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Description of Dec_Intern_Asm fix
@@ -10445,9 +10482,9 @@ static const char* apzX11_SprintfPatch[] = {
*
* List of all fixes
*/
-#define REGEX_COUNT 296
+#define REGEX_COUNT 297
#define MACH_LIST_SIZE_LIMIT 187
-#define FIX_COUNT 257
+#define FIX_COUNT 258
/*
* Enumerate the fixes
@@ -10535,6 +10572,7 @@ typedef enum {
DARWIN_STDINT_6_FIXIDX,
DARWIN_STDINT_7_FIXIDX,
DARWIN_UCRED__ATOMIC_FIXIDX,
+ DARWIN_NIX_SDK_AVAILABILITYINTERNAL_FIXIDX,
DEC_INTERN_ASM_FIXIDX,
DJGPP_WCHAR_H_FIXIDX,
ECD_CURSOR_FIXIDX,
@@ -11123,6 +11161,11 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
DARWIN_UCRED__ATOMIC_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
aDarwin_Ucred__AtomicTests, apzDarwin_Ucred__AtomicPatch, 0 },
+ { zDarwin_Nix_Sdk_AvailabilityinternalName, zDarwin_Nix_Sdk_AvailabilityinternalList,
+ apzDarwin_Nix_Sdk_AvailabilityinternalMachs,
+ DARWIN_NIX_SDK_AVAILABILITYINTERNAL_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
+ aDarwin_Nix_Sdk_AvailabilityinternalTests, apzDarwin_Nix_Sdk_AvailabilityinternalPatch, 0 },
+
{ zDec_Intern_AsmName, zDec_Intern_AsmList,
apzDec_Intern_AsmMachs,
DEC_INTERN_ASM_TEST_CT, FD_MACH_ONLY,
diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def
index bf136fdaa20..89bceb46c26 100644
--- a/fixincludes/inclhack.def
+++ b/fixincludes/inclhack.def
@@ -1727,6 +1727,20 @@ fix = {
test_text = ""; /* Don't provide this for wrap fixes. */
};
+/*
+ * Newer versions of AvailabilityInternal.h use `__has_builtin`,
+ * which is not implemented in or compatible with GCC.
+ */
+fix = {
+ hackname = darwin_nix_sdk_availabilityinternal;
+ mach = "*-*-darwin*";
+ files = AvailabilityInternal.h;
+ c_fix = format;
+ c_fix_arg = "%10%2";
+ select = "(.*)__has_builtin\\(__is_target_os\\)(.*)";
+ test_text = "__has_builtin(__is_target_os)";
+};
+
/*
* Fix <c_asm.h> on Digital UNIX V4.0:
* It contains a prototype for a DEC C internal asm() function,
@@ -1,31 +0,0 @@
Derived from ../11/fix-struct-redefinition-on-glibc-2.36.patch (upstream commit d2356ebb0084a0d80dbfe33040c9afe938c15d19)
diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
index e8fce8a02..cb1ac806e 100644
--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
@@ -65,7 +65,9 @@
#include <sys/vt.h>
#include <linux/cdrom.h>
#include <linux/fd.h>
+#if SANITIZER_ANDROID
#include <linux/fs.h>
+#endif
#include <linux/hdreg.h>
#include <linux/input.h>
#include <linux/ioctl.h>
@@ -846,10 +848,10 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
unsigned IOCTL_EVIOCGPROP = IOCTL_NOT_PRESENT;
unsigned IOCTL_EVIOCSKEYCODE_V2 = IOCTL_NOT_PRESENT;
#endif
- unsigned IOCTL_FS_IOC_GETFLAGS = FS_IOC_GETFLAGS;
- unsigned IOCTL_FS_IOC_GETVERSION = FS_IOC_GETVERSION;
- unsigned IOCTL_FS_IOC_SETFLAGS = FS_IOC_SETFLAGS;
- unsigned IOCTL_FS_IOC_SETVERSION = FS_IOC_SETVERSION;
+ unsigned IOCTL_FS_IOC_GETFLAGS = _IOR('f', 1, long);
+ unsigned IOCTL_FS_IOC_GETVERSION = _IOR('v', 1, long);
+ unsigned IOCTL_FS_IOC_SETFLAGS = _IOW('f', 2, long);
+ unsigned IOCTL_FS_IOC_SETVERSION = _IOW('v', 2, long);
unsigned IOCTL_GIO_CMAP = GIO_CMAP;
unsigned IOCTL_GIO_FONT = GIO_FONT;
unsigned IOCTL_GIO_UNIMAP = GIO_UNIMAP;
@@ -1,99 +0,0 @@
Backported from https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=b2cee5e1e89c8f939bc36fe9756befcb93d96982
diff -ur a/gcc/config/darwin.h b/gcc/config/darwin.h
--- a/gcc/config/darwin.h 2022-05-27 03:21:10.947379000 -0400
+++ b/gcc/config/darwin.h 2023-11-06 12:18:27.209236423 -0500
@@ -230,12 +230,18 @@
#define DSYMUTIL "\ndsymutil"
+/* Spec that controls whether the debug linker is run automatically for
+ a link step. This needs to be done if there is a source file on the
+ command line which will result in a temporary object (and debug is
+ enabled). */
+
#define DSYMUTIL_SPEC \
"%{!fdump=*:%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:\
%{v} \
- %{gdwarf-2:%{!gstabs*:%{%:debug-level-gt(0): -idsym}}}\
- %{.c|.cc|.C|.cpp|.cp|.c++|.cxx|.CPP|.m|.mm: \
- %{gdwarf-2:%{!gstabs*:%{%:debug-level-gt(0): -dsym}}}}}}}}}}}"
+ %{g*:%{!gstabs*:%{%:debug-level-gt(0): -idsym}}}\
+ %{.c|.cc|.C|.cpp|.cp|.c++|.cxx|.CPP|.m|.mm|.s|.f|.f90|\
+ .f95|.f03|.f77|.for|.F|.F90|.F95|.F03: \
+ %{g*:%{!gstabs*:%{%:debug-level-gt(0): -dsym}}}}}}}}}}}"
#define LINK_COMMAND_SPEC LINK_COMMAND_SPEC_A DSYMUTIL_SPEC
@@ -463,21 +469,31 @@
%{Zforce_cpusubtype_ALL:-force_cpusubtype_ALL} \
%{static}" ASM_MMACOSX_VERSION_MIN_SPEC
-/* Default ASM_DEBUG_SPEC. Darwin's as cannot currently produce dwarf
- debugging data. */
-
+#ifdef HAS_AS_STABS_DIRECTIVE
+/* We only pass a debug option to the assembler if that supports stabs, since
+ dwarf is not uniformly supported in the assemblers. */
#define ASM_DEBUG_SPEC "%{g*:%{%:debug-level-gt(0):%{!gdwarf*:--gstabs}}}"
+#else
+#define ASM_DEBUG_SPEC ""
+#endif
+
+#undef ASM_DEBUG_OPTION_SPEC
+#define ASM_DEBUG_OPTION_SPEC ""
+
#define ASM_FINAL_SPEC \
"%{gsplit-dwarf:%ngsplit-dwarf is not supported on this platform} %<gsplit-dwarf"
-/* We still allow output of STABS if the assembler supports it. */
+/* We now require C++11 to bootstrap and newer tools than those based on
+ stabs, so require DWARF-2, even if stabs is supported by the assembler. */
+
+#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
+#define DARWIN_PREFER_DWARF
+#define DWARF2_DEBUGGING_INFO 1
+
#ifdef HAVE_AS_STABS_DIRECTIVE
#define DBX_DEBUGGING_INFO 1
-#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
#endif
-#define DWARF2_DEBUGGING_INFO 1
-
#define DEBUG_FRAME_SECTION "__DWARF,__debug_frame,regular,debug"
#define DEBUG_INFO_SECTION "__DWARF,__debug_info,regular,debug"
#define DEBUG_ABBREV_SECTION "__DWARF,__debug_abbrev,regular,debug"
diff -ur a/gcc/config/darwin9.h b/gcc/config/darwin9.h
--- a/gcc/config/darwin9.h 2022-05-27 03:21:10.947379000 -0400
+++ b/gcc/config/darwin9.h 2023-11-06 12:18:48.325260590 -0500
@@ -18,29 +18,6 @@
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
-/* Prefer DWARF2. */
-#undef PREFERRED_DEBUGGING_TYPE
-#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
-#define DARWIN_PREFER_DWARF
-
-/* Since DWARF2 is default, conditions for running dsymutil are different. */
-#undef DSYMUTIL_SPEC
-#define DSYMUTIL_SPEC \
- "%{!fdump=*:%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:\
- %{v} \
- %{g*:%{!gstabs*:%{%:debug-level-gt(0): -idsym}}}\
- %{.c|.cc|.C|.cpp|.cp|.c++|.cxx|.CPP|.m|.mm|.s|.f|.f90|.f95|.f03|.f77|.for|.F|.F90|.F95|.F03: \
- %{g*:%{!gstabs*:%{%:debug-level-gt(0): -dsym}}}}}}}}}}}"
-
-/* Tell collect2 to run dsymutil for us as necessary. */
-#define COLLECT_RUN_DSYMUTIL 1
-
-/* Only ask as for debug data if the debug style is stabs (since as doesn't
- yet generate dwarf.) */
-
-#undef ASM_DEBUG_SPEC
-#define ASM_DEBUG_SPEC "%{g*:%{%:debug-level-gt(0):%{gstabs:--gstabs}}}"
-
#undef ASM_OUTPUT_ALIGNED_COMMON
#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \
do { \
@@ -1,34 +0,0 @@
From https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92061#c5
--- a/gcc/genconditions.c 2019-01-01 12:37:19.064943662 +0100
+++ b/gcc/genconditions.c 2019-10-11 10:57:11.464595789 +0200
@@ -57,8 +57,9 @@ write_header (void)
\n\
/* It is necessary, but not entirely safe, to include the headers below\n\
in a generator program. As a defensive measure, don't do so when the\n\
- table isn't going to have anything in it. */\n\
-#if GCC_VERSION >= 3001\n\
+ table isn't going to have anything in it.\n\
+ Clang 9 is buggy and doesn't handle __builtin_constant_p correctly. */\n\
+#if GCC_VERSION >= 3001 && __clang_major__ < 9\n\
\n\
/* Do not allow checking to confuse the issue. */\n\
#undef CHECKING_P\n\
@@ -170,7 +171,7 @@ struct c_test\n\
vary at run time. It works in 3.0.1 and later; 3.0 only when not\n\
optimizing. */\n\
\n\
-#if GCC_VERSION >= 3001\n\
+#if GCC_VERSION >= 3001 && __clang_major__ < 9\n\
static const struct c_test insn_conditions[] = {\n");
traverse_c_tests (write_one_condition, 0);
@@ -191,7 +192,7 @@ write_writer (void)
" unsigned int i;\n"
" const char *p;\n"
" puts (\"(define_conditions [\");\n"
- "#if GCC_VERSION >= 3001\n"
+ "#if GCC_VERSION >= 3001 && __clang_major__ < 9\n"
" for (i = 0; i < ARRAY_SIZE (insn_conditions); i++)\n"
" {\n"
" printf (\" (%d \\\"\", insn_conditions[i].value);\n"
@@ -5,7 +5,6 @@
langAda,
langObjC,
langObjCpp,
langD,
langFortran,
langGo,
reproducibleBuild,
@@ -29,17 +28,9 @@
let
atLeast15 = lib.versionAtLeast version "15";
atLeast14 = lib.versionAtLeast version "14";
atLeast13 = lib.versionAtLeast version "13";
atLeast12 = lib.versionAtLeast version "12";
atLeast11 = lib.versionAtLeast version "11";
atLeast10 = lib.versionAtLeast version "10";
is15 = majorVersion == "15";
is14 = majorVersion == "14";
is13 = majorVersion == "13";
is12 = majorVersion == "12";
is11 = majorVersion == "11";
is10 = majorVersion == "10";
is9 = majorVersion == "9";
# We only apply these patches when building a native toolchain for
# aarch64-darwin, as it breaks building a foreign one:
@@ -54,28 +45,20 @@ let
in
#
# Patches below are organized into three general categories:
# 1. Patches relevant to gcc>=12 on every platform
# 2. Patches relevant to gcc>=12 on specific platforms
# 3. Patches relevant only to gcc<12
# Patches below are organized into two general categories:
# 1. Patches relevant on every platform
# 2. Patches relevant on specific platforms
#
## 1. Patches relevant to gcc>=12 on every platform ####################################
## 1. Patches relevant on every platform ####################################
[ ]
# Backport "c++: conversion to base of vbase in NSDMI"
# Fixes https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80431
++ optional (!atLeast12) (fetchpatch {
name = "gcc-bug80431-fix";
url = "https://github.com/gcc-mirror/gcc/commit/de31f5445b12fd9ab9969dc536d821fe6f0edad0.patch";
hash = "sha256-bnHKJP5jR8rNJjRTi58/N/qZ5fPkuFBk7WblJWQpKOs=";
})
# Pass the path to a C++ compiler directly in the Makefile.in
++ optional (!lib.systems.equals targetPlatform hostPlatform) ./libstdc++-target.patch
++ optionals (noSysDirs) (
[
# Do not try looking for binaries and libraries in /lib and /usr/lib
(if atLeast12 then ./gcc-12-no-sys-dirs.patch else ./no-sys-dirs.patch)
./gcc-12-no-sys-dirs.patch
]
++ (
{
@@ -93,45 +76,32 @@ in
./13/no-sys-dirs-riscv.patch
./13/mangle-NIX_STORE-in-__FILE__.patch
];
"12" = [
./no-sys-dirs-riscv.patch
./12/mangle-NIX_STORE-in-__FILE__.patch
];
"11" = [ ./no-sys-dirs-riscv.patch ];
"10" = [ ./no-sys-dirs-riscv.patch ];
"9" = [ ./no-sys-dirs-riscv-gcc9.patch ];
}
."${majorVersion}" or [ ]
)
)
# Pass CFLAGS on to gnat
++ optional (atLeast12 && langAda) ./gnat-cflags-11.patch
++ optional langAda ./gnat-cflags-11.patch
++ optional langFortran (
# Fix interaction of gfortran and libtool
# Fixes the output of -v
# See also https://github.com/nixOS/nixpkgs/commit/cc6f814a8f0e9b70ede5b24192558664fa1f98a2
if atLeast12 then ./gcc-12-gfortran-driving.patch else ./gfortran-driving.patch
)
./gcc-12-gfortran-driving.patch)
# Do not pass a default include dir on PowerPC+Musl
# See https://github.com/NixOS/nixpkgs/pull/45340/commits/d6bb7d45162ac93e017cc9b665ae4836f6410710
++ [ ./ppc-musl.patch ]
# Patches for libphobos, the standard library of the D language
# - Forces libphobos to be built with -j1, as libtool misbehaves in parallel
# - Gets rid of -idirafter flags added by our gcc wrappers, as gdc does not understand them
# See https://github.com/NixOS/nixpkgs/pull/69144#issuecomment-535176453
++ optional langD ./libphobos.patch
# Moves the .cfi_starproc instruction to after the function label
# Needed to build llvm-18 and later
# See https://github.com/NixOS/nixpkgs/pull/354107/commits/2de1b4b14e17f42ba8b4bf43a29347c91511e008
++ optional (!atLeast14) ./cfi_startproc-reorder-label-09-1.diff
++ optional (atLeast14 && !canApplyIainsDarwinPatches) ./cfi_startproc-reorder-label-14-1.diff
## 2. Patches relevant to gcc>=12 on specific platforms ####################################
## 2. Patches relevant on specific platforms ####################################
### Musl+Go+gcc12
# backport fixes to build gccgo with musl libc
++ optionals (stdenv.hostPlatform.isMusl && langGo && atLeast12) [
++ optionals (stdenv.hostPlatform.isMusl && langGo) [
# libgo: handle stat st_atim32 field and SYS_SECCOMP
# syscall: gofmt
# Add blank lines after //sys comments where needed, and then run gofmt
@@ -197,9 +167,7 @@ in
) ../patches/15/libgcc-darwin-detection.patch
# Fix detection of bootstrap compiler Ada support (cctools as) on Nix Darwin
++ optional (
atLeast12 && stdenv.hostPlatform.isDarwin && langAda
) ./ada-cctools-as-detection-configure.patch
++ optional (stdenv.hostPlatform.isDarwin && langAda) ./ada-cctools-as-detection-configure.patch
# Remove CoreServices on Darwin, as it is only needed for macOS SDK 14+
++ optional (
@@ -212,7 +180,6 @@ in
"15" = [ ../patches/14/gnat-darwin-dylib-install-name-14.patch ];
"14" = [ ../patches/14/gnat-darwin-dylib-install-name-14.patch ];
"13" = [ ./gnat-darwin-dylib-install-name-13.patch ];
"12" = [ ./gnat-darwin-dylib-install-name.patch ];
}
.${majorVersion} or [ ]
)
@@ -249,107 +216,6 @@ in
hash = "sha256-xqkBDFYZ6fdowtqR3kV7bR8a4Cu11RDokSzGn1k3a1w=";
})
];
# Patches from https://github.com/iains/gcc-12-branch/compare/2bada4bc59bed4be34fab463bdb3c3ebfd2b41bb..gcc-12-4-darwin
"12" = [
(fetchurl {
name = "gcc-12-darwin-aarch64-support.patch";
url = "https://raw.githubusercontent.com/Homebrew/formula-patches/1ed9eaea059f1677d27382c62f21462b476b37fe/gcc/gcc-12.4.0.diff";
sha256 = "sha256-wOjpT79lps4TKG5/E761odhLGCphBIkCbOPiQg/D1Fw=";
})
# Needed to build LLVM>18
./cfi_startproc-reorder-label-2.diff
];
"11" = [
(fetchpatch {
# There are no upstream release tags in https://github.com/iains/gcc-11-branch.
# 5cc4c42a0d4de08715c2eef8715ad5b2e92a23b6 is the commit from https://github.com/gcc-mirror/gcc/releases/tag/releases%2Fgcc-11.5.0
url = "https://github.com/iains/gcc-11-branch/compare/5cc4c42a0d4de08715c2eef8715ad5b2e92a23b6..gcc-11.5-darwin-r0.diff";
hash = "sha256-7lH+GkgkrE6nOp9PMdIoqlQNWK31s6oW+lDt1LIkadE=";
})
# Needed to build LLVM>18
./cfi_startproc-reorder-label-2.diff
];
"10" = [
(fetchpatch {
# There are no upstream release tags in https://github.com/iains/gcc-10-branch.
# d04fe55 is the commit from https://github.com/gcc-mirror/gcc/releases/tag/releases%2Fgcc-10.5.0
url = "https://github.com/iains/gcc-10-branch/compare/d04fe5541c53cb16d1ca5c80da044b4c7633dbc6...gcc-10-5Dr0-pre-0.diff";
hash = "sha256-kVUHZKtYqkWIcqxHG7yAOR2B60w4KWLoxzaiFD/FWYk=";
})
# Needed to build LLVM>18
./cfi_startproc-reorder-label-2.diff
];
}
.${majorVersion} or [ ]
)
# Work around newer AvailabilityInternal.h when building older versions of GCC.
++ optionals (stdenv.hostPlatform.isDarwin) (
{
"9" = [ ../patches/9/AvailabilityInternal.h-fixincludes.patch ];
}
.${majorVersion} or [ ]
)
## Windows
# Backported mcf thread model support from gcc13:
# https://github.com/gcc-mirror/gcc/commit/f036d759ecee538555fa8c6b11963e4033732463
++ optional (
!atLeast13 && !withoutTargetLibc && targetPlatform.isMinGW && threadsCross.model == "mcf"
) (./. + "/${majorVersion}/Added-mcf-thread-model-support-from-mcfgthread.patch")
##############################################################################
##
## 3. Patches relevant only to gcc<12
##
## Above this point are patches which might potentially be applied
## to gcc version 12 or newer. Below this point are patches which
## will *only* be used for gcc versions older than gcc12.
##
##############################################################################
## gcc 11.0 and older ##############################################################################
# openjdk build fails without this on -march=opteron; is upstream in gcc12
++ optional is11 (fetchpatch {
name = "darwin-aarch64-self-host-driver.patch";
url = "https://github.com/gcc-mirror/gcc/commit/d243f4009d8071b734df16cd70f4c5d09a373769.patch";
sha256 = "sha256-H97GZs2wwzfFGiFOgds/5KaweC+luCsWX3hRFf7+Sm4=";
})
## gcc 10.0 and older ##############################################################################
# Probably needed for gnat wrapper https://github.com/NixOS/nixpkgs/pull/62314
++ optional (langAda && (is9 || is10)) ./gnat-cflags.patch
++
# Backport native aarch64-darwin compilation fix from gcc12
# https://github.com/NixOS/nixpkgs/pull/167595
optional
(
is10
&& buildPlatform.system == "aarch64-darwin"
&& (!lib.systems.equals targetPlatform buildPlatform)
)
(fetchpatch {
name = "0008-darwin-aarch64-self-host-driver.patch";
url = "https://github.com/gcc-mirror/gcc/commit/834c8749ced550af3f17ebae4072fb7dfb90d271.diff";
sha256 = "sha256-XtykrPd5h/tsnjY1wGjzSOJ+AyyNLsfnjuOZ5Ryq9vA=";
})
# Fix undefined symbol errors when building older versions with clang
++ optional (
!atLeast11 && stdenv.cc.isClang && stdenv.hostPlatform.isDarwin
) ./clang-genconditions.patch
## gcc 9.0 and older ##############################################################################
++ optional (majorVersion == "9") ./9/fix-struct-redefinition-on-glibc-2.36.patch
# Needed for NetBSD cross comp in older versions
# https://gcc.gnu.org/pipermail/gcc-patches/2020-January/thread.html#537548
# https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=98d56ea8900fdcff8f1987cf2bf499a5b7399857
++ optional (!atLeast10 && targetPlatform.isNetBSD) ./libstdc++-netbsd-ctypes.patch
# Make Darwin bootstrap respect whether the assembler supports `--gstabs`,
# which is not supported by the clang integrated assembler used by default on Darwin.
++ optional (is9 && hostPlatform.isDarwin) ./9/gcc9-darwin-as-gstabs.patch
@@ -1,20 +0,0 @@
This patch fixes interaction with Libtool.
See <http://thread.gmane.org/gmane.comp.gcc.patches/258777>, for details.
--- a/gcc/fortran/gfortranspec.c
+++ b/gcc/fortran/gfortranspec.c
@@ -461,8 +461,15 @@ For more information about these matters, see the file named COPYING\n\n"));
{
fprintf (stderr, _("Driving:"));
for (i = 0; i < g77_newargc; i++)
+ {
+ if (g77_new_decoded_options[i].opt_index == OPT_l)
+ /* Make sure no white space is inserted after `-l'. */
+ fprintf (stderr, " -l%s",
+ g77_new_decoded_options[i].canonical_option[1]);
+ else
fprintf (stderr, " %s",
g77_new_decoded_options[i].orig_option_with_args_text);
+ }
fprintf (stderr, "\n");
}
@@ -1,35 +0,0 @@
diff --git a/gcc/ada/gcc-interface/Makefile.in b/gcc/ada/gcc-interface/Makefile.in
index 4e74252bd74..0d848b5b4e3 100644
--- a/gcc/ada/gcc-interface/Makefile.in
+++ b/gcc/ada/gcc-interface/Makefile.in
@@ -111,7 +111,7 @@ NO_OMIT_ADAFLAGS = -fno-omit-frame-pointer
NO_SIBLING_ADAFLAGS = -fno-optimize-sibling-calls
NO_REORDER_ADAFLAGS = -fno-toplevel-reorder
GNATLIBFLAGS = -W -Wall -gnatpg -nostdinc
-GNATLIBCFLAGS = -g -O2
+GNATLIBCFLAGS = -g -O2 $(CFLAGS_FOR_TARGET)
# Pretend that _Unwind_GetIPInfo is available for the target by default. This
# should be autodetected during the configuration of libada and passed down to
# here, but we need something for --disable-libada and hope for the best.
@@ -198,7 +198,7 @@ RTSDIR = rts$(subst /,_,$(MULTISUBDIR))
# Link flags used to build gnat tools. By default we prefer to statically
# link with libgcc to avoid a dependency on shared libgcc (which is tricky
# to deal with as it may conflict with the libgcc provided by the system).
-GCC_LINK_FLAGS=-static-libstdc++ -static-libgcc
+GCC_LINK_FLAGS=-static-libstdc++ -static-libgcc $(CFLAGS_FOR_TARGET)
# End of variables for you to override.
diff --git a/libada/Makefile.in b/libada/Makefile.in
index 522b9207326..ca866c74471 100644
--- a/libada/Makefile.in
+++ b/libada/Makefile.in
@@ -59,7 +59,7 @@ LDFLAGS=
CFLAGS=-g
PICFLAG = @PICFLAG@
GNATLIBFLAGS= -W -Wall -gnatpg -nostdinc
-GNATLIBCFLAGS= -g -O2
+GNATLIBCFLAGS= -g -O2 $(CFLAGS)
GNATLIBCFLAGS_FOR_C = -W -Wall $(GNATLIBCFLAGS) $(CFLAGS_FOR_TARGET) \
-fexceptions -DIN_RTS @have_getipinfo@ @have_capability@
@@ -1,19 +0,0 @@
--- a/gcc/ada/gcc-interface/Makefile.in 2022-08-19 18:09:52.000000000 +1000
+++ b/gcc/ada/gcc-interface/Makefile.in 2023-01-11 01:54:06.000000000 +1100
@@ -795,14 +795,14 @@
-o libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
$(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS) \
$(SO_OPTS) \
- -Wl,-install_name,@rpath/libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
+ -Wl,-install_name,$(ADA_RTL_DSO_DIR)/libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
$(MISCLIB)
cd $(RTSDIR); `echo "$(GCC_FOR_TARGET)" \
| sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'` -dynamiclib $(PICFLAG_FOR_TARGET) \
-o libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
$(GNATRTL_TASKING_OBJS) \
$(SO_OPTS) \
- -Wl,-install_name,@rpath/libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
+ -Wl,-install_name,$(ADA_RTL_DSO_DIR)/libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
$(THREADSLIB) -Wl,libgnat$(hyphen)$(LIBRARY_VERSION)$(soext)
cd $(RTSDIR); $(LN_S) libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
libgnat$(soext)
@@ -1,119 +0,0 @@
diff --git a/Makefile.in b/Makefile.in
index a375471..83c5ecb 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -804,7 +804,7 @@ BASE_FLAGS_TO_PASS = \
"STAGE1_LANGUAGES=$(STAGE1_LANGUAGES)" \
"GNATBIND=$(GNATBIND)" \
"GNATMAKE=$(GNATMAKE)" \
- "GDC=$(GDC)" \
+ "`echo 'GDC=$(GDC)' | sed -e 's/-idirafter [^ ]*//g'`" \
"GDCFLAGS=$(GDCFLAGS)" \
"AR_FOR_TARGET=$(AR_FOR_TARGET)" \
"AS_FOR_TARGET=$(AS_FOR_TARGET)" \
@@ -817,7 +817,7 @@ BASE_FLAGS_TO_PASS = \
"GFORTRAN_FOR_TARGET=$(GFORTRAN_FOR_TARGET)" \
"GOC_FOR_TARGET=$(GOC_FOR_TARGET)" \
"GOCFLAGS_FOR_TARGET=$(GOCFLAGS_FOR_TARGET)" \
- "GDC_FOR_TARGET=$(GDC_FOR_TARGET)" \
+ "`echo 'GDC_FOR_TARGET=$(GDC_FOR_TARGET)' | sed -e 's/-idirafter [^ ]*//g'`" \
"GDCFLAGS_FOR_TARGET=$(GDCFLAGS_FOR_TARGET)" \
"LD_FOR_TARGET=$(LD_FOR_TARGET)" \
"LIPO_FOR_TARGET=$(LIPO_FOR_TARGET)" \
@@ -890,7 +890,7 @@ EXTRA_HOST_FLAGS = \
'DLLTOOL=$(DLLTOOL)' \
'GFORTRAN=$(GFORTRAN)' \
'GOC=$(GOC)' \
- 'GDC=$(GDC)' \
+ "`echo 'GDC=$(GDC)' | sed -e 's/-idirafter [^ ]*//g'`" \
'LD=$(LD)' \
'LIPO=$(LIPO)' \
'NM=$(NM)' \
@@ -966,8 +966,11 @@ EXTRA_TARGET_FLAGS = \
'STAGE1_LDFLAGS=$$(POSTSTAGE1_LDFLAGS)' \
'STAGE1_LIBS=$$(POSTSTAGE1_LIBS)' \
"TFLAGS=$$TFLAGS"
+EXTRA_TARGET_FLAGS_D = \
+ "`echo $(EXTRA_TARGET_FLAGS) | sed -e 's/-idirafter [^ ]*//g'`"
TARGET_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)
+TARGET_FLAGS_TO_PASS_D = $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS_D)
# Flags to pass down to gcc. gcc builds a library, libgcc.a, so it
# unfortunately needs the native compiler and the target ar and
@@ -47285,7 +47288,7 @@ check-target-libphobos:
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(NORMAL_TARGET_EXPORTS) \
(cd $(TARGET_SUBDIR)/libphobos && \
- $(MAKE) $(TARGET_FLAGS_TO_PASS) check)
+ $(MAKE) $(TARGET_FLAGS_TO_PASS_D) check)
@endif target-libphobos
@@ -47300,7 +47303,7 @@ install-target-libphobos: installdirs
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(NORMAL_TARGET_EXPORTS) \
(cd $(TARGET_SUBDIR)/libphobos && \
- $(MAKE) $(TARGET_FLAGS_TO_PASS) install)
+ $(MAKE) $(TARGET_FLAGS_TO_PASS_D) install)
@endif target-libphobos
@@ -47315,7 +47318,7 @@ install-strip-target-libphobos: installdirs
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(NORMAL_TARGET_EXPORTS) \
(cd $(TARGET_SUBDIR)/libphobos && \
- $(MAKE) $(TARGET_FLAGS_TO_PASS) install-strip)
+ $(MAKE) $(TARGET_FLAGS_TO_PASS_D) install-strip)
@endif target-libphobos
diff --git a/Makefile.tpl b/Makefile.tpl
index 41cae58..b3d32e7 100644
--- a/Makefile.tpl
+++ b/Makefile.tpl
@@ -721,8 +721,11 @@ EXTRA_TARGET_FLAGS = \
'STAGE1_LDFLAGS=$$(POSTSTAGE1_LDFLAGS)' \
'STAGE1_LIBS=$$(POSTSTAGE1_LIBS)' \
"TFLAGS=$$TFLAGS"
+EXTRA_TARGET_FLAGS_D = \
+ "`echo $(EXTRA_TARGET_FLAGS) | sed -e 's/-idirafter [^ ]*//g'`"
TARGET_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)
+TARGET_FLAGS_TO_PASS_D = $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS_D)
# Flags to pass down to gcc. gcc builds a library, libgcc.a, so it
# unfortunately needs the native compiler and the target ar and
diff --git a/libphobos/Makefile.in b/libphobos/Makefile.in
index e894417..2d18dcb 100644
--- a/libphobos/Makefile.in
+++ b/libphobos/Makefile.in
@@ -365,6 +365,7 @@ AM_MAKEFLAGS = \
"LIBCFLAGS=$(LIBCFLAGS)" \
"LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" \
"MAKE=$(MAKE)" \
+ "`echo 'MAKEFLAGS=$(MAKEFLAGS)' | sed -e 's/-j[0-9]+/-j1/'`" \
"MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \
"PICFLAG=$(PICFLAG)" \
"PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" \
@@ -694,6 +695,8 @@ uninstall-am:
.PRECIOUS: Makefile
+.NOTPARALLEL:
+
# GNU Make needs to see an explicit $(MAKE) variable in the command it
# runs to enable its job server during parallel builds. Hence the
# comments below.
diff --git a/libphobos/configure b/libphobos/configure
index b3cb5f3..25adf2b 100755
--- a/libphobos/configure
+++ b/libphobos/configure
@@ -5122,6 +5122,7 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
+GDC=`$as_echo "$GDC" | sed -e 's/-idirafter [^ ]*//g'`
ac_ext=d
ac_compile='$GDC -c $GDCFLAGS conftest.$ac_ext >&5'
@@ -1,141 +0,0 @@
diff --git a/libstdc++-v3/config/os/bsd/netbsd/ctype_base.h b/libstdc++-v3/config/os/bsd/netbsd/ctype_base.h
index ff3ec893974..21eccf9fde1 100644
--- a/libstdc++-v3/config/os/bsd/netbsd/ctype_base.h
+++ b/libstdc++-v3/config/os/bsd/netbsd/ctype_base.h
@@ -38,40 +38,46 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
/// @brief Base class for ctype.
struct ctype_base
{
- // Non-standard typedefs.
- typedef const unsigned char* __to_type;
// NB: Offsets into ctype<char>::_M_table force a particular size
// on the mask type. Because of this, we don't use an enum.
- typedef unsigned char mask;
#ifndef _CTYPE_U
- static const mask upper = _U;
- static const mask lower = _L;
- static const mask alpha = _U | _L;
- static const mask digit = _N;
- static const mask xdigit = _N | _X;
- static const mask space = _S;
- static const mask print = _P | _U | _L | _N | _B;
- static const mask graph = _P | _U | _L | _N;
- static const mask cntrl = _C;
- static const mask punct = _P;
- static const mask alnum = _U | _L | _N;
+ // Non-standard typedefs.
+ typedef const unsigned char* __to_type;
+
+ typedef unsigned char mask;
+
+ static const mask upper = _U;
+ static const mask lower = _L;
+ static const mask alpha = _U | _L;
+ static const mask digit = _N;
+ static const mask xdigit = _N | _X;
+ static const mask space = _S;
+ static const mask print = _P | _U | _L | _N | _B;
+ static const mask graph = _P | _U | _L | _N;
+ static const mask cntrl = _C;
+ static const mask punct = _P;
+ static const mask alnum = _U | _L | _N;
#else
- static const mask upper = _CTYPE_U;
- static const mask lower = _CTYPE_L;
- static const mask alpha = _CTYPE_U | _CTYPE_L;
- static const mask digit = _CTYPE_N;
- static const mask xdigit = _CTYPE_N | _CTYPE_X;
- static const mask space = _CTYPE_S;
- static const mask print = _CTYPE_P | _CTYPE_U | _CTYPE_L | _CTYPE_N | _CTYPE_B;
- static const mask graph = _CTYPE_P | _CTYPE_U | _CTYPE_L | _CTYPE_N;
- static const mask cntrl = _CTYPE_C;
- static const mask punct = _CTYPE_P;
- static const mask alnum = _CTYPE_U | _CTYPE_L | _CTYPE_N;
+ typedef const unsigned short* __to_type;
+
+ typedef unsigned short mask;
+
+ static const mask upper = _CTYPE_U;
+ static const mask lower = _CTYPE_L;
+ static const mask alpha = _CTYPE_A;
+ static const mask digit = _CTYPE_D;
+ static const mask xdigit = _CTYPE_X;
+ static const mask space = _CTYPE_S;
+ static const mask print = _CTYPE_R;
+ static const mask graph = _CTYPE_G;
+ static const mask cntrl = _CTYPE_C;
+ static const mask punct = _CTYPE_P;
+ static const mask alnum = _CTYPE_A | _CTYPE_D;
#endif
#if __cplusplus >= 201103L
- static const mask blank = space;
+ static const mask blank = space;
#endif
};
diff --git a/libstdc++-v3/config/os/bsd/netbsd/ctype_configure_char.cc b/libstdc++-v3/config/os/bsd/netbsd/ctype_configure_char.cc
index ed3b7cd0d6a..33358e8f5d8 100644
--- a/libstdc++-v3/config/os/bsd/netbsd/ctype_configure_char.cc
+++ b/libstdc++-v3/config/os/bsd/netbsd/ctype_configure_char.cc
@@ -38,11 +38,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// Information as gleaned from /usr/include/ctype.h
- extern "C" const u_int8_t _C_ctype_[];
-
const ctype_base::mask*
ctype<char>::classic_table() throw()
- { return _C_ctype_ + 1; }
+ { return _C_ctype_tab_ + 1; }
ctype<char>::ctype(__c_locale, const mask* __table, bool __del,
size_t __refs)
@@ -69,14 +67,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
char
ctype<char>::do_toupper(char __c) const
- { return ::toupper((int) __c); }
+ { return ::toupper((int)(unsigned char) __c); }
const char*
ctype<char>::do_toupper(char* __low, const char* __high) const
{
while (__low < __high)
{
- *__low = ::toupper((int) *__low);
+ *__low = ::toupper((int)(unsigned char) *__low);
++__low;
}
return __high;
@@ -84,14 +82,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
char
ctype<char>::do_tolower(char __c) const
- { return ::tolower((int) __c); }
+ { return ::tolower((int)(unsigned char) __c); }
const char*
ctype<char>::do_tolower(char* __low, const char* __high) const
{
while (__low < __high)
{
- *__low = ::tolower((int) *__low);
+ *__low = ::tolower((int)(unsigned char) *__low);
++__low;
}
return __high;
diff --git a/libstdc++-v3/config/os/bsd/netbsd/ctype_inline.h b/libstdc++-v3/config/os/bsd/netbsd/ctype_inline.h
index ace1120fba2..3234ce17c70 100644
--- a/libstdc++-v3/config/os/bsd/netbsd/ctype_inline.h
+++ b/libstdc++-v3/config/os/bsd/netbsd/ctype_inline.h
@@ -48,7 +48,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
is(const char* __low, const char* __high, mask* __vec) const
{
while (__low < __high)
- *__vec++ = _M_table[*__low++];
+ *__vec++ = _M_table[(unsigned char)*__low++];
return __high;
}
@@ -1,17 +0,0 @@
diff --git a/gcc/config/riscv/riscv.h b/gcc/config/riscv/riscv.h
index 701f5ea1544..8de333caf54 100644
--- a/gcc/config/riscv/riscv.h
+++ b/gcc/config/riscv/riscv.h
@@ -886,11 +886,7 @@ extern unsigned riscv_stack_boundary;
"%{mabi=lp64f:lp64f}" \
"%{mabi=lp64d:lp64d}" \
-#define STARTFILE_PREFIX_SPEC \
- "/lib" XLEN_SPEC "/" ABI_SPEC "/ " \
- "/usr/lib" XLEN_SPEC "/" ABI_SPEC "/ " \
- "/lib/ " \
- "/usr/lib/ "
+#define STARTFILE_PREFIX_SPEC ""
/* ISA constants needed for code generation. */
#define OPCODE_LW 0x2003
@@ -1,12 +0,0 @@
--- a/gcc/config/riscv/linux.h
+++ b/gcc/config/riscv/linux.h
@@ -69,8 +69,4 @@
#define TARGET_ASM_FILE_END file_end_indicate_exec_stack
-#define STARTFILE_PREFIX_SPEC \
- "/lib" XLEN_SPEC "/" ABI_SPEC "/ " \
- "/usr/lib" XLEN_SPEC "/" ABI_SPEC "/ " \
- "/lib/ " \
- "/usr/lib/ "
+#define STARTFILE_PREFIX_SPEC ""
@@ -1,28 +0,0 @@
diff -ru -x '*~' gcc-4.8.3-orig/gcc/cppdefault.c gcc-4.8.3/gcc/cppdefault.c
--- gcc-4.8.3-orig/gcc/cppdefault.c 2013-01-10 21:38:27.000000000 +0100
+++ gcc-4.8.3/gcc/cppdefault.c 2014-08-18 16:20:32.893944536 +0200
@@ -35,6 +35,8 @@
# undef CROSS_INCLUDE_DIR
#endif
+#undef LOCAL_INCLUDE_DIR
+
const struct default_include cpp_include_defaults[]
#ifdef INCLUDE_DEFAULTS
= INCLUDE_DEFAULTS;
diff -ru -x '*~' gcc-4.8.3-orig/gcc/gcc.c gcc-4.8.3/gcc/gcc.c
--- gcc-4.8.3-orig/gcc/gcc.c 2014-03-23 12:30:57.000000000 +0100
+++ gcc-4.8.3/gcc/gcc.c 2014-08-18 13:19:32.689201690 +0200
@@ -1162,10 +1162,10 @@
/* Default prefixes to attach to command names. */
#ifndef STANDARD_STARTFILE_PREFIX_1
-#define STANDARD_STARTFILE_PREFIX_1 "/lib/"
+#define STANDARD_STARTFILE_PREFIX_1 ""
#endif
#ifndef STANDARD_STARTFILE_PREFIX_2
-#define STANDARD_STARTFILE_PREFIX_2 "/usr/lib/"
+#define STANDARD_STARTFILE_PREFIX_2 ""
#endif
#ifdef CROSS_DIRECTORY_STRUCTURE /* Don't use these prefixes for a cross compiler. */
@@ -1,32 +0,0 @@
Hacky work-around for highly parallel builds.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57125
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index aad927c..182f666 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -3908,21 +3908,21 @@ build/gengtype-lex.o: $(BCONFIG_H)
gengtype-parse.o build/gengtype-parse.o : gengtype-parse.c gengtype.h \
$(SYSTEM_H)
-gengtype-parse.o: $(CONFIG_H)
+gengtype-parse.o: $(CONFIG_H) $(BCONFIG_H)
CFLAGS-gengtype-parse.o += -DGENERATOR_FILE
build/gengtype-parse.o: $(BCONFIG_H)
gengtype-state.o build/gengtype-state.o: gengtype-state.c $(SYSTEM_H) \
gengtype.h errors.h double-int.h version.h $(HASHTAB_H) $(OBSTACK_H) \
$(XREGEX_H)
-gengtype-state.o: $(CONFIG_H)
+gengtype-state.o: $(CONFIG_H) $(BCONFIG_H)
CFLAGS-gengtype-state.o += -DGENERATOR_FILE
build/gengtype-state.o: $(BCONFIG_H)
gengtype.o build/gengtype.o : gengtype.c $(SYSTEM_H) gengtype.h \
rtl.def insn-notes.def errors.h double-int.h version.h $(HASHTAB_H) \
$(OBSTACK_H) $(XREGEX_H)
-gengtype.o: $(CONFIG_H)
+gengtype.o: $(CONFIG_H) $(BCONFIG_H)
CFLAGS-gengtype.o += -DGENERATOR_FILE
build/gengtype.o: $(BCONFIG_H)
@@ -1,52 +0,0 @@
https://gcc.gnu.org/ml/gcc-patches/2015-06/msg02210.html
diff --git a/libcpp/macro.c b/libcpp/macro.c
index 1e0a0b5..a52e3cb 100644
--- a/libcpp/macro.c
+++ b/libcpp/macro.c
@@ -349,14 +349,38 @@ _cpp_builtin_macro_text (cpp_reader *pfile, cpp_hashnode *node)
slow on some systems. */
time_t tt;
struct tm *tb = NULL;
+ char *source_date_epoch;
- /* (time_t) -1 is a legitimate value for "number of seconds
- since the Epoch", so we have to do a little dance to
- distinguish that from a genuine error. */
- errno = 0;
- tt = time(NULL);
- if (tt != (time_t)-1 || errno == 0)
- tb = localtime (&tt);
+ /* Allow the date and time to be set externally by an exported
+ environment variable to enable reproducible builds. */
+ source_date_epoch = getenv ("SOURCE_DATE_EPOCH");
+ if (source_date_epoch)
+ {
+ errno = 0;
+ tt = (time_t) strtol (source_date_epoch, NULL, 10);
+ if (errno == 0)
+ {
+ tb = gmtime (&tt);
+ if (tb == NULL)
+ cpp_error (pfile, CPP_DL_ERROR,
+ "SOURCE_DATE_EPOCH=\"%s\" is not a valid date",
+ source_date_epoch);
+ }
+ else
+ cpp_error (pfile, CPP_DL_ERROR,
+ "SOURCE_DATE_EPOCH=\"%s\" is not a valid number",
+ source_date_epoch);
+ }
+ else
+ {
+ /* (time_t) -1 is a legitimate value for "number of seconds
+ since the Epoch", so we have to do a little dance to
+ distinguish that from a genuine error. */
+ errno = 0;
+ tt = time(NULL);
+ if (tt != (time_t)-1 || errno == 0)
+ tb = localtime (&tt);
+ }
if (tb)
{
@@ -3,10 +3,6 @@ let
"15" = "15.2.0";
"14" = "14.3.0";
"13" = "13.4.0";
"12" = "12.4.0";
"11" = "11.5.0";
"10" = "10.5.0";
"9" = "9.5.0";
};
fromMajorMinor = majorMinorVersion: majorMinorToVersionMap."${majorMinorVersion}";
@@ -20,10 +16,6 @@ let
"15.2.0" = "sha256-Q4/ZloJrDIJIWinaA6ctcdbjVBqD7HAt9Ccfb+Al0k4=";
"14.3.0" = "sha256-4Nx3KXYlYxrI5Q+pL//v6Jmk63AlktpcMu8E4ik6yjo=";
"13.4.0" = "sha256-nEzm27BAVo/cVFWIrAPFy8lajb8MeqSQFwhDr7WcqPU=";
"12.4.0" = "sha256-cE9lJgTMvMsUvavzR4yVEciXiLEss7v/3tNzQZFqkXU=";
"11.5.0" = "sha256-puIYaOrVRc+H8MAfhCduS1KB1nIJhZHByJYkHwk2NHg=";
"10.5.0" = "sha256-JRCVQ/30bzl8NHtdi3osflaUpaUczkucbh6opxyjB8E=";
"9.5.0" = "13ygjmd938m0wmy946pxdhz9i1wq7z4w10l6pvidak0xxxj9yxi7";
}
."${version}";
@@ -33,23 +33,6 @@ stdenv.mkDerivation (
url = "https://github.com/alire-project/GNAT-FSF-builds/releases/download/gnat-${finalAttrs.version}/gnat-${stdenv.hostPlatform.system}-${finalAttrs.version}.tar.gz";
in
{
"11" = {
gccVersion = "11.2.0";
alireRevision = "4";
}
// {
x86_64-darwin = {
inherit url;
hash = "sha256-FmBgD20PPQlX/ddhJliCTb/PRmKxe9z7TFPa2/SK4GY=";
upstreamTriplet = "x86_64-apple-darwin19.6.0";
};
x86_64-linux = {
inherit url;
hash = "sha256-8fMBJp6igH+Md5jE4LMubDmC4GLt4A+bZG/Xcz2LAJQ=";
upstreamTriplet = "x86_64-pc-linux-gnu";
};
}
.${stdenv.hostPlatform.system} or throwUnsupportedSystem;
"12" = {
gccVersion = "12.1.0";
alireRevision = "2";
@@ -1,63 +0,0 @@
{
lib,
stdenv,
libgcrypt,
fetchFromGitHub,
ocamlPackages,
perl,
}:
stdenv.mkDerivation {
pname = "obliv-c";
version = "0.0pre20210621";
strictDeps = true;
nativeBuildInputs = [
perl
]
++ (with ocamlPackages; [
ocaml
findlib
ocamlbuild
]);
buildInputs = [ ocamlPackages.num ];
propagatedBuildInputs = [ libgcrypt ];
src = fetchFromGitHub {
owner = "samee";
repo = "obliv-c";
rev = "e02e5c590523ef4dae06e167a7fa00037bb3fdaf";
sha256 = "sha256:02vyr4689f4dmwqqs0q1mrack9h3g8jz3pj8zqiz987dk0r5mz7a";
};
hardeningDisable = [ "fortify" ];
patches = [ ./ignore-complex-float128.patch ];
# https://github.com/samee/obliv-c/issues/76#issuecomment-438958209
env.OCAMLBUILD = "ocamlbuild -package num -ocamlopt 'ocamlopt -dontlink num' -ocamlc 'ocamlc -dontlink num'";
preBuild = ''
patchShebangs .
'';
preInstall = ''
mkdir -p "$out/bin"
cp bin/* "$out/bin"
mkdir -p "$out/share/doc/obliv-c"
cp -r doc/* README* CHANGE* Change* LICEN* TODO* "$out/share/doc/obliv-c"
mkdir -p "$out/share/obliv-c"
cp -r test "$out/share/obliv-c"
mkdir -p "$out/include"
cp src/ext/oblivc/*.h "$out/include"
mkdir -p "$out/lib"
gcc $(ar t _build/libobliv.a | sed -e 's@^@_build/@') --shared -o _build/libobliv.so
cp _build/lib*.a _build/lib*.so* "$out/lib"
'';
meta = {
description = "GCC wrapper that makes it easy to embed secure computation protocols inside regular C programs";
license = lib.licenses.bsd3;
maintainers = [ lib.maintainers.raskin ];
platforms = lib.platforms.linux;
};
}
@@ -1,37 +0,0 @@
--- a/src/frontc/clexer.mll
+++ b/src/frontc/clexer.mll
@@ -134,9 +134,11 @@ let init_lexicon _ =
(* WW: see /usr/include/sys/cdefs.h for why __signed and __volatile
* are accepted GCC-isms *)
("_Bool", fun loc -> BOOL loc);
+ ("_Complex", fun loc -> COMPLEX loc);
("char", fun loc -> CHAR loc);
("int", fun loc -> INT loc);
("float", fun loc -> FLOAT loc);
+ ("__float128", fun loc -> FLOAT128 loc);
("double", fun loc -> DOUBLE loc);
("void", fun loc -> VOID loc);
("enum", fun loc -> ENUM loc);
--- a/src/frontc/cparser.mly
+++ b/src/frontc/cparser.mly
@@ -269,6 +269,8 @@ let oblivState (s:statement): statement =
%token<Cabs.cabsloc> VOLATILE EXTERN STATIC CONST RESTRICT AUTO REGISTER FROZEN
%token<Cabs.cabsloc> THREAD
+%token<Cabs.cabsloc> COMPLEX FLOAT128
+
%token<Cabs.cabsloc> SIZEOF ALIGNOF
%token EQ PLUS_EQ MINUS_EQ STAR_EQ SLASH_EQ PERCENT_EQ
@@ -1002,7 +1004,11 @@ type_spec: /* ISO 6.7.2 */
| LONG { Tlong, $1 }
| INT64 { Tint64, $1 }
| FLOAT { Tfloat, $1 }
+| FLOAT128 { Tfloat, $1 }
| DOUBLE { Tdouble, $1 }
+| COMPLEX FLOAT { Tfloat, $2 }
+| COMPLEX FLOAT128{ Tfloat, $2 }
+| COMPLEX DOUBLE { Tdouble, $2 }
| SIGNED { Tsigned, $1 }
| UNSIGNED { Tunsigned, $1 }
| STRUCT id_or_typename
@@ -18,7 +18,6 @@
packaging,
# tests
arangodb,
mock,
}:
@@ -61,11 +60,16 @@ buildPythonPackage rec {
];
nativeCheckInputs = [
arangodb
#arangodb
mock
pytestCheckHook
];
# ArangoDB has been removed from Nixpkgs due to lack of maintenace,
# so we cannot run the tests at present.
#
# Before that, the issue was:
#
# arangodb is compiled only for particular target architectures
# (i.e. "haswell"). Thus, these tests may not pass reproducibly,
# failing with: `166: Illegal instruction` if not run on arangodb's
@@ -76,27 +80,27 @@ buildPythonPackage rec {
# architecture issues will be irrelevant.
doCheck = false;
preCheck = lib.optionalString doCheck ''
# Start test DB
mkdir -p .nix-test/{data,work}
ICU_DATA=${arangodb}/share/arangodb3 \
GLIBCXX_FORCE_NEW=1 \
TZ=UTC \
TZ_DATA=${arangodb}/share/arangodb3/tzdata \
ARANGO_ROOT_PASSWORD=${testDBOpts.password} \
${arangodb}/bin/arangod \
--server.uid=$(id -u) \
--server.gid=$(id -g) \
--server.authentication=true \
--server.endpoint=http+tcp://${testDBOpts.host}:${testDBOpts.port} \
--server.descriptors-minimum=4096 \
--server.jwt-secret=${testDBOpts.secret} \
--javascript.app-path=.nix-test/app \
--log.file=.nix-test/log \
--database.directory=.nix-test/data \
--foxx.api=false &
'';
#preCheck = lib.optionalString doCheck ''
# # Start test DB
# mkdir -p .nix-test/{data,work}
#
# ICU_DATA=${arangodb}/share/arangodb3 \
# GLIBCXX_FORCE_NEW=1 \
# TZ=UTC \
# TZ_DATA=${arangodb}/share/arangodb3/tzdata \
# ARANGO_ROOT_PASSWORD=${testDBOpts.password} \
# ${arangodb}/bin/arangod \
# --server.uid=$(id -u) \
# --server.gid=$(id -g) \
# --server.authentication=true \
# --server.endpoint=http+tcp://${testDBOpts.host}:${testDBOpts.port} \
# --server.descriptors-minimum=4096 \
# --server.jwt-secret=${testDBOpts.secret} \
# --javascript.app-path=.nix-test/app \
# --log.file=.nix-test/log \
# --database.directory=.nix-test/data \
# --foxx.api=false &
#'';
pytestFlags = [
"--host=${testDBOpts.host}"
+27 -4
View File
@@ -459,6 +459,7 @@ mapAliases {
apple-sdk_10_14 = throw "apple-sdk_10_14 was removed as Nixpkgs no longer supprots macOS 10.14; see the 25.05 release notes"; # Added 2024-10-27
apple-sdk_10_15 = throw "apple-sdk_10_15 was removed as Nixpkgs no longer supports macOS 10.15; see the 25.05 release notes"; # Added 2024-10-27
appthreat-depscan = dep-scan; # Added 2024-04-10
arangodb = throw "arangodb has been removed, as it was unmaintained and the packaged version does not build with supported GCC versions"; # Added 2025-08-12
arb = throw "'arb' has been removed as it has been merged into 'flint3'"; # Added 2025-03-28
arcanist = throw "arcanist was removed as phabricator is not supported and does not accept fixes"; # Added 2024-06-07
archipelago-minecraft = throw "archipelago-minecraft has been removed, as upstream no longer ships minecraft as a default APWorld."; # Added 2025-07-15
@@ -625,6 +626,7 @@ mapAliases {
code-browser-gtk2 = throw "'code-browser-gtk2' has been removed, as it was broken since 22.11"; # Added 2025-08-22
code-browser-qt = throw "'code-browser-qt' has been removed, as it was broken since 22.11"; # Added 2025-08-22
collada-dom = opencollada; # added 2024-02-21
collada2gltf = throw "collada2gltf has been removed from Nixpkgs, as it has been unmaintained upstream for 5 years and does not build with supported GCC versions"; # Addd 2025-08-08
colloid-kde = throw "'colloid-kde' has been removed, as it is only compatible with Plasma 5, which is EOL"; # Added 2025-08-20
colorpicker = throw "'colorpicker' has been removed due to lack of maintenance upstream. Consider using 'xcolor', 'gcolor3', 'eyedropper' or 'gpick' instead"; # Added 2024-10-19
colorstorm = throw "'colorstorm' has been removed because it was unmaintained in nixpkgs and upstream was rewritten."; # Added 2025-06-15
@@ -946,8 +948,15 @@ mapAliases {
gcc7Stdenv = throw "gcc7Stdenv has been removed from Nixpkgs, as it is unmaintained and obsolete"; # Added 2024-11-20
gcc8 = throw "gcc8 has been removed from Nixpkgs, as it is unmaintained and obsolete"; # Added 2024-11-20
gcc8Stdenv = throw "gcc8Stdenv has been removed from Nixpkgs, as it is unmaintained and obsolete"; # Added 2024-11-20
gcc10StdenvCompat =
if stdenv.cc.isGNU && lib.versionAtLeast stdenv.cc.version "11" then gcc10Stdenv else stdenv; # Added 2024-03-21
gcc9 = throw "gcc9 has been removed from Nixpkgs, as it is unmaintained and obsolete"; # Added 2025-08-08
gcc9Stdenv = throw "gcc9Stdenv has been removed from Nixpkgs, as it is unmaintained and obsolete"; # Added 2025-08-08
gcc10 = throw "gcc10 has been removed from Nixpkgs, as it is unmaintained and obsolete"; # Added 2025-08-08
gcc10Stdenv = throw "gcc10Stdenv has been removed from Nixpkgs, as it is unmaintained and obsolete"; # Added 2025-08-08
gcc10StdenvCompat = throw "gcc10StdenvCompat has been removed from Nixpkgs, as it is unmaintained and obsolete"; # Added 2025-08-08
gcc11 = throw "gcc11 has been removed from Nixpkgs, as it is unmaintained and obsolete"; # Added 2025-08-08
gcc11Stdenv = throw "gcc11Stdenv has been removed from Nixpkgs, as it is unmaintained and obsolete"; # Added 2025-08-08
gcc12 = throw "gcc12 has been removed from Nixpkgs, as it is unmaintained and obsolete"; # Added 2025-08-08
gcc12Stdenv = throw "gcc12Stdenv has been removed from Nixpkgs, as it is unmaintained and obsolete"; # Added 2025-08-08
gcc-arm-embedded-6 = throw "gcc-arm-embedded-6 has been removed from Nixpkgs as it is unmaintained and obsolete"; # Added 2025-04-12
gcc-arm-embedded-7 = throw "gcc-arm-embedded-7 has been removed from Nixpkgs as it is unmaintained and obsolete"; # Added 2025-04-12
gcc-arm-embedded-8 = throw "gcc-arm-embedded-8 has been removed from Nixpkgs as it is unmaintained and obsolete"; # Added 2025-04-12
@@ -955,9 +964,13 @@ mapAliases {
gcc-arm-embedded-10 = throw "gcc-arm-embedded-10 has been removed from Nixpkgs as it is unmaintained and obsolete"; # Added 2025-04-12
gcc-arm-embedded-11 = throw "gcc-arm-embedded-11 has been removed from Nixpkgs as it is unmaintained and obsolete"; # Added 2025-04-12
gcc-arm-embedded-12 = throw "gcc-arm-embedded-12 has been removed from Nixpkgs as it is unmaintained and obsolete"; # Added 2025-04-12
gccgo12 = throw "gccgo12 has been removed from Nixpkgs, as it is unmaintained and obsolete"; # Added 2025-08-08
gcj = gcj6; # Added 2024-09-13
gcj6 = throw "gcj6 has been removed from Nixpkgs, as it is unmaintained and obsolete"; # Added 2024-09-13
gcolor2 = throw "'gcolor2' has been removed due to lack of maintenance upstream and depending on gtk2. Consider using 'gcolor3' or 'eyedropper' instead"; # Added 2024-09-15
gdc = throw "gdc has been removed from Nixpkgs, as recent versions require complex bootstrapping"; # Added 2025-08-08
gdc11 = throw "gdc11 has been removed from Nixpkgs, as it is unmaintained and obsolete"; # Added 2025-08-08
gdmd = throw "gdmd has been removed from Nixpkgs, as it depends on GDC which was removed"; # Added 2025-08-08
gdome2 = throw "'gdome2' has been removed from nixpkgs, as it is umaintained and obsolete"; # Added 2024-12-29
geocode-glib = throw "throw 'geocode-glib' has been removed, as it was unused and used outdated libraries"; # Added 2025-04-16
geos_3_11 = throw "geos_3_11 has been removed from nixpgks. Please use a more recent 'geos' instead.";
@@ -966,6 +979,10 @@ mapAliases {
gfortran49 = throw "'gfortran49' has been removed from nixpkgs"; # Added 2024-09-11
gfortran7 = throw "gfortran7 has been removed from Nixpkgs, as it is unmaintained and obsolete"; # Added 2024-11-20
gfortran8 = throw "gfortran8 has been removed from Nixpkgs, as it is unmaintained and obsolete"; # Added 2024-11-20
gfortran9 = throw "gfortran9 has been removed from Nixpkgs, as it is unmaintained and obsolete"; # Added 2025-08-08
gfortran10 = throw "gfortran10 has been removed from Nixpkgs, as it is unmaintained and obsolete"; # Added 2025-08-08
gfortran11 = throw "gfortran11 has been removed from Nixpkgs, as it is unmaintained and obsolete"; # Added 2025-08-08
gfortran12 = throw "gfortran12 has been removed from Nixpkgs, as it is unmaintained and obsolete"; # Added 2025-08-08
gg = go-graft; # Added 2025-03-07
ggobi = throw "'ggobi' has been removed from Nixpkgs, as it is unmaintained and broken"; # Added 2025-05-18
ghostwriter = makePlasma5Throw "ghostwriter"; # Added 2023-03-18
@@ -1013,8 +1030,13 @@ mapAliases {
gmailieer = throw "'gmailieer' has been renamed to/replaced by 'lieer'"; # Converted to throw 2024-10-17
gmnisrv = throw "'gmnisrv' has been removed due to lack of maintenance upstream"; # Added 2025-06-07
gmp4 = throw "'gmp4' is end-of-life, consider using 'gmp' instead"; # Added 2024-12-24
gnatboot11 = gnat-bootstrap11;
gnatboot12 = gnat-bootstrap12;
gnat11 = throw "gnat11 has been removed from Nixpkgs, as it is unmaintained and obsolete"; # Added 2025-08-08
gnat-bootstrap11 = throw "gnat-bootstrap11 has been removed from Nixpkgs, as it is unmaintained and obsolete"; # Added 2025-08-08
gnatboot11 = throw "gnatboot11 has been removed from Nixpkgs, as it is unmaintained and obsolete"; # Added 2025-08-08
gnat12 = throw "gnat12 has been removed from Nixpkgs, as it is unmaintained and obsolete"; # Added 2025-08-08
gnat-bootstrap12 = throw "gnat-bootstrap12 has been removed from Nixpkgs, as it is unmaintained and obsolete"; # Added 2025-08-08
gnatboot12 = throw "gnatboot12 has been removed from Nixpkgs, as it is unmaintained and obsolete"; # Added 2025-08-08
gnat12Packages = throw "gnat12Packages has been removed from Nixpkgs, as it is unmaintained and obsolete"; # Added 2025-08-08
gnatboot = gnat-bootstrap;
gnatcoll-core = gnatPackages.gnatcoll-core; # Added 2024-02-25
gnatcoll-gmp = gnatPackages.gnatcoll-gmp; # Added 2024-02-25
@@ -1670,6 +1692,7 @@ mapAliases {
o = orbiton; # Added 2023-04-09
oathToolkit = oath-toolkit; # Added 2022-04-04
oauth2_proxy = throw "'oauth2_proxy' has been renamed to/replaced by 'oauth2-proxy'"; # Converted to throw 2024-10-17
obliv-c = throw "obliv-c has been removed from Nixpkgs, as it has been unmaintained upstream for 4 years and does not build with supported GCC versions"; # Added 2025-08-18
ocis-bin = throw "ocis-bin has been renamed to ocis_5-bin'. Future major.minor versions will be made available as separate packages"; # Added 2025-03-30
odoo15 = throw "odoo15 has been removed from nixpkgs as it is unsupported; migrate to a newer version of odoo"; # Added 2025-05-06
offrss = throw "offrss has been removed due to lack of upstream maintenance; consider using another rss reader"; # Added 2025-06-01
+1 -113
View File
@@ -4861,10 +4861,6 @@ with pkgs;
extraBuildInputs = lib.optional stdenv.hostPlatform.isDarwin clang.cc;
};
gcc9Stdenv = overrideCC gccStdenv buildPackages.gcc9;
gcc10Stdenv = overrideCC gccStdenv buildPackages.gcc10;
gcc11Stdenv = overrideCC gccStdenv buildPackages.gcc11;
gcc12Stdenv = overrideCC gccStdenv buildPackages.gcc12;
gcc13Stdenv = overrideCC gccStdenv buildPackages.gcc13;
gcc14Stdenv = overrideCC gccStdenv buildPackages.gcc14;
gcc15Stdenv = overrideCC gccStdenv buildPackages.gcc15;
@@ -4966,10 +4962,6 @@ with pkgs;
});
inherit (callPackage ../development/compilers/gcc/all.nix { inherit noSysDirs; })
gcc9
gcc10
gcc11
gcc12
gcc13
gcc14
gcc15
@@ -4989,62 +4981,6 @@ with pkgs;
gnat = gnat13; # When changing this, update also gnatPackages
gnat11 = wrapCC (
gcc11.cc.override {
name = "gnat";
langC = true;
langCC = false;
langAda = true;
profiledCompiler = false;
# As per upstream instructions building a cross compiler
# should be done with a (native) compiler of the same version.
# If we are cross-compiling GNAT, we may as well do the same.
gnat-bootstrap =
if stdenv.hostPlatform == stdenv.targetPlatform && stdenv.buildPlatform == stdenv.hostPlatform then
buildPackages.gnat-bootstrap11
else
buildPackages.gnat11;
stdenv =
if
stdenv.hostPlatform == stdenv.targetPlatform
&& stdenv.buildPlatform == stdenv.hostPlatform
&& stdenv.buildPlatform.isDarwin
&& stdenv.buildPlatform.isx86_64
then
overrideCC stdenv gnat-bootstrap11
else
stdenv;
}
);
gnat12 = wrapCC (
gcc12.cc.override {
name = "gnat";
langC = true;
langCC = false;
langAda = true;
profiledCompiler = false;
# As per upstream instructions building a cross compiler
# should be done with a (native) compiler of the same version.
# If we are cross-compiling GNAT, we may as well do the same.
gnat-bootstrap =
if stdenv.hostPlatform == stdenv.targetPlatform && stdenv.buildPlatform == stdenv.hostPlatform then
buildPackages.gnat-bootstrap12
else
buildPackages.gnat12;
stdenv =
if
stdenv.hostPlatform == stdenv.targetPlatform
&& stdenv.buildPlatform == stdenv.hostPlatform
&& stdenv.buildPlatform.isDarwin
&& stdenv.buildPlatform.isx86_64
then
overrideCC stdenv gnat-bootstrap12
else
stdenv;
}
);
gnat13 = wrapCC (
gcc13.cc.override {
name = "gnat";
@@ -5129,18 +5065,7 @@ with pkgs;
}
);
gnat-bootstrap = gnat-bootstrap12;
gnat-bootstrap11 = wrapCC (
callPackage ../development/compilers/gnat-bootstrap { majorVersion = "11"; }
);
gnat-bootstrap12 = wrapCCWith (
{
cc = callPackage ../development/compilers/gnat-bootstrap { majorVersion = "12"; };
}
// lib.optionalAttrs (stdenv.hostPlatform.isDarwin) {
bintools = bintoolsDualAs;
}
);
gnat-bootstrap = gnat-bootstrap13;
gnat-bootstrap13 = wrapCCWith (
{
cc = callPackage ../development/compilers/gnat-bootstrap { majorVersion = "13"; };
@@ -5158,7 +5083,6 @@ with pkgs;
}
);
gnat12Packages = recurseIntoAttrs (callPackage ./ada-packages.nix { gnat = buildPackages.gnat12; });
gnat13Packages = recurseIntoAttrs (callPackage ./ada-packages.nix { gnat = buildPackages.gnat13; });
gnat14Packages = recurseIntoAttrs (callPackage ./ada-packages.nix { gnat = buildPackages.gnat14; });
gnat15Packages = recurseIntoAttrs (callPackage ./ada-packages.nix { gnat = buildPackages.gnat15; });
@@ -5184,21 +5108,6 @@ with pkgs;
}
);
gccgo12 = wrapCC (
gcc12.cc.override {
name = "gccgo";
langCC = true; # required for go.
langC = true;
langGo = true;
langJit = true;
profiledCompiler = false;
}
// {
# not supported on darwin: https://github.com/golang/go/issues/463
meta.broken = stdenv.hostPlatform.isDarwin;
}
);
gccgo13 = wrapCC (
gcc13.cc.override {
name = "gccgo";
@@ -5255,19 +5164,6 @@ with pkgs;
gcc-arm-embedded = gcc-arm-embedded-14;
# It would be better to match the default gcc so that there are no linking errors
# when using C/C++ libraries in D packages, but right now versions >= 12 are broken.
gdc = gdc11;
gdc11 = wrapCC (
gcc11.cc.override {
name = "gdc";
langCC = false;
langC = false;
langD = true;
profiledCompiler = false;
}
);
# Haskell and GHC
haskell = callPackage ./haskell-packages.nix { };
@@ -5706,11 +5602,6 @@ with pkgs;
enableGui = true;
};
obliv-c = callPackage ../development/compilers/obliv-c {
stdenv = gcc10Stdenv;
ocamlPackages = ocaml-ng.ocamlPackages_4_14;
};
ocaml-ng = callPackage ./ocaml-packages.nix { };
ocaml = ocamlPackages.ocaml;
@@ -5933,7 +5824,6 @@ with pkgs;
libcxx
extraPackages
nixSupport
zlib
;
}
// extraArgs;
@@ -10714,8 +10604,6 @@ with pkgs;
# hardened kernels
linuxPackages_hardened = linuxKernel.packages.linux_hardened;
linux_hardened = linuxPackages_hardened.kernel;
linuxPackages_5_4_hardened = linuxKernel.packages.linux_5_4_hardened;
linux_5_4_hardened = linuxKernel.kernels.linux_5_4_hardened;
linuxPackages_5_10_hardened = linuxKernel.packages.linux_5_10_hardened;
linux_5_10_hardened = linuxKernel.kernels.linux_5_10_hardened;
linuxPackages_5_15_hardened = linuxKernel.packages.linux_5_15_hardened;
+2 -10
View File
@@ -12,7 +12,6 @@
newScope,
lib,
fetchurl,
gcc10Stdenv,
}:
# When adding a kernel:
@@ -297,14 +296,6 @@ in
linux_hardened = hardenedKernelFor packageAliases.linux_default.kernel { };
linux_5_4_hardened = markBroken (
hardenedKernelFor kernels.linux_5_4 {
stdenv = gcc10Stdenv;
buildPackages = buildPackages // {
stdenv = buildPackages.gcc10Stdenv;
};
}
);
linux_5_10_hardened = hardenedKernelFor kernels.linux_5_10 { };
linux_5_15_hardened = hardenedKernelFor kernels.linux_5_15 { };
linux_6_1_hardened = hardenedKernelFor kernels.linux_6_1 { };
@@ -321,6 +312,7 @@ in
linux_6_14 = throw "linux 6.14 was removed because it has reached its end of life upstream";
linux_4_19_hardened = throw "linux 4.19 was removed because it will reach its end of life within 24.11";
linux_5_4_hardened = throw "linux_5_4_hardened was removed because it was broken";
linux_6_9_hardened = throw "linux 6.9 was removed because it has reached its end of life upstream";
linux_6_10_hardened = throw "linux 6.10 was removed because it has reached its end of life upstream";
linux_6_11_hardened = throw "linux 6.11 was removed because it has reached its end of life upstream";
@@ -779,7 +771,6 @@ in
linux_hardened = recurseIntoAttrs (packagesFor kernels.linux_hardened);
linux_5_4_hardened = recurseIntoAttrs (packagesFor kernels.linux_5_4_hardened);
linux_5_10_hardened = recurseIntoAttrs (packagesFor kernels.linux_5_10_hardened);
linux_5_15_hardened = recurseIntoAttrs (packagesFor kernels.linux_5_15_hardened);
linux_6_1_hardened = recurseIntoAttrs (packagesFor kernels.linux_6_1_hardened);
@@ -799,6 +790,7 @@ in
}
// lib.optionalAttrs config.allowAliases {
linux_4_19_hardened = throw "linux 4.19 was removed because it will reach its end of life within 24.11";
linux_5_4_hardened = throw "linux_5_4_hardened was removed because it was broken";
linux_6_9_hardened = throw "linux 6.9 was removed because it has reached its end of life upstream";
linux_6_10_hardened = throw "linux 6.10 was removed because it has reached its end of life upstream";
linux_6_11_hardened = throw "linux 6.11 was removed because it has reached its end of life upstream";
+1 -1
View File
@@ -17941,7 +17941,7 @@ self: super: with self; {
#
# We use the nixpkgs' default libstdc++ to stay compatible with other
# python modules
stdenv = pkgs.stdenvAdapters.useLibsFrom stdenv pkgs.gcc12Stdenv;
#stdenv = pkgs.stdenvAdapters.useLibsFrom stdenv pkgs.gcc12Stdenv;
};
tensorflow-datasets = callPackage ../development/python-modules/tensorflow-datasets { };