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 SOURCES = sources
CONFIG_SUB_REV = 3d5db9ebe860 CONFIG_SUB_REV = 3d5db9ebe860
@ -19,8 +18,10 @@ GMP_SITE = $(GNU_SITE)/gmp
MPC_SITE = $(GNU_SITE)/mpc MPC_SITE = $(GNU_SITE)/mpc
MPFR_SITE = $(GNU_SITE)/mpfr MPFR_SITE = $(GNU_SITE)/mpfr
# ISL_SITE = https://libisl.sourceforge.io # SOURCEFORGE_MIRROT = https://downloads.sourceforge.net
ISL_SITE = https://downloads.sourceforge.net/project/libisl/ SOURCEFORGE_MIRROT = https://jaist.dl.sourceforge.net
ISL_SITE = $(SOURCEFORGE_MIRROT)/project/libisl
GCC_SNAP = https://sourceware.org/pub/gcc/snapshots GCC_SNAP = https://sourceware.org/pub/gcc/snapshots
MUSL_SITE = https://musl.libc.org/releases 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 MUSL_REPO = git://git.musl-libc.org/musl
LINUX_SITE = https://cdn.kernel.org/pub/linux/kernel 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 DL_CMD = curl -sLo
SHA1_CMD = sha1sum -c SHA1_CMD = sha1sum -c

View File

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

View File

@ -105,6 +105,31 @@ FULL_BINUTILS_CONFIG = \
--with-sysroot=$(SYSROOT) \ --with-sysroot=$(SYSROOT) \
--enable-deterministic-archives --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 \ FULL_GCC_CONFIG = --enable-languages=c,c++,fortran \
$(GCC_CONFIG_FOR_TARGET) \ $(GCC_CONFIG_FOR_TARGET) \
$(COMMON_CONFIG) $(GCC_CONFIG) $(TOOLCHAIN_CONFIG) \ $(COMMON_CONFIG) $(GCC_CONFIG) $(TOOLCHAIN_CONFIG) \
@ -125,28 +150,7 @@ FULL_GCC_CONFIG = --enable-languages=c,c++,fortran \
--enable-libquadmath --enable-libquadmath-support \ --enable-libquadmath --enable-libquadmath-support \
--disable-decimal-float \ --disable-decimal-float \
$(OVERRIDE) $(OVERRIDE)
endif
# 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)
FULL_MUSL_CONFIG = $(MUSL_CONFIG) \ FULL_MUSL_CONFIG = $(MUSL_CONFIG) \
--prefix= --host=$(TARGET) --prefix= --host=$(TARGET)

View File

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

View File

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