чување 375d5b5a5798cce4f622eddf6da48f3ac71d69f5 родитељ 6b2970ff07ea454932f19bbd4539f669ed0cf4a7 Аутор: Страхиња Радић <contact@strahinja.org> Датум: Sun, 17 Jul 2022 18:22:32 +0200 Further development, mostly related to boot process and services Signed-off-by: Страхиња Радић <contact@strahinja.org> Diffstat:
измењених датотека: 144, додавања: 566(+), брисања: 3294(-)
diff --git a/01-cross.sh b/01-cross.sh @@ -43,26 +43,15 @@ check_dir ${TL}/lib check_dir ${G_SPKG} -msg info "Setup root structure" -check_dir ${GR}/bin -remove_file ${GR}/sbin -link_if_ne bin ${GR}/sbin -check_dir ${GR}/etc -check_dir ${GR}/include -check_dir ${GR}/local -check_dir ${GR}/local/bin -check_dir ${GR}/local/include -check_dir ${GR}/local/share -check_dir ${GR}/local/lib -link_if_ne bin ${GR}/local/sbin -check_dir ${GR}/share -check_dir ${GR}/sucks/bin -check_dir ${GR}/sucks/lib -check_dir ${GR}/sucks/share -link_if_ne bin ${GR}/sucks/sbin -link_if_ne ../../share/locale ${GR}/sucks/share/locale - -:>${GR}/etc/fstab +msg info "Creating directories" +./lib/createdirs 01-cross.sh || exit 1 + +msg info "Creating symlinks" +./lib/createlinks 01-cross.sh || exit 1 + +cat <<! >${GR}/etc/fstab +/dev/sda1 /boot vfat rw,relatime,fmask=0133,dmask=0022,errors=remount-ro 0 2 +! if [ ! -e /${CTD} ] && [ ! -e /${TLD} ]; then msg info "Linking %s and %s to / (needs root)" ${CTD} ${TLD} diff --git a/02-chroot.sh b/02-chroot.sh @@ -38,35 +38,8 @@ fi cat art/galeb.ansi -check_dir ${GR}/bin -check_dir ${GR}/boot -check_dir ${GR}/dev -check_dir ${GR}/etc -check_dir ${GR}/home -check_dir ${GR}/include -check_dir ${GR}/lib -check_dir ${GR}/mnt -check_dir ${GR}/proc -check_dir ${GR}/root -check_dir ${GR}/run -remove_file ${GR}/sbin -link_if_ne bin ${GR}/sbin -check_dir ${GR}/share -check_dir ${GR}/share/locale -check_dir ${GR}/sucks/bin -check_dir ${GR}/sucks/lib -remove_file ${GR}/sucks/sbin -link_if_ne bin ${GR}/sucks/sbin -check_dir ${GR}/share -check_dir ${GR}/share/locale -check_dir ${GR}/sys -check_dir ${GR}/tmp -chmod +t ${GR}/tmp -link_if_ne . ${GR}/usr -check_dir ${GR}/var/cache -check_dir ${GR}/var/log -check_dir ${GR}/var/run -check_dir ${GR}/var/spool +msg info "Creating directories" +./lib/createdirs 02-chroot.sh-start check_mknod ${GR}/dev/console c 5 1 -m 600 check_mknod ${GR}/dev/null c 1 3 -m 666 @@ -135,17 +108,23 @@ cp_or_fail ${WD}/lib/env.sh ${GR}/lib/env.sh /bin/sed -i 's,^\(GR=\).*,\1,' ${GR}/lib/env.sh cp_or_fail ${WD}/lib/fun.sh ${GR}/lib/fun.sh cp_or_fail ${WD}/${FLD}/rc.d/g_fun.sh ${GR}/lib/g_fun.sh +cp_or_fail ${WD}/lib/createdirs ${GR}/lib/createdirs +cp_or_fail ${WD}/lib/dirs.tsv ${GR}/lib/dirs.tsv cp_or_fail ${WD}/lib/createlinks ${GR}/lib/createlinks cp_or_fail ${WD}/lib/symlinks.tsv ${GR}/lib/symlinks.tsv cp_or_fail ${WD}/lib/setperms ${GR}/lib/setperms cp_or_fail ${WD}/lib/perms.tsv ${GR}/lib/perms.tsv +cp_or_fail ${WD}/lib/rmfiles ${GR}/lib/rmfiles +cp_or_fail ${WD}/lib/rmlist.tsv ${GR}/lib/rmlist.tsv cp_or_fail ${WD}/${FLD}/rc.d/profile ${GR}/etc/profile.final cp_or_fail ${WD}/${FLD}/rc.d/mkshrc ${GR}/etc/mkshrc +cp_or_fail ${WD}/${FLD}/rc.d/rc.conf ${GR}/etc/rc.conf cp_or_fail ${WD}/${FLD}/rc.d/rc.init ${GR}/bin/rc.init cp_or_fail ${WD}/${FLD}/rc.d/rc.shutdown ${GR}/bin/rc.shutdown -cp_or_fail ${WD}/${FLD}/rc.d/rc.conf ${GR}/etc/rc.conf +cp_or_fail ${WD}/${FLD}/rc.d/rc.svc ${GR}/bin/rc.svc cp_or_fail ${WD}/${FLD}/rc.d/rc.local ${GR}/etc/rc.local +cp_or_fail -r ${WD}/${FLD}/svc.d/* ${GR}/bin/svc.d/ msg warn "Next run 03-packages.sh" @@ -162,3 +141,19 @@ umount ${GR}/sys/firmware/efi/efivars umount ${GR}/sys umount ${GR}/proc umount -R ${GR}/dev + +cd ${WD} + +msg info "Creating directories" +./lib/createdirs + +msg info "Creating symlinks" +./lib/createlinks 02-chroot.sh-end + +msg info "Setting permissions" +./lib/setperms + +msg info "Cleaning up" +./lib/rmfiles 02-chroot.sh-end + +mv_or_fail ${GR}/etc/profile.final ${GR}/etc/profile diff --git a/03-packages.sh b/03-packages.sh @@ -30,6 +30,9 @@ cat /etc/issue totalsteps=1 step=1 +msg info "Creating symlinks" +./lib/createlinks 03-packages.sh + begin_step "packages" totalsubsteps=100 @@ -40,12 +43,10 @@ for cmd in cat dd echo env mksh lksh ln pwd rm stty install perl do link_if_ne /${TLD}/bin/${cmd} /bin/${cmd} done -link_if_ne lksh /bin/sh for lib in gcc_s.so gcc_s.so.1 stdc++.a stdc++.so stdc++.so.6 do link_if_ne /${TLD}/lib/lib${lib} /lib/lib${lib} done -link_if_ne /proc/self/mounts /etc/mtab msg info "Regenerating /etc/passwd" cat <<! >/etc/passwd @@ -75,8 +76,10 @@ cdrom:x:15: adm:x:16: messagebus:x:18: input:x:24: +cron:x:33: mail:x:34: nogroup:x:99: +wheel:x:998: users:x:999: ! @@ -3032,6 +3035,48 @@ mkpk_install() fi end_substep +begin_substep dcron-4.5 +if [ -x /bin/cron ]; then + msg info "%s exists, skipping %s" /bin/cron ${pkg} +elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then + unpack_pkg ${pkg} / +else + extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.gz + ( + cd_or_fail ${G_SRC}/${pkg} + + apply_patch packages -Np0 -i \ + ${G_PAT}/dcron-galeb/reopen_after_editfile.patch + + cat <<! >MKPK +mkpk_name() +{ + printf "%s" "${pkg}" +} + +mkpk_install() +{ + CFLAGS='-Os -pipe -static --static -fcommon' + LDFLAGS='-static --static -fcommon -s' + DESTDIR=/build + export CFLAGS LDFLAGS DESTDIR + + make ${JN} CFLAGS="\${CFLAGS}" LDFLAGS="\${LDFLAGS}" \\ + DESTDIR=\${DESTDIR} PREFIX= CRONTAB_GROUP=cron || exit 1 + make CFLAGS="\${CFLAGS}" LDFLAGS="\${LDFLAGS}" DESTDIR=\${DESTDIR} \\ + PREFIX= CRONTAB_GROUP=cron install || exit 1 + + chmod 4750 ../build/bin/crontab + chmod 4700 ../build/sbin/crond +} +! + mkpk ${pkg} + remove_dir ${G_SRC}/${pkg} + unpack_pkg ${pkg} / + ) || exit 1 +fi +end_substep + begin_substep git-2.37.1 if [ -x /bin/git ]; then msg info "%s exists, skipping %s" /bin/git ${pkg} @@ -3064,8 +3109,8 @@ mkpk_install() } ! mkpk ${pkg} - #remove_dir ${G_SRC}/${pkg} - #unpack_pkg ${pkg} / + remove_dir ${G_SRC}/${pkg} + unpack_pkg ${pkg} / ) || exit 1 fi end_substep @@ -3643,104 +3688,6 @@ mkpk_install() fi end_substep -if [ -x /sucks/bin/lsblk ]; then - msg info "%s exists, skipping %s" /sucks/bin/lsblk ${pkg} -elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then - unpack_pkg ${pkg} / -else - extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.gz - ( - cd_or_fail ${G_SRC}/${pkg} - - apply_patch packages -Np0 -i \ - ${G_PAT}/util-linux-void/fix-musl.patch - - apply_patch packages -Np1 -i \ - ${G_PAT}/util-linux-mlfs/use-tiparm-when-compiling-\ -with-netbsd_curses.patch - - cat <<! >MKPK -mkpk_name() -{ - printf "%s" "${pkg}" -} - -mkpk_install() -{ - CFLAGS='-Os -pipe -static --static -fcommon -fPIC' - LDFLAGS='-static --static -fcommon' - DESTDIR=/build - YACC=/${TLD}/bin/yacc - export CFLAGS LDFLAGS DESTDIR YACC - - mkdir -pv /build/var/lib/hwclock - - cp -v ${G_FIL}/util-linux-adelie/ttydefaults.h include/ - - :>config/config.rpath - :>config.h.in - - libtoolize --force || exit 1 - aclocal -I m4 || exit 1 - autoconf -v || exit 1 - automake --add-missing || exit 1 - - CFLAGS+=' -D_DIRENT_HAVE_D_TYPE ' - export CFLAGS - - NOCONFIGURE=1 ./autogen.sh || exit 1 - - ./configure \\ - --prefix=/sucks \\ - ADJTIME_PATH=/var/lib/hwclock/adjtime \\ - --docdir=/sucks/share/doc/util-linux-2.37.4 \\ - --disable-cal \\ - --disable-chfn-chsh \\ - --disable-eject \\ - --disable-fallocate \\ - --disable-hwclock \\ - --disable-kill \\ - --disable-last \\ - --disable-logger \\ - --disable-login \\ - --disable-mesg \\ - --disable-mount \\ - --disable-mountpoint \\ - --disable-nologin \\ - --disable-pivot_root \\ - --disable-setpriv \\ - --disable-su \\ - --disable-swapon \\ - --disable-switch_root \\ - --disable-runuser \\ - --disable-pylibmount \\ - --disable-unshare \\ - --disable-static \\ - --without-python \\ - --without-systemd \\ - --without-systemdsystemunitdir \\ - --sbindir=/sucks/sbin \\ - --bindir=/sucks/bin \\ - --libdir=/sucks/lib || exit 1 - - make ${JN} || exit 1 - make install-strip - - # Overlap with sbase/ubase - for prog in blkdiscard ctrlaltdel dmesg flock fsfreeze look mkswap \\ - renice rev setsid swaplabel swapoff umount - do - find /build -name \${prog} -exec rm {} \\; - done -} -! - mkpk ${pkg} - remove_dir ${G_SRC}/${pkg} - unpack_pkg ${pkg} / - ) || exit 1 -fi -end_substep - begin_substep e2fsprogs-1.46.5 if [ -x /sucks/sbin/e2fsck ]; then msg info "%s exists, skipping %s" /sucks/sbin/e2fsck ${pkg} @@ -3840,6 +3787,49 @@ mkpk_install() fi end_substep +begin_substep sdhcp-20220716 +if [ -x /bin/sdhcp ]; then + msg info "%s exists, skipping %s" /bin/sdhcp ${pkg} +elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then + unpack_pkg ${pkg} / +else + ( + cd_or_fail ${G_SRC}/${pkg} + + cat <<! >MKPK +mkpk_name() +{ + printf "%s" "${pkg}" +} + +mkpk_install() +{ + AR=ar + CC=tcc + CFLAGS='-static -fcommon' + LDFLAGS='-static -fcommon' + LDLIBS=-lc + export AR CC CFLAGS LDFLAGS LDLIBS + + if [ ! -e config.mk.orig ]; then + cp config.mk config.mk.orig + /${TLD}/bin/sed -i -e "s,^\\(PREFIX\\s*=\\s*\\).*,PREFIX = ," \\ + -e "s,^\\(CC\\s*=\\s*\\).*,CC = \${CC}," \\ + config.mk + fi + + make clean + make ${JN} || exit 1 + make DESTDIR=/build install +} +! + mkpk ${pkg} + #remove_dir ${G_SRC}/${pkg} + unpack_pkg ${pkg} / + ) || exit 1 +fi +end_substep + begin_substep sinit-20220713 if [ -x /sbin/init ]; then msg info "%s exists, skipping %s" /sbin/init ${pkg} @@ -3887,52 +3877,43 @@ mkpk_install() fi end_substep -# begin_substep perp-2.07 -# if [ -x /sbin/perp ]; then -# msg info "%s exists, skipping %s" /sbin/perp ${pkg} -# elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then -# unpack_pkg ${pkg} / -# else -# ( -# cd_or_fail ${G_SRC}/${pkg} -# -# cat <<! >MKPK -# mkpk_name() -# { -# printf "%s" "${pkg}" -# } -# -# mkpk_install() -# { -# AR=ar -# CC=tcc -# CFLAGS='-static -fcommon' -# LDFLAGS='-static -fcommon' -# LDLIBS=-lc -# export AR CC CFLAGS LDFLAGS LDLIBS -# -# if [ ! -e config.mk.orig ]; then -# cp config.mk config.mk.orig -# /${TLD}/bin/sed -i -e "s,^\\(PREFIX\\s*=\\s*\\).*,PREFIX = ," \\ -# -e "s,^\\(CC\\s*=\\s*\\).*,CC = \${CC}," \\ -# config.mk -# fi -# -# make clean -# make ${JN} || exit 1 -# make DESTDIR=/build install -# -# ln -sfv bin ../build/sbin -# cd ../build/sbin -# ln -sfv sinit init -# } -# ! -# mkpk ${pkg} -# #remove_dir ${G_SRC}/${pkg} -# unpack_pkg ${pkg} / -# ) || exit 1 -# fi -# end_substep +begin_substep snarf-7.0 +if [ -x /bin/snarf ]; then + msg info "%s exists, skipping %s" /bin/snarf ${pkg} +elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then + unpack_pkg ${pkg} / +else + extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.gz + ( + cd_or_fail ${G_SRC}/${pkg} + + cat <<! >MKPK +mkpk_name() +{ + printf "%s" "${pkg}" +} + +mkpk_install() +{ + AR=ar + CC=tcc + CFLAGS='-static -fcommon' + LDFLAGS='-static -fcommon -L/lib/tcc' + LIBS='-lc -ltcc1' + export AR CC CFLAGS LDFLAGS LIBS + + ./configure --prefix=/ --mandir=/share/man + + make ${JN} || exit 1 + make DESTDIR=/build install +} +! + mkpk ${pkg} + remove_dir ${G_SRC}/${pkg} + unpack_pkg ${pkg} / + ) || exit 1 +fi +end_substep # Needed for efibootmgr begin_substep popt-1.18 @@ -4076,15 +4057,20 @@ begin_substep linux-5.17.13 cd_or_fail ${G_SRC}/${pkg} cp_or_fail ${G_FIL}/linux/config-20220714-gl20 .config -msg warn "Next, configure Linux using: " +msg warn "Next, configure Linux by using: " +msg warn " mv /bin/ln /bin/_ln " +msg warn " export PATH=/bin:/sucks/bin:/tools/bin " msg warn " make LEX=/${TLD}/bin/flex menuconfig && \\\\ " msg warn " make CFLAGS=-fPIE LDFLAGS=-fPIE LEX=/${TLD}/bin/flex \\\\" -msg warn " BC=/${TLD}/bin/bc vmlinux modules modules_install && \\\\ " +msg warn " BC=/${TLD}/bin/bc bzImage modules modules_install && \\\\" msg warn " cp arch/x86/boot/bzImage /boot/vmlinuz && \\\\ " msg warn " cp System.map /boot/ && \\\\ " msg warn " cp .config /boot/config " +msg warn " mv /bin/_ln /bin/ln " msg warn "You might want to then use efibootmgr to add vmlinuz to EFI. " + PATH=/local/bin:/bin:/sucks/bin:/tools/bin + export PATH /bin/mksh -l +h end_substep diff --git a/04-finale.sh b/04-finale.sh @@ -150,6 +150,9 @@ mkpk_install() make clean make ${JN} || exit 1 make DESTDIR=/build install + + # Overlap with dcron + /${TLD}/bin/rm -v ../build/bin/cron ../build/share/man/man1/cron.1 } ! mkpk ${pkg} @@ -211,6 +214,7 @@ mkpk_install() :>/build/var/run/utmp chown root:utmp /build/var/run/utmp chmod 664 /build/var/run/utmp + chmod +s /build/bin/su } ! mkpk ${pkg} @@ -220,25 +224,35 @@ mkpk_install() fi end_substep -msg info "Creating symlinks" -/lib/createlinks - -msg info "Setting permissions" -/lib/setperms - -msg info "Cleaning up" -remove_file /bin/bash -remove_file /bin/stty -remove_file /lib/env.sh -remove_file /lib/fun.sh -remove_file /bin/03-packages.sh -remove_file /bin/04-finale.sh -remove_file /lib/createlinks -remove_file /lib/symlinks.tsv -remove_file /lib/setperms -remove_file /lib/perms.tsv - -mv_or_fail /etc/profile.final /etc/profile +begin_substep svc-20220717 +if [ -x /bin/svc ]; then + msg info "%s exists, skipping %s" /bin/svc ${pkg} +elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then + unpack_pkg ${pkg} / +else + ( + cd_or_fail ${G_SRC}/${pkg} + + cat <<! >MKPK +mkpk_name() +{ + printf "%s" "${pkg}" +} + +mkpk_install() +{ + cp -r bin ../build/ + cp -r svc.d ../build/bin/ + mkdir -p ../build/share/doc/${pkg} + cp README.md ../build/share/doc/${pkg}/ +} +! + mkpk ${pkg} + #remove_dir ${G_SRC}/${pkg} + unpack_pkg ${pkg} / + ) || exit 1 +fi +end_substep msg info "Generating /etc/galeb-release" cat <<! >/etc/galeb-release diff --git a/TODO b/TODO @@ -4,20 +4,37 @@ TODO [~] Fix init scripts [x] shutdown, poweroff, reboot [ ] git://r-36.net/stali-init + [ ] http://r-36.net/scm/ + [ ] https://codemadness.org/git/ + [ ] https://git.2f30.org/ + [ ] https://git.suckless.org/ [x] hwclock on shutdown + [ ] shutdown as regular user (remount / ro) [~] Add packages [x] Add git - [ ] Add dhcp - [ ] Add curl - [ ] Add svc - [ ] Add table, text-utils + [x] Add dhcp + [ ] Add curl (needed for git?) + [x] Add snarf + [x] Add svc + [x] Add table, text-utils + [ ] git://git.suckless.org/utmp + [ ] git://r-36.net/nldev + [ ] git://r-36.net/nlmon + [ ] git://r-36.net/rfkilld + [ ] fsck.vfat -[ ] Linux - [ ] /proc/sys/kernel/hotplug/create - Add hotplugging to Linux - [ ] Remove ram disks from Linux +[ ] Add -h to free + +[~] Fix dcron + [ ] crontab -e doesn't respect EDITOR? + +[x] Linux + [x] /proc/sys/kernel/hotplug/create - Add hotplugging to Linux + [x] Remove ram disks from Linux [x] Fix filesystem [x] stty broken link to /tools/bin/stty? [x] Remove /bin/bash in final system + [x] suid/sgid doesn't get preserved? diff --git a/fil/rc.d/g_fun.sh b/fil/rc.d/g_fun.sh @@ -35,6 +35,9 @@ msg() icon="${bold}${white}${bgred}${icon_plain}";; info) icon_plain="=I=" icon="${green}${icon_plain}";; + serv) icon_plain="=S=" + icon="${green}${icon_plain}" + newline=0;; query) icon_plain="=Q=" icon="${bold}${yellow}${icon_plain}" log=0 diff --git a/fil/rc.d/mkshrc b/fil/rc.d/mkshrc @@ -1,11 +1,11 @@ #!/bin/mksh if [ "${KSHUID}" -eq 0 ]; then - PS1=$'\1\r\1\e]0;\1${PWD/#${HOME/\//\\\/}/\\~}\1\b\e[97m\1='\ -$'${HOSTNAME:=$(hostname)}=${PWD/#${HOME/\//\\\/}/\\~}= \1\e[1;31m\1\#'\ + PS1=$'\1\r\1\e]0;\1${PWD/#${HOME/\//\\\/}/\\~}\1\b\e[1;97m\1='\ +$'${HOSTNAME:=$(hostname)}=${PWD/#${HOME/\//\\\/}/\\~}= \1\e[0;31m\1\#'\ $'\1\e[0m\1 ' else - PS1=$'\1\r\1\e]0;\1${PWD/#${HOME/\//\\\/}/\\~}\1\b\e[97m\1='\ + PS1=$'\1\r\1\e]0;\1${PWD/#${HOME/\//\\\/}/\\~}\1\b\e[1;97m\1='\ $'${HOSTNAME:=$(hostname)}=${PWD/#${HOME/\//\\\/}/\\~}= \1\e[93m\1\$\1\e[0m\1 ' fi diff --git a/fil/rc.d/profile b/fil/rc.d/profile @@ -16,6 +16,6 @@ lc() /bin/ls $* | cols } -[ -e /etc/mkshrc ] && . /etc/mkshrc -[ -e ${HOME}/.profile ] && . ${HOME}/.profile -[ -e ${HOME}/.mkshrc ] && . ${HOME}/.mkshrc +if [ -e /etc/mkshrc ]; then + . /etc/mkshrc +fi +\ No newline at end of file diff --git a/fil/rc.d/rc.init b/fil/rc.d/rc.init @@ -21,7 +21,7 @@ mount -n -t tmpfs -o nosuid,mode=0755 dev /dev mkdir -p /dev/pts mount -n -t devpts -o gid=5,mode=0020 devpts /dev/pts -if grep -q verbose /proc/cmdline; then +if grep -q verbose /proc/cmdline >/dev/null 2>&1; then dmesg -n 8 else dmesg -n 3 @@ -32,7 +32,6 @@ mount -o ro,remount / msg info "Running smdev" smdev -s -mkdir -p /proc/sys/kernel echo /bin/smdev >/proc/sys/kernel/hotplug cd /dev @@ -69,30 +68,10 @@ msg info "Bringing up lo interface" ip addr add 127.0.0.1/8 dev lo broadcast + scope host ip link set lo up -HWCLOCK_PARAMS=-s -case "${HARDWARECLOCK}" in - '') ;; - UTC) HWCLOCK_PARAMS="-u ${HWCLOCK_PARAMS}";; - localtime) ;;#HWCLOCK_PARAMS="-l ${HWCLOCK_PARAMS}";; - *) ;; -esac - -if [ -n "${HWCLOCK_PARAMS}" ]; then - msg info "Setting hwclock" - if [ -n "${TIMEZONE}" ]; then - TZ=":${TIMEZONE}" - export TZ - fi - # ubase hwclock only has UTC support currently - hwclock ${HWCLOCK_PARAMS} /dev/rtc0 >/dev/null 2>&1 - unset TZ -fi - msg info "Setting random seed" if [ -f /etc/random-seed ]; then cat /etc/random-seed >/dev/urandom fi - dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2>/dev/null msg info "Storing dmesg output to /var/log/dmesg.log" @@ -101,9 +80,9 @@ dmesg >/var/log/dmesg.log if [ -e /proc/sys/kernel/dmesg_restrict ] && \ [ "$(cat /proc/sys/kernel/dmesg_restrict)" = "1" ] then - chmod 0644 /var/log/dmesg.log + chmod 0600 /var/log/dmesg.log else - chmod 0666 /var/log/dmesg.log + chmod 0644 /var/log/dmesg.log fi if [ -x /bin/rc.modules ]; then diff --git a/fil/rc.d/rc.shutdown b/fil/rc.d/rc.shutdown @@ -42,24 +42,6 @@ echo; stty onlcr msg info "Shutting down" -HWCLOCK_PARAMS=-w -case "${HARDWARECLOCK}" in - UTC) HWCLOCK_PARAMS="-u ${HWCLOCK_PARAMS}";; - localtime) ;;#HWCLOCK_PARAMS="-l ${HWCLOCK_PARAMS}";; - *) ;; -esac - -if [ -n "${HWCLOCK_PARAMS}" ]; then - msg info "Saving system clock" - if [ -n "${TIMEZONE}" ]; then - TZ=":${TIMEZONE}" - export TZ - fi - # ubase hwclock only has UTC support currently - hwclock ${HWCLOCK_PARAMS} /dev/rtc0 >/dev/null 2>&1 - unset TZ -fi - msg info "Storing random seed" dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2>/dev/null @@ -71,11 +53,14 @@ sleep 3 msg info "Sending processes the KILL signal..." killall5 -s KILL +msg info "whoami=" +whoami + msg info "Remounting / as read-only" mount -o ro,remount / msg info "Unmounting filesystems" -umount -a +umount -a >/dev/null 2>&1 sync; sync; sync sleep 3 wait diff --git a/fil/rc.d/rc.svc b/fil/rc.d/rc.svc @@ -0,0 +1,21 @@ +#!/bin/sh + +umask 022 + +. /etc/rc.conf +. /lib/g_fun.sh + +msg info "Configure svc" +svc -c + +for service in $(find /bin/svc.d/run -type l) +do + msg serv "Starting %s\t\t\t" ${service##*/} + service start ${service##*/} >/dev/null 2>&1 + case $? in + 0) printf "${green}( ${white}OK${norm} ${green})${norm}\n";; + 1) printf "${green}(RNNG)${norm}\n";; + 2) printf "${green}(${lred}FAIL${norm}${green})${norm}\n";; + *) printf "${green}(${yellow} ?? ${norm}${green})${norm}\n";; + esac +done diff --git a/fil/svc.d/avail/crond b/fil/svc.d/avail/crond @@ -0,0 +1,21 @@ +#!/bin/sh + +. /bin/svc.d/default/crond + +PID=$(pidof -o %PPID /bin/crond) + +case $1 in + -s) if [ -z "${PID}" ]; then + /bin/crond ${PARAMS} || exit 2 + else + exit 1 + fi;; + -k) kill ${PID} >/dev/null 2>&1 + sleep 1 + if [ -n "${PID}" ]; then + kill -9 ${PID} >/dev/null 2>&1 || exit 2 + else + exit 2 + fi;; + *) exit 2;; +esac diff --git a/fil/svc.d/avail/hwclock b/fil/svc.d/avail/hwclock @@ -0,0 +1,16 @@ +#!/bin/sh + +. /etc/rc.conf +. /bin/svc.d/default/hwclock + +if [ -n "${TIMEZONE}" ]; then + TZ=:${TIMEZONE} + export TZ +fi + +case $1 in + -s) hwclock -s ${PARAMS} >/dev/null 2>&1;; + -k) hwclock -w ${PARAMS} >/dev/null 2>&1;; + *) echo "usage: $0 -s|-k" + exit 1 +esac +\ No newline at end of file diff --git a/fil/svc.d/default/crond b/fil/svc.d/default/crond @@ -0,0 +1,2 @@ +PARAMS="-S -l info" +LOGFILE=/var/log/crond.log diff --git a/fil/svc.d/default/hwclock b/fil/svc.d/default/hwclock @@ -0,0 +1,3 @@ +# sbase hwclock only has UTC support +PARAMS="-u /dev/rtc0" + diff --git a/lib/createdirs b/lib/createdirs @@ -0,0 +1,65 @@ +#!/bin/sh + +. ./lib/env.sh +. ./lib/fun.sh + +dirdb=./lib/dirs.tsv +currentstep=$1 + +startuid=$(id -u) + +recno=0 +IFS=$(printf '\n') +while read -r record +do + recno=$((recno+1)) + + if [ "${recno}" -eq 1 ]; then + continue + fi + + path=$(printf "${record}" | cut -d "$(printf '\t')" -f1) + mode=$(printf "${record}" | cut -sd "$(printf '\t')" -f2) + owner=$(printf "${record}" | cut -sd "$(printf '\t')" -f3) + group=$(printf "${record}" | cut -sd "$(printf '\t')" -f4) + step=$(printf "${record}" | cut -sd "$(printf '\t')" -f5) + + ownerid='' + if [ -n "${owner}" ]; then + ownerid=$(grep "^${owner}:" ${GR}/etc/passwd | cut -d: -f3) + fi + + groupid='' + if [ -n "${group}" ]; then + groupid=$(grep "^${owner}:" ${GR}/etc/group | cut -d: -f3) + fi + + # If no step was passed, do all + if [ -n "${currentstep}" ] && \ + ! { echo "${step}" | grep "${currentstep}" >/dev/null 2>&1; } + then + continue + fi + + if [ -z "${path}" ]; then + msg warn "Empty path at record #%d; skipping" "${recno}" + continue + fi + + if [ ! -d "${GR}${path}" ]; then + msg info "mkdir -p %s" "${GR}${path}" + mkdir -p "${GR}${path}" || exit 1 + fi + + if [ "${startuid}" -eq 0 ] && [ -n "${mode}" ]; then + msg info "chmod %s %s" "${mode}" "${GR}${path}" + chmod "${mode}" "${GR}${path}" || exit 1 + fi + + if [ "${startuid}" -eq 0 ] && [ -n "${owner}" ] && \ + [ -n "${group}" ]; then + msg info "chown %s:%s %s" "${ownerid}" "${groupid}" \ + "${GR}${path}" + chown ${ownerid}:${groupid} "${GR}${path}" || exit 1 + fi +done <${dirdb} diff --git a/lib/createlinks b/lib/createlinks @@ -3,15 +3,10 @@ . ./lib/env.sh . ./lib/fun.sh -symlinkdb=/lib/symlinks.tsv +symlinkdb=./lib/symlinks.tsv +currentstep=$1 -if [ ! -d /sucks ]; then - msg err "You must run this script from inside chroot" - exit 1 -elif [ "$(id -u)" -ne 0 ]; then - msg err "You must run this script as root" - exit 1 -fi +startuid=$(id -u) recno=0 ( @@ -19,16 +14,29 @@ IFS=$(printf '\n') while read -r record do recno=$((recno+1)) + + if [ "${recno}" -eq 1 ]; then + continue + fi + src=$(printf "${record}" | cut -d "$(printf '\t')" -f1) dest=$(printf "${record}" | cut -sd "$(printf '\t')" -f2) + step=$(printf "${record}" | cut -sd "$(printf '\t')" -f3) + + # If no step was passed, do all + if [ -n "${currentstep}" ] && \ + ! { echo "${step}" | grep "${currentstep}" >/dev/null 2>&1; } + then + continue + fi if [ -z "${src}" ] || [ -z "{dest}" ]; then msg warn "Invalid record #%d; skipping" "${recno}" continue fi - msg info "ln -sf %s %s" "${src}" "${dest}" - ln -sf ${src} ${dest} + msg info "ln -sf %s %s" "${src}" "${GR}${dest}" + ln -sf "${src}" "${GR}${dest}" #|| exit 1 done <${symlinkdb} ) diff --git a/lib/dirs.tsv b/lib/dirs.tsv @@ -0,0 +1,38 @@ +Path Mode Owner Group Step +/bin 0755 root root 01-cross.sh,02-chroot.sh-start +/bin/svc.d 0755 root root 02-chroot.sh-start +/bin/svc.d/run 0755 root root 02-chroot.sh-start +/boot 0755 root root 01-cross.sh,02-chroot.sh-start +/dev 0755 root root 01-cross.sh,02-chroot.sh-start +/etc 0755 root root 01-cross.sh,02-chroot.sh-start +/etc/cron 0755 root root 02-chroot.sh-start +/etc/cron/cron.d 0755 root root 02-chroot.sh-start +/home 0755 root root 01-cross.sh,02-chroot.sh-start +/include 0755 root root 01-cross.sh,02-chroot.sh-start +/lib 0755 root root 01-cross.sh,02-chroot.sh-start +/local 0755 root root 01-cross.sh,02-chroot.sh-start +/local/bin 0755 root root 01-cross.sh,02-chroot.sh-start +/local/include 0755 root root 01-cross.sh,02-chroot.sh-start +/local/share 0755 root root 01-cross.sh,02-chroot.sh-start +/local/lib 0755 root root 01-cross.sh,02-chroot.sh-start +/mnt 0755 root root 01-cross.sh,02-chroot.sh-start +/proc 0755 root root 01-cross.sh,02-chroot.sh-start +/root 0700 root root 01-cross.sh,02-chroot.sh-start +/run 0755 root root 01-cross.sh,02-chroot.sh-start +/share 0755 root root 01-cross.sh,02-chroot.sh-start +/share/locale 0755 root root 01-cross.sh,02-chroot.sh-start +/sucks 0755 root root 01-cross.sh,02-chroot.sh-start +/sucks/bin 0755 root root 01-cross.sh,02-chroot.sh-start +/sucks/include 0755 root root 01-cross.sh,02-chroot.sh-start +/sucks/lib 0755 root root 01-cross.sh,02-chroot.sh-start +/sucks/share 0755 root root 01-cross.sh,02-chroot.sh-start +/sys 0755 root root 01-cross.sh,02-chroot.sh-start +/tmp 1777 root root 01-cross.sh,02-chroot.sh-start +/var 0755 root root 01-cross.sh,02-chroot.sh-start +/var/cache 0755 root root 01-cross.sh,02-chroot.sh-start +/var/log 0755 root root 01-cross.sh,02-chroot.sh-start +/var/run 0755 root root 01-cross.sh,02-chroot.sh-start +/var/spool 0755 root root 01-cross.sh,02-chroot.sh-start +/var/spool/cron/crontabs 0755 root root 01-cross.sh,02-chroot.sh-start +/var/spool/cron/cronstamps 0755 root root 01-cross.sh,02-chroot.sh-start +/etc/cron.d 0755 root root 04-finale.sh diff --git a/lib/fun.sh b/lib/fun.sh @@ -473,17 +473,21 @@ msg() *) ;; esac printf "%s %s " "${icon}" ${tstamp} - printf "%s %s " "${icon_plain}" ${tstamp} >>${G_LOGFILE} + if [ -e "${G_LOGFILE}" ]; then + printf "%s %s " "${icon_plain}" ${tstamp} >>${G_LOGFILE} + fi printf "${fmt}${norm}" "$@" if [ ${newline} -eq 1 ]; then echo else printf ' ' fi - [ ${log} -eq 1 ] && \ + if [ -e "${G_LOGFILE}" ] && \ + [ ${log} -eq 1 ]; then printf "$(echo "${fmt}" | \ sed 's/'$(printf '\033')'\[[0-9]\+m//g')\n" \ "$@" >>${G_LOGFILE} + fi } mv_or_fail() diff --git a/lib/perms.tsv b/lib/perms.tsv @@ -1,6 +1,13 @@ +Path Mode Owner Group /bin/mksh 555 root bin /bin/lksh 555 root bin +/bin/su 4555 root root +/bin/crond 4700 root root +/bin/crontab 4750 root cron +/var/spool/cron 0755 root root +/var/spool/cron/cronstamps 0755 root root +/var/spool/cron/crontabs 0755 root root /var/run/utmp 664 root utmp -/tmp 1777 root root /bin/rc.init 555 root root -/bin/rc.shutdown 555 root root +/bin/rc.shutdown 4555 root root +/bin/rc.svc 555 root root diff --git a/lib/pkgs.tsv b/lib/pkgs.tsv @@ -1,13 +1,17 @@ URL Directory/Tarball MD5 Sum git+https://git.adelielinux.org/adelie/musl-locales.git musl-locales-20220708 +git+https://git.sr.ht/~strahinja/reflow reflow-20220716 git+https://github.com/mirbsd/mksh mksh-20220709 git+https://github.com/onetrueawk/awk awk-20220709 +git://git.2f30.org/sdhcp sdhcp-20220716 git://git.suckless.org/9base 9base-20220706 git://git.suckless.org/sbase sbase-20220709 git://git.suckless.org/sinit sinit-20220713 git://git.suckless.org/smdev smdev-20220715 git://git.suckless.org/ubase ubase-20220709 +git+https://git.sr.ht/~strahinja/svc svc-20220717 git://repo.or.cz/tinycc.git tinycc-20220708 +http://www.jimpryor.net/linux/releases/dcron-4.5.tar.gz 078833f3281f96944fc30392b1888326 https://astron.com/pub/file/file-5.41.tar.gz 18233bb0a0089dfdc7dfbc93b96f231b https://cmake.org/files/v3.23/cmake-3.23.2.tar.gz ab3c9ed9578cdb496a252c6733989d78 https://cpan.metacpan.org/authors/id/T/TO/TODDR/XML-Parser-2.46.tar.gz 80bb18a8e6240fcf7ec2f7b57601c170 @@ -50,6 +54,7 @@ https://ftp.gnu.org/gnu/texinfo/texinfo-6.8.tar.xz a91b404e30561a5df803e6eb3a53 https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-3.4.2.tar.gz 18aa728e7947a30af3bb04243e4482aa https://gcc.gnu.org/pub/gcc/snapshots/11-20220101/gcc-11-20220101.tar.xz 2d984314c9ad01d941358bcf3ec6b29e https://git.sr.ht/~strahinja/sled/archive/v0.10.8.tar.gz sled-0.10.8.tar.gz 2a12c7eb0e6cb4f671299acb76753986 +https://git.sr.ht/~strahinja/table/archive/v0.6.2.tar.gz table-0.6.2.tar.gz d77b956284878bb68c07d96e7efbc161 https://github.com/Mic92/iana-etc/releases/download/20210611/iana-etc-20210611.tar.gz f2854be57fe281e3ffc7364984467d2f https://github.com/arsv/perl-cross/releases/download/1.4/perl-cross-1.4.tar.gz 73c246c20766d027c3dc9f606418c22c https://github.com/ericonr/argp-standalone/archive/refs/tags/1.4.1.tar.gz argp-standalone-1.4.1.tar.gz 7f391d52161e7fe8e8d3df4f850bc7ee @@ -97,3 +102,4 @@ https://www.kernel.org/pub/linux/utils/kernel/kmod/kmod-29.tar.xz e81e63acd8069 https://www.kernel.org/pub/linux/utils/net/iproute2/iproute2-5.17.0.tar.xz 8ade96ee93f37fba7e1beec89f1a54bf https://www.leonerd.org.uk/code/libtermkey/libtermkey-0.22.tar.gz 08bf514d59660391c3a21b3977a16c8c https://www.python.org/ftp/python/3.9.9/Python-3.9.9.tar.xz 11d12076311563252a995201248d17e5 +https://www.xach.com/snarf/download/source/snarf-7.0.tar.gz 7470d8457bc0d347b5cd8668c9e735c4 diff --git a/lib/rmfiles b/lib/rmfiles @@ -0,0 +1,43 @@ +#!/bin/sh + +. ./lib/env.sh +. ./lib/fun.sh + +rmlist=./lib/rmlist.tsv +currentstep=$1 + +startuid=$(id -u) + +recno=0 +IFS=$(printf '\n') +while read -r record +do + recno=$((recno+1)) + + if [ "${recno}" -eq 1 ]; then + continue + fi + + path=$(printf "${record}" | cut -d "$(printf '\t')" -f1) + step=$(printf "${record}" | cut -sd "$(printf '\t')" -f2) + + # If no step was passed, do all + if [ -n "${currentstep}" ] && \ + ! { echo "${step}" | grep "${currentstep}" >/dev/null 2>&1; } + then + continue + fi + + if [ -z "${path}" ]; then + msg warn "Empty path at record #%d; skipping" "${recno}" + continue + fi + + if [ -d "${GR}${path}" ]; then + msg info "rm -fr %s" "${GR}${path}" + rm -fr "${GR}${path}" || exit 1 + elif [ -e "${GR}${path}" ]; then + msg info "rm -f %s" "${GR}${path}" + rm -f "${GR}${path}" || exit 1 + fi +done <${rmlist} diff --git a/lib/rmlist.tsv b/lib/rmlist.tsv @@ -0,0 +1,15 @@ +Path Step +/bin/bash 02-chroot.sh-end +/bin/stty 02-chroot.sh-end +/lib/env.sh 02-chroot.sh-end +/lib/fun.sh 02-chroot.sh-end +/bin/03-packages.sh 02-chroot.sh-end +/bin/04-finale.sh 02-chroot.sh-end +/lib/createdirs 02-chroot.sh-end +/lib/dirs.tsv 02-chroot.sh-end +/lib/createlinks 02-chroot.sh-end +/lib/symlinks.tsv 02-chroot.sh-end +/lib/setperms 02-chroot.sh-end +/lib/perms.tsv 02-chroot.sh-end +/lib/rmfiles 02-chroot.sh-end +/lib/rmlist.tsv 02-chroot.sh-end diff --git a/lib/setperms b/lib/setperms @@ -3,12 +3,11 @@ . ./lib/env.sh . ./lib/fun.sh -permdb=/lib/perms.tsv +permdb=./lib/perms.tsv -if [ ! -d /sucks ]; then - msg err "You must run this script from inside chroot" - exit 1 -elif [ "$(id -u)" -ne 0 ]; then +startuid=$(id -u) + +if [ "${startuid}" -ne 0 ]; then msg err "You must run this script as root" exit 1 fi @@ -19,11 +18,26 @@ IFS=$(printf '\n') while read -r record do recno=$((recno+1)) + + if [ "${recno}" -eq 1 ]; then + continue + fi + path=$(printf "${record}" | cut -d "$(printf '\t')" -f1) mode=$(printf "${record}" | cut -sd "$(printf '\t')" -f2) owner=$(printf "${record}" | cut -sd "$(printf '\t')" -f3) group=$(printf "${record}" | cut -sd "$(printf '\t')" -f4) + ownerid='' + if [ -n "${owner}" ]; then + ownerid=$(grep "^${owner}:" ${GR}/etc/passwd | cut -d: -f3) + fi + + groupid='' + if [ -n "${group}" ]; then + groupid=$(grep "^${group}:" ${GR}/etc/group | cut -d: -f3) + fi + if [ -z "${path}" ]; then msg warn "Empty path at record #%d; skipping" "${recno}" continue @@ -31,14 +45,16 @@ do #printf "Record #%d: path=[%s] mode=[%s] [%s:%s]\n" \ # "${recno}" "${path}" "${mode}" "${owner}" "${group}" - if [ -n "${mode}" ]; then - msg info "chmod %s %s" "${mode}" "${path}" - chmod "${mode}" "${path}" + if [ "${startuid}" -eq 0 ] && [ -n "${owner}" ] && \ + [ -n "${group}" ]; then + msg info "chown %s:%s %s" "${ownerid}" "${groupid}" \ + "${GR}${path}" + chown ${ownerid}:${groupid} "${GR}${path}" || exit 1 fi - if [ -n "${owner}" ] && [ -n "${group}" ]; then - msg info "chown %s:%s %s" "${owner}" "${group}" "${path}" - chown ${owner}:${group} "${path}" + if [ -n "${mode}" ]; then + msg info "chmod %s %s" "${mode}" "${GR}${path}" + chmod "${mode}" "${GR}${path}" fi done <${permdb} ) diff --git a/lib/symlinks.tsv b/lib/symlinks.tsv @@ -1,3 +1,12 @@ -/bin/rc.shutdown /bin/shutdown -/bin/rc.shutdown /bin/poweroff -/bin/rc.shutdown /bin/reboot +Source Destination Step +bin /sbin 01-cross.sh +bin /local/sbin 01-cross.sh +bin /sucks/sbin 01-cross.sh +. /usr 01-cross.sh +../../share/locale /sucks/share/locale 03-packages.sh +lksh /bin/sh 03-packages.sh +/proc/self/mounts /etc/mtab 03-packages.sh +../avail/crond /bin/svc.d/run/crond 02-chroot.sh-end +/bin/rc.shutdown /bin/shutdown 02-chroot.sh-end +/bin/rc.shutdown /bin/poweroff 02-chroot.sh-end +/bin/rc.shutdown /bin/reboot 02-chroot.sh-end diff --git a/pat b/pat @@ -1 +0,0 @@ -pat-11.2.1 -\ No newline at end of file diff --git a/pat-12.1.0/gcc-alpine/0001-posix_memalign.patch b/pat-12.1.0/gcc-alpine/0001-posix_memalign.patch @@ -1,42 +0,0 @@ -From 0f6c64b962bb3bf75f15aec350a9d6f8997fa814 Mon Sep 17 00:00:00 2001 -From: Szabolcs Nagy <nsz@port70.net> -Date: Fri, 26 Jan 2018 20:32:50 +0000 -Subject: [PATCH] posix_memalign - ---- - gcc/config/i386/pmm_malloc.h | 9 +++++---- - 1 file changed, 5 insertions(+), 4 deletions(-) - -diff --git a/gcc/config/i386/pmm_malloc.h b/gcc/config/i386/pmm_malloc.h -index 87344d9383f..ece428df487 100644 ---- a/gcc/config/i386/pmm_malloc.h -+++ b/gcc/config/i386/pmm_malloc.h -@@ -27,12 +27,13 @@ - #include <stdlib.h> - - /* We can't depend on <stdlib.h> since the prototype of posix_memalign -- may not be visible. */ -+ may not be visible and we can't pollute the namespace either. */ - #ifndef __cplusplus --extern int posix_memalign (void **, size_t, size_t); -+extern int _mm_posix_memalign (void **, size_t, size_t) - #else --extern "C" int posix_memalign (void **, size_t, size_t) throw (); -+extern "C" int _mm_posix_memalign (void **, size_t, size_t) throw () - #endif -+__asm__("posix_memalign"); - - static __inline void * - _mm_malloc (size_t __size, size_t __alignment) -@@ -42,7 +43,7 @@ _mm_malloc (size_t __size, size_t __alignment) - return malloc (__size); - if (__alignment == 2 || (sizeof (void *) == 8 && __alignment == 4)) - __alignment = sizeof (void *); -- if (posix_memalign (&__ptr, __alignment, __size) == 0) -+ if (_mm_posix_memalign (&__ptr, __alignment, __size) == 0) - return __ptr; - else - return NULL; --- -2.31.1 - diff --git a/pat-12.1.0/gcc-alpine/0002-gcc-poison-system-directories.patch b/pat-12.1.0/gcc-alpine/0002-gcc-poison-system-directories.patch @@ -1,203 +0,0 @@ -From 2f5ca6e3850401c628c5cc18cd606134e8b29113 Mon Sep 17 00:00:00 2001 -From: Khem Raj <raj.khem@gmail.com> -Date: Fri, 29 Mar 2013 08:59:00 +0400 -Subject: [PATCH] gcc: poison-system-directories - -Add /sw/include and /opt/include based on the original -zecke-no-host-includes.patch patch. The original patch checked for -/usr/include, /sw/include and /opt/include and then triggered a failure and -aborted. - -Instead, we add the two missing items to the current scan. If the user -wants this to be a failure, they can add "-Werror=poison-system-directories". - -Signed-off-by: Mark Hatle <mark.hatle@windriver.com> -Signed-off-by: Khem Raj <raj.khem@gmail.com> - -Upstream-Status: Pending ---- - gcc/common.opt | 4 ++++ - gcc/config.in | 6 ++++++ - gcc/configure | 16 ++++++++++++++++ - gcc/configure.ac | 10 ++++++++++ - gcc/doc/invoke.texi | 9 +++++++++ - gcc/gcc.c | 2 ++ - gcc/incpath.c | 21 +++++++++++++++++++++ - 7 files changed, 68 insertions(+) - -diff --git a/gcc/common.opt b/gcc/common.opt -index ec5235c3a41..ca942863064 100644 ---- a/gcc/common.opt -+++ b/gcc/common.opt -@@ -682,6 +682,10 @@ Wreturn-local-addr - Common Var(warn_return_local_addr) Init(1) Warning - Warn about returning a pointer/reference to a local or temporary variable. - -+Wpoison-system-directories -+Common Var(flag_poison_system_directories) Init(1) Warning -+Warn for -I and -L options using system directories if cross compiling -+ - Wshadow - Common Var(warn_shadow) Warning - Warn when one variable shadows another. Same as -Wshadow=global. -diff --git a/gcc/config.in b/gcc/config.in -index 364eba47737..9551c0dfdf9 100644 ---- a/gcc/config.in -+++ b/gcc/config.in -@@ -224,6 +224,12 @@ - #endif - - -+/* Define to warn for use of native system header directories */ -+#ifndef USED_FOR_TARGET -+#undef ENABLE_POISON_SYSTEM_DIRECTORIES -+#endif -+ -+ - /* Define if you want all operations on RTL (the basic data structure of the - optimizer and back end) to be checked for dynamic type safety at runtime. - This is quite expensive. */ -diff --git a/gcc/configure b/gcc/configure -index 8fe9c91fd7c..17b878e4b4e 100755 ---- a/gcc/configure -+++ b/gcc/configure -@@ -1010,6 +1010,7 @@ with_system_zlib - enable_maintainer_mode - enable_link_mutex - enable_version_specific_runtime_libs -+enable_poison_system_directories - enable_plugin - enable_host_shared - enable_libquadmath_support -@@ -1766,6 +1767,8 @@ Optional Features: - --enable-version-specific-runtime-libs - specify that runtime libraries should be installed - in a compiler-specific directory -+ --enable-poison-system-directories -+ warn for use of native system header directories - --enable-plugin enable plugin support - --enable-host-shared build host code as shared libraries - --disable-libquadmath-support -@@ -30276,6 +30279,19 @@ if test "${enable_version_specific_runtime_libs+set}" = set; then : - fi - - -+# Check whether --enable-poison-system-directories was given. -+if test "${enable_poison_system_directories+set}" = set; then : -+ enableval=$enable_poison_system_directories; -+else -+ enable_poison_system_directories=no -+fi -+ -+if test "x${enable_poison_system_directories}" = "xyes"; then -+ -+$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h -+ -+fi -+ - # Substitute configuration variables - - -diff --git a/gcc/configure.ac b/gcc/configure.ac -index 84dceb8074a..bf64ffbe46f 100644 ---- a/gcc/configure.ac -+++ b/gcc/configure.ac -@@ -6608,6 +6608,16 @@ AC_ARG_ENABLE(version-specific-runtime-libs, - [specify that runtime libraries should be - installed in a compiler-specific directory])]) - -+AC_ARG_ENABLE([poison-system-directories], -+ AS_HELP_STRING([--enable-poison-system-directories], -+ [warn for use of native system header directories]),, -+ [enable_poison_system_directories=no]) -+if test "x${enable_poison_system_directories}" = "xyes"; then -+ AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES], -+ [1], -+ [Define to warn for use of native system header directories]) -+fi -+ - # Substitute configuration variables - AC_SUBST(subdirs) - AC_SUBST(srcdir) -diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi -index eabeec944e7..cd31b522e42 100644 ---- a/gcc/doc/invoke.texi -+++ b/gcc/doc/invoke.texi -@@ -348,6 +348,7 @@ Objective-C and Objective-C++ Dialects}. - -Wpacked -Wno-packed-bitfield-compat -Wpacked-not-aligned -Wpadded @gol - -Wparentheses -Wno-pedantic-ms-format @gol - -Wpointer-arith -Wno-pointer-compare -Wno-pointer-to-int-cast @gol -+-Wno-poison-system-directories @gol - -Wno-pragmas -Wno-prio-ctor-dtor -Wredundant-decls @gol - -Wrestrict -Wno-return-local-addr -Wreturn-type @gol - -Wno-scalar-storage-order -Wsequence-point @gol -@@ -6926,6 +6927,14 @@ made up of data only and thus requires no special treatment. But, for - most targets, it is made up of code and thus requires the stack to be - made executable in order for the program to work properly. - -+@item -Wno-poison-system-directories -+@opindex Wno-poison-system-directories -+Do not warn for @option{-I} or @option{-L} options using system -+directories such as @file{/usr/include} when cross compiling. This -+option is intended for use in chroot environments when such -+directories contain the correct headers and libraries for the target -+system rather than the host. -+ - @item -Wfloat-equal - @opindex Wfloat-equal - @opindex Wno-float-equal -diff --git a/gcc/gcc.c b/gcc/gcc.c -index 9f790db0daf..b2200c5185a 100644 ---- a/gcc/gcc.c -+++ b/gcc/gcc.c -@@ -1041,6 +1041,8 @@ proper position among the other output files. */ - "%{fuse-ld=*:-fuse-ld=%*} " LINK_COMPRESS_DEBUG_SPEC \ - "%X %{o*} %{e*} %{N} %{n} %{r}\ - %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!r:%{!nostartfiles:%S}}} \ -+ %{Wno-poison-system-directories:--no-poison-system-directories} \ -+ %{Werror=poison-system-directories:--error-poison-system-directories} \ - %{static|no-pie|static-pie:} %@{L*} %(mfwrap) %(link_libgcc) " \ - VTABLE_VERIFICATION_SPEC " " SANITIZER_EARLY_SPEC " %o "" \ - %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\ -diff --git a/gcc/incpath.c b/gcc/incpath.c -index 8a2bda00f80..9098ab044ab 100644 ---- a/gcc/incpath.c -+++ b/gcc/incpath.c -@@ -26,6 +26,7 @@ - #include "intl.h" - #include "incpath.h" - #include "cppdefault.h" -+#include "diagnostic-core.h" - - /* Microsoft Windows does not natively support inodes. - VMS has non-numeric inodes. */ -@@ -393,6 +394,26 @@ merge_include_chains (const char *sysroot, cpp_reader *pfile, int verbose) - } - fprintf (stderr, _("End of search list.\n")); - } -+ -+#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES -+ if (flag_poison_system_directories) -+ { -+ struct cpp_dir *p; -+ -+ for (p = heads[INC_QUOTE]; p; p = p->next) -+ { -+ if ((!strncmp (p->name, "/usr/include", 12)) -+ || (!strncmp (p->name, "/usr/local/include", 18)) -+ || (!strncmp (p->name, "/usr/X11R6/include", 18)) -+ || (!strncmp (p->name, "/sw/include", 11)) -+ || (!strncmp (p->name, "/opt/include", 12))) -+ warning (OPT_Wpoison_system_directories, -+ "include location \"%s\" is unsafe for " -+ "cross-compilation", -+ p->name); -+ } -+ } -+#endif - } - - /* Use given -I paths for #include "..." but not #include <...>, and --- -2.31.1 - diff --git a/pat-12.1.0/gcc-alpine/0003-Turn-on-Wl-z-relro-z-now-by-default.patch b/pat-12.1.0/gcc-alpine/0003-Turn-on-Wl-z-relro-z-now-by-default.patch @@ -1,39 +0,0 @@ -From ef512b8fcf9c7628267ff2dbb127aa094f6754f3 Mon Sep 17 00:00:00 2001 -From: Ariadne Conill <ariadne@dereferenced.org> -Date: Fri, 21 Aug 2020 06:45:49 +0000 -Subject: [PATCH] Turn on -Wl,-z,relro,-z,now by default. - ---- - gcc/doc/invoke.texi | 3 +++ - gcc/gcc.cc | 1 + - 2 files changed, 4 insertions(+) - -diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi -index cd31b522e42..17d371ef432 100644 ---- a/gcc/doc/invoke.texi -+++ b/gcc/doc/invoke.texi -@@ -14663,6 +14663,9 @@ For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the - linker. When using the GNU linker, you can also get the same effect with - @option{-Wl,-Map=output.map}. - -+NOTE: In Alpine Linux, for LDFLAGS, the option -+@option{-Wl,-z,relro,now} is used. To disable, use @option{-Wl,-z,norelro}. -+ - @item -u @var{symbol} - @opindex u - Pretend the symbol @var{symbol} is undefined, to force linking of -diff --git a/gcc/gcc.cc b/gcc/gcc.cc -index b2200c5185a..625c9ab7902 100644 ---- a/gcc/gcc.cc -+++ b/gcc/gcc.cc -@@ -1039,6 +1039,7 @@ proper position among the other output files. */ - "%{flto|flto=*:%<fcompare-debug*} \ - %{flto} %{fno-lto} %{flto=*} %l " LINK_PIE_SPEC \ - "%{fuse-ld=*:-fuse-ld=%*} " LINK_COMPRESS_DEBUG_SPEC \ -+ "-z relro -z now " \ - "%X %{o*} %{e*} %{N} %{n} %{r}\ - %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!r:%{!nostartfiles:%S}}} \ - %{Wno-poison-system-directories:--no-poison-system-directories} \ --- -2.31.1 - diff --git a/pat-12.1.0/gcc-alpine/0004-Turn-on-D_FORTIFY_SOURCE-2-by-default-for-C-C-ObjC-O.patch b/pat-12.1.0/gcc-alpine/0004-Turn-on-D_FORTIFY_SOURCE-2-by-default-for-C-C-ObjC-O.patch @@ -1,46 +0,0 @@ -From 3c848f2fbde81db336ec97d9be7a5a4a05015eef Mon Sep 17 00:00:00 2001 -From: Ariadne Conill <ariadne@dereferenced.org> -Date: Fri, 21 Aug 2020 06:46:22 +0000 -Subject: [PATCH] Turn on -D_FORTIFY_SOURCE=2 by default for C, C++, ObjC, - ObjC++, if the optimization level is > 0 - ---- - gcc/c-family/c-cppbuiltin.cc | 4 ++++ - gcc/doc/invoke.texi | 6 ++++++ - 2 files changed, 10 insertions(+) - -diff --git a/gcc/c-family/c-cppbuiltin.cc b/gcc/c-family/c-cppbuiltin.cc -index db91a36794a..ed976c71404 100644 ---- a/gcc/c-family/c-cppbuiltin.cc -+++ b/gcc/c-family/c-cppbuiltin.cc -@@ -1385,6 +1385,10 @@ c_cpp_builtins (cpp_reader *pfile) - builtin_define_with_value ("__REGISTER_PREFIX__", REGISTER_PREFIX, 0); - builtin_define_with_value ("__USER_LABEL_PREFIX__", user_label_prefix, 0); - -+ /* Fortify Source enabled by default for optimization levels > 0 */ -+ if (optimize) -+ builtin_define_with_int_value ("_FORTIFY_SOURCE", 2); -+ - /* Misc. */ - if (flag_gnu89_inline) - cpp_define (pfile, "__GNUC_GNU_INLINE__"); -diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi -index 17d371ef432..fe793ac08db 100644 ---- a/gcc/doc/invoke.texi -+++ b/gcc/doc/invoke.texi -@@ -9230,6 +9230,12 @@ also turns on the following optimization flags: - Please note the warning under @option{-fgcse} about - invoking @option{-O2} on programs that use computed gotos. - -+NOTE: In Alpine Linux, @option{-D_FORTIFY_SOURCE=2} is -+set by default, and is activated when @option{-O} is set to 2 or higher. -+This enables additional compile-time and run-time checks for several libc -+functions. To disable, specify either @option{-U_FORTIFY_SOURCE} or -+@option{-D_FORTIFY_SOURCE=0}. -+ - @item -O3 - @opindex O3 - Optimize yet more. @option{-O3} turns on all optimizations specified --- -2.31.1 - diff --git a/pat-12.1.0/gcc-alpine/0005-On-linux-targets-pass-as-needed-by-default-to-the-li.patch b/pat-12.1.0/gcc-alpine/0005-On-linux-targets-pass-as-needed-by-default-to-the-li.patch @@ -1,242 +0,0 @@ -From: Ariadne Conill <ariadne@dereferenced.org> -From: Olsken (updated patches) -Date: Sat, 21 Aug 2021 08:51:52 +0000 -Subject: [PATCH] On linux targets pass --as-needed by default to the linker, - but always link the sanitizer libraries with --no-as-needed. - -diff --git a/gcc/config/aarch64/aarch64-linux.h b/gcc/config/aarch64/aarch64-linux.h -index 7f2529a2a..b097e1688 100644 ---- a/gcc/config/aarch64/aarch64-linux.h -+++ b/gcc/config/aarch64/aarch64-linux.h -@@ -35,6 +35,7 @@ - #define CPP_SPEC "%{pthread:-D_REENTRANT}" - - #define LINUX_TARGET_LINK_SPEC "%{h*} \ -+ --as-needed \ - %{static:-Bstatic} \ - %{shared:-shared} \ - %{symbolic:-Bsymbolic} \ -diff --git a/gcc/config/alpha/linux-elf.h b/gcc/config/alpha/linux-elf.h -index c1dae8ca2..a87dc7401 100644 ---- a/gcc/config/alpha/linux-elf.h -+++ b/gcc/config/alpha/linux-elf.h -@@ -37,7 +37,7 @@ along with GCC; see the file COPYING3. If not see - - #define ELF_DYNAMIC_LINKER GNU_USER_DYNAMIC_LINKER - --#define LINK_SPEC "-m elf64alpha %{G*} %{relax:-relax} \ -+#define LINK_SPEC "-m elf64alpha --as-needed %{G*} %{relax:-relax} \ - %{O*:-O3} %{!O*:-O1} \ - %{shared:-shared} \ - %{!shared: \ -diff --git a/gcc/config/arm/linux-elf.h b/gcc/config/arm/linux-elf.h -index 0c1c4e70b..8b581afac 100644 ---- a/gcc/config/arm/linux-elf.h -+++ b/gcc/config/arm/linux-elf.h -@@ -70,6 +70,7 @@ - %{rdynamic:-export-dynamic} \ - %{!shared:-dynamic-linker " GNU_USER_DYNAMIC_LINKER "}} \ - -X \ -+ --as-needed \ - %{mbig-endian:-EB} %{mlittle-endian:-EL}" \ - SUBTARGET_EXTRA_LINK_SPEC - -diff --git a/gcc/config/gnu-user.h b/gcc/config/gnu-user.h -index 5ebbf42a1..e1a04e9fd 100644 ---- a/gcc/config/gnu-user.h -+++ b/gcc/config/gnu-user.h -@@ -136,21 +136,21 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see - #define LIBASAN_EARLY_SPEC "%{!shared:libasan_preinit%O%s} " \ - "%{static-libasan:%{!shared:" \ - LD_STATIC_OPTION " --whole-archive -lasan --no-whole-archive " \ -- LD_DYNAMIC_OPTION "}}%{!static-libasan:-lasan}" -+ LD_DYNAMIC_OPTION "}}%{!static-libasan:%{!fuse-ld=gold:--push-state} --no-as-needed -lasan %{fuse-ld=gold:--as-needed;:--pop-state}}" - #undef LIBHWASAN_EARLY_SPEC - #define LIBHWASAN_EARLY_SPEC "%{static-libhwasan:%{!shared:" \ - LD_STATIC_OPTION " --whole-archive -lhwasan --no-whole-archive " \ -- LD_DYNAMIC_OPTION "}}%{!static-libhwasan:-lhwasan}" -+ LD_DYNAMIC_OPTION "}}%{!static-libhwasan:%{!fuse-ld=gold:--push-state} --no-as-needed -lhwasan %{fuse-ld=gold:--as-needed;:--pop-state}}" - #undef LIBTSAN_EARLY_SPEC - #define LIBTSAN_EARLY_SPEC "%{!shared:libtsan_preinit%O%s} " \ - "%{static-libtsan:%{!shared:" \ - LD_STATIC_OPTION " --whole-archive -ltsan --no-whole-archive " \ -- LD_DYNAMIC_OPTION "}}%{!static-libtsan:-ltsan}" -+ LD_DYNAMIC_OPTION "}}%{!static-libtsan:%{!fuse-ld=gold:--push-state} --no-as-needed -ltsan %{fuse-ld=gold:--as-needed;:--pop-state}}" - #undef LIBLSAN_EARLY_SPEC - #define LIBLSAN_EARLY_SPEC "%{!shared:liblsan_preinit%O%s} " \ - "%{static-liblsan:%{!shared:" \ - LD_STATIC_OPTION " --whole-archive -llsan --no-whole-archive " \ -- LD_DYNAMIC_OPTION "}}%{!static-liblsan:-llsan}" -+ LD_DYNAMIC_OPTION "}}%{!static-liblsan:%{!fuse-ld=gold:--push-state} --no-as-needed -llsan %{fuse-ld=gold:--as-needed;:--pop-state}}" - #endif - - #undef TARGET_F951_OPTIONS -diff --git a/gcc/config/i386/gnu-user.h b/gcc/config/i386/gnu-user.h -index a23e7ab3e..12ac8cb93 100644 ---- a/gcc/config/i386/gnu-user.h -+++ b/gcc/config/i386/gnu-user.h -@@ -68,7 +68,7 @@ along with GCC; see the file COPYING3. If not see - { "link_emulation", GNU_USER_LINK_EMULATION },\ - { "dynamic_linker", GNU_USER_DYNAMIC_LINKER } - --#define GNU_USER_TARGET_LINK_SPEC "-m %(link_emulation) %{shared:-shared} \ -+#define GNU_USER_TARGET_LINK_SPEC "-m %(link_emulation) --as-needed %{shared:-shared} \ - %{!shared: \ - %{!static: \ - %{!static-pie: \ -diff --git a/gcc/config/i386/gnu-user64.h b/gcc/config/i386/gnu-user64.h -index f3e25b141..712b0f1c3 100644 ---- a/gcc/config/i386/gnu-user64.h -+++ b/gcc/config/i386/gnu-user64.h -@@ -56,6 +56,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see - "%{" SPEC_64 ":-m " GNU_USER_LINK_EMULATION64 "} \ - %{" SPEC_32 ":-m " GNU_USER_LINK_EMULATION32 "} \ - %{" SPEC_X32 ":-m " GNU_USER_LINK_EMULATIONX32 "} \ -+ --as-needed \ - %{shared:-shared} \ - %{!shared: \ - %{!static: \ -diff --git a/gcc/config/ia64/linux.h b/gcc/config/ia64/linux.h -index ac40c3dfd..6e19e25c3 100644 ---- a/gcc/config/ia64/linux.h -+++ b/gcc/config/ia64/linux.h -@@ -58,7 +58,7 @@ do { \ - #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-ia64.so.2" - - #undef LINK_SPEC --#define LINK_SPEC "\ -+#define LINK_SPEC " --as-needed \ - %{shared:-shared} \ - %{!shared: \ - %{!static: \ -diff --git a/gcc/config/mips/gnu-user.h b/gcc/config/mips/gnu-user.h -index a390bcece..be0ee2893 100644 ---- a/gcc/config/mips/gnu-user.h -+++ b/gcc/config/mips/gnu-user.h -@@ -55,6 +55,7 @@ along with GCC; see the file COPYING3. If not see - #undef GNU_USER_TARGET_LINK_SPEC - #define GNU_USER_TARGET_LINK_SPEC "\ - %{G*} %{EB} %{EL} %{mips*} %{shared} \ -+ -as-needed \ - %{!shared: \ - %{!static: \ - %{rdynamic:-export-dynamic} \ -diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h -index e3f2cd254..43499ed29 100644 ---- a/gcc/config/rs6000/linux64.h -+++ b/gcc/config/rs6000/linux64.h -@@ -374,13 +374,13 @@ extern int dot_symbols; - " -m elf64ppc") - #endif - --#define LINK_OS_LINUX_SPEC32 LINK_OS_LINUX_EMUL32 " %{!shared: %{!static: \ -+#define LINK_OS_LINUX_SPEC32 LINK_OS_LINUX_EMUL32 " --as-needed %{!shared: %{!static: \ - %{!static-pie: \ - %{rdynamic:-export-dynamic} \ - -dynamic-linker " GNU_USER_DYNAMIC_LINKER32 "}}} \ - %(link_os_extra_spec32)" - --#define LINK_OS_LINUX_SPEC64 LINK_OS_LINUX_EMUL64 " %{!shared: %{!static: \ -+#define LINK_OS_LINUX_SPEC64 LINK_OS_LINUX_EMUL64 " --as-needed %{!shared: %{!static: \ - %{!static-pie: \ - %{rdynamic:-export-dynamic} \ - -dynamic-linker " GNU_USER_DYNAMIC_LINKER64 "}}} \ -diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h -index 510abe169..3c1f3a8ec 100644 ---- a/gcc/config/rs6000/sysv4.h -+++ b/gcc/config/rs6000/sysv4.h -@@ -789,7 +789,7 @@ GNU_USER_TARGET_CC1_SPEC - #define GNU_USER_DYNAMIC_LINKER GLIBC_DYNAMIC_LINKER - #endif - --#define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \ -+#define LINK_OS_LINUX_SPEC "-m elf32ppclinux --as-needed %{!shared: %{!static: \ - %{rdynamic:-export-dynamic} \ - -dynamic-linker " GNU_USER_DYNAMIC_LINKER "}}" - -diff --git a/gcc/config/s390/linux.h b/gcc/config/s390/linux.h -index daa48fdfc..2fcfc5d77 100644 ---- a/gcc/config/s390/linux.h -+++ b/gcc/config/s390/linux.h -@@ -82,7 +82,7 @@ along with GCC; see the file COPYING3. If not see - - #undef LINK_SPEC - #define LINK_SPEC \ -- "%{m31:-m elf_s390}%{m64:-m elf64_s390} \ -+ "%{m31:-m elf_s390}%{m64:-m elf64_s390} --as-needed \ - %{shared:-shared} \ - %{!shared: \ - %{static:-static} \ -diff --git a/gcc/config/sparc/linux.h b/gcc/config/sparc/linux.h -index 2550d7ee8..7596d0b27 100644 ---- a/gcc/config/sparc/linux.h -+++ b/gcc/config/sparc/linux.h -@@ -81,7 +81,7 @@ extern const char *host_detect_local_cpu (int argc, const char **argv); - #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2" - - #undef LINK_SPEC --#define LINK_SPEC "-m elf32_sparc %{shared:-shared} \ -+#define LINK_SPEC "-m elf32_sparc --as-needed %{shared:-shared} \ - %{!mno-relax:%{!r:-relax}} \ - %{!shared: \ - %{!static: \ -diff --git a/gcc/gcc.c b/gcc/gcc.c -index 4d790f9dd..5b2fa8c93 100644 ---- a/gcc/gcc.c -+++ b/gcc/gcc.c -@@ -737,8 +737,11 @@ proper position among the other output files. */ - #ifdef LIBASAN_EARLY_SPEC - #define LIBASAN_SPEC STATIC_LIBASAN_LIBS - #elif defined(HAVE_LD_STATIC_DYNAMIC) --#define LIBASAN_SPEC "%{static-libasan:" LD_STATIC_OPTION \ -- "} -lasan %{static-libasan:" LD_DYNAMIC_OPTION "}" \ -+#define LIBASAN_SPEC "%{static-libasan:" LD_STATIC_OPTION "}" \ -+ " %{!static-libasan:%{!fuse-ld=gold:--push-state }--no-as-needed}" \ -+ " -lasan " \ -+ " %{static-libasan:" LD_DYNAMIC_OPTION "}" \ -+ " %{!static-libasan:%{fuse-ld=gold:--as-needed;:--pop-state}}" \ - STATIC_LIBASAN_LIBS - #else - #define LIBASAN_SPEC "-lasan" STATIC_LIBASAN_LIBS -@@ -773,8 +776,11 @@ proper position among the other output files. */ - #ifdef LIBTSAN_EARLY_SPEC - #define LIBTSAN_SPEC STATIC_LIBTSAN_LIBS - #elif defined(HAVE_LD_STATIC_DYNAMIC) --#define LIBTSAN_SPEC "%{static-libtsan:" LD_STATIC_OPTION \ -- "} -ltsan %{static-libtsan:" LD_DYNAMIC_OPTION "}" \ -+#define LIBTSAN_SPEC "%{static-libtsan:" LD_STATIC_OPTION "}" \ -+ " %{!static-libtsan:%{!fuse-ld=gold:--push-state }--no-as-needed}" \ -+ " -ltsan " \ -+ " %{static-libtsan:" LD_DYNAMIC_OPTION "}" \ -+ " %{!static-libtsan:%{fuse-ld=gold:--as-needed;:--pop-state}}" \ - STATIC_LIBTSAN_LIBS - #else - #define LIBTSAN_SPEC "-ltsan" STATIC_LIBTSAN_LIBS -@@ -791,8 +797,11 @@ proper position among the other output files. */ - #ifdef LIBLSAN_EARLY_SPEC - #define LIBLSAN_SPEC STATIC_LIBLSAN_LIBS - #elif defined(HAVE_LD_STATIC_DYNAMIC) --#define LIBLSAN_SPEC "%{static-liblsan:" LD_STATIC_OPTION \ -- "} -llsan %{static-liblsan:" LD_DYNAMIC_OPTION "}" \ -+#define LIBLSAN_SPEC "%{static-liblsan:" LD_STATIC_OPTION "}" \ -+ " %{!static-liblsan:%{!fuse-ld=gold:--push-state }--no-as-needed}" \ -+ " -llsan " \ -+ " %{static-liblsan:" LD_DYNAMIC_OPTION "}" \ -+ " %{!static-liblsan:%{fuse-ld=gold:--as-needed;:--pop-state}}" \ - STATIC_LIBLSAN_LIBS - #else - #define LIBLSAN_SPEC "-llsan" STATIC_LIBLSAN_LIBS -@@ -807,8 +816,11 @@ proper position among the other output files. */ - #define STATIC_LIBUBSAN_LIBS \ - " %{static-libubsan|static:%:include(libsanitizer.spec)%(link_libubsan)}" - #ifdef HAVE_LD_STATIC_DYNAMIC --#define LIBUBSAN_SPEC "%{static-libubsan:" LD_STATIC_OPTION \ -- "} -lubsan %{static-libubsan:" LD_DYNAMIC_OPTION "}" \ -+#define LIBUBSAN_SPEC "%{static-libubsan:" LD_STATIC_OPTION "}" \ -+ " %{!static-libubsan:%{!fuse-ld=gold:--push-state }--no-as-needed}" \ -+ " -lubsan " \ -+ " %{static-libubsan:" LD_DYNAMIC_OPTION "}" \ -+ " %{!static-libubsan:%{fuse-ld=gold:--as-needed;:--pop-state}}" \ - STATIC_LIBUBSAN_LIBS - #else - #define LIBUBSAN_SPEC "-lubsan" STATIC_LIBUBSAN_LIBS diff --git a/pat-12.1.0/gcc-alpine/0006-Enable-Wformat-and-Wformat-security-by-default.patch b/pat-12.1.0/gcc-alpine/0006-Enable-Wformat-and-Wformat-security-by-default.patch @@ -1,34 +0,0 @@ -From 44b1a01cbe3932122112f38e06a21b1c9efad568 Mon Sep 17 00:00:00 2001 -From: Ariadne Conill <ariadne@dereferenced.org> -Date: Fri, 21 Aug 2020 06:47:43 +0000 -Subject: [PATCH] Enable -Wformat and -Wformat-security by default. - ---- - gcc/c-family/c.opt | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt -index c49da99d395..93f25319005 100644 ---- a/gcc/c-family/c.opt -+++ b/gcc/c-family/c.opt -@@ -599,7 +599,7 @@ Warn about function calls with format strings that write past the end - of the destination region. Same as -Wformat-overflow=1. - - Wformat-security --C ObjC C++ ObjC++ Var(warn_format_security) Warning LangEnabledBy(C ObjC C++ ObjC++,Wformat=, warn_format >= 2, 0) -+C ObjC C++ ObjC++ Var(warn_format_security) Init(1) Warning LangEnabledBy(C ObjC C++ ObjC++,Wformat=, warn_format >= 2, 0) - Warn about possible security problems with format functions. - - Wformat-signedness -@@ -620,7 +620,7 @@ C ObjC C++ ObjC++ Var(warn_format_zero_length) Warning LangEnabledBy(C ObjC C++ - Warn about zero-length formats. - - Wformat= --C ObjC C++ ObjC++ Joined RejectNegative UInteger Var(warn_format) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall, 1, 0) IntegerRange(0, 2) -+C ObjC C++ ObjC++ Joined RejectNegative UInteger Var(warn_format) Init(1) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall, 1, 0) IntegerRange(0, 2) - Warn about printf/scanf/strftime/strfmon format string anomalies. - - Wformat-overflow= --- -2.31.1 - diff --git a/pat-12.1.0/gcc-alpine/0007-Enable-Wtrampolines-by-default.patch b/pat-12.1.0/gcc-alpine/0007-Enable-Wtrampolines-by-default.patch @@ -1,25 +0,0 @@ -From 5679adc04a200e3a1a8dd77466eb79d03da8bf8a Mon Sep 17 00:00:00 2001 -From: Ariadne Conill <ariadne@dereferenced.org> -Date: Fri, 21 Aug 2020 06:48:24 +0000 -Subject: [PATCH] Enable -Wtrampolines by default. - ---- - gcc/common.opt | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/gcc/common.opt b/gcc/common.opt -index ca942863064..0a0ab6195ee 100644 ---- a/gcc/common.opt -+++ b/gcc/common.opt -@@ -774,7 +774,7 @@ Common Var(warn_system_headers) Warning - Do not suppress warnings from system headers. - - Wtrampolines --Common Var(warn_trampolines) Warning -+Common Var(warn_trampolines) Init(1) Warning - Warn whenever a trampoline is generated. - - Wtype-limits --- -2.31.1 - diff --git a/pat-12.1.0/gcc-alpine/0008-Disable-ssp-on-nostdlib-nodefaultlibs-and-ffreestand.patch b/pat-12.1.0/gcc-alpine/0008-Disable-ssp-on-nostdlib-nodefaultlibs-and-ffreestand.patch @@ -1,45 +0,0 @@ -From: Ariadne Conill <ariadne@dereferenced.org> -From: Olsken (updated patches) -Date: Sat, 21 Aug 2021 08:51:52 +0000 -Subject: [PATCH] Disable ssp on -nostdlib, -nodefaultlibs and -ffreestanding - Change the buffer size. - -diff --git a/gcc/gcc.c b/gcc/gcc.c -index 5b2fa8c93..d7f3ee55c 100644 ---- a/gcc/gcc.c -+++ b/gcc/gcc.c -@@ -989,6 +989,12 @@ proper position among the other output files. */ - #define LINK_GCC_C_SEQUENCE_SPEC "%G %{!nolibc:%L %G}" - #endif - -+#ifdef ENABLE_DEFAULT_SSP -+#define NO_SSP_SPEC "%{nostdlib|nodefaultlibs|ffreestanding:-fno-stack-protector} " -+#else -+#define NO_SSP_SPEC "" -+#endif -+ - #ifndef LINK_SSP_SPEC - #ifdef TARGET_LIBC_PROVIDES_SSP - #define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \ -@@ -1285,7 +1291,7 @@ static const char *cc1_options = - %{-version:--version}\ - %{-help=*:--help=%*}\ - %{!fsyntax-only:%{S:%W{o*}%{!o*:-o %w%b.s}}}\ -- %{fsyntax-only:-o %j} %{-param*}\ -+ %{fsyntax-only:-o %j} %{-param*} " NO_SSP_SPEC "\ - %{coverage:-fprofile-arcs -ftest-coverage}\ - %{fprofile-arcs|fprofile-generate*|coverage:\ - %{!fprofile-update=single:\ -diff --git a/gcc/params.opt b/gcc/params.opt -index 8ba281b4c..bab39cdf8 100644 ---- a/gcc/params.opt -+++ b/gcc/params.opt -@@ -946,7 +946,7 @@ Common Joined UInteger Var(param_ssa_name_def_chain_limit) Init(512) Param Optim - The maximum number of SSA_NAME assignments to follow in determining a value. - - -param=ssp-buffer-size= --Common Joined UInteger Var(param_ssp_buffer_size) Init(8) IntegerRange(1, 65536) Param Optimization -+Common Joined UInteger Var(param_ssp_buffer_size) Init(4) IntegerRange(1, 65536) Param Optimization - The lower bound for a buffer to be considered for stack smashing protection. - - -param=stack-clash-protection-guard-size= diff --git a/pat-12.1.0/gcc-alpine/0009-Ensure-that-msgfmt-doesn-t-encounter-problems-during.patch b/pat-12.1.0/gcc-alpine/0009-Ensure-that-msgfmt-doesn-t-encounter-problems-during.patch @@ -1,54 +0,0 @@ -From 27863679bde671cdd354cba398ef71a956873e6a Mon Sep 17 00:00:00 2001 -From: Ariadne Conill <ariadne@dereferenced.org> -Date: Fri, 21 Aug 2020 06:50:33 +0000 -Subject: [PATCH] Ensure that msgfmt doesn't encounter problems during gcc - bootstrapping. - -Solves error messages like the following: - -msgfmt: /var/tmp/portage/sys-devel/gcc-4.1.2/work/build/./gcc/libgcc_s.so.1: version `GCC_4.2.0' not found (required by /usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/libstdc++.so.6) - -The libgcc_s.so used during build doesn't satisfy the needs of the -libstdc++.so that msgfmt is linked against. On the other hand, msgfmt -is used as a stand-alone application here, and what library it uses -behind the scenes is of no concern to the gcc build process. -Therefore, simply invoking it "as usual", i.e. without any special -library path, will make it work as expected here. - -2011-09-19 Martin von Gagern - -References: -https://bugs.gentoo.org/372377 -https://bugs.gentoo.org/295480 ---- - libstdc++-v3/po/Makefile.am | 1 + - libstdc++-v3/po/Makefile.in | 1 + - 2 files changed, 2 insertions(+) - -diff --git a/libstdc++-v3/po/Makefile.am b/libstdc++-v3/po/Makefile.am -index a9391d8d167..f7eee24dc8c 100644 ---- a/libstdc++-v3/po/Makefile.am -+++ b/libstdc++-v3/po/Makefile.am -@@ -38,6 +38,7 @@ MSGFMT = msgfmt - EXTRA_DIST = string_literals.cc POTFILES.in $(PACKAGE).pot $(LOCALE_IN) - - .po.mo: -+ env --unset=LD_LIBRARY_PATH \ - $(MSGFMT) -o $@ $< - - all-local: all-local-$(USE_NLS) -diff --git a/libstdc++-v3/po/Makefile.in b/libstdc++-v3/po/Makefile.in -index a0f84b0cfa0..ab24a47a2fd 100644 ---- a/libstdc++-v3/po/Makefile.in -+++ b/libstdc++-v3/po/Makefile.in -@@ -548,6 +548,7 @@ uninstall-am: - - - .po.mo: -+ env --unset=LD_LIBRARY_PATH \ - $(MSGFMT) -o $@ $< - - all-local: all-local-$(USE_NLS) --- -2.31.1 - diff --git a/pat-12.1.0/gcc-alpine/0010-Don-t-declare-asprintf-if-defined-as-a-macro.patch b/pat-12.1.0/gcc-alpine/0010-Don-t-declare-asprintf-if-defined-as-a-macro.patch @@ -1,28 +0,0 @@ -From 953779008f2caa78c55f80c2d6096bf627080016 Mon Sep 17 00:00:00 2001 -From: Ariadne Conill <ariadne@dereferenced.org> -Date: Fri, 21 Aug 2020 06:52:07 +0000 -Subject: [PATCH] Don't declare asprintf if defined as a macro. - ---- - include/libiberty.h | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/include/libiberty.h b/include/libiberty.h -index 141cb886a85..fa0e78eb62f 100644 ---- a/include/libiberty.h -+++ b/include/libiberty.h -@@ -645,8 +645,11 @@ extern int pwait (int, int *, int); - /* Like sprintf but provides a pointer to malloc'd storage, which must - be freed by the caller. */ - -+/* asprintf may be declared as a macro by glibc with __USE_FORTIFY_LEVEL. */ -+#ifndef asprintf - extern int asprintf (char **, const char *, ...) ATTRIBUTE_PRINTF_2; - #endif -+#endif - - /* Like asprintf but allocates memory without fail. This works like - xmalloc. */ --- -2.31.1 - diff --git a/pat-12.1.0/gcc-alpine/0011-libiberty-copy-PIC-objects-during-build-process.patch b/pat-12.1.0/gcc-alpine/0011-libiberty-copy-PIC-objects-during-build-process.patch @@ -1,24 +0,0 @@ -From b43185f44ed438267db101fbe41361001c4e8a94 Mon Sep 17 00:00:00 2001 -From: Ariadne Conill <ariadne@dereferenced.org> -Date: Fri, 21 Aug 2020 06:53:00 +0000 -Subject: [PATCH] libiberty: copy PIC objects during build process - ---- - libiberty/Makefile.in | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in -index d6b302e02fd..fd39928546f 100644 ---- a/libiberty/Makefile.in -+++ b/libiberty/Makefile.in -@@ -263,6 +263,7 @@ $(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS) - $(AR) $(AR_FLAGS) $(TARGETLIB) \ - $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS); \ - $(RANLIB) $(TARGETLIB); \ -+ cp $(TARGETLIB) ../ ; \ - cd ..; \ - else true; fi - --- -2.31.1 - diff --git a/pat-12.1.0/gcc-alpine/0012-libitm-disable-FORTIFY.patch b/pat-12.1.0/gcc-alpine/0012-libitm-disable-FORTIFY.patch @@ -1,33 +0,0 @@ -From 10f38bef9af2e3d6a32253ca18d5ae0123e25e1b Mon Sep 17 00:00:00 2001 -From: Ariadne Conill <ariadne@dereferenced.org> -Date: Fri, 21 Aug 2020 06:53:36 +0000 -Subject: [PATCH] libitm: disable FORTIFY - ---- - libitm/configure.tgt | 10 ++++++++++ - 1 file changed, 10 insertions(+) - -diff --git a/libitm/configure.tgt b/libitm/configure.tgt -index d1beb5c9ec8..c2b50b95c01 100644 ---- a/libitm/configure.tgt -+++ b/libitm/configure.tgt -@@ -47,6 +47,16 @@ if test "$gcc_cv_have_tls" = yes ; then - esac - fi - -+# FIXME: error: inlining failed in call to always_inline -+# ‘int vfprintf(FILE*, const char*, __va_list_tag*)’ -+# : function body can be overwritten at link time -+# Disable Fortify in libitm for now. #508852 -+case "${target}" in -+ *-*-linux*) -+ XCFLAGS="${XCFLAGS} -U_FORTIFY_SOURCE" -+ ;; -+esac -+ - # Map the target cpu to an ARCH sub-directory. At the same time, - # work out any special compilation flags as necessary. - case "${target_cpu}" in --- -2.31.1 - diff --git a/pat-12.1.0/gcc-alpine/0013-libgcc_s.patch b/pat-12.1.0/gcc-alpine/0013-libgcc_s.patch @@ -1,57 +0,0 @@ -From 3614b3586d4a0f75e454943895977a9df1b734d5 Mon Sep 17 00:00:00 2001 -From: Szabolcs Nagy <nsz@port70.net> -Date: Sat, 24 Oct 2015 20:09:53 +0000 -Subject: [PATCH] libgcc_s - ---- - gcc/config/i386/i386-expand.cc | 4 ++-- - libgcc/config/i386/cpuinfo.c | 6 +++--- - libgcc/config/i386/t-linux | 2 +- - 3 files changed, 6 insertions(+), 6 deletions(-) - -diff --git a/gcc/config/i386/i386-expand.cc b/gcc/config/i386/i386-expand.cc -index 47d52550e5e..9cb8cc7950e 100644 ---- a/gcc/config/i386/i386-expand.cc -+++ b/gcc/config/i386/i386-expand.cc -@@ -12338,10 +12338,10 @@ - { - case IX86_BUILTIN_CPU_INIT: - { -- /* Make it call __cpu_indicator_init in libgcc. */ -+ /* Make it call __cpu_indicator_init_local in libgcc.a. */ - tree call_expr, fndecl, type; - type = build_function_type_list (integer_type_node, NULL_TREE); -- fndecl = build_fn_decl ("__cpu_indicator_init", type); -+ fndecl = build_fn_decl ("__cpu_indicator_init_local", type); - call_expr = build_call_expr (fndecl, 0); - return expand_expr (call_expr, target, mode, EXPAND_NORMAL); - } -diff --git a/libgcc/config/i386/cpuinfo.c b/libgcc/config/i386/cpuinfo.c -index 83301a1445f..89fdc7eb587 100644 ---- a/libgcc/config/i386/cpuinfo.c -+++ b/libgcc/config/i386/cpuinfo.c -@@ -516,7 +516,7 @@ __cpu_indicator_init (void) - return 0; - } - --#if defined SHARED && defined USE_ELF_SYMVER --__asm__ (".symver __cpu_indicator_init, __cpu_indicator_init@GCC_4.8.0"); --__asm__ (".symver __cpu_model, __cpu_model@GCC_4.8.0"); -+#ifndef SHARED -+int __cpu_indicator_init_local (void) -+ __attribute__ ((weak, alias ("__cpu_indicator_init"))); - #endif -diff --git a/libgcc/config/i386/t-linux b/libgcc/config/i386/t-linux -index 8506a635790..564296f788e 100644 ---- a/libgcc/config/i386/t-linux -+++ b/libgcc/config/i386/t-linux -@@ -3,5 +3,5 @@ - # t-slibgcc-elf-ver and t-linux - SHLIB_MAPFILES = libgcc-std.ver $(srcdir)/config/i386/libgcc-glibc.ver - --HOST_LIBGCC2_CFLAGS += -mlong-double-80 -DUSE_ELF_SYMVER $(CET_FLAGS) -+HOST_LIBGCC2_CFLAGS += -mlong-double-80 $(CET_FLAGS) - CRTSTUFF_T_CFLAGS += $(CET_FLAGS) --- -2.31.1 - diff --git a/pat-12.1.0/gcc-alpine/0014-nopie.patch b/pat-12.1.0/gcc-alpine/0014-nopie.patch @@ -1,75 +0,0 @@ -From 8e58f9aa5b86dc92e5a1fa71e40e499739473894 Mon Sep 17 00:00:00 2001 -From: Szabolcs Nagy <nsz@port70.net> -Date: Sat, 7 Nov 2015 02:08:05 +0000 -Subject: [PATCH] nopie - ---- - gcc/configure | 27 +++++++++++++++++++++++++++ - gcc/configure.ac | 13 +++++++++++++ - 2 files changed, 40 insertions(+) - -diff --git a/gcc/configure b/gcc/configure -index 17b878e4b4e..808570b6c99 100755 ---- a/gcc/configure -+++ b/gcc/configure -@@ -30784,6 +30784,33 @@ fi - $as_echo "$gcc_cv_no_pie" >&6; } - if test "$gcc_cv_no_pie" = "yes"; then - NO_PIE_FLAG="-no-pie" -+else -+ # Check if -nopie works. -+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -nopie option" >&5 -+$as_echo_n "checking for -nopie option... " >&6; } -+if test "${gcc_cv_nopie+set}" = set; then : -+ $as_echo_n "(cached) " >&6 -+else -+ saved_LDFLAGS="$LDFLAGS" -+ LDFLAGS="$LDFLAGS -nopie" -+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext -+/* end confdefs.h. */ -+int main(void) {return 0;} -+_ACEOF -+if ac_fn_cxx_try_link "$LINENO"; then : -+ gcc_cv_nopie=yes -+else -+ gcc_cv_nopie=no -+fi -+rm -f core conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext -+ LDFLAGS="$saved_LDFLAGS" -+fi -+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_nopie" >&5 -+$as_echo "$gcc_cv_nopie" >&6; } -+ if test "$gcc_cv_nopie" = "yes"; then -+ NO_PIE_FLAG="-nopie" -+ fi - fi - - -diff --git a/gcc/configure.ac b/gcc/configure.ac -index bf64ffbe46f..9c2571de709 100644 ---- a/gcc/configure.ac -+++ b/gcc/configure.ac -@@ -6866,6 +6866,19 @@ AC_CACHE_CHECK([for -no-pie option], - LDFLAGS="$saved_LDFLAGS"]) - if test "$gcc_cv_no_pie" = "yes"; then - NO_PIE_FLAG="-no-pie" -+else -+ # Check if -nopie works. -+ AC_CACHE_CHECK([for -nopie option], -+ [gcc_cv_nopie], -+ [saved_LDFLAGS="$LDFLAGS" -+ LDFLAGS="$LDFLAGS -nopie" -+ AC_LINK_IFELSE([int main(void) {return 0;}], -+ [gcc_cv_nopie=yes], -+ [gcc_cv_nopie=no]) -+ LDFLAGS="$saved_LDFLAGS"]) -+ if test "$gcc_cv_nopie" = "yes"; then -+ NO_PIE_FLAG="-nopie" -+ fi - fi - AC_SUBST([NO_PIE_FLAG]) - --- -2.31.1 - diff --git a/pat-12.1.0/gcc-alpine/0015-libffi-use-__linux__-instead-of-__gnu_linux__-for-mu.patch b/pat-12.1.0/gcc-alpine/0015-libffi-use-__linux__-instead-of-__gnu_linux__-for-mu.patch @@ -1,25 +0,0 @@ -From c5ee6bb497f640877be668428292487eb026d79e Mon Sep 17 00:00:00 2001 -From: Ariadne Conill <ariadne@dereferenced.org> -Date: Fri, 21 Aug 2020 06:57:09 +0000 -Subject: [PATCH] libffi: use __linux__ instead of __gnu_linux__ for musl - ---- - libffi/src/closures.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/libffi/src/closures.c b/libffi/src/closures.c -index 721ff00ea43..22a699c6340 100644 ---- a/libffi/src/closures.c -+++ b/libffi/src/closures.c -@@ -34,7 +34,7 @@ - #include <ffi_common.h> - - #if !FFI_MMAP_EXEC_WRIT && !FFI_EXEC_TRAMPOLINE_TABLE --# if __gnu_linux__ && !defined(__ANDROID__) -+# if __linux__ && !defined(__ANDROID__) - /* This macro indicates it may be forbidden to map anonymous memory - with both write and execute permission. Code compiled when this - option is defined will attempt to map such pages once, but if it --- -2.31.1 - diff --git a/pat-12.1.0/gcc-alpine/0016-dlang-update-zlib-binding.patch b/pat-12.1.0/gcc-alpine/0016-dlang-update-zlib-binding.patch @@ -1,425 +0,0 @@ -From b2e1bf216169f470ced86f1f3e95c89debf606cd Mon Sep 17 00:00:00 2001 -From: Ariadne Conill <ariadne@dereferenced.org> -Date: Fri, 21 Aug 2020 06:57:51 +0000 -Subject: [PATCH] dlang: update zlib binding - ---- - libphobos/src/std/zlib.d | 266 ++++++++++++++++++++++++++++----------- - 1 file changed, 196 insertions(+), 70 deletions(-) - -diff --git a/libphobos/src/std/zlib.d b/libphobos/src/std/zlib.d -index e6cce240fd5..bd2fe37ebec 100644 ---- a/libphobos/src/std/zlib.d -+++ b/libphobos/src/std/zlib.d -@@ -1,7 +1,7 @@ - // Written in the D programming language. - - /** -- * Compress/decompress data using the $(HTTP www._zlib.net, _zlib library). -+ * Compress/decompress data using the $(HTTP www.zlib.net, zlib library). - * - * Examples: - * -@@ -43,12 +43,12 @@ - * References: - * $(HTTP en.wikipedia.org/wiki/Zlib, Wikipedia) - * -- * Copyright: Copyright Digital Mars 2000 - 2011. -+ * Copyright: Copyright The D Language Foundation 2000 - 2011. - * License: $(HTTP www.boost.org/LICENSE_1_0.txt, Boost License 1.0). - * Authors: $(HTTP digitalmars.com, Walter Bright) -- * Source: $(PHOBOSSRC std/_zlib.d) -+ * Source: $(PHOBOSSRC std/zlib.d) - */ --/* Copyright Digital Mars 2000 - 2011. -+/* Copyright The D Language Foundation 2000 - 2011. - * Distributed under the Boost Software License, Version 1.0. - * (See accompanying file LICENSE_1_0.txt or copy at - * http://www.boost.org/LICENSE_1_0.txt) -@@ -75,9 +75,9 @@ enum - - class ZlibException : Exception - { -- this(int errnum) -- { string msg; -- -+ private static string getmsg(int errnum) nothrow @nogc pure @safe -+ { -+ string msg; - switch (errnum) - { - case Z_STREAM_END: msg = "stream end"; break; -@@ -90,7 +90,12 @@ class ZlibException : Exception - case Z_VERSION_ERROR: msg = "version error"; break; - default: msg = "unknown error"; break; - } -- super(msg); -+ return msg; -+ } -+ -+ this(int errnum) -+ { -+ super(getmsg(errnum)); - } - } - -@@ -104,7 +109,7 @@ class ZlibException : Exception - * buf = buffer containing input data - * - * Returns: -- * A $(D uint) checksum for the provided input data and starting checksum -+ * A `uint` checksum for the provided input data and starting checksum - * - * See_Also: - * $(LINK http://en.wikipedia.org/wiki/Adler-32) -@@ -147,7 +152,7 @@ uint adler32(uint adler, const(void)[] buf) - * buf = buffer containing input data - * - * Returns: -- * A $(D uint) checksum for the provided input data and starting checksum -+ * A `uint` checksum for the provided input data and starting checksum - * - * See_Also: - * $(LINK http://en.wikipedia.org/wiki/Cyclic_redundancy_check) -@@ -191,13 +196,14 @@ uint crc32(uint crc, const(void)[] buf) - ubyte[] compress(const(void)[] srcbuf, int level) - in - { -- assert(-1 <= level && level <= 9); -+ assert(-1 <= level && level <= 9, "Compression level needs to be within [-1, 9]."); - } --body -+do - { - import core.memory : GC; -+ import std.array : uninitializedArray; - auto destlen = srcbuf.length + ((srcbuf.length + 1023) / 1024) + 12; -- auto destbuf = new ubyte[destlen]; -+ auto destbuf = uninitializedArray!(ubyte[])(destlen); - auto err = etc.c.zlib.compress2(destbuf.ptr, &destlen, cast(ubyte *) srcbuf.ptr, srcbuf.length, level); - if (err) - { -@@ -276,7 +282,7 @@ void[] uncompress(const(void)[] srcbuf, size_t destlen = 0u, int winbits = 15) - throw new ZlibException(err); - } - } -- assert(0); -+ assert(0, "Unreachable code"); - } - - @system unittest -@@ -370,9 +376,9 @@ class Compress - this(int level, HeaderFormat header = HeaderFormat.deflate) - in - { -- assert(1 <= level && level <= 9); -+ assert(1 <= level && level <= 9, "Legal compression level are in [1, 9]."); - } -- body -+ do - { - this.level = level; - this.gzip = header == HeaderFormat.gzip; -@@ -406,6 +412,7 @@ class Compress - const(void)[] compress(const(void)[] buf) - { - import core.memory : GC; -+ import std.array : uninitializedArray; - int err; - ubyte[] destbuf; - -@@ -420,7 +427,7 @@ class Compress - inited = 1; - } - -- destbuf = new ubyte[zs.avail_in + buf.length]; -+ destbuf = uninitializedArray!(ubyte[])(zs.avail_in + buf.length); - zs.next_out = destbuf.ptr; - zs.avail_out = to!uint(destbuf.length); - -@@ -461,9 +468,10 @@ class Compress - void[] flush(int mode = Z_FINISH) - in - { -- assert(mode == Z_FINISH || mode == Z_SYNC_FLUSH || mode == Z_FULL_FLUSH); -+ assert(mode == Z_FINISH || mode == Z_SYNC_FLUSH || mode == Z_FULL_FLUSH, -+ "Mode must be either Z_FINISH, Z_SYNC_FLUSH or Z_FULL_FLUSH."); - } -- body -+ do - { - import core.memory : GC; - ubyte[] destbuf; -@@ -523,6 +531,7 @@ class UnCompress - z_stream zs; - int inited; - int done; -+ bool inputEnded; - size_t destbufsize; - - HeaderFormat format; -@@ -571,16 +580,16 @@ class UnCompress - const(void)[] uncompress(const(void)[] buf) - in - { -- assert(!done); -+ assert(!done, "Buffer has been flushed."); - } -- body -+ do - { -+ if (inputEnded || !buf.length) -+ return null; -+ - import core.memory : GC; -+ import std.array : uninitializedArray; - int err; -- ubyte[] destbuf; -- -- if (buf.length == 0) -- return null; - - if (!inited) - { -@@ -598,26 +607,152 @@ class UnCompress - - if (!destbufsize) - destbufsize = to!uint(buf.length) * 2; -- destbuf = new ubyte[zs.avail_in * 2 + destbufsize]; -- zs.next_out = destbuf.ptr; -- zs.avail_out = to!uint(destbuf.length); -- -- if (zs.avail_in) -- buf = zs.next_in[0 .. zs.avail_in] ~ cast(ubyte[]) buf; -+ auto destbuf = uninitializedArray!(ubyte[])(destbufsize); -+ size_t destFill; - - zs.next_in = cast(ubyte*) buf.ptr; - zs.avail_in = to!uint(buf.length); - -- err = inflate(&zs, Z_NO_FLUSH); -- if (err != Z_STREAM_END && err != Z_OK) -+ while (true) - { -- GC.free(destbuf.ptr); -- error(err); -+ auto oldAvailIn = zs.avail_in; -+ -+ zs.next_out = destbuf[destFill .. $].ptr; -+ zs.avail_out = to!uint(destbuf.length - destFill); -+ -+ err = inflate(&zs, Z_NO_FLUSH); -+ if (err == Z_STREAM_END) -+ { -+ inputEnded = true; -+ break; -+ } -+ else if (err != Z_OK) -+ { -+ GC.free(destbuf.ptr); -+ error(err); -+ } -+ else if (!zs.avail_in) -+ break; -+ -+ /* -+ According to the zlib manual inflate() stops when either there's -+ no more data to uncompress or the output buffer is full -+ So at this point, the output buffer is too full -+ */ -+ -+ destFill = destbuf.length; -+ -+ if (destbuf.capacity) -+ { -+ if (destbuf.length < destbuf.capacity) -+ destbuf.length = destbuf.capacity; -+ else -+ { -+ auto newLength = GC.extend(destbuf.ptr, destbufsize, destbufsize); -+ -+ if (newLength && destbuf.length < destbuf.capacity) -+ destbuf.length = destbuf.capacity; -+ else -+ destbuf.length += destbufsize; -+ } -+ } -+ else -+ destbuf.length += destbufsize; - } -+ - destbuf.length = destbuf.length - zs.avail_out; - return destbuf; - } - -+ // Test for issues 3191 and 9505 -+ @system unittest -+ { -+ import std.algorithm.comparison; -+ import std.array; -+ import std.file; -+ import std.zlib; -+ -+ // Data that can be easily compressed -+ ubyte[1024] originalData; -+ -+ // This should yield a compression ratio of at least 1/2 -+ auto compressedData = compress(originalData, 9); -+ assert(compressedData.length < originalData.length / 2, -+ "The compression ratio is too low to accurately test this situation"); -+ -+ auto chunkSize = compressedData.length / 4; -+ assert(chunkSize < compressedData.length, -+ "The length of the compressed data is too small to accurately test this situation"); -+ -+ auto decompressor = new UnCompress(); -+ ubyte[originalData.length] uncompressedData; -+ ubyte[] reusedBuf; -+ int progress; -+ -+ reusedBuf.length = chunkSize; -+ -+ for (int i = 0; i < compressedData.length; i += chunkSize) -+ { -+ auto len = min(chunkSize, compressedData.length - i); -+ // simulate reading from a stream in small chunks -+ reusedBuf[0 .. len] = compressedData[i .. i + len]; -+ -+ // decompress using same input buffer -+ auto chunk = decompressor.uncompress(reusedBuf); -+ assert(progress + chunk.length <= originalData.length, -+ "The uncompressed result is bigger than the original data"); -+ -+ uncompressedData[progress .. progress + chunk.length] = cast(const ubyte[]) chunk[]; -+ progress += chunk.length; -+ } -+ -+ auto chunk = decompressor.flush(); -+ assert(progress + chunk.length <= originalData.length, -+ "The uncompressed result is bigger than the original data"); -+ -+ uncompressedData[progress .. progress + chunk.length] = cast(const ubyte[]) chunk[]; -+ progress += chunk.length; -+ -+ assert(progress == originalData.length, -+ "The uncompressed and the original data sizes differ"); -+ assert(originalData[] == uncompressedData[], -+ "The uncompressed and the original data differ"); -+ } -+ -+ @system unittest -+ { -+ ubyte[1024] invalidData; -+ auto decompressor = new UnCompress(); -+ -+ try -+ { -+ auto uncompressedData = decompressor.uncompress(invalidData); -+ } -+ catch (ZlibException e) -+ { -+ assert(e.msg == "data error"); -+ return; -+ } -+ -+ assert(false, "Corrupted data didn't result in an error"); -+ } -+ -+ @system unittest -+ { -+ ubyte[2014] originalData = void; -+ auto compressedData = compress(originalData, 9); -+ -+ auto decompressor = new UnCompress(); -+ auto uncompressedData = decompressor.uncompress(compressedData ~ cast(ubyte[]) "whatever"); -+ -+ assert(originalData.length == uncompressedData.length, -+ "The uncompressed and the original data sizes differ"); -+ assert(originalData[] == uncompressedData[], -+ "The uncompressed and the original data differ"); -+ assert(!decompressor.uncompress("whatever").length, -+ "Compression continued after the end"); -+ } -+ - /** - * Decompress and return any remaining data. - * The returned data should be appended to that returned by uncompress(). -@@ -626,49 +761,40 @@ class UnCompress - void[] flush() - in - { -- assert(!done); -+ assert(!done, "Buffer has been flushed before."); - } - out - { -- assert(done); -+ assert(done, "Flushing failed."); - } -- body -+ do - { -- import core.memory : GC; -- ubyte[] extra; -- ubyte[] destbuf; -- int err; -- - done = 1; -- if (!inited) -- return null; -+ return null; -+ } - -- L1: -- destbuf = new ubyte[zs.avail_in * 2 + 100]; -- zs.next_out = destbuf.ptr; -- zs.avail_out = to!uint(destbuf.length); -+ /// Returns true if all input data has been decompressed and no further data -+ /// can be decompressed (inflate() returned Z_STREAM_END) -+ @property bool empty() const -+ { -+ return inputEnded; -+ } - -- err = etc.c.zlib.inflate(&zs, Z_NO_FLUSH); -- if (err == Z_OK && zs.avail_out == 0) -- { -- extra ~= destbuf; -- goto L1; -- } -- if (err != Z_STREAM_END) -- { -- GC.free(destbuf.ptr); -- if (err == Z_OK) -- err = Z_BUF_ERROR; -- error(err); -- } -- destbuf = destbuf.ptr[0 .. zs.next_out - destbuf.ptr]; -- err = etc.c.zlib.inflateEnd(&zs); -- inited = 0; -- if (err) -- error(err); -- if (extra.length) -- destbuf = extra ~ destbuf; -- return destbuf; -+ /// -+ @system unittest -+ { -+ // some random data -+ ubyte[1024] originalData = void; -+ -+ // append garbage data (or don't, this works in both cases) -+ auto compressedData = cast(ubyte[]) compress(originalData) ~ cast(ubyte[]) "whatever"; -+ -+ auto decompressor = new UnCompress(); -+ auto uncompressedData = decompressor.uncompress(compressedData); -+ -+ assert(uncompressedData[] == originalData[], -+ "The uncompressed and the original data differ"); -+ assert(decompressor.empty, "The UnCompressor reports not being done"); - } - } - --- -2.31.1 - diff --git a/pat-12.1.0/gcc-alpine/0017-dlang-fix-fcntl-on-mips-add-libucontext-dep.patch b/pat-12.1.0/gcc-alpine/0017-dlang-fix-fcntl-on-mips-add-libucontext-dep.patch @@ -1,51 +0,0 @@ -From 76c7eb27b9dfe96f2f1db4fa6f29ce28715ad2a4 Mon Sep 17 00:00:00 2001 -From: Ariadne Conill <ariadne@dereferenced.org> -Date: Fri, 21 Aug 2020 06:58:22 +0000 -Subject: [PATCH] dlang: fix fcntl on mips, add libucontext dep - ---- - libphobos/configure.tgt | 1 + - libphobos/libdruntime/core/sys/posix/fcntl.d | 15 +++++++++++++++ - 2 files changed, 16 insertions(+) - -diff --git a/libphobos/configure.tgt b/libphobos/configure.tgt -index 94e42bf5509..73f2e4b7f01 100644 ---- a/libphobos/configure.tgt -+++ b/libphobos/configure.tgt -@@ -35,6 +35,7 @@ case "${target}" in - ;; - mips*-*-linux*) - LIBPHOBOS_SUPPORTED=yes -+ LIBDRUNTIME_NEEDS_UCONTEXT=yes - ;; - power*-*-linux*) - LIBPHOBOS_SUPPORTED=yes -diff --git a/libphobos/libdruntime/core/sys/posix/fcntl.d b/libphobos/libdruntime/core/sys/posix/fcntl.d -index 9febcff849b..cb34e2108bd 100644 ---- a/libphobos/libdruntime/core/sys/posix/fcntl.d -+++ b/libphobos/libdruntime/core/sys/posix/fcntl.d -@@ -870,6 +870,21 @@ else version (CRuntime_Musl) - F_SETLKW = 7, - } - } -+ else version (MIPS_Any) -+ { -+ enum -+ { -+ O_DIRECTORY = 0x010000, // octal 0200000 -+ O_NOFOLLOW = 0x020000, // octal 0400000 -+ O_DIRECT = 0x008000, // octal 0100000 -+ O_LARGEFILE = 0x002000, // octal 0020000 -+ O_TMPFILE = 0x410000, // octal 020200000 -+ -+ F_GETLK = 33, -+ F_SETLK = 34, -+ F_SETLKW = 35, -+ } -+ } - else - static assert(0, "Platform not supported"); - --- -2.31.1 - diff --git a/pat-12.1.0/gcc-alpine/0018-ada-fix-shared-linking.patch b/pat-12.1.0/gcc-alpine/0018-ada-fix-shared-linking.patch @@ -1,42 +0,0 @@ -From 95fee2cfb1a6a32b7e671861b58ee93978ba16b8 Mon Sep 17 00:00:00 2001 -From: Ariadne Conill <ariadne@dereferenced.org> -Date: Fri, 21 Aug 2020 06:59:16 +0000 -Subject: [PATCH] ada: fix shared linking - ---- - gcc/ada/link.c | 12 ++++++------ - 1 file changed, 6 insertions(+), 6 deletions(-) - -diff --git a/gcc/ada/link.c b/gcc/ada/link.c -index 02c413a412f..f0e52a87d6e 100644 ---- a/gcc/ada/link.c -+++ b/gcc/ada/link.c -@@ -107,9 +107,9 @@ const char *__gnat_default_libgcc_subdir = "lib"; - || defined (__NetBSD__) || defined (__OpenBSD__) \ - || defined (__QNX__) - const char *__gnat_object_file_option = "-Wl,@"; --const char *__gnat_run_path_option = "-Wl,-rpath,"; --char __gnat_shared_libgnat_default = STATIC; --char __gnat_shared_libgcc_default = STATIC; -+const char *__gnat_run_path_option = ""; -+char __gnat_shared_libgnat_default = SHARED; -+char __gnat_shared_libgcc_default = SHARED; - int __gnat_link_max = 8192; - unsigned char __gnat_objlist_file_supported = 1; - const char *__gnat_object_library_extension = ".a"; -@@ -129,9 +129,9 @@ const char *__gnat_default_libgcc_subdir = "lib"; - - #elif defined (__linux__) || defined (__GLIBC__) - const char *__gnat_object_file_option = "-Wl,@"; --const char *__gnat_run_path_option = "-Wl,-rpath,"; --char __gnat_shared_libgnat_default = STATIC; --char __gnat_shared_libgcc_default = STATIC; -+const char *__gnat_run_path_option = ""; -+char __gnat_shared_libgnat_default = SHARED; -+char __gnat_shared_libgcc_default = SHARED; - int __gnat_link_max = 8192; - unsigned char __gnat_objlist_file_supported = 1; - const char *__gnat_object_library_extension = ".a"; --- -2.31.1 - diff --git a/pat-12.1.0/gcc-alpine/0019-build-fix-CXXFLAGS_FOR_BUILD-passing.patch b/pat-12.1.0/gcc-alpine/0019-build-fix-CXXFLAGS_FOR_BUILD-passing.patch @@ -1,24 +0,0 @@ -From aa0311c59892d7fbc4ffa9e2f0520391521cc4dd Mon Sep 17 00:00:00 2001 -From: Ariadne Conill <ariadne@dereferenced.org> -Date: Fri, 21 Aug 2020 06:59:43 +0000 -Subject: [PATCH] build: fix CXXFLAGS_FOR_BUILD passing - ---- - Makefile.in | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/Makefile.in b/Makefile.in -index 36e369df6e7..63627db68cf 100644 ---- a/Makefile.in -+++ b/Makefile.in -@@ -170,6 +170,7 @@ BUILD_EXPORTS = \ - # built for the build system to override those in BASE_FLAGS_TO_PASS. - EXTRA_BUILD_FLAGS = \ - CFLAGS="$(CFLAGS_FOR_BUILD)" \ -+ CXXFLAGS="$(CXXFLAGS_FOR_BUILD)" \ - LDFLAGS="$(LDFLAGS_FOR_BUILD)" - - # This is the list of directories to built for the host system. --- -2.31.1 - diff --git a/pat-12.1.0/gcc-alpine/0020-add-fortify-headers-paths.patch b/pat-12.1.0/gcc-alpine/0020-add-fortify-headers-paths.patch @@ -1,25 +0,0 @@ -From 39e86416709d3d34f46da7cd7b8a3e5a8f0ff7cd Mon Sep 17 00:00:00 2001 -From: Ariadne Conill <ariadne@dereferenced.org> -Date: Fri, 21 Aug 2020 07:01:06 +0000 -Subject: [PATCH] add fortify-headers paths - ---- - gcc/config/linux.h | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/gcc/config/linux.h b/gcc/config/linux.h -index 95654bcdb5a..d88df8f154a 100644 ---- a/gcc/config/linux.h -+++ b/gcc/config/linux.h -@@ -167,6 +167,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see - - #ifdef NATIVE_SYSTEM_HEADER_DIR - #define INCLUDE_DEFAULTS_MUSL_NATIVE \ -+ { NATIVE_SYSTEM_HEADER_DIR "/fortify", 0, 0, 0, 1, 2 }, \ -+ { NATIVE_SYSTEM_HEADER_DIR "/fortify", 0, 0, 0, 1, 0 }, \ - { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \ - { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 }, - #else --- -2.31.1 - diff --git a/pat-12.1.0/gcc-alpine/0021-Alpine-musl-package-provides-libssp_nonshared.a.-We-.patch b/pat-12.1.0/gcc-alpine/0021-Alpine-musl-package-provides-libssp_nonshared.a.-We-.patch @@ -1,31 +0,0 @@ -From c6b54651688cf062ae48ca3402d6d2e08b70ceed Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi> -Date: Fri, 21 Aug 2020 07:03:00 +0000 -Subject: [PATCH] Alpine musl package provides libssp_nonshared.a. We link to - it unconditionally, as otherwise we get link failures if some objects are - -fstack-protector built and final link happens with -fno-stack-protector. - This seems to be the common case when bootstrapping gcc, the piepatches do - not seem to fully fix the crosstoolchain and bootstrap sequence wrt. - stack-protector flag usage. - ---- - gcc/gcc.c | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -diff --git a/gcc/gcc.c b/gcc/gcc.c -index daeb4d0c8ea..6920bec0fa0 100644 ---- a/gcc/gcc.c -+++ b/gcc/gcc.c -@@ -894,8 +894,7 @@ proper position among the other output files. */ - - #ifndef LINK_SSP_SPEC - #ifdef TARGET_LIBC_PROVIDES_SSP --#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \ -- "|fstack-protector-strong|fstack-protector-explicit:}" -+#define LINK_SSP_SPEC "-lssp_nonshared" - #else - #define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \ - "|fstack-protector-strong|fstack-protector-explicit" \ --- -2.31.1 - diff --git a/pat-12.1.0/gcc-alpine/0022-DP-Use-push-state-pop-state-for-gold-as-well-when-li.patch b/pat-12.1.0/gcc-alpine/0022-DP-Use-push-state-pop-state-for-gold-as-well-when-li.patch @@ -1,69 +0,0 @@ -From 4841bee243517cd52504f97ea934f44bc0c1fd5c Mon Sep 17 00:00:00 2001 -From: Ariadne Conill <ariadne@dereferenced.org> -Date: Fri, 21 Aug 2020 07:03:42 +0000 -Subject: [PATCH] DP: Use --push-state/--pop-state for gold as well when - linking libtsan. - ---- - gcc/gcc.cc | 16 ++++++++-------- - 1 file changed, 8 insertions(+), 8 deletions(-) - -diff --git a/gcc/gcc.cc b/gcc/gcc.cc -index 6920bec0fa0..40e07354b3d 100644 ---- a/gcc/gcc.cc -+++ b/gcc/gcc.cc -@@ -696,10 +696,10 @@ proper position among the other output files. */ - #define LIBASAN_SPEC STATIC_LIBASAN_LIBS - #elif defined(HAVE_LD_STATIC_DYNAMIC) - #define LIBASAN_SPEC "%{static-libasan:" LD_STATIC_OPTION "}" \ -- " %{!static-libasan:%{!fuse-ld=gold:--push-state }--no-as-needed}" \ -+ " %{!static-libasan:--push-state --no-as-needed}" \ - " -lasan " \ - " %{static-libasan:" LD_DYNAMIC_OPTION "}" \ -- " %{!static-libasan:%{fuse-ld=gold:--as-needed;:--pop-state}}" \ -+ " %{!static-libasan:--pop-state}" \ - STATIC_LIBASAN_LIBS - #else - #define LIBASAN_SPEC "-lasan" STATIC_LIBASAN_LIBS -@@ -717,10 +717,10 @@ proper position among the other output files. */ - #define LIBTSAN_SPEC STATIC_LIBTSAN_LIBS - #elif defined(HAVE_LD_STATIC_DYNAMIC) - #define LIBTSAN_SPEC "%{static-libtsan:" LD_STATIC_OPTION "}" \ -- " %{!static-libtsan:%{!fuse-ld=gold:--push-state }--no-as-needed}" \ -+ " %{!static-libtsan:--push-state --no-as-needed}" \ - " -ltsan " \ - " %{static-libtsan:" LD_DYNAMIC_OPTION "}" \ -- " %{!static-libtsan:%{fuse-ld=gold:--as-needed;:--pop-state}}" \ -+ " %{!static-libtsan:--pop-state}" \ - STATIC_LIBTSAN_LIBS - #else - #define LIBTSAN_SPEC "-ltsan" STATIC_LIBTSAN_LIBS -@@ -738,10 +738,10 @@ proper position among the other output files. */ - #define LIBLSAN_SPEC STATIC_LIBLSAN_LIBS - #elif defined(HAVE_LD_STATIC_DYNAMIC) - #define LIBLSAN_SPEC "%{static-liblsan:" LD_STATIC_OPTION "}" \ -- " %{!static-liblsan:%{!fuse-ld=gold:--push-state }--no-as-needed}" \ -+ " %{!static-liblsan:--push-state --no-as-needed}" \ - " -llsan " \ - " %{static-liblsan:" LD_DYNAMIC_OPTION "}" \ -- " %{!static-liblsan:%{fuse-ld=gold:--as-needed;:--pop-state}}" \ -+ " %{!static-liblsan:--pop-state}" \ - STATIC_LIBLSAN_LIBS - #else - #define LIBLSAN_SPEC "-llsan" STATIC_LIBLSAN_LIBS -@@ -757,10 +757,10 @@ proper position among the other output files. */ - " %{static-libubsan|static:%:include(libsanitizer.spec)%(link_libubsan)}" - #ifdef HAVE_LD_STATIC_DYNAMIC - #define LIBUBSAN_SPEC "%{static-libubsan:" LD_STATIC_OPTION "}" \ -- " %{!static-libubsan:%{!fuse-ld=gold:--push-state }--no-as-needed}" \ -+ " %{!static-libubsan:--push-state --no-as-needed}" \ - " -lubsan " \ - " %{static-libubsan:" LD_DYNAMIC_OPTION "}" \ -- " %{!static-libubsan:%{fuse-ld=gold:--as-needed;:--pop-state}}" \ -+ " %{!static-libubsan:--pop-state}" \ - STATIC_LIBUBSAN_LIBS - #else - #define LIBUBSAN_SPEC "-lubsan" STATIC_LIBUBSAN_LIBS --- -2.31.1 - diff --git a/pat-12.1.0/gcc-alpine/0023-Pure-64-bit-MIPS.patch b/pat-12.1.0/gcc-alpine/0023-Pure-64-bit-MIPS.patch @@ -1,47 +0,0 @@ -From 720c0d7094d27b6cbfe9669c4f65e2021debcb07 Mon Sep 17 00:00:00 2001 -From: Nils Andreas Svee <me@lochnair.net> -Date: Thu, 21 Dec 2017 03:14:33 +0100 -Subject: [PATCH] Pure 64-bit MIPS - ---- - gcc/config/mips/mips.h | 8 ++++---- - gcc/config/mips/t-linux64 | 6 +++--- - 2 files changed, 7 insertions(+), 7 deletions(-) - -diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h -index 3ce0c19a29a..b9920b49167 100644 ---- a/gcc/config/mips/mips.h -+++ b/gcc/config/mips/mips.h -@@ -3424,11 +3424,11 @@ struct GTY(()) machine_function { - /* If we are *not* using multilibs and the default ABI is not ABI_32 we - need to change these from /lib and /usr/lib. */ - #if MIPS_ABI_DEFAULT == ABI_N32 --#define STANDARD_STARTFILE_PREFIX_1 "/lib32/" --#define STANDARD_STARTFILE_PREFIX_2 "/usr/lib32/" -+#define STANDARD_STARTFILE_PREFIX_1 "/lib/" -+#define STANDARD_STARTFILE_PREFIX_2 "/usr/lib/" - #elif MIPS_ABI_DEFAULT == ABI_64 --#define STANDARD_STARTFILE_PREFIX_1 "/lib64/" --#define STANDARD_STARTFILE_PREFIX_2 "/usr/lib64/" -+#define STANDARD_STARTFILE_PREFIX_1 "/lib/" -+#define STANDARD_STARTFILE_PREFIX_2 "/usr/lib/" - #endif - - /* Load store bonding is not supported by micromips and fix_24k. The -diff --git a/gcc/config/mips/t-linux64 b/gcc/config/mips/t-linux64 -index ceb58d3b5f3..8116e23ebba 100644 ---- a/gcc/config/mips/t-linux64 -+++ b/gcc/config/mips/t-linux64 -@@ -21,6 +21,6 @@ MULTILIB_DIRNAMES = n32 32 64 - MIPS_EL = $(if $(filter %el, $(firstword $(subst -, ,$(target)))),el) - MIPS_SOFT = $(if $(strip $(filter MASK_SOFT_FLOAT_ABI, $(target_cpu_default)) $(filter soft, $(with_float))),soft) - MULTILIB_OSDIRNAMES = \ -- ../lib32$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabin32$(MIPS_SOFT)) \ -- ../lib$(call if_multiarch,:mips$(MIPS_EL)-linux-gnu$(MIPS_SOFT)) \ -- ../lib64$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabi64$(MIPS_SOFT)) -+ ../lib \ -+ ../lib32 \ -+ ../lib --- -2.31.1 - diff --git a/pat-12.1.0/gcc-alpine/0024-use-pure-64-bit-configuration-where-appropriate.patch b/pat-12.1.0/gcc-alpine/0024-use-pure-64-bit-configuration-where-appropriate.patch @@ -1,121 +0,0 @@ -From c60bb23972769f687dcac689ddf00f88e46b8bb7 Mon Sep 17 00:00:00 2001 -From: Ariadne Conill <ariadne@dereferenced.org> -Date: Fri, 21 Aug 2020 07:04:40 +0000 -Subject: [PATCH] use pure 64-bit configuration where appropriate - ---- - gcc/config/aarch64/t-aarch64-linux | 2 +- - gcc/config/i386/t-linux64 | 4 ++-- - gcc/config/rs6000/t-linux | 6 ++++-- - gcc/config/rs6000/t-linux64 | 4 ++-- - gcc/config/rs6000/t-linux64bele | 4 ++-- - gcc/config/rs6000/t-linux64lebe | 4 ++-- - gcc/config/s390/t-linux64 | 4 ++-- - 7 files changed, 15 insertions(+), 13 deletions(-) - -diff --git a/gcc/config/aarch64/t-aarch64-linux b/gcc/config/aarch64/t-aarch64-linux -index 83e59e33b85..6ec56fdf6a8 100644 ---- a/gcc/config/aarch64/t-aarch64-linux -+++ b/gcc/config/aarch64/t-aarch64-linux -@@ -22,7 +22,7 @@ LIB1ASMSRC = aarch64/lib1funcs.asm - LIB1ASMFUNCS = _aarch64_sync_cache_range - - AARCH_BE = $(if $(findstring TARGET_BIG_ENDIAN_DEFAULT=1, $(tm_defines)),_be) --MULTILIB_OSDIRNAMES = mabi.lp64=../lib64$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu) -+MULTILIB_OSDIRNAMES = mabi.lp64=../lib - MULTIARCH_DIRNAME = $(call if_multiarch,aarch64$(AARCH_BE)-linux-gnu) - - MULTILIB_OSDIRNAMES += mabi.ilp32=../libilp32$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu_ilp32) -diff --git a/gcc/config/i386/t-linux64 b/gcc/config/i386/t-linux64 -index 1171e218578..256f8c079ba 100644 ---- a/gcc/config/i386/t-linux64 -+++ b/gcc/config/i386/t-linux64 -@@ -33,6 +33,6 @@ - comma=, - MULTILIB_OPTIONS = $(subst $(comma),/,$(TM_MULTILIB_CONFIG)) - MULTILIB_DIRNAMES = $(patsubst m%, %, $(subst /, ,$(MULTILIB_OPTIONS))) --MULTILIB_OSDIRNAMES = m64=../lib64$(call if_multiarch,:x86_64-linux-gnu) --MULTILIB_OSDIRNAMES+= m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:i386-linux-gnu) -+MULTILIB_OSDIRNAMES = m64=../lib -+MULTILIB_OSDIRNAMES+= m32=../lib32 - MULTILIB_OSDIRNAMES+= mx32=../libx32$(call if_multiarch,:x86_64-linux-gnux32) -diff --git a/gcc/config/rs6000/t-linux b/gcc/config/rs6000/t-linux -index aeb7440c492..ab14c455d8d 100644 ---- a/gcc/config/rs6000/t-linux -+++ b/gcc/config/rs6000/t-linux -@@ -2,7 +2,8 @@ - # or soft-float. - ifeq (,$(filter $(with_cpu),$(SOFT_FLOAT_CPUS))$(findstring soft,$(with_float))) - ifneq (,$(findstring powerpc64,$(target))) --MULTILIB_OSDIRNAMES := .=../lib64$(call if_multiarch,:powerpc64-linux-gnu) -+MULTILIB_OSDIRNAMES := m64=../lib -+MULTILIB_OSDIRNAMES += m32=../lib32 - else - MULTIARCH_DIRNAME := $(call if_multiarch,powerpc-linux-gnu) - endif -@@ -10,7 +11,8 @@ ifneq (,$(findstring powerpcle,$(target))) - MULTIARCH_DIRNAME := $(subst -linux,le-linux,$(MULTIARCH_DIRNAME)) - endif - ifneq (,$(findstring powerpc64le,$(target))) --MULTILIB_OSDIRNAMES := $(subst -linux,le-linux,$(MULTILIB_OSDIRNAMES)) -+MULTILIB_OSDIRNAMES := m64=../lib -+MULTILIB_OSDIRNAMES += m32=../lib32 - endif - endif - -diff --git a/gcc/config/rs6000/t-linux64 b/gcc/config/rs6000/t-linux64 -index 264a7e27524..d1e460811cc 100644 ---- a/gcc/config/rs6000/t-linux64 -+++ b/gcc/config/rs6000/t-linux64 -@@ -28,8 +28,8 @@ - MULTILIB_OPTIONS := m64/m32 - MULTILIB_DIRNAMES := 64 32 - MULTILIB_EXTRA_OPTS := --MULTILIB_OSDIRNAMES := m64=../lib64$(call if_multiarch,:powerpc64-linux-gnu) --MULTILIB_OSDIRNAMES += m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:powerpc-linux-gnu) -+MULTILIB_OSDIRNAMES := m64=../lib -+MULTILIB_OSDIRNAMES += m32=../lib32 - - rs6000-linux.o: $(srcdir)/config/rs6000/rs6000-linux.c - $(COMPILE) $< -diff --git a/gcc/config/rs6000/t-linux64bele b/gcc/config/rs6000/t-linux64bele -index 97c1ee6fb4d..08d72639cb6 100644 ---- a/gcc/config/rs6000/t-linux64bele -+++ b/gcc/config/rs6000/t-linux64bele -@@ -2,6 +2,6 @@ - - MULTILIB_OPTIONS += mlittle - MULTILIB_DIRNAMES += le --MULTILIB_OSDIRNAMES += $(subst =,.mlittle=,$(subst lible32,lib32le,$(subst lible64,lib64le,$(subst lib,lible,$(subst -linux,le-linux,$(MULTILIB_OSDIRNAMES)))))) --MULTILIB_OSDIRNAMES += $(subst $(if $(findstring 64,$(target)),m64,m32).,,$(filter $(if $(findstring 64,$(target)),m64,m32).mlittle%,$(MULTILIB_OSDIRNAMES))) -+MULTILIB_OSDIRNAMES = m64=../lib -+MULTILIB_OSDIRNAMES+= m32=../lib32 - MULTILIB_MATCHES := ${MULTILIB_MATCHES_ENDIAN} -diff --git a/gcc/config/rs6000/t-linux64lebe b/gcc/config/rs6000/t-linux64lebe -index 2e63bdb9fc9..c6e1c5db65d 100644 ---- a/gcc/config/rs6000/t-linux64lebe -+++ b/gcc/config/rs6000/t-linux64lebe -@@ -2,6 +2,6 @@ - - MULTILIB_OPTIONS += mbig - MULTILIB_DIRNAMES += be --MULTILIB_OSDIRNAMES += $(subst =,.mbig=,$(subst libbe32,lib32be,$(subst libbe64,lib64be,$(subst lib,libbe,$(subst le-linux,-linux,$(MULTILIB_OSDIRNAMES)))))) --MULTILIB_OSDIRNAMES += $(subst $(if $(findstring 64,$(target)),m64,m32).,,$(filter $(if $(findstring 64,$(target)),m64,m32).mbig%,$(MULTILIB_OSDIRNAMES))) -+MULTILIB_OSDIRNAMES := m64=../lib -+MULTILIB_OSDIRNAMES += m32=../lib32 - MULTILIB_MATCHES := ${MULTILIB_MATCHES_ENDIAN} -diff --git a/gcc/config/s390/t-linux64 b/gcc/config/s390/t-linux64 -index cc6ab367072..7f498ee1cdc 100644 ---- a/gcc/config/s390/t-linux64 -+++ b/gcc/config/s390/t-linux64 -@@ -7,5 +7,5 @@ - - MULTILIB_OPTIONS = m64/m31 - MULTILIB_DIRNAMES = 64 32 --MULTILIB_OSDIRNAMES = ../lib64$(call if_multiarch,:s390x-linux-gnu) --MULTILIB_OSDIRNAMES += $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:s390-linux-gnu) -+MULTILIB_OSDIRNAMES = m64=../lib -+MULTILIB_OSDIRNAMES+= m32=../lib32 --- -2.31.1 - diff --git a/pat-12.1.0/gcc-alpine/0025-always-build-libgcc_eh.a.patch b/pat-12.1.0/gcc-alpine/0025-always-build-libgcc_eh.a.patch @@ -1,51 +0,0 @@ -From 00917df4274ea2fb33b08c963a97cf1b28f59dd3 Mon Sep 17 00:00:00 2001 -From: Ariadne Conill <ariadne@dereferenced.org> -Date: Fri, 21 Aug 2020 07:05:41 +0000 -Subject: [PATCH] always build libgcc_eh.a - -highly inspired by: - http://landley.net/hg/aboriginal/file/7e0747a665ab/sources/patches/gcc-core-libgcceh.patch ---- - libgcc/Makefile.in | 11 ++++++----- - 1 file changed, 6 insertions(+), 5 deletions(-) - -diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in -index 851e7657d07..99ec513a1a6 100644 ---- a/libgcc/Makefile.in -+++ b/libgcc/Makefile.in -@@ -956,8 +956,9 @@ ifneq ($(LIBUNWIND),) - all: libunwind.a - endif - -+all: libgcc_eh.a - ifeq ($(enable_shared),yes) --all: libgcc_eh.a libgcc_s$(SHLIB_EXT) -+all: libgcc_s$(SHLIB_EXT) - ifneq ($(LIBUNWIND),) - all: libunwind$(SHLIB_EXT) - libgcc_s$(SHLIB_EXT): libunwind$(SHLIB_EXT) -@@ -1159,10 +1160,6 @@ install-libunwind: - install-shared: - $(mkinstalldirs) $(DESTDIR)$(inst_libdir) - -- $(INSTALL_DATA) libgcc_eh.a $(DESTDIR)$(inst_libdir)/ -- chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a -- $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a -- - $(subst @multilib_dir@,$(MULTIDIR),$(subst \ - @shlib_base_name@,libgcc_s,$(subst \ - @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIB_INSTALL)))) -@@ -1179,6 +1176,10 @@ ifeq ($(enable_gcov),yes) - $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcov.a - endif - -+ $(INSTALL_DATA) libgcc_eh.a $(DESTDIR)$(inst_libdir)/ -+ chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a -+ $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a -+ - parts="$(INSTALL_PARTS)"; \ - for file in $$parts; do \ - rm -f $(DESTDIR)$(inst_libdir)/$$file; \ --- -2.31.1 - diff --git a/pat-12.1.0/gcc-alpine/0026-ada-libgnarl-compatibility-for-musl.patch b/pat-12.1.0/gcc-alpine/0026-ada-libgnarl-compatibility-for-musl.patch @@ -1,133 +0,0 @@ -From: Ariadne Conill <ariadne@dereferenced.org> -From: Olsken (updated patches) -Date: Sat, 21 Aug 2021 08:51:52 +0000 -Subject: [PATCH] ada: libgnarl compatibility for musl - -diff --git a/gcc/ada/libgnarl/s-osinte__linux.ads b/gcc/ada/libgnarl/s-osinte__linux.ads -index 2272f83d6..1d7845654 100644 ---- a/gcc/ada/libgnarl/s-osinte__linux.ads -+++ b/gcc/ada/libgnarl/s-osinte__linux.ads -@@ -401,12 +401,6 @@ package System.OS_Interface is - PTHREAD_RWLOCK_PREFER_WRITER_NP : constant := 1; - PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP : constant := 2; - -- function pthread_rwlockattr_setkind_np -- (attr : access pthread_rwlockattr_t; -- pref : int) return int; -- pragma Import -- (C, pthread_rwlockattr_setkind_np, "pthread_rwlockattr_setkind_np"); -- - function pthread_rwlock_init - (mutex : access pthread_rwlock_t; - attr : access pthread_rwlockattr_t) return int; -@@ -468,11 +462,6 @@ package System.OS_Interface is - protocol : int) return int; - pragma Import (C, pthread_mutexattr_setprotocol); - -- function pthread_mutexattr_setprioceiling -- (attr : access pthread_mutexattr_t; -- prioceiling : int) return int; -- pragma Import (C, pthread_mutexattr_setprioceiling); -- - type struct_sched_param is record - sched_priority : int; -- scheduling priority - end record; -diff --git a/gcc/ada/libgnarl/s-taprop__linux.adb b/gcc/ada/libgnarl/s-taprop__linux.adb -index 757a6cdfd..18e60e8d1 100644 ---- a/gcc/ada/libgnarl/s-taprop__linux.adb -+++ b/gcc/ada/libgnarl/s-taprop__linux.adb -@@ -198,9 +198,6 @@ package body System.Task_Primitives.Operations is - pragma Import - (C, GNAT_pthread_condattr_setup, "__gnat_pthread_condattr_setup"); - -- function GNAT_has_cap_sys_nice return C.int; -- pragma Import -- (C, GNAT_has_cap_sys_nice, "__gnat_has_cap_sys_nice"); - -- We do not have pragma Linker_Options ("-lcap"); here, because this - -- library is not present on many Linux systems. 'libcap' is the Linux - -- "capabilities" library, called by __gnat_has_cap_sys_nice. -@@ -210,44 +207,6 @@ package body System.Task_Primitives.Operations is - -- Convert Ada priority to Linux priority. Priorities are 1 .. 99 on - -- GNU/Linux, so we map 0 .. 98 to 1 .. 99. - -- function Get_Ceiling_Support return Boolean; -- -- Get the value of the Ceiling_Support constant (see below). -- -- Note well: If this function or related code is modified, it should be -- -- tested by hand, because automated testing doesn't exercise it. -- -- ------------------------- -- -- Get_Ceiling_Support -- -- ------------------------- -- -- function Get_Ceiling_Support return Boolean is -- Ceiling_Support : Boolean := False; -- begin -- if Locking_Policy /= 'C' then -- return False; -- end if; -- -- declare -- function geteuid return Integer; -- pragma Import (C, geteuid, "geteuid"); -- Superuser : constant Boolean := geteuid = 0; -- Has_Cap : constant C.int := GNAT_has_cap_sys_nice; -- pragma Assert (Has_Cap in 0 | 1); -- begin -- Ceiling_Support := Superuser or else Has_Cap = 1; -- end; -- -- return Ceiling_Support; -- end Get_Ceiling_Support; -- -- pragma Warnings (Off, "non-preelaborable call not allowed*"); -- Ceiling_Support : constant Boolean := Get_Ceiling_Support; -- pragma Warnings (On, "non-preelaborable call not allowed*"); -- -- True if the locking policy is Ceiling_Locking, and the current process -- -- has permission to use this policy. The process has permission if it is -- -- running as 'root', or if the capability was set by the setcap command, -- -- as in "sudo /sbin/setcap cap_sys_nice=ep exe_file". If it doesn't have -- -- permission, then a request for Ceiling_Locking is ignored. -- - type RTS_Lock_Ptr is not null access all RTS_Lock; - - function Init_Mutex (L : RTS_Lock_Ptr; Prio : Any_Priority) return C.int; -@@ -344,7 +303,9 @@ package body System.Task_Primitives.Operations is - -- Init_Mutex -- - ---------------- - -+ pragma Warnings (Off, "formal parameter * is not referenced"); - function Init_Mutex (L : RTS_Lock_Ptr; Prio : Any_Priority) return C.int is -+ pragma Warnings (On, "formal parameter * is not referenced"); - Mutex_Attr : aliased pthread_mutexattr_t; - Result, Result_2 : C.int; - -@@ -356,16 +317,7 @@ package body System.Task_Primitives.Operations is - return Result; - end if; - -- if Ceiling_Support then -- Result := pthread_mutexattr_setprotocol -- (Mutex_Attr'Access, PTHREAD_PRIO_PROTECT); -- pragma Assert (Result = 0); -- -- Result := pthread_mutexattr_setprioceiling -- (Mutex_Attr'Access, Prio_To_Linux_Prio (Prio)); -- pragma Assert (Result = 0); -- -- elsif Locking_Policy = 'I' then -+ if Locking_Policy = 'I' then - Result := pthread_mutexattr_setprotocol - (Mutex_Attr'Access, PTHREAD_PRIO_INHERIT); - pragma Assert (Result = 0); -@@ -405,11 +357,6 @@ package body System.Task_Primitives.Operations is - Result := pthread_rwlockattr_init (RWlock_Attr'Access); - pragma Assert (Result = 0); - -- Result := pthread_rwlockattr_setkind_np -- (RWlock_Attr'Access, -- PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP); -- pragma Assert (Result = 0); -- - Result := pthread_rwlock_init (L.RW'Access, RWlock_Attr'Access); - - pragma Assert (Result in 0 | ENOMEM); diff --git a/pat-12.1.0/gcc-alpine/0027-ada-musl-support-fixes.patch b/pat-12.1.0/gcc-alpine/0027-ada-musl-support-fixes.patch @@ -1,223 +0,0 @@ -From 21692d89e7876dcaecea3e3c961c6504be4a83e9 Mon Sep 17 00:00:00 2001 -From: Ariadne Conill <ariadne@dereferenced.org> -Date: Fri, 21 Aug 2020 07:07:48 +0000 -Subject: [PATCH] ada: musl support fixes - ---- - gcc/ada/Makefile.rtl | 10 +++++----- - gcc/ada/adaint.c | 34 +++++++++++++++++++--------------- - gcc/ada/adaint.h | 10 ++++------ - gcc/ada/terminals.c | 8 ++++---- - 4 files changed, 32 insertions(+), 30 deletions(-) - -diff --git a/gcc/ada/Makefile.rtl b/gcc/ada/Makefile.rtl -index 55ff9b0f3d5..0fadf4e4b79 100644 ---- a/gcc/ada/Makefile.rtl -+++ b/gcc/ada/Makefile.rtl -@@ -1533,7 +1533,7 @@ ifeq ($(strip $(filter-out %86 linux%,$(target_cpu) $(target_os))),) - s-intman.adb<libgnarl/s-intman__posix.adb \ - s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \ - $(TRASYM_DWARF_UNIX_PAIRS) \ -- s-tsmona.adb<libgnat/s-tsmona__linux.adb \ -+ s-tsmona.adb<libgnat/s-tsmona.adb \ - a-exetim.adb<libgnarl/a-exetim__posix.adb \ - a-exetim.ads<libgnarl/a-exetim__default.ads \ - s-linux.ads<libgnarl/s-linux.ads \ -@@ -2083,7 +2083,7 @@ ifeq ($(strip $(filter-out powerpc% linux%,$(target_cpu) $(target_os))),) - s-osinte.adb<libgnarl/s-osinte__posix.adb \ - s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \ - $(TRASYM_DWARF_UNIX_PAIRS) \ -- s-tsmona.adb<libgnat/s-tsmona__linux.adb \ -+ s-tsmona.adb<libgnat/s-tsmona.adb \ - $(ATOMICS_TARGET_PAIRS) \ - $(ATOMICS_BUILTINS_TARGET_PAIRS) \ - system.ads<libgnat/system-linux-ppc.ads -@@ -2112,7 +2112,7 @@ ifeq ($(strip $(filter-out powerpc% linux%,$(target_cpu) $(target_os))),) - endif - - # ARM linux, GNU eabi --ifeq ($(strip $(filter-out arm% linux-gnueabi%,$(target_cpu) $(target_os))),) -+ifeq ($(strip $(filter-out arm% linux-gnueabi% linux-musleabi% linux-muslgnueabi%,$(target_cpu) $(target_os))),) - LIBGNAT_TARGET_PAIRS = \ - a-intnam.ads<libgnarl/a-intnam__linux.ads \ - s-inmaop.adb<libgnarl/s-inmaop__posix.adb \ -@@ -2305,7 +2305,7 @@ ifeq ($(strip $(filter-out %ia64 linux%,$(target_cpu) $(target_os))),) - s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \ - s-taspri.ads<libgnarl/s-taspri__posix-noaltstack.ads \ - $(TRASYM_DWARF_UNIX_PAIRS) \ -- s-tsmona.adb<libgnat/s-tsmona__linux.adb \ -+ s-tsmona.adb<libgnat/s-tsmona.adb \ - $(ATOMICS_TARGET_PAIRS) \ - $(ATOMICS_BUILTINS_TARGET_PAIRS) \ - system.ads<libgnat/system-linux-ia64.ads -@@ -2401,7 +2401,7 @@ ifeq ($(strip $(filter-out %x86_64 linux%,$(target_cpu) $(target_os))),) - s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \ - s-taspri.ads<libgnarl/s-taspri__posix.ads \ - $(TRASYM_DWARF_UNIX_PAIRS) \ -- s-tsmona.adb<libgnat/s-tsmona__linux.adb \ -+ s-tsmona.adb<libgnat/s-tsmona.adb \ - $(ATOMICS_TARGET_PAIRS) \ - $(X86_64_TARGET_PAIRS) \ - system.ads<libgnat/system-linux-x86.ads -diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c -index 595abf87d65..00858c24f53 100644 ---- a/gcc/ada/adaint.c -+++ b/gcc/ada/adaint.c -@@ -90,6 +90,11 @@ - #include <sys/param.h> - #include <sys/pstat.h> - #endif -+ -+#if defined (linux) -+#define _GNU_SOURCE 1 -+#include <sched.h> -+#endif - - #ifdef __PikeOS__ - #define __BSD_VISIBLE 1 -@@ -3308,7 +3313,6 @@ __gnat_lwp_self (void) - #endif - - #if defined (__linux__) --#include <sched.h> - - /* glibc versions earlier than 2.7 do not define the routines to handle - dynamically allocated CPU sets. For these targets, we use the static -@@ -3318,7 +3322,7 @@ __gnat_lwp_self (void) - - /* Dynamic cpu sets */ - --cpu_set_t * -+void * - __gnat_cpu_alloc (size_t count) - { - return CPU_ALLOC (count); -@@ -3331,33 +3335,33 @@ __gnat_cpu_alloc_size (size_t count) - } - - void --__gnat_cpu_free (cpu_set_t *set) -+__gnat_cpu_free (void *set) - { -- CPU_FREE (set); -+ CPU_FREE ((cpu_set_t *) set); - } - - void --__gnat_cpu_zero (size_t count, cpu_set_t *set) -+__gnat_cpu_zero (size_t count, void *set) - { -- CPU_ZERO_S (count, set); -+ CPU_ZERO_S (count, (cpu_set_t *) set); - } - - void --__gnat_cpu_set (int cpu, size_t count, cpu_set_t *set) -+__gnat_cpu_set (int cpu, size_t count, void *set) - { - /* Ada handles CPU numbers starting from 1, while C identifies the first - CPU by a 0, so we need to adjust. */ -- CPU_SET_S (cpu - 1, count, set); -+ CPU_SET_S (cpu - 1, count, (cpu_set_t *) set); - } - - #else /* !CPU_ALLOC */ - - /* Static cpu sets */ - --cpu_set_t * -+void * - __gnat_cpu_alloc (size_t count ATTRIBUTE_UNUSED) - { -- return (cpu_set_t *) xmalloc (sizeof (cpu_set_t)); -+ return xmalloc (sizeof (cpu_set_t)); - } - - size_t -@@ -3367,23 +3371,23 @@ __gnat_cpu_alloc_size (size_t count ATTRIBUTE_UNUSED) - } - - void --__gnat_cpu_free (cpu_set_t *set) -+__gnat_cpu_free (void *set) - { - free (set); - } - - void --__gnat_cpu_zero (size_t count ATTRIBUTE_UNUSED, cpu_set_t *set) -+__gnat_cpu_zero (size_t count ATTRIBUTE_UNUSED, void *set) - { -- CPU_ZERO (set); -+ CPU_ZERO ((cpu_set_t *) set); - } - - void --__gnat_cpu_set (int cpu, size_t count ATTRIBUTE_UNUSED, cpu_set_t *set) -+__gnat_cpu_set (int cpu, size_t count ATTRIBUTE_UNUSED, void *set) - { - /* Ada handles CPU numbers starting from 1, while C identifies the first - CPU by a 0, so we need to adjust. */ -- CPU_SET (cpu - 1, set); -+ CPU_SET (cpu - 1, (cpu_set_t *) set); - } - #endif /* !CPU_ALLOC */ - #endif /* __linux__ */ -diff --git a/gcc/ada/adaint.h b/gcc/ada/adaint.h -index 311e240dfcc..1c4d0050103 100644 ---- a/gcc/ada/adaint.h -+++ b/gcc/ada/adaint.h -@@ -316,13 +316,11 @@ extern void *__gnat_lwp_self (void); - - /* Routines for interface to required CPU set primitives */ - --#include <sched.h> -- --extern cpu_set_t *__gnat_cpu_alloc (size_t); -+extern void * __gnat_cpu_alloc (size_t); - extern size_t __gnat_cpu_alloc_size (size_t); --extern void __gnat_cpu_free (cpu_set_t *); --extern void __gnat_cpu_zero (size_t, cpu_set_t *); --extern void __gnat_cpu_set (int, size_t, cpu_set_t *); -+extern void __gnat_cpu_free (void *); -+extern void __gnat_cpu_zero (size_t, void *); -+extern void __gnat_cpu_set (int, size_t, void *); - #endif - - #if defined (_WIN32) -diff --git a/gcc/ada/terminals.c b/gcc/ada/terminals.c -index af4417fab90..bab6bf3ca87 100644 ---- a/gcc/ada/terminals.c -+++ b/gcc/ada/terminals.c -@@ -1145,7 +1145,7 @@ __gnat_setup_winsize (void *desc, int rows, int columns) - /* POSIX does not specify how to open the master side of a terminal.Several - methods are available (system specific): - 1- using a cloning device (USE_CLONE_DEVICE) -- 2- getpt (USE_GETPT) -+ 2- posix_openpt (USE_POSIX_OPENPT) - 3- openpty (USE_OPENPTY) - - When using the cloning device method, the macro USE_CLONE_DEVICE should -@@ -1159,7 +1159,7 @@ __gnat_setup_winsize (void *desc, int rows, int columns) - #if defined (__APPLE__) || defined (BSD) - #define USE_OPENPTY - #elif defined (__linux__) --#define USE_GETPT -+#define USE_POSIX_OPENPT - #elif defined (__sun__) - #define USE_CLONE_DEVICE "/dev/ptmx" - #elif defined (_AIX) -@@ -1208,8 +1208,8 @@ allocate_pty_desc (pty_desc **desc) { - int master_fd = -1; - char *slave_name = NULL; - --#ifdef USE_GETPT -- master_fd = getpt (); -+#if defined(USE_POSIX_OPENPT) -+ master_fd = posix_openpt(O_RDWR | O_NOCTTY); - #elif defined (USE_OPENPTY) - status = openpty (&master_fd, &slave_fd, NULL, NULL, NULL); - #elif defined (USE_CLONE_DEVICE) --- -2.31.1 - diff --git a/pat-12.1.0/gcc-alpine/0028-gcc-go-Use-_off_t-type-instead-of-_loff_t.patch b/pat-12.1.0/gcc-alpine/0028-gcc-go-Use-_off_t-type-instead-of-_loff_t.patch @@ -1,48 +0,0 @@ -From 1852ae06e733180f090b58c267bde8fb9501a41e Mon Sep 17 00:00:00 2001 -From: "A. Wilcox" <AWilcox@Wilcox-Tech.com> -Date: Sun, 30 Aug 2020 17:58:08 +0200 -Subject: [PATCH] gcc-go: Use _off_t type instead of _loff_t -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Taken from Adélie Linux. ---- - libgo/go/syscall/libcall_linux.go | 16 ++++++++-------- - 1 file changed, 8 insertions(+), 8 deletions(-) - -diff --git a/libgo/go/syscall/libcall_linux.go b/libgo/go/syscall/libcall_linux.go -index 88286c07b6e..f8f5cfb5011 100644 ---- a/libgo/go/syscall/libcall_linux.go -+++ b/libgo/go/syscall/libcall_linux.go -@@ -206,19 +206,19 @@ func Gettid() (tid int) { - //sys Setxattr(path string, attr string, data []byte, flags int) (err error) - //setxattr(path *byte, name *byte, value *byte, size Size_t, flags _C_int) _C_int - --//sys splice(rfd int, roff *_loff_t, wfd int, woff *_loff_t, len int, flags int) (n int64, err error) --//splice(rfd _C_int, roff *_loff_t, wfd _C_int, woff *_loff_t, len Size_t, flags _C_uint) Ssize_t -+//sys splice(rfd int, roff *_off_t, wfd int, woff *_off_t, len int, flags int) (n int64, err error) -+//splice(rfd _C_int, roff *_off_t, wfd _C_int, woff *_off_t, len Size_t, flags _C_uint) Ssize_t - func Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error) { -- var lroff _loff_t -- var plroff *_loff_t -+ var lroff _off_t -+ var plroff *_off_t - if roff != nil { -- lroff = _loff_t(*roff) -+ lroff = _off_t(*roff) - plroff = &lroff - } -- var lwoff _loff_t -- var plwoff *_loff_t -+ var lwoff _off_t -+ var plwoff *_off_t - if woff != nil { -- lwoff = _loff_t(*woff) -+ lwoff = _off_t(*woff) - plwoff = &lwoff - } - n, err = splice(rfd, plroff, wfd, plwoff, len, flags) --- -2.31.1 - diff --git a/pat-12.1.0/gcc-alpine/0029-gcc-go-Don-t-include-sys-user.h.patch b/pat-12.1.0/gcc-alpine/0029-gcc-go-Don-t-include-sys-user.h.patch @@ -1,30 +0,0 @@ -From 40322de36043aaa3cbb98d7f01037f53fc1b5a98 Mon Sep 17 00:00:00 2001 -From: "A. Wilcox" <AWilcox@Wilcox-Tech.com> -Date: Sun, 30 Aug 2020 17:58:21 +0200 -Subject: [PATCH] gcc-go: Don't include sys/user.h -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Taken from Adélie Linux. ---- - libgo/sysinfo.c | 3 --- - 1 file changed, 3 deletions(-) - -diff --git a/libgo/sysinfo.c b/libgo/sysinfo.c -index 0692fd41eb7..c8d987358d9 100644 ---- a/libgo/sysinfo.c -+++ b/libgo/sysinfo.c -@@ -73,9 +73,6 @@ - #include <sys/times.h> - #include <sys/wait.h> - #include <sys/un.h> --#if defined(HAVE_SYS_USER_H) --#include <sys/user.h> --#endif - #if defined(HAVE_SYS_UTSNAME_H) - #include <sys/utsname.h> - #endif --- -2.31.1 - diff --git a/pat-12.1.0/gcc-alpine/0030-gcc-go-Fix-ucontext_t-on-PPC64.patch b/pat-12.1.0/gcc-alpine/0030-gcc-go-Fix-ucontext_t-on-PPC64.patch @@ -1,29 +0,0 @@ -From f1503cf97b5a5c6f9466145f5eb1ed3b5f200119 Mon Sep 17 00:00:00 2001 -From: "A. Wilcox" <AWilcox@Wilcox-Tech.com> -Date: Sun, 30 Aug 2020 17:59:22 +0200 -Subject: [PATCH] gcc-go: Fix ucontext_t on PPC64 -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Taken from Adélie Linux. ---- - libgo/runtime/go-signal.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/libgo/runtime/go-signal.c b/libgo/runtime/go-signal.c -index b429fdb2403..fd1c885f043 100644 ---- a/libgo/runtime/go-signal.c -+++ b/libgo/runtime/go-signal.c -@@ -224,7 +224,7 @@ getSiginfo(siginfo_t *info, void *context __attribute__((unused))) - #elif defined(__alpha__) && defined(__linux__) - ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.sc_pc; - #elif defined(__PPC__) && defined(__linux__) -- ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.regs->nip; -+ ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.gp_regs[32]; - #elif defined(__PPC__) && defined(_AIX) - ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.jmp_context.iar; - #elif defined(__aarch64__) && defined(__linux__) --- -2.31.1 - diff --git a/pat-12.1.0/gcc-alpine/0031-gcc-go-Fix-handling-of-signal-34-on-musl.patch b/pat-12.1.0/gcc-alpine/0031-gcc-go-Fix-handling-of-signal-34-on-musl.patch @@ -1,43 +0,0 @@ -From fc950e32b9ebc2bae09604ebe630df6df454151d Mon Sep 17 00:00:00 2001 -From: "A. Wilcox" <AWilcox@Wilcox-Tech.com> -Date: Sun, 30 Aug 2020 17:59:45 +0200 -Subject: [PATCH] gcc-go: Fix handling of signal 34 on musl -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Taken from Adélie Linux. ---- - libgo/mksigtab.sh | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -diff --git a/libgo/mksigtab.sh b/libgo/mksigtab.sh -index 11e4ec436bd..fe866eacb27 100644 ---- a/libgo/mksigtab.sh -+++ b/libgo/mksigtab.sh -@@ -82,7 +82,7 @@ checksig _SIGPWR '{_SigNotify, "SIGPWR: power failure restart"}' - checksig _SIGEMT '{_SigThrow, "SIGEMT: emulate instruction executed"}' - checksig _SIGINFO '{_SigNotify, "SIGINFO: status request from keyboard"}' - checksig _SIGTHR '{_SigNotify, "SIGTHR: reserved"}' --checksig _SIGPOLL '{_SigNotify, "SIGPOLL: pollable event occurred"}' -+#checksig _SIGPOLL '{_SigNotify, "SIGPOLL: pollable event occurred"}' - checksig _SIGWAITING '{_SigNotify, "SIGWAITING: reserved signal no longer used by"}' - checksig _SIGLWP '{_SigNotify, "SIGLWP: reserved signal no longer used by"}' - checksig _SIGFREEZE '{_SigNotify, "SIGFREEZE: special signal used by CPR"}' -@@ -95,10 +95,12 @@ checksig _SIGLOST ' {_SigNotify, "SIGLOST: resource lost (Sun); server died (G - - # Special handling of signals 32 and 33 on GNU/Linux systems, - # because they are special to glibc. -+# Signal 34 is additionally special to Linux systems with musl. - if test "${GOOS}" = "linux"; then -- SIGLIST=$SIGLIST"_32__33_" -+ SIGLIST=$SIGLIST"_32__33__34_" - echo ' 32: {_SigSetStack + _SigUnblock, "signal 32"}, /* SIGCANCEL; see issue 6997 */' - echo ' 33: {_SigSetStack + _SigUnblock, "signal 33"}, /* SIGSETXID; see issues 3871, 9400, 12498 */' -+ echo ' 34: {_SigSetStack + _SigUnblock, "signal 34"}, /* see issue 30062 */' - fi - - if test "${GOOS}" = "aix"; then --- -2.31.1 - diff --git a/pat-12.1.0/gcc-alpine/0032-gcc-go-Use-int64-type-as-offset-argument-for-mmap.patch b/pat-12.1.0/gcc-alpine/0032-gcc-go-Use-int64-type-as-offset-argument-for-mmap.patch @@ -1,38 +0,0 @@ -From 3be2284d92c560204e9eddb20db56d57fe584360 Mon Sep 17 00:00:00 2001 -From: "A. Wilcox" <AWilcox@Wilcox-Tech.com> -Date: Sun, 30 Aug 2020 18:01:03 +0200 -Subject: [PATCH] gcc-go: Use int64 type as offset argument for mmap -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Taken from Adélie Linux. ---- - libgo/go/runtime/mem_gccgo.go | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/libgo/go/runtime/mem_gccgo.go b/libgo/go/runtime/mem_gccgo.go -index ba38ebaa9ab..3c9e5ce9461 100644 ---- a/libgo/go/runtime/mem_gccgo.go -+++ b/libgo/go/runtime/mem_gccgo.go -@@ -15,7 +15,7 @@ import ( - //go:linkname sysFree - - //extern mmap --func sysMmap(addr unsafe.Pointer, n uintptr, prot, flags, fd int32, off uintptr) unsafe.Pointer -+func sysMmap(addr unsafe.Pointer, n uintptr, prot, flags, fd int32, off int64) unsafe.Pointer - - //extern munmap - func munmap(addr unsafe.Pointer, length uintptr) int32 -@@ -37,7 +37,7 @@ func init() { - } - } - --func mmap(addr unsafe.Pointer, n uintptr, prot, flags, fd int32, off uintptr) (unsafe.Pointer, int) { -+func mmap(addr unsafe.Pointer, n uintptr, prot, flags, fd int32, off int64) (unsafe.Pointer, int) { - p := sysMmap(addr, n, prot, flags, fd, off) - if uintptr(p) == _MAP_FAILED { - return nil, errno() --- -2.31.1 - diff --git a/pat-12.1.0/gcc-alpine/0033-gcc-go-Fix-st_-a-m-c-tim-fields-in-generated-sysinfo.patch b/pat-12.1.0/gcc-alpine/0033-gcc-go-Fix-st_-a-m-c-tim-fields-in-generated-sysinfo.patch @@ -1,24 +0,0 @@ -From: "A. Wilcox" <AWilcox@Wilcox-Tech.com> -From: Olsken (updated patches) -Date: Sat, 21 Aug 2021 08:51:52 +0000 -Subject: [PATCH] gcc-go: Fix st_{a,m,c}tim fields in generated sysinfo.go - -There are more than one st_{a,m,c}tim fields in struct stat on time64 machines. - -Run the Go-isation on all of them. - -Taken from Adélie Linux. - -diff --git a/libgo/mksysinfo.sh b/libgo/mksysinfo.sh -index 0c52ea5d7..6fef104cc 100755 ---- a/libgo/mksysinfo.sh -+++ b/libgo/mksysinfo.sh -@@ -510,7 +510,7 @@ fi - - # For historical reasons Go uses the suffix "timespec" instead of "tim" for - # stat_t's time fields on NetBSD. --st_times='-e s/st_atim/Atim/ -e s/st_mtim/Mtim/ -e s/st_ctim/Ctim/' -+st_times='-e s/st_atim/Atim/g -e s/st_mtim/Mtim/g -e s/st_ctim/Ctim/g' - if test "${GOOS}" = "netbsd"; then - st_times='-e s/st_atim/Atimespec/ -e s/st_mtim/Mtimespec/ -e s/st_ctim/Ctimespec/' - fi diff --git a/pat-12.1.0/gcc-alpine/0034-gcc-go-signal-34-is-special-on-musl-libc.patch b/pat-12.1.0/gcc-alpine/0034-gcc-go-signal-34-is-special-on-musl-libc.patch @@ -1,29 +0,0 @@ -From dd1465b56f76ada5c7383ebd98ef02311a3b907c Mon Sep 17 00:00:00 2001 -From: "A. Wilcox" <AWilcox@Wilcox-Tech.com> -Date: Sun, 30 Aug 2020 18:03:03 +0200 -Subject: [PATCH] gcc-go: signal 34 is special on musl libc -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Taken from Adélie Linux. ---- - libgo/go/runtime/signal_gccgo.go | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/libgo/go/runtime/signal_gccgo.go b/libgo/go/runtime/signal_gccgo.go -index c555712a03c..9e228580d37 100644 ---- a/libgo/go/runtime/signal_gccgo.go -+++ b/libgo/go/runtime/signal_gccgo.go -@@ -106,7 +106,7 @@ func getsig(i uint32) uintptr { - if sigaction(i, nil, &sa) < 0 { - // On GNU/Linux glibc rejects attempts to call - // sigaction with signal 32 (SIGCANCEL) or 33 (SIGSETXID). -- if GOOS == "linux" && (i == 32 || i == 33) { -+ if GOOS == "linux" && (i == 32 || i == 33 || i == 34) { - return _SIG_DFL - } - throw("sigaction read failure") --- -2.31.1 - diff --git a/pat-12.1.0/gcc-alpine/0035-gcc-go-Prefer-_off_t-over-_off64_t.patch b/pat-12.1.0/gcc-alpine/0035-gcc-go-Prefer-_off_t-over-_off64_t.patch @@ -1,30 +0,0 @@ -From 382d4516db8a7c183e9d7b5ec16a9bc175523ac9 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net> -Date: Sun, 30 Aug 2020 19:26:53 +0200 -Subject: [PATCH] gcc-go: Prefer _off_t over _off64_t - -musl does not seem to have _off64_t. ---- - libgo/mksysinfo.sh | 6 +----- - 1 file changed, 1 insertion(+), 5 deletions(-) - -diff --git a/libgo/mksysinfo.sh b/libgo/mksysinfo.sh -index 972e2c379bc..8d6da15f983 100755 ---- a/libgo/mksysinfo.sh -+++ b/libgo/mksysinfo.sh -@@ -379,11 +379,7 @@ fi - # Some basic types. - echo 'type Size_t _size_t' >> ${OUT} - echo "type Ssize_t _ssize_t" >> ${OUT} --if grep '^const _HAVE_OFF64_T = ' gen-sysinfo.go > /dev/null 2>&1; then -- echo "type Offset_t _off64_t" >> ${OUT} --else -- echo "type Offset_t _off_t" >> ${OUT} --fi -+echo "type Offset_t _off_t" >> ${OUT} - echo "type Mode_t _mode_t" >> ${OUT} - echo "type Pid_t _pid_t" >> ${OUT} - echo "type Uid_t _uid_t" >> ${OUT} --- -2.31.1 - diff --git a/pat-12.1.0/gcc-alpine/0036-gcc-go-undef-SETCONTEXT_CLOBBERS_TLS-in-proc.c.patch b/pat-12.1.0/gcc-alpine/0036-gcc-go-undef-SETCONTEXT_CLOBBERS_TLS-in-proc.c.patch @@ -1,27 +0,0 @@ -From 79d8ab42aefb1d3c5f794f51df643ab040c30e30 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net> -Date: Sun, 30 Aug 2020 19:27:51 +0200 -Subject: [PATCH] gcc-go: undef SETCONTEXT_CLOBBERS_TLS in proc.c - ---- - libgo/runtime/proc.c | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/libgo/runtime/proc.c b/libgo/runtime/proc.c -index 6f7d2e27996..5afd7902497 100644 ---- a/libgo/runtime/proc.c -+++ b/libgo/runtime/proc.c -@@ -66,6 +66,10 @@ static void gscanstack(G*); - - __thread G *g __asm__(GOSYM_PREFIX "runtime.g"); - -+/* libucontext does not seem to support tlsbase, undef the macro -+ * here to make sure we define initcontext and fixcontext as dummies. */ -+#undef SETCONTEXT_CLOBBERS_TLS -+ - #ifndef SETCONTEXT_CLOBBERS_TLS - - static inline void --- -2.31.1 - diff --git a/pat-12.1.0/gcc-alpine/0037-gcc-go-link-to-libucontext.patch b/pat-12.1.0/gcc-alpine/0037-gcc-go-link-to-libucontext.patch @@ -1,25 +0,0 @@ -From d42de24395e4f07cf6412896d4cd8c7f83a9b875 Mon Sep 17 00:00:00 2001 -From: "A. Wilcox" <AWilcox@Wilcox-Tech.com> -Date: Mon, 31 Aug 2020 08:59:40 +0200 -Subject: [PATCH] gcc-go: link to libucontext - ---- - Makefile.in | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/Makefile.in b/Makefile.in -index 63627db68cf..c7f1f84d683 100644 ---- a/Makefile.in -+++ b/Makefile.in -@@ -48823,7 +48823,7 @@ configure-target-libgo: - esac; \ - module_srcdir=libgo; \ - rm -f no-such-file || : ; \ -- CONFIG_SITE=no-such-file $(SHELL) \ -+ CONFIG_SITE=no-such-file LIBS="-lucontext $$LIBS" $(SHELL) \ - $$s/$$module_srcdir/configure \ - --srcdir=$${topdir}/$$module_srcdir \ - $(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \ --- -2.31.1 - diff --git a/pat-12.1.0/gcc-alpine/0038-gcc-go-Disable-printing-of-unaccessible-ppc64-struct.patch b/pat-12.1.0/gcc-alpine/0038-gcc-go-Disable-printing-of-unaccessible-ppc64-struct.patch @@ -1,26 +0,0 @@ -From 570cd2b596daf12e8dfe1a444fe405a7c26fc2bc Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net> -Date: Mon, 31 Aug 2020 20:26:56 +0200 -Subject: [PATCH] gcc-go: Disable printing of unaccessible ppc64 struct members - -These struct members do not seem to exist on musl. ---- - libgo/runtime/go-signal.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/libgo/runtime/go-signal.c b/libgo/runtime/go-signal.c -index fd1c885f043..e845e453332 100644 ---- a/libgo/runtime/go-signal.c -+++ b/libgo/runtime/go-signal.c -@@ -333,7 +333,7 @@ dumpregs(siginfo_t *info __attribute__((unused)), void *context __attribute__((u - runtime_printf("sp %X\n", m->sc_regs[30]); - runtime_printf("pc %X\n", m->sc_pc); - } --#elif defined(__PPC__) && defined(__LITTLE_ENDIAN__) && defined(__linux__) -+#elif defined(__PPC__) && defined(__LITTLE_ENDIAN__) && defined(__GLIBC__) - { - mcontext_t *m = &((ucontext_t*)(context))->uc_mcontext; - int i; --- -2.31.1 - diff --git a/pat-12.1.0/gcc-alpine/0040-configure-Add-enable-autolink-libatomic-use-in-LINK_.patch b/pat-12.1.0/gcc-alpine/0040-configure-Add-enable-autolink-libatomic-use-in-LINK_.patch @@ -1,264 +0,0 @@ -From: Drew DeVault <sir@cmpwn.com> -From: Olsken (updated patches) -Date: Sat, 21 Aug 2021 08:51:52 +0000 -Subject: [PATCH] configure: Add --enable-autolink-libatomic, use in - LINK_GCC_C_SEQUENCE_SPEC [PR81358] - -This fixes issues with RISC-V. - -diff --git a/Makefile.in b/Makefile.in -index 047be0255..765f6b89b 100644 ---- a/Makefile.in -+++ b/Makefile.in -@@ -221,6 +221,7 @@ HOST_EXPORTS = \ - RANLIB_FOR_TARGET="$(RANLIB_FOR_TARGET)"; export RANLIB_FOR_TARGET; \ - READELF_FOR_TARGET="$(READELF_FOR_TARGET)"; export READELF_FOR_TARGET; \ - TOPLEVEL_CONFIGURE_ARGUMENTS="$(TOPLEVEL_CONFIGURE_ARGUMENTS)"; export TOPLEVEL_CONFIGURE_ARGUMENTS; \ -+ TARGET_CONFIGDIRS="$(TARGET_CONFIGDIRS)"; export TARGET_CONFIGDIRS; \ - HOST_LIBS="$(STAGE1_LIBS)"; export HOST_LIBS; \ - GMPLIBS="$(HOST_GMPLIBS)"; export GMPLIBS; \ - GMPINC="$(HOST_GMPINC)"; export GMPINC; \ -diff --git a/gcc/config.in b/gcc/config.in -index 313c13c8e..d0287d4cc 100644 ---- a/gcc/config.in -+++ b/gcc/config.in -@@ -106,6 +106,12 @@ - #endif - - -+/* Define if libatomic should always be linked. */ -+#ifndef USED_FOR_TARGET -+#undef ENABLE_AUTOLINK_LIBATOMIC -+#endif -+ -+ - /* Define to 1 to specify that we are using the BID decimal floating point - format instead of DPD */ - #ifndef USED_FOR_TARGET -diff --git a/gcc/config/gnu-user.h b/gcc/config/gnu-user.h -index e1a04e9fd..ef1ffa6d2 100644 ---- a/gcc/config/gnu-user.h -+++ b/gcc/config/gnu-user.h -@@ -109,8 +109,18 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see - #define LINK_EH_SPEC "%{!static|static-pie:--eh-frame-hdr} " - #endif - -+#if !defined(LINK_LIBATOMIC_SPEC) && defined(ENABLE_AUTOLINK_LIBATOMIC) -+# ifdef LD_AS_NEEDED_OPTION -+# define LINK_LIBATOMIC_SPEC LD_AS_NEEDED_OPTION " -latomic " LD_NO_AS_NEEDED_OPTION -+# else -+# define LINK_LIBATOMIC_SPEC "-latomic" -+# endif -+#elif !defined(LINK_LIBATOMIC_SPEC) -+# define LINK_LIBATOMIC_SPEC "" -+#endif -+ - #define GNU_USER_TARGET_LINK_GCC_C_SEQUENCE_SPEC \ -- "%{static|static-pie:--start-group} %G %{!nolibc:%L} \ -+ "%{static|static-pie:--start-group} %G %{!nolibc:" LINK_LIBATOMIC_SPEC " %L} \ - %{static|static-pie:--end-group}%{!static:%{!static-pie:%G}}" - - #undef LINK_GCC_C_SEQUENCE_SPEC -diff --git a/gcc/configure b/gcc/configure -index 9b28369e3..8afa1c84f 100755 ---- a/gcc/configure -+++ b/gcc/configure -@@ -978,6 +978,7 @@ with_changes_root_url - enable_languages - with_multilib_list - with_multilib_generator -+enable_autolink_libatomic - with_zstd - with_zstd_include - with_zstd_lib -@@ -1706,6 +1707,9 @@ Optional Features: - --disable-shared don't provide a shared libgcc - --disable-gcov don't provide libgcov and related host tools - --enable-languages=LIST specify which front-ends to build -+ --enable-autolink-libatomic -+ enable automatic linking of libatomic (ignored if -+ not built) - --disable-rpath do not hardcode runtime library paths - --enable-sjlj-exceptions - arrange to use setjmp/longjmp exception handling -@@ -8076,6 +8080,33 @@ else - fi - - -+# If libatomic is available, whether it should be linked automatically -+# Check whether --enable-autolink-libatomic was given. -+if test "${enable_autolink_libatomic+set}" = set; then : -+ enableval=$enable_autolink_libatomic; -+ case $enable_autolink_libatomic in -+ yes | no) ;; -+ *) as_fn_error $? "'$enable_autolink_libatomic' is an invalid value for -+--enable-autolink-libatomic. Valid choices are 'yes' and 'no'." "$LINENO" 5 ;; -+ esac -+ -+else -+ enable_autolink_libatomic='' -+fi -+ -+ -+if test x$enable_autolink_libatomic = xyes; then -+ if echo " ${TARGET_CONFIGDIRS} " | grep " libatomic " > /dev/null 2>&1 ; then -+ -+$as_echo "#define ENABLE_AUTOLINK_LIBATOMIC 1" >>confdefs.h -+ -+ else -+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libatomic is not build for this target, --enable-autolink-libatomic ignored" >&5 -+$as_echo "$as_me: WARNING: libatomic is not build for this target, --enable-autolink-libatomic ignored" >&2;} -+ fi -+fi -+ -+ - # ------------------------- - # Checks for other programs - # ------------------------- -@@ -19392,7 +19423,7 @@ else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF --#line 19395 "configure" -+#line 19426 "configure" - #include "confdefs.h" - - #if HAVE_DLFCN_H -@@ -19498,7 +19529,7 @@ else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF --#line 19501 "configure" -+#line 19532 "configure" - #include "confdefs.h" - - #if HAVE_DLFCN_H -@@ -33588,4 +33619,3 @@ if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then - $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} - fi - -- -diff --git a/gcc/configure.ac b/gcc/configure.ac -index 162e08cbc..115ba8ac6 100644 ---- a/gcc/configure.ac -+++ b/gcc/configure.ac -@@ -1149,6 +1149,28 @@ AC_ARG_WITH(multilib-generator, - :, - with_multilib_generator=default) - -+# If libatomic is available, whether it should be linked automatically -+AC_ARG_ENABLE(autolink-libatomic, -+[AS_HELP_STRING([--enable-autolink-libatomic], -+ [enable automatic linking of libatomic (ignored if not built)])], -+[ -+ case $enable_autolink_libatomic in -+ yes | no) ;; -+ *) AC_MSG_ERROR(['$enable_autolink_libatomic' is an invalid value for -+--enable-autolink-libatomic. Valid choices are 'yes' and 'no'.]) ;; -+ esac -+], [enable_autolink_libatomic='']) -+ -+if test x$enable_autolink_libatomic = xyes; then -+ if echo " ${TARGET_CONFIGDIRS} " | grep " libatomic " > /dev/null 2>&1 ; then -+ AC_DEFINE(ENABLE_AUTOLINK_LIBATOMIC, 1, -+ [Define if libatomic should always be linked.]) -+ else -+ AC_MSG_WARN([libatomic is not build for this target, --enable-autolink-libatomic ignored]) -+ fi -+fi -+ -+ - # ------------------------- - # Checks for other programs - # ------------------------- -@@ -7553,4 +7575,3 @@ done - ], - [subdirs='$subdirs']) - AC_OUTPUT -- -diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi -index 4c38244ae..4a544e6a4 100644 ---- a/gcc/doc/install.texi -+++ b/gcc/doc/install.texi -@@ -2213,6 +2213,14 @@ files, but these changed header paths may conflict with some compilation - environments. Enabled by default, and may be disabled using - @option{--disable-canonical-system-headers}. - -+@item --enable-autolink-libatomic -+@itemx --disable-autolink-libatomic -+Tell GCC that it should automatically link libatomic; if supported by -+the linker, the file is only linked as needed. This flag is ignored -+when libatomic is not built. Note that this conigure flag is in particular -+useful when building an offloading-target compiler; as for those, a -+user had to specify @code{-foffload=target=-latomic} otherwise. -+ - @item --with-glibc-version=@var{major}.@var{minor} - Tell GCC that when the GNU C Library (glibc) is used on the target it - will be version @var{major}.@var{minor} or later. Normally this can -diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi -index b370bc76b..acc782739 100644 ---- a/gcc/doc/tm.texi -+++ b/gcc/doc/tm.texi -@@ -381,7 +381,13 @@ the argument @option{-lgcc} to tell the linker to do the search. - - @defmac LINK_GCC_C_SEQUENCE_SPEC - The sequence in which libgcc and libc are specified to the linker. --By default this is @code{%G %L %G}. -+By default this is @code{%G LINK_LIBATOMIC_SPEC %L %G}. -+@end defmac -+ -+@defmac LINK_LIBATOMIC_SPEC -+This macro is used in the default @code{LINK_GCC_C_SEQUENCE_SPEC} to link -+libatomic. By default, it is unset unless @code{ENABLE_AUTOLINK_LIBATOMIC} -+is set. - @end defmac - - @defmac POST_LINK_SPEC -diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in -index 2974dae27..80e003a38 100644 ---- a/gcc/doc/tm.texi.in -+++ b/gcc/doc/tm.texi.in -@@ -381,7 +381,13 @@ the argument @option{-lgcc} to tell the linker to do the search. - - @defmac LINK_GCC_C_SEQUENCE_SPEC - The sequence in which libgcc and libc are specified to the linker. --By default this is @code{%G %L %G}. -+By default this is @code{%G LINK_LIBATOMIC_SPEC %L %G}. -+@end defmac -+ -+@defmac LINK_LIBATOMIC_SPEC -+This macro is used in the default @code{LINK_GCC_C_SEQUENCE_SPEC} to link -+libatomic. By default, it is unset unless @code{ENABLE_AUTOLINK_LIBATOMIC} -+is set. - @end defmac - - @defmac POST_LINK_SPEC -diff --git a/gcc/gcc.c b/gcc/gcc.c -index d7f3ee55c..bc1bd1686 100644 ---- a/gcc/gcc.c -+++ b/gcc/gcc.c -@@ -980,13 +980,23 @@ proper position among the other output files. */ - # define ASM_DEBUG_OPTION_SPEC "" - #endif - -+#if !defined(LINK_LIBATOMIC_SPEC) && defined(ENABLE_AUTOLINK_LIBATOMIC) -+# ifdef LD_AS_NEEDED_OPTION -+# define LINK_LIBATOMIC_SPEC LD_AS_NEEDED_OPTION " -latomic " LD_NO_AS_NEEDED_OPTION -+# else -+# define LINK_LIBATOMIC_SPEC "-latomic" -+# endif -+#elif !defined(LINK_LIBATOMIC_SPEC) -+# define LINK_LIBATOMIC_SPEC "" -+#endif -+ - /* Here is the spec for running the linker, after compiling all files. */ - - /* This is overridable by the target in case they need to specify the - -lgcc and -lc order specially, yet not require them to override all - of LINK_COMMAND_SPEC. */ - #ifndef LINK_GCC_C_SEQUENCE_SPEC --#define LINK_GCC_C_SEQUENCE_SPEC "%G %{!nolibc:%L %G}" -+#define LINK_GCC_C_SEQUENCE_SPEC "%G %{!nolibc:" LINK_LIBATOMIC_SPEC " %L %G}" - #endif - - #ifdef ENABLE_DEFAULT_SSP diff --git a/pat-12.1.0/gcc-alpine/0041-Use-generic-errstr.go-implementation-on-musl.patch b/pat-12.1.0/gcc-alpine/0041-Use-generic-errstr.go-implementation-on-musl.patch @@ -1,48 +0,0 @@ -From 70d70a1106b31ab840dbf5361312af221a2d5f04 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net> -Date: Mon, 19 Apr 2021 07:21:41 +0200 -Subject: [PATCH] Use generic errstr.go implementation on musl - -glibc provides two version of strerror_r() depending on a feature test -macro. The first is the XSI-compliant version which returns an int, the -second is GNU-specific and returns a char pointer. - -Similarity, gcc's libgo provides two implementations of Errstr() both of -which use strerror_r(). On Linux, it is assumed that the GNU-specific -strerror_r version is used. However, musl only provides the -XSI-compliant version of strerror_r. This patch enables the generic -Errstr() implementation which also uses the XSI-compliant version of -strerror_r. ---- - libgo/go/syscall/errstr.go | 1 - - libgo/go/syscall/errstr_glibc.go | 2 +- - 2 files changed, 1 insertion(+), 2 deletions(-) - -diff --git a/libgo/go/syscall/errstr.go b/libgo/go/syscall/errstr.go -index 6c2441d364d..8f7c5538163 100644 ---- a/libgo/go/syscall/errstr.go -+++ b/libgo/go/syscall/errstr.go -@@ -5,7 +5,6 @@ - // license that can be found in the LICENSE file. - - // +build !hurd --// +build !linux - - package syscall - -diff --git a/libgo/go/syscall/errstr_glibc.go b/libgo/go/syscall/errstr_glibc.go -index 5b19e6f202d..8dc60172186 100644 ---- a/libgo/go/syscall/errstr_glibc.go -+++ b/libgo/go/syscall/errstr_glibc.go -@@ -7,7 +7,7 @@ - // We use this rather than errstr.go because on GNU/Linux sterror_r - // returns a pointer to the error message, and may not use buf at all. - --// +build hurd linux -+// +build hurd !linux - - package syscall - --- -2.31.1 - diff --git a/pat-12.1.0/gcc-alpine/0042-Disable-ssp-on-nostdlib-nodefaultlibs-and-ffreestand.patch b/pat-12.1.0/gcc-alpine/0042-Disable-ssp-on-nostdlib-nodefaultlibs-and-ffreestand.patch @@ -1,21 +0,0 @@ -From: Alpine Linux community -From: Olsken (updated patches) -Date: Sat, 21 Aug 2021 08:51:52 +0000 - -diff --git a/gcc/gcc.cc b/gcc/gcc.cc -index bc1bd1686..b5c83977f 100644 ---- a/gcc/gcc.cc -+++ b/gcc/gcc.cc -@@ -1005,6 +1005,12 @@ proper position among the other output files. */ - #define NO_SSP_SPEC "" - #endif - -+#ifdef ENABLE_DEFAULT_SSP -+#define NO_SSP_SPEC "%{nostdlib|nodefaultlibs|ffreestanding:-fno-stack-protector} " -+#else -+#define NO_SSP_SPEC "" -+#endif -+ - #ifndef LINK_SSP_SPEC - #ifdef TARGET_LIBC_PROVIDES_SSP - #define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \ diff --git a/pat-12.1.0/gcc-alpine/0043-configure-Add-enable-autolink-libatomic-use-in-LINK_.patch b/pat-12.1.0/gcc-alpine/0043-configure-Add-enable-autolink-libatomic-use-in-LINK_.patch @@ -1,21 +0,0 @@ -From: Alpine Linux community -From: Olsken (updated patches) -Date: Sat, 21 Aug 2021 08:51:52 +0000 - -diff --git a/gcc/config.in b/gcc/config.in -index d0287d4cc..8c10816c4 100644 ---- a/gcc/config.in -+++ b/gcc/config.in -@@ -112,6 +112,12 @@ - #endif - - -+/* Define if libatomic should always be linked. */ -+#ifndef USED_FOR_TARGET -+#undef ENABLE_AUTOLINK_LIBATOMIC -+#endif -+ -+ - /* Define to 1 to specify that we are using the BID decimal floating point - format instead of DPD */ - #ifndef USED_FOR_TARGET diff --git a/pat-12.1.0/gcc-alpine/apply_patches_ct.sh b/pat-12.1.0/gcc-alpine/apply_patches_ct.sh @@ -1,40 +0,0 @@ -#! /bin/bash - -for p in 0001-posix_memalign 0002-gcc-poison-system-directories \ - 0003-Turn-on-Wl-z-relro-z-now-by-default \ - 0004-Turn-on-D_FORTIFY_SOURCE-2-by-default-for-C-C-ObjC-O \ - 0006-Enable-Wformat-and-Wformat-security-by-default \ - 0007-Enable-Wtrampolines-by-default \ - 0009-Ensure-that-msgfmt-doesn-t-encounter-problems-during \ - 0010-Don-t-declare-asprintf-if-defined-as-a-macro \ - 0011-libiberty-copy-PIC-objects-during-build-process \ - 0012-libitm-disable-FORTIFY \ - 0013-libgcc_s \ - 0014-nopie \ - 0015-libffi-use-__linux__-instead-of-__gnu_linux__-for-mu \ - 0016-dlang-update-zlib-binding \ - 0017-dlang-fix-fcntl-on-mips-add-libucontext-dep \ - 0018-ada-fix-shared-linking \ - 0019-build-fix-CXXFLAGS_FOR_BUILD-passing \ - 0020-add-fortify-headers-paths \ - 0023-Pure-64-bit-MIPS \ - 0024-use-pure-64-bit-configuration-where-appropriate \ - 0025-always-build-libgcc_eh.a \ - 0027-ada-musl-support-fixes \ - 0028-gcc-go-Use-_off_t-type-instead-of-_loff_t \ - 0029-gcc-go-Don-t-include-sys-user.h \ - 0030-gcc-go-Fix-ucontext_t-on-PPC64 \ - 0031-gcc-go-Fix-handling-of-signal-34-on-musl \ - 0032-gcc-go-Use-int64-type-as-offset-argument-for-mmap \ - 0034-gcc-go-signal-34-is-special-on-musl-libc \ - 0035-gcc-go-Prefer-_off_t-over-_off64_t \ - 0036-gcc-go-undef-SETCONTEXT_CLOBBERS_TLS-in-proc.c \ - 0037-gcc-go-link-to-libucontext \ - 0038-gcc-go-Disable-printing-of-unaccessible-ppc64-struct \ - 0041-Use-generic-errstr.go-implementation-on-musl \ - 0042-Disable-ssp-on-nostdlib-nodefaultlibs-and-ffreestand \ - 0043-configure-Add-enable-autolink-libatomic-use-in-LINK_ \ - 0022-DP-Use-push-state-pop-state-for-gold-as-well-when-li -do - patch -Np1 -i ../patches/gcc-alpine/$p.patch -done diff --git a/pat-12.1.0/gcc-mlfs/fix_fenv_header.patch b/pat-12.1.0/gcc-mlfs/fix_fenv_header.patch @@ -1,32 +0,0 @@ ---- gcc-11.2.0.orig/libstdc++-v3/include/c_global/cfenv 2021-07-28 01:55:09.292315320 -0500 -+++ gcc-11.2.0/libstdc++-v3/include/c_global/cfenv 2021-08-07 10:17:27.945057906 -0500 -@@ -37,9 +37,14 @@ - - #include <bits/c++config.h> - --#if _GLIBCXX_HAVE_FENV_H --# include <fenv.h> --#endif -+//#if _GLIBCXX_HAVE_FENV_H -+//# include <fenv.h> -+//#endif -+// Need to ensure this finds the C library's <fenv.h> not a libstdc++ -+// wrapper that might already be installed later in the include search path. -+#define _GLIBCXX_INCLUDE_NEXT_C_HEADERS -+# include_next <fenv.h> -+#undef _GLIBCXX_INCLUDE_NEXT_C_HEADERS - - #ifdef _GLIBCXX_USE_C99_FENV_TR1 - ---- gcc-11.2.0.orig/libstdc++-v3/include/c_compatibility/fenv.h 2021-07-28 01:55:09.292315320 -0500 -+++ gcc-11.2.0/libstdc++-v3/include/c_compatibility/fenv.h 2021-08-07 10:15:08.542063961 -0500 -@@ -25,6 +25,9 @@ - /** @file fenv.h - * This is a Standard C++ Library header. - */ -+#if !defined __cplusplus || defined _GLIBCXX_INCLUDE_NEXT_C_HEADERS -+# include_next <fenv.h> -+#else - - #ifndef _GLIBCXX_FENV_H - #define _GLIBCXX_FENV_H 1 diff --git a/pat-11.2.1/argp-standalone-adelie/gnu89-inline.patch b/pat/argp-standalone-adelie/gnu89-inline.patch diff --git a/pat-11.2.1/argp-standalone-mlfs/generate_configure_script.patch b/pat/argp-standalone-mlfs/generate_configure_script.patch diff --git a/pat-11.2.1/binutils-alpine/0001-Revert-PR25882-.gnu.attributes-are-not-checked-for-s.patch b/pat/binutils-alpine/0001-Revert-PR25882-.gnu.attributes-are-not-checked-for-s.patch diff --git a/pat-11.2.1/binutils-alpine/binutils-ld-fix-static-linking.patch b/pat/binutils-alpine/binutils-ld-fix-static-linking.patch diff --git a/pat-11.2.1/bzip2-clear/0001-Autotoolize-bzip2.patch b/pat/bzip2-clear/0001-Autotoolize-bzip2.patch diff --git a/pat-11.2.1/bzip2-clear/0002-Improve-file-access.patch b/pat/bzip2-clear/0002-Improve-file-access.patch diff --git a/pat-11.2.1/bzip2-mlfs/bzip2-reconfigured.patch b/pat/bzip2-mlfs/bzip2-reconfigured.patch diff --git a/pat/dcron-galeb/reopen_after_editfile.patch b/pat/dcron-galeb/reopen_after_editfile.patch @@ -0,0 +1,19 @@ +--- crontab.c 2011-05-01 14:22:09.000000000 +0200 ++++ crontab.c 2022-07-17 15:31:30.188117594 +0200 +@@ -176,9 +176,15 @@ + while ((n = fread(buf, 1, sizeof(buf), fi)) > 0) + write(fd, buf, n); + } ++ /* ++ * In my testing, on musl, file state is ++ * not updated after EditFile, so ++ * reopening is needed. - [SR] ++ **/ ++ close(fd); + EditFile(caller, tmp); ++ fd = open(tmp, O_RDWR, 0); + remove(tmp); +- lseek(fd, 0L, 0); + repFd = fd; + } else { + printlogf(0, "unable to create %s: %s", tmp, strerror(errno)); diff --git a/pat-11.2.1/efivar-void/0001-Support-custom-cflags-for-CC_FOR_BUILD-and-CCLD_FOR_.patch b/pat/efivar-void/0001-Support-custom-cflags-for-CC_FOR_BUILD-and-CCLD_FOR_.patch diff --git a/pat-11.2.1/efivar-void/0002-Replace-call-to-strncpy-by-memcpy-to-fix-some-GCC8-w.patch b/pat/efivar-void/0002-Replace-call-to-strncpy-by-memcpy-to-fix-some-GCC8-w.patch diff --git a/pat-11.2.1/gcc-alpine/0001-posix_memalign.patch b/pat/gcc-alpine/0001-posix_memalign.patch diff --git a/pat-11.2.1/gcc-alpine/0002-gcc-poison-system-directories.patch b/pat/gcc-alpine/0002-gcc-poison-system-directories.patch diff --git a/pat-11.2.1/gcc-alpine/0003-Turn-on-Wl-z-relro-z-now-by-default.patch b/pat/gcc-alpine/0003-Turn-on-Wl-z-relro-z-now-by-default.patch diff --git a/pat-11.2.1/gcc-alpine/0004-Turn-on-D_FORTIFY_SOURCE-2-by-default-for-C-C-ObjC-O.patch b/pat/gcc-alpine/0004-Turn-on-D_FORTIFY_SOURCE-2-by-default-for-C-C-ObjC-O.patch diff --git a/pat-11.2.1/gcc-alpine/0005-On-linux-targets-pass-as-needed-by-default-to-the-li.patch b/pat/gcc-alpine/0005-On-linux-targets-pass-as-needed-by-default-to-the-li.patch diff --git a/pat-11.2.1/gcc-alpine/0006-Enable-Wformat-and-Wformat-security-by-default.patch b/pat/gcc-alpine/0006-Enable-Wformat-and-Wformat-security-by-default.patch diff --git a/pat-11.2.1/gcc-alpine/0007-Enable-Wtrampolines-by-default.patch b/pat/gcc-alpine/0007-Enable-Wtrampolines-by-default.patch diff --git a/pat-11.2.1/gcc-alpine/0008-Disable-ssp-on-nostdlib-nodefaultlibs-and-ffreestand.patch b/pat/gcc-alpine/0008-Disable-ssp-on-nostdlib-nodefaultlibs-and-ffreestand.patch diff --git a/pat-11.2.1/gcc-alpine/0009-Ensure-that-msgfmt-doesn-t-encounter-problems-during.patch b/pat/gcc-alpine/0009-Ensure-that-msgfmt-doesn-t-encounter-problems-during.patch diff --git a/pat-11.2.1/gcc-alpine/0010-Don-t-declare-asprintf-if-defined-as-a-macro.patch b/pat/gcc-alpine/0010-Don-t-declare-asprintf-if-defined-as-a-macro.patch diff --git a/pat-11.2.1/gcc-alpine/0011-libiberty-copy-PIC-objects-during-build-process.patch b/pat/gcc-alpine/0011-libiberty-copy-PIC-objects-during-build-process.patch diff --git a/pat-11.2.1/gcc-alpine/0012-libitm-disable-FORTIFY.patch b/pat/gcc-alpine/0012-libitm-disable-FORTIFY.patch diff --git a/pat-11.2.1/gcc-alpine/0013-libgcc_s.patch b/pat/gcc-alpine/0013-libgcc_s.patch diff --git a/pat-11.2.1/gcc-alpine/0014-nopie.patch b/pat/gcc-alpine/0014-nopie.patch diff --git a/pat-11.2.1/gcc-alpine/0015-libffi-use-__linux__-instead-of-__gnu_linux__-for-mu.patch b/pat/gcc-alpine/0015-libffi-use-__linux__-instead-of-__gnu_linux__-for-mu.patch diff --git a/pat-11.2.1/gcc-alpine/0016-dlang-update-zlib-binding.patch b/pat/gcc-alpine/0016-dlang-update-zlib-binding.patch diff --git a/pat-11.2.1/gcc-alpine/0017-dlang-fix-fcntl-on-mips-add-libucontext-dep.patch b/pat/gcc-alpine/0017-dlang-fix-fcntl-on-mips-add-libucontext-dep.patch diff --git a/pat-11.2.1/gcc-alpine/0018-ada-fix-shared-linking.patch b/pat/gcc-alpine/0018-ada-fix-shared-linking.patch diff --git a/pat-11.2.1/gcc-alpine/0019-build-fix-CXXFLAGS_FOR_BUILD-passing.patch b/pat/gcc-alpine/0019-build-fix-CXXFLAGS_FOR_BUILD-passing.patch diff --git a/pat-11.2.1/gcc-alpine/0020-add-fortify-headers-paths.patch b/pat/gcc-alpine/0020-add-fortify-headers-paths.patch diff --git a/pat-11.2.1/gcc-alpine/0021-Alpine-musl-package-provides-libssp_nonshared.a.-We-.patch b/pat/gcc-alpine/0021-Alpine-musl-package-provides-libssp_nonshared.a.-We-.patch diff --git a/pat-11.2.1/gcc-alpine/0022-DP-Use-push-state-pop-state-for-gold-as-well-when-li.patch b/pat/gcc-alpine/0022-DP-Use-push-state-pop-state-for-gold-as-well-when-li.patch diff --git a/pat-11.2.1/gcc-alpine/0023-Pure-64-bit-MIPS.patch b/pat/gcc-alpine/0023-Pure-64-bit-MIPS.patch diff --git a/pat-11.2.1/gcc-alpine/0024-use-pure-64-bit-configuration-where-appropriate.patch b/pat/gcc-alpine/0024-use-pure-64-bit-configuration-where-appropriate.patch diff --git a/pat-11.2.1/gcc-alpine/0025-always-build-libgcc_eh.a.patch b/pat/gcc-alpine/0025-always-build-libgcc_eh.a.patch diff --git a/pat-11.2.1/gcc-alpine/0026-ada-libgnarl-compatibility-for-musl.patch b/pat/gcc-alpine/0026-ada-libgnarl-compatibility-for-musl.patch diff --git a/pat-11.2.1/gcc-alpine/0027-ada-musl-support-fixes.patch b/pat/gcc-alpine/0027-ada-musl-support-fixes.patch diff --git a/pat-11.2.1/gcc-alpine/0028-gcc-go-Use-_off_t-type-instead-of-_loff_t.patch b/pat/gcc-alpine/0028-gcc-go-Use-_off_t-type-instead-of-_loff_t.patch diff --git a/pat-11.2.1/gcc-alpine/0029-gcc-go-Don-t-include-sys-user.h.patch b/pat/gcc-alpine/0029-gcc-go-Don-t-include-sys-user.h.patch diff --git a/pat-11.2.1/gcc-alpine/0030-gcc-go-Fix-ucontext_t-on-PPC64.patch b/pat/gcc-alpine/0030-gcc-go-Fix-ucontext_t-on-PPC64.patch diff --git a/pat-11.2.1/gcc-alpine/0031-gcc-go-Fix-handling-of-signal-34-on-musl.patch b/pat/gcc-alpine/0031-gcc-go-Fix-handling-of-signal-34-on-musl.patch diff --git a/pat-11.2.1/gcc-alpine/0032-gcc-go-Use-int64-type-as-offset-argument-for-mmap.patch b/pat/gcc-alpine/0032-gcc-go-Use-int64-type-as-offset-argument-for-mmap.patch diff --git a/pat-11.2.1/gcc-alpine/0033-gcc-go-Fix-st_-a-m-c-tim-fields-in-generated-sysinfo.patch b/pat/gcc-alpine/0033-gcc-go-Fix-st_-a-m-c-tim-fields-in-generated-sysinfo.patch diff --git a/pat-11.2.1/gcc-alpine/0034-gcc-go-signal-34-is-special-on-musl-libc.patch b/pat/gcc-alpine/0034-gcc-go-signal-34-is-special-on-musl-libc.patch diff --git a/pat-11.2.1/gcc-alpine/0035-gcc-go-Prefer-_off_t-over-_off64_t.patch b/pat/gcc-alpine/0035-gcc-go-Prefer-_off_t-over-_off64_t.patch diff --git a/pat-11.2.1/gcc-alpine/0036-gcc-go-undef-SETCONTEXT_CLOBBERS_TLS-in-proc.c.patch b/pat/gcc-alpine/0036-gcc-go-undef-SETCONTEXT_CLOBBERS_TLS-in-proc.c.patch diff --git a/pat-11.2.1/gcc-alpine/0037-gcc-go-link-to-libucontext.patch b/pat/gcc-alpine/0037-gcc-go-link-to-libucontext.patch diff --git a/pat-11.2.1/gcc-alpine/0038-gcc-go-Disable-printing-of-unaccessible-ppc64-struct.patch b/pat/gcc-alpine/0038-gcc-go-Disable-printing-of-unaccessible-ppc64-struct.patch diff --git a/pat-11.2.1/gcc-alpine/0040-configure-Add-enable-autolink-libatomic-use-in-LINK_.patch b/pat/gcc-alpine/0040-configure-Add-enable-autolink-libatomic-use-in-LINK_.patch diff --git a/pat-11.2.1/gcc-alpine/0041-Use-generic-errstr.go-implementation-on-musl.patch b/pat/gcc-alpine/0041-Use-generic-errstr.go-implementation-on-musl.patch diff --git a/pat-11.2.1/gcc-alpine/0042-Disable-ssp-on-nostdlib-nodefaultlibs-and-ffreestand.patch b/pat/gcc-alpine/0042-Disable-ssp-on-nostdlib-nodefaultlibs-and-ffreestand.patch diff --git a/pat-11.2.1/gcc-alpine/0043-configure-Add-enable-autolink-libatomic-use-in-LINK_.patch b/pat/gcc-alpine/0043-configure-Add-enable-autolink-libatomic-use-in-LINK_.patch diff --git a/pat-11.2.1/gcc-alpine/apply_patches_ct.sh b/pat/gcc-alpine/apply_patches_ct.sh diff --git a/pat-11.2.1/gcc-mlfs/fix_fenv_header.patch b/pat/gcc-mlfs/fix_fenv_header.patch diff --git a/pat-11.2.1/gettext-tiny-galeb/autopoint.patch b/pat/gettext-tiny-galeb/autopoint.patch diff --git a/pat-11.2.1/kbd-lfs/kbd-2.3.0-backspace-1.patch b/pat/kbd-lfs/kbd-2.3.0-backspace-1.patch diff --git a/pat-11.2.1/libffi-alpine/pax-dlmmap.patch b/pat/libffi-alpine/pax-dlmmap.patch diff --git a/pat-11.2.1/libuv-mlfs/autogen-hardcode.patch b/pat/libuv-mlfs/autogen-hardcode.patch diff --git a/pat-11.2.1/m4-alpine/musl-realpath.patch b/pat/m4-alpine/musl-realpath.patch diff --git a/pat-11.2.1/mandoc-galeb/test-recvmsg.patch b/pat/mandoc-galeb/test-recvmsg.patch diff --git a/pat-11.2.1/musl-alpine/handle-aux-at_base.patch b/pat/musl-alpine/handle-aux-at_base.patch diff --git a/pat-11.2.1/musl-mlfs/change-scheduler-functions-Linux-compatib.patch b/pat/musl-mlfs/change-scheduler-functions-Linux-compatib.patch diff --git a/pat-11.2.1/musl-mlfs/fix-utmp-wtmp-paths.patch b/pat/musl-mlfs/fix-utmp-wtmp-paths.patch diff --git a/pat-11.2.1/musl-mlfs/i686-fix-rounding.patch b/pat/musl-mlfs/i686-fix-rounding.patch diff --git a/pat-11.2.1/perl-alpine/musl-locale.patch b/pat/perl-alpine/musl-locale.patch diff --git a/pat-11.2.1/perl-alpine/musl-stack-size.patch b/pat/perl-alpine/musl-stack-size.patch diff --git a/pat-11.2.1/posixtz-adelie/0001-posixtz-fix-up-lseek.patch b/pat/posixtz-adelie/0001-posixtz-fix-up-lseek.patch diff --git a/pat-11.2.1/python3-void/musl-find_library.patch b/pat/python3-void/musl-find_library.patch diff --git a/pat-11.2.1/python3-void/tweak-MULTIARCH-for-powerpc-linux-musl.patch b/pat/python3-void/tweak-MULTIARCH-for-powerpc-linux-musl.patch diff --git a/pat-11.2.1/ubase-galeb/getty_show_issue.patch b/pat/ubase-galeb/getty_show_issue.patch diff --git a/pat-11.2.1/util-linux-mlfs/use-tiparm-when-compiling-with-netbsd_curses.patch b/pat/util-linux-mlfs/use-tiparm-when-compiling-with-netbsd_curses.patch diff --git a/pat-11.2.1/util-linux-void/fix-musl.patch b/pat/util-linux-void/fix-musl.patch diff --git a/pat-11.2.1/xz-alpine/xzgrep-ZDI-CAN-16587.patch b/pat/xz-alpine/xzgrep-ZDI-CAN-16587.patch diff --git a/pat-11.2.1/zlib-ng-mlfs/configure-fix-interpreter.patch b/pat/zlib-ng-mlfs/configure-fix-interpreter.patch