Fix: mingw ld error

This commit is contained in:
zijiren233 2024-01-11 16:02:18 +08:00
parent a07b9afb92
commit 1aefb41dad
5 changed files with 115 additions and 89 deletions

View File

@ -1,4 +1,3 @@
SOURCES = sources
CONFIG_SUB_REV = 3d5db9ebe860
@ -19,8 +18,10 @@ GMP_SITE = $(GNU_SITE)/gmp
MPC_SITE = $(GNU_SITE)/mpc
MPFR_SITE = $(GNU_SITE)/mpfr
# ISL_SITE = https://libisl.sourceforge.io
ISL_SITE = https://downloads.sourceforge.net/project/libisl/
# SOURCEFORGE_MIRROT = https://downloads.sourceforge.net
SOURCEFORGE_MIRROT = https://jaist.dl.sourceforge.net
ISL_SITE = $(SOURCEFORGE_MIRROT)/project/libisl
GCC_SNAP = https://sourceware.org/pub/gcc/snapshots
MUSL_SITE = https://musl.libc.org/releases
@ -28,9 +29,9 @@ MUSL_SITE = https://musl.libc.org/releases
MUSL_REPO = git://git.musl-libc.org/musl
LINUX_SITE = https://cdn.kernel.org/pub/linux/kernel
LINUX_HEADERS_SITE = https://ftp.barfooze.de/pub/sabotage/tarballs/
LINUX_HEADERS_SITE = https://ftp.barfooze.de/pub/sabotage/tarballs
MINGW_SITE = https://sourceforge.net/projects/mingw-w64/files/mingw-w64/mingw-w64-release/
MINGW_SITE = $(SOURCEFORGE_MIRROT)/project/mingw-w64/mingw-w64/mingw-w64-release
DL_CMD = curl -sLo
SHA1_CMD = sha1sum -c

View File

@ -22,81 +22,95 @@
set -e
echo () { printf "%s\n" "$*" ; }
echo() { printf "%s\n" "$*"; }
cow () {
test -h "$1" || return 0
if test -d "$1" ; then
case "$1" in
*/*) set -- "${1%/*}/" "${1##*/}" ;;
*) set -- "" "$1" ;;
esac
mkdir "$1$2.tmp.$$"
mv "$1$2" "$1.$2.orig"
mv "$1$2.tmp.$$" "$1$2"
( cd "$1$2" && ln -s ../".$2.orig"/* . )
else
cp "$1" "$1.tmp.$$"
mv "$1.tmp.$$" "$1"
fi
cow() {
test -h "$1" || return 0
if test -d "$1"; then
case "$1" in
*/*) set -- "${1%/*}/" "${1##*/}" ;;
*) set -- "" "$1" ;;
esac
mkdir "$1$2.tmp.$$"
mv "$1$2" "$1.$2.orig"
mv "$1$2.tmp.$$" "$1$2"
(cd "$1$2" && ln -s ../".$2.orig"/* .)
else
cp "$1" "$1.tmp.$$"
mv "$1.tmp.$$" "$1"
fi
}
cowp () {
while test "$1" ; do
case "$1" in
*/*) set -- "${1#*/}" "$2${2:+/}${1%%/*}" ;;
*) set -- "" "$2${2:+/}$1" ;;
esac
cow "$2"
done
cowp() {
while test "$1"; do
case "$1" in
*/*) set -- "${1#*/}" "$2${2:+/}${1%%/*}" ;;
*) set -- "" "$2${2:+/}$1" ;;
esac
cow "$2"
done
}
cowpatch () {
cowpatch() {
plev=0
OPTIND=1
while getopts ":p:i:RNE" opt ; do
test "$opt" = p && plev="$OPTARG"
done
plev=0
OPTIND=1
while getopts ":p:i:RNE" opt; do
test "$opt" = p && plev="$OPTARG"
done
while IFS= read -r l ; do
case "$l" in
+++*)
IFS=" " read -r junk pfile junk <<EOF
while IFS= read -r l; do
case "$l" in
+++*)
IFS=" " read -r junk pfile junk <<EOF
$l
EOF
i=0; while test "$i" -lt "$plev" ; do pfile=${pfile#*/}; i=$((i+1)) ; done
cowp "$pfile"
echo "$l"
;;
@@*)
echo "$l"
IFS=" " read -r junk i j junk <<EOF
i=0
while test "$i" -lt "$plev"; do
pfile=${pfile#*/}
i=$((i + 1))
done
cowp "$pfile"
echo "$l"
;;
@@*)
echo "$l"
IFS=" " read -r junk i j junk <<EOF
$l
EOF
case "$i" in *,*) i=${i#*,} ;; *) i=1 ;; esac
case "$j" in *,*) j=${j#*,} ;; *) j=1 ;; esac
while test $i -gt 0 || test $j -gt 0 ; do
IFS= read -r l
echo "$l"
case "$l" in
+*) j=$((j-1)) ;;
-*) i=$((i-1)) ;;
*) i=$((i-1)) ; j=$((j-1)) ;;
esac
done ;;
*) echo "$l" ;;
esac
done
case "$i" in *,*) i=${i#*,} ;; *) i=1 ;; esac
case "$j" in *,*) j=${j#*,} ;; *) j=1 ;; esac
while test $i -gt 0 || test $j -gt 0; do
IFS= read -r l
echo "$l"
case "$l" in
+*) j=$((j - 1)) ;;
-*) i=$((i - 1)) ;;
*)
i=$((i - 1))
j=$((j - 1))
;;
esac
done
;;
*) echo "$l" ;;
esac
done
}
gotcmd=0
while getopts ":p:i:RNEI:S:" opt ; do
case "$opt" in
I) find "$OPTARG" -path "$OPTARG/*" -prune -exec sh -c 'ln -sf "$@" .' sh {} + ; gotcmd=1 ;;
S) cowp "$OPTARG" ; gotcmd=1 ;;
esac
while getopts ":p:i:RNEI:S:" opt; do
case "$opt" in
I)
find "$OPTARG" -path "$OPTARG/*" -prune -exec sh -c 'ln -sf "$@" .' sh {} +
gotcmd=1
;;
S)
cowp "$OPTARG"
gotcmd=1
;;
esac
done
test "$gotcmd" -eq 0 || exit 0

View File

@ -105,6 +105,31 @@ FULL_BINUTILS_CONFIG = \
--with-sysroot=$(SYSROOT) \
--enable-deterministic-archives
ifneq ($(findstring mingw,$(TARGET)),)
FULL_GCC_CONFIG = --enable-languages=c,c++,fortran \
$(GCC_CONFIG_FOR_TARGET) \
$(COMMON_CONFIG) $(GCC_CONFIG) $(TOOLCHAIN_CONFIG) \
--disable-bootstrap \
--disable-assembly \
--disable-werror \
--target=$(TARGET) --prefix= \
--libdir=/lib --disable-multilib \
--with-sysroot=$(SYSROOT) \
--enable-fully-dynamic-string \
--enable-libstdcxx-time=yes \
--enable-libstdcxx-filesystem-ts=yes \
--enable-cloog-backend=isl \
--disable-sjlj-exceptions \
--disable-multilib \
--with-dwarf2 \
--enable-deterministic-archives \
--enable-libstdcxx-time \
--enable-libquadmath --enable-libquadmath-support \
--disable-decimal-float \
$(OVERRIDE)
endif
ifneq ($(findstring musl,$(TARGET)),)
FULL_GCC_CONFIG = --enable-languages=c,c++,fortran \
$(GCC_CONFIG_FOR_TARGET) \
$(COMMON_CONFIG) $(GCC_CONFIG) $(TOOLCHAIN_CONFIG) \
@ -125,28 +150,7 @@ FULL_GCC_CONFIG = --enable-languages=c,c++,fortran \
--enable-libquadmath --enable-libquadmath-support \
--disable-decimal-float \
$(OVERRIDE)
# FULL_GCC_CONFIG = --enable-languages=c,c++,fortran \
# $(GCC_CONFIG_FOR_TARGET) \
# $(COMMON_CONFIG) $(GCC_CONFIG) $(TOOLCHAIN_CONFIG) \
# --disable-bootstrap \
# --disable-assembly \
# --disable-werror \
# --target=$(TARGET) --prefix= \
# --libdir=/lib --disable-multilib \
# --with-sysroot=$(SYSROOT) \
# --enable-fully-dynamic-string \
# --enable-libstdcxx-time=yes \
# --enable-libstdcxx-filesystem-ts=yes \
# --enable-cloog-backend=isl \
# --disable-sjlj-exceptions \
# --disable-multilib \
# --with-dwarf2 \
# --enable-deterministic-archives \
# --enable-libstdcxx-time \
# --enable-libquadmath --enable-libquadmath-support \
# --disable-decimal-float \
# $(OVERRIDE)
endif
FULL_MUSL_CONFIG = $(MUSL_CONFIG) \
--prefix= --host=$(TARGET)

View File

@ -56,6 +56,7 @@ function Build() {
MPFR_VER="4.2.1" \
ISL_VER="" \
LINUX_VER="" \
MINGW_VER="v11.0.1" \
'COMMON_CONFIG+=CFLAGS="-g0 -Os" CXXFLAGS="-g0 -Os" LDFLAGS="-s"' \
'BINUTILS_CONFIG+=--enable-compressed-debug-sections=none' \
install
@ -107,7 +108,10 @@ powerpcle-linux-muslsf
riscv64-linux-musl
s390x-linux-musl
x86_64-linux-musl
x86_64-linux-muslx32'
x86_64-linux-muslx32
i486-w64-mingw32
i686-w64-mingw32
x86_64-w64-mingw32'
function BuildAll() {
if [ "$TARGETS_FILE" ]; then

View File

@ -48,3 +48,6 @@ sh4-linux-musl
sh4eb-linux-musl
x86_64-linux-musl
x86_64-linux-muslx32
i486-w64-mingw32
i686-w64-mingw32
x86_64-w64-mingw32