This commit is contained in:
DHDAXCW 2023-01-21 10:42:33 +00:00
parent f7124f06dc
commit 20a6149d5b
68 changed files with 978 additions and 1789 deletions

View File

@ -14,14 +14,14 @@ config EXPERIMENTAL
positive and negative). But do so only if you know how to
recover your device in case of flashing potentially non-working
firmware.
If you plan to use this build in production, say NO!
menu "Global build settings"
config JSON_OVERVIEW_IMAGE_INFO
bool "Create JSON info file overview per target"
default y
default BUILDBOT
help
Create a JSON info file called profiles.json in the target
directory containing machine readable list of built profiles
@ -111,7 +111,7 @@ menu "Global build settings"
default n
help
This makes file checksums part of package metadata. It increases size
but provides you with pkg_check command to check for flash corruptions.
but provides you with pkg_check command to check for flash coruptions.
config INCLUDE_CONFIG
bool "Include build configuration in firmware" if DEVEL
@ -154,12 +154,17 @@ menu "Global build settings"
Adds -g3 to the CFLAGS.
config IPV6
def_bool y
bool
prompt "Enable IPv6 support in packages"
default y
help
Enables IPv6 support in kernel (builtin) and packages.
comment "Stripping options"
choice
prompt "Binary stripping method"
default USE_STRIP if EXTERNAL_TOOLCHAIN
default USE_STRIP if USE_GLIBC
default USE_SSTRIP
help
@ -216,6 +221,20 @@ menu "Global build settings"
make the system libraries incompatible with most of the packages that are
not selected during the build process.
choice
prompt "Preferred standard C++ library"
default USE_LIBSTDCXX if USE_GLIBC
default USE_UCLIBCXX
help
Select the preferred standard C++ library for all packages that support this.
config USE_UCLIBCXX
bool "uClibc++"
config USE_LIBSTDCXX
bool "libstdc++"
endchoice
comment "Hardening build options"
config PKG_CHECK_FORMAT_SECURITY
@ -371,16 +390,4 @@ menu "Global build settings"
endchoice
config SECCOMP
bool "Enable SECCOMP"
select KERNEL_SECCOMP
select PACKAGE_procd-seccomp
depends on (aarch64 || arm || armeb || mips || mipsel || mips64 || mips64el || i386 || powerpc || x86_64)
depends on !TARGET_uml
default y
help
This option enables seccomp kernel features to safely
execute untrusted bytecode and selects the seccomp-variants
of procd
endmenu

View File

@ -95,11 +95,6 @@ menuconfig DEVEL
Store ccache in this directory.
If not set, uses './.ccache'
config KERNEL_CFLAGS
string "Kernel extra CFLAGS" if DEVEL
default "-falign-functions=32" if TARGET_bcm53xx
default ""
config EXTERNAL_KERNEL_TREE
string "Use external kernel tree" if DEVEL
default ""

View File

@ -48,7 +48,6 @@ menu "Target Images"
bool "xz"
config TARGET_INITRAMFS_COMPRESSION_ZSTD
depends on !LINUX_5_4
bool "zstd"
endchoice
@ -152,7 +151,7 @@ menu "Target Images"
bool "squashfs"
default y if USES_SQUASHFS
help
Build a squashfs root filesystem.
Build a squashfs-lzma root filesystem.
config TARGET_SQUASHFS_BLOCK_SIZE
int "Block size (in KiB)"
@ -160,9 +159,6 @@ menu "Target Images"
default 64 if LOW_MEMORY_FOOTPRINT
default 1024 if (SMALL_FLASH && !LOW_MEMORY_FOOTPRINT)
default 1024
help
Select squashfs block size, must be one of:
4, 8, 16, 32, 64, 128, 256, 512, 1024
menuconfig TARGET_ROOTFS_UBIFS
bool "ubifs"
@ -297,7 +293,7 @@ menu "Target Images"
source "target/linux/*/image/Config.in"
config TARGET_KERNEL_PARTSIZE
int "Kernel partition size (in MiB)"
int "Kernel partition size (in MB)"
depends on USES_BOOT_PART
default 8 if TARGET_apm821xx_sata
default 64 if TARGET_bcm27xx
@ -305,8 +301,8 @@ menu "Target Images"
default 16
config TARGET_ROOTFS_PARTSIZE
int "Root filesystem partition size (in MiB)"
depends on USES_ROOTFS_PART || TARGET_ROOTFS_EXT4FS
int "Root filesystem partition size (in MB)"
depends on USES_ROOTFS_PART || TARGET_ROOTFS_EXT4FS || TARGET_omap || TARGET_sunxi || TARGET_uml
default 400
help
Select the root filesystem partition size.

View File

@ -24,6 +24,11 @@ config KERNEL_PRINTK
bool "Enable support for printk"
default y
config KERNEL_CRASHLOG
bool "Crash logging"
depends on !(arm || powerpc || sparc || TARGET_uml || i386 || x86_64)
default y
config KERNEL_SWAP
bool "Support for paging of anonymous memory (swap)"
default y if !SMALL_FLASH
@ -43,7 +48,8 @@ config KERNEL_DEBUG_FS
config KERNEL_MIPS_FP_SUPPORT
bool
default y if TARGET_pistachio
default y
depends on (mips || mipsel || mips64 || mips64el)
config KERNEL_ARM_PMU
bool
@ -81,11 +87,6 @@ config KERNEL_PROFILING
Enable the extended profiling support mechanisms used by profilers such
as OProfile.
config KERNEL_RPI_AXIPERF
bool "Compile the kernel with RaspberryPi AXI Performance monitors"
default y
depends on KERNEL_PERF_EVENTS && TARGET_bcm27xx
config KERNEL_UBSAN
bool "Compile the kernel with undefined behaviour sanity checker"
help
@ -114,16 +115,6 @@ config KERNEL_UBSAN_ALIGNMENT
Enabling this option on architectures that support unaligned
accesses may produce a lot of false positives.
config KERNEL_UBSAN_BOUNDS
bool "Perform array index bounds checking"
depends on KERNEL_UBSAN
help
This option enables detection of directly indexed out of bounds array
accesses, where the array size is known at compile time. Note that
this does not protect array overflows via bad calls to the
{str,mem}*cpy() family of functions (that is addressed by
FORTIFY_SOURCE).
config KERNEL_UBSAN_NULL
bool "Enable checking of null pointers"
depends on KERNEL_UBSAN
@ -131,19 +122,6 @@ config KERNEL_UBSAN_NULL
This option enables detection of memory accesses via a
null pointer.
config KERNEL_UBSAN_TRAP
bool "On Sanitizer warnings, abort the running kernel code"
depends on KERNEL_UBSAN
help
Building kernels with Sanitizer features enabled tends to grow the
kernel size by around 5%, due to adding all the debugging text on
failure paths. To avoid this, Sanitizer instrumentation can just
issue a trap. This reduces the kernel size overhead but turns all
warnings (including potentially harmless conditions) into full
exceptions that abort the running kernel code (regardless of context,
locks held, etc), which may destabilize the system. For some system
builders this is an acceptable trade-off.
config KERNEL_KASAN
bool "Compile the kernel with KASan: runtime memory debugger"
select KERNEL_SLUB_DEBUG
@ -170,30 +148,6 @@ config KERNEL_KASAN_EXTRA
compile time.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81715 has more
config KERNEL_KASAN_VMALLOC
bool "Back mappings in vmalloc space with real shadow memory"
depends on KERNEL_KASAN
help
By default, the shadow region for vmalloc space is the read-only
zero page. This means that KASAN cannot detect errors involving
vmalloc space.
Enabling this option will hook in to vmap/vmalloc and back those
mappings with real shadow memory allocated on demand. This allows
for KASAN to detect more sorts of errors (and to support vmapped
stacks), but at the cost of higher memory usage.
This option depends on HAVE_ARCH_KASAN_VMALLOC, but we can't
depend on that in here, so it is possible that enabling this
will have no effect.
if KERNEL_KASAN
config KERNEL_KASAN_GENERIC
def_bool y
config KERNEL_KASAN_SW_TAGS
def_bool n
endif
choice
prompt "Instrumentation type"
@ -349,19 +303,6 @@ config KERNEL_PREEMPT_TRACER
enabled. This option and the irqs-off timing option can be
used together or separately.)
config KERNEL_HIST_TRIGGERS
bool "Histogram triggers"
depends on KERNEL_FTRACE
help
Hist triggers allow one or more arbitrary trace event fields to be
aggregated into hash tables and dumped to stdout by reading a
debugfs/tracefs file. They're useful for gathering quick and dirty
(though precise) summaries of event activity as an initial guide for
further investigation using more advanced tools.
Inter-event tracing of quantities such as latencies is also
supported using hist triggers under this option.
config KERNEL_DEBUG_KERNEL
bool
default n
@ -373,34 +314,6 @@ config KERNEL_DEBUG_INFO
help
This will compile your kernel and modules with debug information.
config KERNEL_DEBUG_INFO_BTF
bool "Enable additional BTF type information"
default n
depends on !HOST_OS_MACOS
depends on KERNEL_DEBUG_INFO && !KERNEL_DEBUG_INFO_REDUCED
select DWARVES
help
Generate BPF Type Format (BTF) information from DWARF debug info.
Turning this on expects presence of pahole tool, which will convert
DWARF type info into equivalent deduplicated BTF type info.
Required to run BPF CO-RE applications.
config KERNEL_DEBUG_INFO_REDUCED
bool "Reduce debugging information"
default y
depends on KERNEL_DEBUG_INFO
help
If you say Y here gcc is instructed to generate less debugging
information for structure types. This means that tools that
need full debugging information (like kgdb or systemtap) won't
be happy. But if you merely need debugging information to
resolve line numbers there is no loss. Advantage is that
build directory object sizes shrink dramatically over a full
DEBUG_INFO build and compile times are reduced too.
Only works with newer gcc versions.
config KERNEL_DEBUG_LL_UART_NONE
bool
default n
@ -414,14 +327,6 @@ config KERNEL_DEBUG_LL
help
ARM low level debugging.
config KERNEL_DEBUG_VIRTUAL
bool "Compile the kernel with VM translations debugging"
select KERNEL_DEBUG_KERNEL
default n
help
Enable checks sanity checks to catch invalid uses of
virt_to_phys()/phys_to_virt() against the non-linear address space.
config KERNEL_DYNAMIC_DEBUG
bool "Compile the kernel with dynamic printk"
select KERNEL_DEBUG_FS
@ -463,21 +368,6 @@ config KERNEL_KPROBE_EVENTS
bool
default y if KERNEL_KPROBES
config KERNEL_BPF_EVENTS
bool "Compile the kernel with BPF event support"
default n
select KERNEL_KPROBES
help
Allows to attach BPF programs to kprobe, uprobe and tracepoint events.
This is required to use BPF maps of type BPF_MAP_TYPE_PERF_EVENT_ARRAY
for sending data from BPF programs to user-space for post-processing
or logging.
config KERNEL_BPF_KPROBE_OVERRIDE
bool
default n
depends on KERNEL_KPROBES
config KERNEL_AIO
bool "Compile the kernel with asynchronous IO support"
default y if !SMALL_FLASH
@ -547,22 +437,34 @@ config KERNEL_PROVE_LOCKING
select KERNEL_DEBUG_KERNEL
default n
config KERNEL_SOFTLOCKUP_DETECTOR
bool "Compile the kernel with detect Soft Lockups"
config KERNEL_LOCKUP_DETECTOR
bool "Compile the kernel with detect Hard and Soft Lockups"
depends on KERNEL_DEBUG_KERNEL
help
Say Y here to enable the kernel to act as a watchdog to detect
soft lockups.
hard and soft lockups.
Softlockups are bugs that cause the kernel to loop in kernel
mode for more than 20 seconds, without giving other tasks a
chance to run. The current stack trace is displayed upon
detection and the system will stay locked up.
Hardlockups are bugs that cause the CPU to loop in kernel mode
for more than 10 seconds, without letting other interrupts have a
chance to run. The current stack trace is displayed upon detection
and the system will stay locked up.
The overhead should be minimal. A periodic hrtimer runs to
generate interrupts and kick the watchdog task every 4 seconds.
An NMI is generated every 10 seconds or so to check for hardlockups.
The frequency of hrtimer and NMI events and the soft and hard lockup
thresholds can be controlled through the sysctl watchdog_thresh.
config KERNEL_DETECT_HUNG_TASK
bool "Compile the kernel with detect Hung Tasks"
depends on KERNEL_DEBUG_KERNEL
default KERNEL_SOFTLOCKUP_DETECTOR
default KERNEL_LOCKUP_DETECTOR
help
Say Y here to enable the kernel to detect "hung tasks",
which are bugs that cause the task to be stuck in
@ -1042,19 +944,6 @@ config KERNEL_IP_MROUTE
Multicast routing requires a multicast routing daemon in
addition to kernel support.
if KERNEL_IP_MROUTE
config KERNEL_IP_MROUTE_MULTIPLE_TABLES
def_bool y
config KERNEL_IP_PIMSM_V1
def_bool y
config KERNEL_IP_PIMSM_V2
def_bool y
endif
#
# IPv6 configuration
#
@ -1077,15 +966,8 @@ if KERNEL_IPV6
Multicast routing requires a multicast routing daemon in
addition to kernel support.
if KERNEL_IPV6_MROUTE
config KERNEL_IPV6_MROUTE_MULTIPLE_TABLES
def_bool y
config KERNEL_IPV6_PIMSM_V2
def_bool y
endif
config KERNEL_IPV6_PIMSM_V2
def_bool n
config KERNEL_IPV6_SEG6_LWTUNNEL
bool "Enable support for lightweight tunnels"
@ -1098,16 +980,6 @@ if KERNEL_IPV6
endif
#
# Miscellaneous network configuration
#
config KERNEL_NET_L3_MASTER_DEV
bool "L3 Master device support"
help
This module provides glue between core networking code and device
drivers to support L3 master devices like VRF.
#
# NFS related symbols
#
@ -1253,7 +1125,7 @@ config KERNEL_SQUASHFS_XATTR
bool "Squashfs XATTR support"
#
# compile optimization setting
# compile optimiziation setting
#
choice
prompt "Compiler optimization level"

View File

@ -35,7 +35,7 @@ define autoreconf
$(patsubst %,rm -f %;,$(2)) \
$(foreach p,$(3), \
if [ -f $(p)/configure.ac ] || [ -f $(p)/configure.in ]; then \
[ -d $(p)/autom4te.cache ] && rm -rf $(p)/autom4te.cache; \
[ -d $(p)/autom4te.cache ] && rm -rf autom4te.cache; \
[ -e $(p)/config.rpath ] || \
ln -s $(SCRIPT_DIR)/config.rpath $(p)/config.rpath; \
touch NEWS AUTHORS COPYING ABOUT-NLS ChangeLog; \

View File

@ -64,14 +64,14 @@ BPF_CFLAGS := \
-O2 -emit-llvm -Xclang -disable-llvm-passes
ifneq ($(CONFIG_HAS_BPF_TOOLCHAIN),)
ifeq ($(DUMP),)
CLANG_VER:=$(shell $(CLANG) -dM -E - < /dev/null | grep __clang_major__ | cut -d' ' -f3)
CLANG_VER_VALID:=$(shell [ "$(CLANG_VER)" -ge "$(CLANG_MIN_VER)" ] && echo 1 )
ifeq ($(CLANG_VER_VALID),)
$(error ERROR: LLVM/clang version too old. Minimum required: $(CLANG_MIN_VER), found: $(CLANG_VER))
ifeq ($(DUMP),)
CLANG_VER:=$(shell $(CLANG) -dM -E - < /dev/null | grep __clang_major__ | cut -d' ' -f3)
CLANG_VER_VALID:=$(shell [ "$(CLANG_VER)" -ge "$(CLANG_MIN_VER)" ] && echo 1 )
ifeq ($(CLANG_VER_VALID),)
$(error ERROR: LLVM/clang version too old. Minimum required: $(CLANG_MIN_VER), found: $(CLANG_VER))
endif
endif
endif
endif
define CompileBPF
$(CLANG) -g -target $(BPF_ARCH)-linux-gnu $(BPF_CFLAGS) $(2) \

View File

@ -53,7 +53,6 @@ define Build/append-image-stage
cp "$(BIN_DIR)/$(DEVICE_IMG_PREFIX)-$(1)" "$@.stripmeta"
fwtool -s /dev/null -t "$@.stripmeta" || :
fwtool -i /dev/null -t "$@.stripmeta" || :
mkdir -p "$(STAGING_DIR_IMAGE)"
dd if="$@.stripmeta" of="$(STAGING_DIR_IMAGE)/$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))-$(DEVICE_NAME)-$(1)"
dd if="$@.stripmeta" >> "$@"
rm "$@.stripmeta"
@ -306,13 +305,8 @@ define Build/fit
@mv $@.new $@
endef
define Build/libdeflate-gzip
$(STAGING_DIR_HOST)/bin/libdeflate-gzip -f -12 -c $@ $(1) > $@.new
@mv $@.new $@
endef
define Build/gzip
$(STAGING_DIR_HOST)/bin/gzip -f -9n -c $@ $(1) > $@.new
gzip -f -9n -c $@ $(1) > $@.new
@mv $@.new $@
endef

View File

@ -520,7 +520,6 @@ define Device/Build/compile
$$(_COMPILE_TARGET): $(KDIR)/$(1)
$(eval $(call Device/Export,$(KDIR)/$(1)))
$(KDIR)/$(1): FORCE
rm -f $(KDIR)/$(1)
$$(call concat_cmd,$(COMPILE/$(1)))
endef

View File

@ -1,2 +1,2 @@
LINUX_VERSION-5.10 = .161
LINUX_KERNEL_HASH-5.10.161 = 7aaaf6d0bcd8a2cfa14ad75f02ca62bb2de08aad3bee3eff198de49ea5254079
LINUX_VERSION-5.10 = .142
LINUX_KERNEL_HASH-5.10.142 = 3f47ebdb9afe152a0c32c1157336ef13fa5cc08ac6d884dfc1f6ddc2b7dba268

View File

@ -1,2 +1,2 @@
LINUX_VERSION-5.15 = .86
LINUX_KERNEL_HASH-5.15.86 = 80fcd9efa443502de9e2750f6dfb59e8de43a5d87a6d2be09dca748d79b5f2ee
LINUX_VERSION-5.15 = .67
LINUX_KERNEL_HASH-5.15.67 = da47d9a80b694548835ccb553b6eb1a1f3f5d5cddd9e2bd6f4886b99ca14f940

View File

@ -130,7 +130,7 @@ ifneq ($(HOST_OS),Linux)
export SKIP_STACK_VALIDATION:=1
endif
KERNEL_MAKEOPTS = -C $(LINUX_DIR) $(KERNEL_MAKE_FLAGS)
KERNEL_MAKEOPTS := -C $(LINUX_DIR) $(KERNEL_MAKE_FLAGS)
ifdef CONFIG_USE_SPARSE
KERNEL_MAKEOPTS += C=1 CHECK=$(STAGING_DIR_HOST)/bin/sparse

View File

@ -230,6 +230,11 @@ $(eval $(call nf_add,NF_NATHELPER_EXTRA,CONFIG_NF_CONNTRACK_IRC, $(P_XT)nf_connt
$(eval $(call nf_add,NF_NATHELPER_EXTRA,CONFIG_NF_NAT_IRC, $(P_XT)nf_nat_irc))
# ulog
$(eval $(call nf_add,IPT_ULOG,CONFIG_IP_NF_TARGET_ULOG, $(P_V4)ipt_ULOG))
# nflog
$(eval $(call nf_add,IPT_NFLOG,CONFIG_NETFILTER_XT_TARGET_NFLOG, $(P_XT)xt_NFLOG))
@ -316,6 +321,7 @@ $(eval $(call nf_add,EBTABLES_IP4,CONFIG_BRIDGE_EBT_SNAT, $(P_EBT)ebt_snat))
# watchers
$(eval $(call nf_add,EBTABLES_WATCHERS,CONFIG_BRIDGE_EBT_LOG, $(P_EBT)ebt_log))
$(eval $(call nf_add,EBTABLES_WATCHERS,CONFIG_BRIDGE_EBT_ULOG, $(P_EBT)ebt_ulog))
$(eval $(call nf_add,EBTABLES_WATCHERS,CONFIG_BRIDGE_EBT_NFLOG, $(P_EBT)ebt_nflog))
$(eval $(call nf_add,EBTABLES_WATCHERS,CONFIG_BRIDGE_EBT_NFQUEUE, $(P_EBT)ebt_nfqueue))
@ -387,6 +393,7 @@ IPT_BUILTIN += $(IPT_NAT6-y)
IPT_BUILTIN += $(IPT_NAT_EXTRA-y)
IPT_BUILTIN += $(NF_NATHELPER-y)
IPT_BUILTIN += $(NF_NATHELPER_EXTRA-y)
IPT_BUILTIN += $(IPT_ULOG-y)
IPT_BUILTIN += $(IPT_TPROXY-y)
IPT_BUILTIN += $(NFNETLINK-y)
IPT_BUILTIN += $(NFNETLINK_LOG-y)

View File

@ -9,13 +9,13 @@ ifeq ($(CONFIG_BUILD_NLS),y)
INTL_PREFIX:=$(STAGING_DIR)/usr/lib/libintl-full
INTL_FULL:=1
CMAKE_OPTIONS += -DCMAKE_PREFIX_PATH="$(ICONV_PREFIX);$(INTL_PREFIX)"
else
ICONV_PREFIX:=
ICONV_FULL:=
INTL_PREFIX:=
INTL_PREFIX:=$
INTL_FULL:=
endif

View File

@ -2,7 +2,7 @@
#
# Copyright (C) 2006-2020 OpenWrt.org
PKG_DEFAULT_DEPENDS = +libc
PKG_DEFAULT_DEPENDS = +libc +USE_GLIBC:librt +USE_GLIBC:libpthread
ifneq ($(PKG_NAME),toolchain)
PKG_FIXUP_DEPENDS = $(if $(filter kmod-%,$(1)),$(2),$(PKG_DEFAULT_DEPENDS) $(filter-out $(PKG_DEFAULT_DEPENDS),$(2)))

View File

@ -58,8 +58,7 @@ DEFAULT_PACKAGES.router:=\
iptables-mod-tproxy iptables-mod-extra ipset ip-full default-settings luci luci-newapi \
ddns-scripts_aliyun ddns-scripts_dnspod luci-app-ddns luci-app-upnp luci-app-autoreboot \
luci-app-arpbind luci-app-filetransfer luci-app-vsftpd luci-app-ssr-plus luci-app-vlmcsd \
luci-app-accesscontrol luci-app-nlbwmon luci-app-turboacc luci-app-wol curl ca-certificates \
tc-tiny
luci-app-accesscontrol luci-app-nlbwmon luci-app-turboacc luci-app-wol curl ca-certificates
ifneq ($(DUMP),)
all: dumpinfo
@ -234,7 +233,6 @@ ifeq ($(DUMP),1)
ifeq ($(ARCH),powerpc)
CPU_CFLAGS_603e:=-mcpu=603e
CPU_CFLAGS_8540:=-mcpu=8540
CPU_CFLAGS_8548:=-mcpu=8548
CPU_CFLAGS_405:=-mcpu=405
CPU_CFLAGS_440:=-mcpu=440
CPU_CFLAGS_464fp:=-mcpu=464fp

View File

@ -1,5 +1,5 @@
PKG_NAME ?= trusted-firmware-a
PKG_CPE_ID ?= cpe:/a:arm:trusted_firmware-a
PKG_CPE_ID ?= cpe:/a:arm:arm_trusted_firmware
ifndef PKG_SOURCE_PROTO
PKG_SOURCE = trusted-firmware-a-$(PKG_VERSION).tar.gz
@ -81,7 +81,6 @@ define Build/Compile/Trusted-Firmware-A
$(if $(DTC),DTC="$(DTC)") \
PLAT=$(PLAT) \
BUILD_STRING="OpenWrt v$(PKG_VERSION)-$(PKG_RELEASE) ($(VARIANT))" \
$(if $(CONFIG_BINUTILS_VERSION_2_39),LDFLAGS="-no-warn-rwx-segments") \
$(TFA_MAKE_FLAGS)
endef

View File

@ -1,2 +1,16 @@
$(warn uclibc++.mk is deprecated. Please remove it and CXX_DEPENDS)
CXX_DEPENDS = +libstdcpp
ifndef DUMP
ifdef __package_mk
$(error uclibc++.mk must be included before package.mk)
endif
endif
PKG_PREPARED_DEPENDS += CONFIG_USE_UCLIBCXX
CXX_DEPENDS = +USE_UCLIBCXX:uclibcxx +USE_LIBSTDCXX:libstdcpp
ifneq ($(CONFIG_USE_UCLIBCXX),)
ifneq ($(CONFIG_CCACHE),)
TARGET_CXX_NOCACHE=g++-uc
else
TARGET_CXX=g++-uc
endif
endif

View File

@ -21,9 +21,6 @@ boot() {
[ -f /proc/mounts ] || /sbin/mount_root
[ -f /proc/jffs2_bbc ] && echo "S" > /proc/jffs2_bbc
have_ro_ext4=$(/bin/cat /proc/mounts |/bin/grep ' / ext4'|/bin/grep 'ro'|/usr/bin/wc -l)
if [ "$have_ro_ext4" != "0" ]; then
/usr/bin/mount -o remount,rw /
fi
mkdir -p /var/lock
chmod 1777 /var/lock

View File

@ -249,14 +249,16 @@ foreach my $mirror (@ARGV) {
} elsif ($mirror =~ /^\@OPENWRT$/) {
# use OpenWrt source server directly
} elsif ($mirror =~ /^\@DEBIAN\/(.+)$/) {
push @mirrors, "https://mirrors.aliyun.com/debian/$1";
push @mirrors, "https://mirrors.tencent.com/debian/$1";
push @mirrors, "https://mirrors.tuna.tsinghua.edu.cn/debian/$1";
push @mirrors, "https://mirrors.ustc.edu.cn/debian/$1";
push @mirrors, "https://ftp.debian.org/debian/$1";
push @mirrors, "https://mirror.leaseweb.com/debian/$1";
push @mirrors, "https://mirror.netcologne.de/debian/$1";
} elsif ($mirror =~ /^\@APACHE\/(.+)$/) {
push @mirrors, "https://mirrors.aliyun.com/apache/$1";
push @mirrors, "https://mirrors.tencent.com/apache/$1";
push @mirrors, "https://mirrors.cloud.tencent.com/apache/$1";
push @mirrors, "https://mirrors.tuna.tsinghua.edu.cn/apache/$1";
push @mirrors, "https://mirrors.ustc.edu.cn/apache/$1";
push @mirrors, "https://mirror.netcologne.de/apache.org/$1";
push @mirrors, "https://mirror.aarnet.edu.au/pub/apache/$1";
push @mirrors, "https://mirror.csclub.uwaterloo.ca/apache/$1";
@ -272,8 +274,8 @@ foreach my $mirror (@ARGV) {
push @mirrors, "https://raw.githubusercontent.com/$1";
}
} elsif ($mirror =~ /^\@GNU\/(.+)$/) {
push @mirrors, "https://mirrors.aliyun.com/gnu/$1";
push @mirrors, "https://mirrors.tencent.com/gnu/$1";
push @mirrors, "https://mirrors.tuna.tsinghua.edu.cn/gnu/$1";
push @mirrors, "https://mirrors.ustc.edu.cn/gnu/$1";
push @mirrors, "https://mirror.csclub.uwaterloo.ca/gnu/$1";
push @mirrors, "https://mirror.netcologne.de/gnu/$1";
push @mirrors, "http://ftp.kddilabs.jp/GNU/gnu/$1";
@ -299,7 +301,7 @@ foreach my $mirror (@ARGV) {
push @extra, "$extra[0]/longterm/v$1";
}
foreach my $dir (@extra) {
push @mirrors, "https://mirror.iscas.ac.cn/kernel.org/$dir";
push @mirrors, "https://mirrors.tuna.tsinghua.edu.cn/kernel/$dir";
push @mirrors, "https://mirrors.ustc.edu.cn/kernel.org/$dir";
push @mirrors, "https://cdn.kernel.org/pub/$dir";
push @mirrors, "https://download.xs4all.nl/ftp.kernel.org/pub/$dir";

View File

@ -1,13 +0,0 @@
#!/bin/sh
TARGETS=$*
READELF="${READELF:-readelf}"
XARGS="${XARGS:-xargs -r}"
find $TARGETS -type f -a -exec file {} \; | \
sed -n -e 's/^\(.*\):.*ELF.*\(executable\|shared object\).*,.*/\1/p' | \
$XARGS -n1 $READELF -l | grep 'Requesting' | cut -d':' -f2 | tr -d ' ]' | \
$XARGS basename
cd `dirname ${0}`
./gen-dependencies.sh ${TARGETS}

View File

@ -1,41 +0,0 @@
#!/bin/sh
# Copyright (C) 2006-2012 OpenWrt.org
set -e -x
if [ $# -ne 5 ] && [ $# -ne 6 ]; then
echo "SYNTAX: $0 <file> <kernel size> <kernel directory> <rootfs size> <rootfs image>"
exit 1
fi
OUTPUT="$1"
KERNELSIZE="$2"
KERNELDIR="$3"
ROOTFSSIZE="$4"
ROOTFSIMAGE="$5"
UBOOTSIZE=8
UBOOTOFFSET=8
KERNELOFFSET="$(($UBOOTOFFSET + $UBOOTSIZE))"
ROOTFSOFFSET="$(($KERNELSIZE + $KERNELOFFSET))"
rm -f "$OUTPUT"
# create partition table
set $(ptgen -g -o "$OUTPUT" -a 2 -N uboot -p "$UBOOTSIZE"M@"$UBOOTOFFSET"M -N kernel -p "$KERNELSIZE"M@"$KERNELOFFSET"M -N rootfs -p "$ROOTFSSIZE"M@"$ROOTFSOFFSET"M)
KERNELOFFSET="$(($3 / 512))"
KERNELSIZE="$4"
ROOTFSOFFSET="$(($5 / 512))"
ROOTFSSIZE="$(($6 / 512))"
[ -n "$PADDING" ] && dd if=/dev/zero of="$OUTPUT" bs=512 seek="$ROOTFSOFFSET" conv=notrunc count="$ROOTFSSIZE"
dd if="$ROOTFSIMAGE" of="$OUTPUT" bs=512 seek="$ROOTFSOFFSET" conv=notrunc
if [ -n "$GUID" ]; then
[ -n "$PADDING" ] && dd if=/dev/zero of="$OUTPUT" bs=512 seek="$((ROOTFSOFFSET + ROOTFSSIZE))" conv=notrunc count="$sect"
mkfs.fat -n kernel -C "$OUTPUT.kernel" -S 512 "$((KERNELSIZE / 1024))"
mcopy -s -i "$OUTPUT.kernel" "$KERNELDIR"/* ::/
else
make_ext4fs -J -L kernel -l "$KERNELSIZE" "$OUTPUT.kernel" "$KERNELDIR"
fi
dd if="$OUTPUT.kernel" of="$OUTPUT" bs=512 seek="$KERNELOFFSET" conv=notrunc
rm -f "$OUTPUT.kernel"

View File

@ -17,6 +17,7 @@
# <padding> Padding ('0' + 0x20 *7) (8 bytes)
# <signature> Signature of signer. Not checked so use arbitrary value (16 bytes)
# <padding> Padding (0x00) (192 bytes)
# 0x0A (1 byte)
## version history
# * version 1: initial commit
@ -61,4 +62,6 @@ printf ".LINKSYS.01000409%-15s%-8s%-8s%-16s" "${TYPE}" "${CRC}" "0" "K0000000F02
dd if=/dev/zero bs=1 count=192 conv=notrunc >> "${IMG_TMP_OUT}"
printf '\12' >> "${IMG_TMP_OUT}"
cp "${IMG_TMP_OUT}" "${IMG_OUT}"

View File

@ -1,122 +0,0 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: GPL-2.0-or-later
#
# Copyright (c) 2021 Mikhail Zhilkin <csharper2005@gmail.com>
#
###
### sercomm-kernel.sh - calculates and appends a special kernel header.
### Intended for some Sercomm devices (e.g., Beeline
### SmartBox GIGA, Beeline SmartBox Turbo+, Sercomm
### S3).
#
# Credits to @kar200 for the header description. More details are here:
# https://forum.openwrt.org/t/add-support-for-sercomm-s3-on-stock-uboot
#
if [ $# -ne 3 ]; then
echo "SYNTAX: $0 <kernel> <kernel_offset> <rootfs_offset>"
exit 1
fi
FILE_TMP=$1.shdr
KERNEL_IMG=$1
KERNEL_OFFSET=$2
ROOTFS_OFFSET=$3
# Sercomm HDR (0x53657200), 0xffffffff for hdr crc32 calc
hdr_sign_offs=0x0
hdr_sign_val=0x53657200
# Absoulte lenght for Sercomm footer
hdr_footer_size_offs=0x4
hdr_footer_size_val=
# Header checksum. 0xffffffff for hdr crc32 calc
hdr_head_chksum_offs=0x8
hdr_head_chksum_val=
# Magic constant (0x2ffffff)
hdr_int04_offs=0xc
hdr_int04_val=0x2ffffff
# Kernel flash offset
hdr_kern_offs_offs=0x10
hdr_kern_offs_val=$KERNEL_OFFSET
# Kernel lenght
hdr_kern_len_offs=0x14
hdr_kern_len_val=
# Kernel checksum
hdr_kern_chksum_offs=0x18
hdr_kern_chksum_val=
# Magic constant (0x0)
hdr_int08_offs=0x1c
hdr_int08_val=0x0
# Rootfs flash offset
hdr_rootfs_offs_offs=0x28
hdr_rootfs_offs_val=$ROOTFS_OFFSET
# Rootfs flash lenght. We're checking only first 4 bytes
hdr_rootfs_len_offs=0x2c
hdr_rootfs_len_val=0x4
# Rootfs checksum. Checksum is a constant for UBI (first 4 bytes)
hdr_rootfs_chksum_offs=0x30
hdr_rootfs_chksum_val=0x1cfc552d
# Magic constant (0x0)
hdr_int10_offs=0x34
hdr_int10_val=0x0
pad_zeros () {
awk '{ printf "%8s\n", $0 }' | sed 's/ /0/g'
}
# Remove leading 0x
trim_hx () {
printf "%x\n" $1 | pad_zeros
}
# Change endian
swap_hx () {
pad_zeros | awk '{for (i=7;i>=1;i=i-2) printf "%s%s", \
substr($1,i,2), (i>1?"":"\n")}'
}
# Check file size
fsize () {
printf "%x\n" `stat -c "%s" $1`
}
# Calculate checksum
chksum () {
dd if=$1 2>/dev/null | gzip -c | tail -c 8 | od -An -tx4 -N4 \
--endian=big | tr -d ' \n' | pad_zeros
}
# Write 4 bytes in the header by offset
write_hdr () {
echo -ne "$(echo $1 | sed 's/../\\x&/g')" | dd of=$FILE_TMP bs=1 \
seek=$(($2)) count=4 conv=notrunc status=none 2>/dev/null
}
# Pad a new header with 0xff
dd if=/dev/zero ibs=1 count=256 status=none | tr "\000" "\377" > \
$FILE_TMP 2>/dev/null
# Write constants
write_hdr $(trim_hx $hdr_int04_val) $hdr_int04_offs
write_hdr $(trim_hx $hdr_int08_val) $hdr_int08_offs
write_hdr $(trim_hx $hdr_int10_val) $hdr_int10_offs
# Write footer data
hdr_footer_size_val=$(($hdr_rootfs_offs_val + $hdr_rootfs_len_val))
write_hdr $(trim_hx $hdr_footer_size_val | swap_hx) $hdr_footer_size_offs
# Write kernel data
write_hdr $(trim_hx $hdr_kern_offs_val | swap_hx) $hdr_kern_offs_offs
hdr_kern_len_val=$(fsize $KERNEL_IMG | pad_zeros)
write_hdr $(echo $hdr_kern_len_val | swap_hx) $hdr_kern_len_offs
hdr_kern_chksum_val=$(chksum $KERNEL_IMG)
write_hdr $hdr_kern_chksum_val $hdr_kern_chksum_offs
# Write rootfs data
write_hdr $(trim_hx $hdr_rootfs_offs_val | swap_hx) $hdr_rootfs_offs_offs
write_hdr $(trim_hx $hdr_rootfs_len_val | swap_hx) $hdr_rootfs_len_offs
write_hdr $(trim_hx $hdr_rootfs_chksum_val) $hdr_rootfs_chksum_offs
# Write header checksum
hdr_head_chksum_val=$(chksum $FILE_TMP)
write_hdr $hdr_head_chksum_val $hdr_head_chksum_offs
# Place Sercomm signature
write_hdr $(trim_hx $hdr_sign_val) $hdr_sign_offs
dd if=$KERNEL_IMG >> $FILE_TMP
mv $FILE_TMP $KERNEL_IMG

View File

@ -179,7 +179,7 @@ EOF
print <<EOF;
choice
prompt "Target System"
default TARGET_x86
default TARGET_ath79
reset if !DEVEL
EOF

View File

@ -7,7 +7,7 @@ BOARDNAME:=Rockchip
FEATURES:=ext4 audio usb usbgadget display gpio fpu pci pcie rootfs-part boot-part squashfs
SUBTARGETS:=armv8
KERNEL_PATCHVER=6.1
KERNEL_PATCHVER=5.4
KERNEL_TESTING_PATCHVER=6.1
define Target/Description

View File

@ -130,7 +130,7 @@ define Device/friendlyarm_nanopi-r5c
IMAGE/sysupgrade.img.gz := boot-common | boot-script nanopi-r5s | pine64-img | gzip | append-metadata
DEVICE_PACKAGES := kmod-r8125
endef
#TARGET_DEVICES += friendlyarm_nanopi-r5c
TARGET_DEVICES += friendlyarm_nanopi-r5c
define Device/firefly_station-p2
DEVICE_VENDOR := Firefly

View File

@ -37,7 +37,6 @@ menuconfig TARGET_OPTIONS
Most people will answer N.
choice BPF_TOOLCHAIN
prompt "BPF toolchain" if DEVEL
default BPF_TOOLCHAIN_BUILD_LLVM if BUILDBOT
@ -169,7 +168,6 @@ menuconfig EXTERNAL_TOOLCHAIN
string
prompt "Toolchain include path" if DEVEL
depends on EXTERNAL_TOOLCHAIN && !NATIVE_TOOLCHAIN
default "./usr/include ./include/fortify ./include" if EXTERNAL_TOOLCHAIN_LIBC_USE_MUSL
default "./usr/include ./include"
help
Specify additional directories searched for header files (override
@ -309,7 +307,7 @@ config GDB_PYTHON
help
Enable the python bindings for GDB to allow using python in the gdb shell.
config HAS_BPF_TOOLCHAIN
bool
@ -328,7 +326,7 @@ config USE_LLVM_PREBUILT
config USE_LLVM_BUILD
default y if !DEVEL && BUILDBOT
select HAS_BPF_TOOLCHAIN
bool
bool
config USE_GLIBC
default y if !TOOLCHAINOPTS && !EXTERNAL_TOOLCHAIN && !NATIVE_TOOLCHAIN && (arc)

View File

@ -2,7 +2,7 @@
choice
prompt "Binutils Version" if TOOLCHAINOPTS
default BINUTILS_USE_VERSION_2_39
default BINUTILS_USE_VERSION_2_37
help
Select the version of binutils you wish to use.
@ -13,7 +13,7 @@ choice
config BINUTILS_USE_VERSION_2_38
bool "Binutils 2.38"
select BINUTILS_VERSION_2_38
config BINUTILS_USE_VERSION_2_39
bool "Binutils 2.39"
select BINUTILS_VERSION_2_39

View File

@ -1,13 +1,12 @@
config BINUTILS_VERSION_2_37
bool
config BINUTILS_VERSION_2_38
bool
config BINUTILS_VERSION_2_39
default y if !TOOLCHAINOPTS
bool
config BINUTILS_VERSION_2_39
bool
config BINUTILS_VERSION
string

View File

@ -1,27 +0,0 @@
From 9284b63ea39cecbfc1522d9e143ecb7727d77eb5 Mon Sep 17 00:00:00 2001
From: Martin Liska <mliska@suse.cz>
Date: Mon, 8 Aug 2022 13:22:26 +0200
Subject: [PATCH 005/160] ld: fix NEWS typos
ld/ChangeLog:
* NEWS: Fix 2 typos.
---
ld/NEWS | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/ld/NEWS
+++ b/ld/NEWS
@@ -27,10 +27,10 @@ Changes in 2.39:
--enable-warn-rwx-segments=no
will make --no-warn-rwx-segments enabled by default.
- --enable-defaul-execstack=no
+ --enable-default-execstack=no
will stop the creation of an executable stack simply because an input file
is missing a .note.GNU-stack section, even on architectures where this
- ehaviour is the default.
+ behaviour is the default.
* TYPE=<type> is now supported in an output section description to set the
section type value.

View File

@ -1,90 +0,0 @@
From e8cf73215187b0c08679d726a5cc7c019fa3ea2e Mon Sep 17 00:00:00 2001
From: Jan Beulich <jbeulich@suse.com>
Date: Wed, 10 Aug 2022 10:34:22 +0200
Subject: [PATCH 008/160] gas/Dwarf: properly skip zero-size functions
PR gas/29451
While out_debug_abbrev() properly skips such functions, out_debug_info()
mistakenly didn't. It needs to calculate the high_pc expression ahead of
time, in order to skip emitting any data for the function if the value
is zero.
The one case which would still leave a zero-size entry is when
symbol_get_obj(symp)->size ends up evaluating to zero. I hope we can
expect that to not be the case, otherwise we'd need to have a way to
post-process .debug_info contents between resolving expressions and
actually writing the data out to the file. Even then it wouldn't be
entirely obvious in which way to alter the data.
(cherry picked from commit d7abcbcea5ddd40a3bf28758b62f35933c59f996)
---
gas/dwarf2dbg.c | 39 ++++++++++++++++++++-------------------
1 file changed, 20 insertions(+), 19 deletions(-)
--- a/gas/dwarf2dbg.c
+++ b/gas/dwarf2dbg.c
@@ -2882,6 +2882,7 @@ out_debug_info (segT info_seg, segT abbr
{
const char *name;
size_t len;
+ expressionS size = { .X_op = O_constant };
/* Skip warning constructs (see above). */
if (symbol_get_bfdsym (symp)->flags & BSF_WARNING)
@@ -2895,6 +2896,18 @@ out_debug_info (segT info_seg, segT abbr
if (!S_IS_DEFINED (symp) || !S_IS_FUNCTION (symp))
continue;
+#if defined (OBJ_ELF) /* || defined (OBJ_MAYBE_ELF) */
+ size.X_add_number = S_GET_SIZE (symp);
+ if (size.X_add_number == 0 && IS_ELF
+ && symbol_get_obj (symp)->size != NULL)
+ {
+ size.X_op = O_add;
+ size.X_op_symbol = make_expr_symbol (symbol_get_obj (symp)->size);
+ }
+#endif
+ if (size.X_op == O_constant && size.X_add_number == 0)
+ continue;
+
subseg_set (str_seg, 0);
name_sym = symbol_temp_new_now_octets ();
name = S_GET_NAME (symp);
@@ -2920,29 +2933,17 @@ out_debug_info (segT info_seg, segT abbr
emit_expr (&exp, sizeof_address);
/* DW_AT_high_pc */
- exp.X_op = O_constant;
-#if defined (OBJ_ELF) /* || defined (OBJ_MAYBE_ELF) */
- exp.X_add_number = S_GET_SIZE (symp);
- if (exp.X_add_number == 0 && IS_ELF
- && symbol_get_obj (symp)->size != NULL)
- {
- exp.X_op = O_add;
- exp.X_op_symbol = make_expr_symbol (symbol_get_obj (symp)->size);
- }
-#else
- exp.X_add_number = 0;
-#endif
if (DWARF2_VERSION < 4)
{
- if (exp.X_op == O_constant)
- exp.X_op = O_symbol;
- exp.X_add_symbol = symp;
- emit_expr (&exp, sizeof_address);
+ if (size.X_op == O_constant)
+ size.X_op = O_symbol;
+ size.X_add_symbol = symp;
+ emit_expr (&size, sizeof_address);
}
- else if (exp.X_op == O_constant)
- out_uleb128 (exp.X_add_number);
+ else if (size.X_op == O_constant)
+ out_uleb128 (size.X_add_number);
else
- emit_leb128_expr (symbol_get_value_expression (exp.X_op_symbol), 0);
+ emit_leb128_expr (symbol_get_value_expression (size.X_op_symbol), 0);
}
/* End of children. */

View File

@ -1,270 +0,0 @@
From e3b5d935247084dca057dea72be61b063fe2357a Mon Sep 17 00:00:00 2001
From: Alan Modra <amodra@gmail.com>
Date: Wed, 10 Aug 2022 10:38:52 +0930
Subject: [PATCH 009/160] PR29462, internal error in relocate, at
powerpc.cc:10796
Prior to the inline plt call support (commit 08be322439), the only
local syms with plt entries were local ifunc symbols. There shouldn't
be stubs for other local symbols so don't look for them. The patch
also fixes minor bugs in get_reference_flags; Many relocs are valid
only for ppc64 and a couple only for ppc32.
PR 29462
* powerpc.cc (Target_powerpc::Relocate::relocate): Rename
use_plt_offset to pltcal_to_direct, invert logic. For relocs
not used with inline plt sequences against local symbols, only
look for stubs when the symbol is an ifunc.
(Target_powerpc::Scan::get_reference_flags): Correct reloc
handling for relocs not valid for both 32-bit and 64-bit.
(cherry picked from commit 6158b25f77db11712b84e6a4609898f2615ac749)
---
gold/powerpc.cc | 129 ++++++++++++++++++++++++++++--------------------
1 file changed, 75 insertions(+), 54 deletions(-)
--- a/gold/powerpc.cc
+++ b/gold/powerpc.cc
@@ -7675,22 +7675,18 @@ Target_powerpc<size, big_endian>::Scan::
switch (r_type)
{
+ case elfcpp::R_PPC64_TOC:
+ if (size != 64)
+ break;
+ // Fall through.
case elfcpp::R_POWERPC_NONE:
case elfcpp::R_POWERPC_GNU_VTINHERIT:
case elfcpp::R_POWERPC_GNU_VTENTRY:
- case elfcpp::R_PPC64_TOC:
// No symbol reference.
break;
case elfcpp::R_PPC64_ADDR64:
case elfcpp::R_PPC64_UADDR64:
- case elfcpp::R_POWERPC_ADDR32:
- case elfcpp::R_POWERPC_UADDR32:
- case elfcpp::R_POWERPC_ADDR16:
- case elfcpp::R_POWERPC_UADDR16:
- case elfcpp::R_POWERPC_ADDR16_LO:
- case elfcpp::R_POWERPC_ADDR16_HI:
- case elfcpp::R_POWERPC_ADDR16_HA:
case elfcpp::R_PPC64_ADDR16_HIGHER34:
case elfcpp::R_PPC64_ADDR16_HIGHERA34:
case elfcpp::R_PPC64_ADDR16_HIGHEST34:
@@ -7700,6 +7696,16 @@ Target_powerpc<size, big_endian>::Scan::
case elfcpp::R_PPC64_D34_HI30:
case elfcpp::R_PPC64_D34_HA30:
case elfcpp::R_PPC64_D28:
+ if (size != 64)
+ break;
+ // Fall through.
+ case elfcpp::R_POWERPC_ADDR32:
+ case elfcpp::R_POWERPC_UADDR32:
+ case elfcpp::R_POWERPC_ADDR16:
+ case elfcpp::R_POWERPC_UADDR16:
+ case elfcpp::R_POWERPC_ADDR16_LO:
+ case elfcpp::R_POWERPC_ADDR16_HI:
+ case elfcpp::R_POWERPC_ADDR16_HA:
ref = Symbol::ABSOLUTE_REF;
break;
@@ -7710,13 +7716,14 @@ Target_powerpc<size, big_endian>::Scan::
ref = Symbol::FUNCTION_CALL | Symbol::ABSOLUTE_REF;
break;
- case elfcpp::R_PPC64_REL64:
- case elfcpp::R_POWERPC_REL32:
case elfcpp::R_PPC_LOCAL24PC:
- case elfcpp::R_POWERPC_REL16:
- case elfcpp::R_POWERPC_REL16_LO:
- case elfcpp::R_POWERPC_REL16_HI:
- case elfcpp::R_POWERPC_REL16_HA:
+ if (size != 32)
+ break;
+ // Fall through.
+ ref = Symbol::RELATIVE_REF;
+ break;
+
+ case elfcpp::R_PPC64_REL64:
case elfcpp::R_PPC64_REL16_HIGH:
case elfcpp::R_PPC64_REL16_HIGHA:
case elfcpp::R_PPC64_REL16_HIGHER:
@@ -7729,36 +7736,45 @@ Target_powerpc<size, big_endian>::Scan::
case elfcpp::R_PPC64_REL16_HIGHEST34:
case elfcpp::R_PPC64_REL16_HIGHESTA34:
case elfcpp::R_PPC64_PCREL28:
+ if (size != 64)
+ break;
+ // Fall through.
+ case elfcpp::R_POWERPC_REL32:
+ case elfcpp::R_POWERPC_REL16:
+ case elfcpp::R_POWERPC_REL16_LO:
+ case elfcpp::R_POWERPC_REL16_HI:
+ case elfcpp::R_POWERPC_REL16_HA:
ref = Symbol::RELATIVE_REF;
break;
+ case elfcpp::R_PPC_PLTREL24:
+ if (size != 32)
+ break;
+ ref = Symbol::FUNCTION_CALL | Symbol::RELATIVE_REF;
+ break;
+
case elfcpp::R_PPC64_REL24_NOTOC:
- if (size == 32)
+ case elfcpp::R_PPC64_REL24_P9NOTOC:
+ case elfcpp::R_PPC64_PLT16_LO_DS:
+ case elfcpp::R_PPC64_PLTSEQ_NOTOC:
+ case elfcpp::R_PPC64_PLTCALL_NOTOC:
+ case elfcpp::R_PPC64_PLT_PCREL34:
+ case elfcpp::R_PPC64_PLT_PCREL34_NOTOC:
+ if (size != 64)
break;
// Fall through.
- case elfcpp::R_PPC64_REL24_P9NOTOC:
case elfcpp::R_POWERPC_REL24:
- case elfcpp::R_PPC_PLTREL24:
case elfcpp::R_POWERPC_REL14:
case elfcpp::R_POWERPC_REL14_BRTAKEN:
case elfcpp::R_POWERPC_REL14_BRNTAKEN:
case elfcpp::R_POWERPC_PLT16_LO:
case elfcpp::R_POWERPC_PLT16_HI:
case elfcpp::R_POWERPC_PLT16_HA:
- case elfcpp::R_PPC64_PLT16_LO_DS:
case elfcpp::R_POWERPC_PLTSEQ:
- case elfcpp::R_PPC64_PLTSEQ_NOTOC:
case elfcpp::R_POWERPC_PLTCALL:
- case elfcpp::R_PPC64_PLTCALL_NOTOC:
- case elfcpp::R_PPC64_PLT_PCREL34:
- case elfcpp::R_PPC64_PLT_PCREL34_NOTOC:
ref = Symbol::FUNCTION_CALL | Symbol::RELATIVE_REF;
break;
- case elfcpp::R_POWERPC_GOT16:
- case elfcpp::R_POWERPC_GOT16_LO:
- case elfcpp::R_POWERPC_GOT16_HI:
- case elfcpp::R_POWERPC_GOT16_HA:
case elfcpp::R_PPC64_GOT16_DS:
case elfcpp::R_PPC64_GOT16_LO_DS:
case elfcpp::R_PPC64_GOT_PCREL34:
@@ -7768,11 +7784,16 @@ Target_powerpc<size, big_endian>::Scan::
case elfcpp::R_PPC64_TOC16_HA:
case elfcpp::R_PPC64_TOC16_DS:
case elfcpp::R_PPC64_TOC16_LO_DS:
+ if (size != 64)
+ break;
+ // Fall through.
+ case elfcpp::R_POWERPC_GOT16:
+ case elfcpp::R_POWERPC_GOT16_LO:
+ case elfcpp::R_POWERPC_GOT16_HI:
+ case elfcpp::R_POWERPC_GOT16_HA:
ref = Symbol::RELATIVE_REF;
break;
- case elfcpp::R_POWERPC_GOT_TPREL16:
- case elfcpp::R_POWERPC_TLS:
case elfcpp::R_PPC64_TLSGD:
case elfcpp::R_PPC64_TLSLD:
case elfcpp::R_PPC64_TPREL34:
@@ -7781,6 +7802,11 @@ Target_powerpc<size, big_endian>::Scan::
case elfcpp::R_PPC64_GOT_TLSLD_PCREL34:
case elfcpp::R_PPC64_GOT_TPREL_PCREL34:
case elfcpp::R_PPC64_GOT_DTPREL_PCREL34:
+ if (size != 64)
+ break;
+ // Fall through.
+ case elfcpp::R_POWERPC_GOT_TPREL16:
+ case elfcpp::R_POWERPC_TLS:
ref = Symbol::TLS_REF;
break;
@@ -10671,10 +10697,8 @@ Target_powerpc<size, big_endian>::Reloca
bool has_stub_value = false;
bool localentry0 = false;
unsigned int r_sym = elfcpp::elf_r_sym<size>(rela.get_r_info());
- bool use_plt_offset
- = (gsym != NULL
- ? gsym->use_plt_offset(Scan::get_reference_flags(r_type, target))
- : object->local_has_plt_offset(r_sym));
+ bool pltcall_to_direct = false;
+
if (is_plt16_reloc<size>(r_type)
|| r_type == elfcpp::R_PPC64_PLT_PCREL34
|| r_type == elfcpp::R_PPC64_PLT_PCREL34_NOTOC
@@ -10688,21 +10712,18 @@ Target_powerpc<size, big_endian>::Reloca
// that the decision depends on the PLTCALL reloc, and we don't
// know the address of that instruction when processing others
// in the sequence. So the decision needs to be made in
- // do_relax(). For now, don't optimise inline plt calls.
- if (gsym)
- use_plt_offset = gsym->has_plt_offset();
- }
- if (use_plt_offset
- && !is_got_reloc(r_type)
- && !is_plt16_reloc<size>(r_type)
- && r_type != elfcpp::R_PPC64_PLT_PCREL34
- && r_type != elfcpp::R_PPC64_PLT_PCREL34_NOTOC
- && r_type != elfcpp::R_POWERPC_PLTSEQ
- && r_type != elfcpp::R_POWERPC_PLTCALL
- && r_type != elfcpp::R_PPC64_PLTSEQ_NOTOC
- && r_type != elfcpp::R_PPC64_PLTCALL_NOTOC
- && (!psymval->is_ifunc_symbol()
- || Scan::reloc_needs_plt_for_ifunc(target, object, r_type, false)))
+ // do_relax().
+ pltcall_to_direct = !(gsym != NULL
+ ? gsym->has_plt_offset()
+ : object->local_has_plt_offset(r_sym));
+ }
+ else if ((gsym != NULL
+ ? gsym->use_plt_offset(Scan::get_reference_flags(r_type, target))
+ : psymval->is_ifunc_symbol() && object->local_has_plt_offset(r_sym))
+ && !is_got_reloc(r_type)
+ && (!psymval->is_ifunc_symbol()
+ || Scan::reloc_needs_plt_for_ifunc(target, object, r_type,
+ false)))
{
if (size == 64
&& gsym != NULL
@@ -10796,9 +10817,9 @@ Target_powerpc<size, big_endian>::Reloca
gold_assert(has_stub_value || !(os->flags() & elfcpp::SHF_ALLOC));
}
- if (use_plt_offset && (is_plt16_reloc<size>(r_type)
- || r_type == elfcpp::R_PPC64_PLT_PCREL34
- || r_type == elfcpp::R_PPC64_PLT_PCREL34_NOTOC))
+ if (!pltcall_to_direct && (is_plt16_reloc<size>(r_type)
+ || r_type == elfcpp::R_PPC64_PLT_PCREL34
+ || r_type == elfcpp::R_PPC64_PLT_PCREL34_NOTOC))
{
const Output_data_plt_powerpc<size, big_endian>* plt;
if (gsym)
@@ -10826,7 +10847,7 @@ Target_powerpc<size, big_endian>::Reloca
value -= target->toc_pointer();
}
}
- else if (!use_plt_offset
+ else if (pltcall_to_direct
&& (is_plt16_reloc<size>(r_type)
|| r_type == elfcpp::R_POWERPC_PLTSEQ
|| r_type == elfcpp::R_PPC64_PLTSEQ_NOTOC))
@@ -10835,7 +10856,7 @@ Target_powerpc<size, big_endian>::Reloca
elfcpp::Swap<32, big_endian>::writeval(iview, nop);
r_type = elfcpp::R_POWERPC_NONE;
}
- else if (!use_plt_offset
+ else if (pltcall_to_direct
&& (r_type == elfcpp::R_PPC64_PLT_PCREL34
|| r_type == elfcpp::R_PPC64_PLT_PCREL34_NOTOC))
{
@@ -11316,8 +11337,8 @@ Target_powerpc<size, big_endian>::Reloca
}
else if (!has_stub_value)
{
- if (!use_plt_offset && (r_type == elfcpp::R_POWERPC_PLTCALL
- || r_type == elfcpp::R_PPC64_PLTCALL_NOTOC))
+ if (pltcall_to_direct && (r_type == elfcpp::R_POWERPC_PLTCALL
+ || r_type == elfcpp::R_PPC64_PLTCALL_NOTOC))
{
// PLTCALL without plt entry => convert to direct call
Insn* iview = reinterpret_cast<Insn*>(view);

View File

@ -1,167 +0,0 @@
From 9e855cffa1fda44629e7f9b76dfa3e5a51a440e9 Mon Sep 17 00:00:00 2001
From: Alan Modra <amodra@gmail.com>
Date: Thu, 11 Aug 2022 09:51:03 +0930
Subject: [PATCH 011/160] PR29466, APP/NO_APP with .linefile
Commit 53f2b36a54b9 exposed a bug in sb_scrub_and_add_sb that could
result in losing input. If scrubbing results in expansion past the
holding capacity of do_scrub_chars output buffer, then do_scrub_chars
stashes the extra input for the next call. That call never came
because sb_scrub_and_add_sb wrongly decided it was done. Fix that by
allowing sb_scrub_and_add_sb to see whether there is pending input.
Also allow a little extra space so that in most cases we won't need
to resize the output buffer.
sb_scrub_and_add_sb also limited output to the size of the input,
rather than the actual output buffer size. Fixing that resulted in a
fail of gas/testsuite/macros/dot with an extra warning: "end of file
not at end of a line; newline inserted". OK, so the macro in dot.s
really does finish without end-of-line. Apparently the macro
expansion code relied on do_scrub_chars returning early. So fix that
too by adding a newline if needed in macro_expand_body.
PR 29466
* app.c (do_scrub_pending): New function.
* as.h: Declare it.
* input-scrub.c (input_scrub_include_sb): Add extra space for
two .linefile directives.
* sb.c (sb_scrub_and_add_sb): Take into account pending input.
Allow output to max.
* macro.c (macro_expand_body): Add terminating newline.
* testsuite/config/default.exp (SIZE, SIZEFLAGS): Define.
* testsuite/gas/macros/app5.d,
* testsuite/gas/macros/app5.s: New test.
* testsuite/gas/macros/macros.exp: Run it.
(cherry picked from commit 4d74aab7aa562fe79d4669cdad0c32610531cbc0)
---
gas/app.c | 13 +++++++++++++
gas/as.h | 1 +
gas/input-scrub.c | 6 ++++--
gas/macro.c | 2 ++
gas/sb.c | 5 +++--
gas/testsuite/config/default.exp | 8 ++++++++
gas/testsuite/gas/macros/app5.d | 6 ++++++
gas/testsuite/gas/macros/app5.s | 5 +++++
gas/testsuite/gas/macros/macros.exp | 1 +
9 files changed, 43 insertions(+), 4 deletions(-)
create mode 100644 gas/testsuite/gas/macros/app5.d
create mode 100644 gas/testsuite/gas/macros/app5.s
--- a/gas/app.c
+++ b/gas/app.c
@@ -1537,3 +1537,16 @@ do_scrub_chars (size_t (*get) (char *, s
last_char = to[-1];
return to - tostart;
}
+
+/* Return amount of pending input. */
+
+size_t
+do_scrub_pending (void)
+{
+ size_t len = 0;
+ if (saved_input)
+ len += saved_input_len;
+ if (state == -1)
+ len += strlen (out_string);
+ return len;
+}
--- a/gas/as.h
+++ b/gas/as.h
@@ -460,6 +460,7 @@ void input_scrub_insert_file (char *);
char * input_scrub_new_file (const char *);
char * input_scrub_next_buffer (char **bufp);
size_t do_scrub_chars (size_t (*get) (char *, size_t), char *, size_t);
+size_t do_scrub_pending (void);
bool scan_for_multibyte_characters (const unsigned char *, const unsigned char *, bool);
int gen_to_words (LITTLENUM_TYPE *, int, long);
int had_err (void);
--- a/gas/input-scrub.c
+++ b/gas/input-scrub.c
@@ -278,9 +278,11 @@ input_scrub_include_sb (sb *from, char *
next_saved_file = input_scrub_push (position);
- /* Allocate sufficient space: from->len + optional newline. */
+ /* Allocate sufficient space: from->len plus optional newline
+ plus two ".linefile " directives, plus a little more for other
+ expansion. */
newline = from->len >= 1 && from->ptr[0] != '\n';
- sb_build (&from_sb, from->len + newline);
+ sb_build (&from_sb, from->len + newline + 2 * sizeof (".linefile") + 30);
if (expansion == expanding_repeat && from_sb_expansion >= expanding_macro)
expansion = expanding_nested;
from_sb_expansion = expansion;
--- a/gas/macro.c
+++ b/gas/macro.c
@@ -1056,6 +1056,8 @@ macro_expand_body (sb *in, sb *out, form
loclist = f;
}
+ if (!err && (out->len == 0 || out->ptr[out->len - 1] != '\n'))
+ sb_add_char (out, '\n');
return err;
}
--- a/gas/sb.c
+++ b/gas/sb.c
@@ -119,11 +119,12 @@ sb_scrub_and_add_sb (sb *ptr, sb *s)
So we loop until the input S is consumed. */
while (1)
{
- size_t copy = s->len - (scrub_position - s->ptr);
+ size_t copy = s->len - (scrub_position - s->ptr) + do_scrub_pending ();
if (copy == 0)
break;
sb_check (ptr, copy);
- ptr->len += do_scrub_chars (scrub_from_sb, ptr->ptr + ptr->len, copy);
+ ptr->len += do_scrub_chars (scrub_from_sb, ptr->ptr + ptr->len,
+ ptr->max - ptr->len);
}
sb_to_scrub = 0;
--- a/gas/testsuite/config/default.exp
+++ b/gas/testsuite/config/default.exp
@@ -52,6 +52,14 @@ if ![info exists NMFLAGS] then {
set NMFLAGS {}
}
+if ![info exists SIZE] then {
+ set SIZE [findfile $base_dir/size]
+}
+
+if ![info exists SIZEFLAGS] then {
+ set SIZEFLAGS ""
+}
+
if ![info exists OBJCOPY] then {
set OBJCOPY [findfile $base_dir/../../binutils/objcopy]
}
--- /dev/null
+++ b/gas/testsuite/gas/macros/app5.d
@@ -0,0 +1,6 @@
+#name: APP with linefile
+#xfail: tic30-*-*
+#size: -G
+# pr29466 just check that the test assembles
+
+#pass
--- /dev/null
+++ b/gas/testsuite/gas/macros/app5.s
@@ -0,0 +1,5 @@
+#NO_APP
+#APP
+# 5 "foo.c" 1
+# 0 "" 2
+#NO_APP
--- a/gas/testsuite/gas/macros/macros.exp
+++ b/gas/testsuite/gas/macros/macros.exp
@@ -70,6 +70,7 @@ run_dump_test app2
run_dump_test app3
remote_download host "$srcdir/$subdir/app4b.s"
run_dump_test app4
+run_dump_test app5
run_list_test badarg ""

View File

@ -1,128 +0,0 @@
From 509a2ec6ad3ea7eb3f4cf59538cf636a2126e4c3 Mon Sep 17 00:00:00 2001
From: liuzhensong <liuzhensong@loongson.cn>
Date: Fri, 2 Sep 2022 16:29:14 +0800
Subject: [PATCH 039/160] LoongArch:ld: Fix relocation error of pcrel.
Patch for branch 2.39.
Need to reduce the address of pc when using
reloction R_LARCH_SOP_PUSH_PCREL.
bfd/
* elfnn-loongarch.c
---
bfd/elfnn-loongarch.c | 3 +-
ld/testsuite/ld-loongarch-elf/pcrel-const.d | 14 +++++++
ld/testsuite/ld-loongarch-elf/pcrel-const.lds | 14 +++++++
ld/testsuite/ld-loongarch-elf/pcrel-const.s | 12 ++++++
ld/testsuite/ld-loongarch-elf/pr.exp | 39 +++++++++++++++++++
5 files changed, 81 insertions(+), 1 deletion(-)
create mode 100644 ld/testsuite/ld-loongarch-elf/pcrel-const.d
create mode 100644 ld/testsuite/ld-loongarch-elf/pcrel-const.lds
create mode 100644 ld/testsuite/ld-loongarch-elf/pcrel-const.s
create mode 100644 ld/testsuite/ld-loongarch-elf/pr.exp
--- a/bfd/elfnn-loongarch.c
+++ b/bfd/elfnn-loongarch.c
@@ -2341,9 +2341,10 @@ loongarch_elf_relocate_section (bfd *out
case R_LARCH_SOP_PUSH_PLT_PCREL:
unresolved_reloc = false;
- if (resolved_to_const)
+ if (!is_undefweak && resolved_to_const)
{
relocation += rel->r_addend;
+ relocation -= pc;
break;
}
else if (is_undefweak)
--- /dev/null
+++ b/ld/testsuite/ld-loongarch-elf/pcrel-const.d
@@ -0,0 +1,14 @@
+#as: -mla-global-with-pcrel
+#objdump: -Drsz
+
+.*:[ ]+file format .*
+
+
+Disassembly of section .text:
+
+.* <foo>:
+#...
+[ ]+8:[ ]+02c04084[ ]+addi.d[ ]+\$a0,[ ]+\$a0,[ ]+16\(0x10\)
+#...
+0+14 <__sec_end>:
+#pass
--- /dev/null
+++ b/ld/testsuite/ld-loongarch-elf/pcrel-const.lds
@@ -0,0 +1,14 @@
+ENTRY(foo);
+SECTIONS
+{
+ .text : {
+ *(.text*)
+ }
+
+ .data : {
+ __sec_start = .;
+ *(.gzdata)
+ __sec_end = .;
+ }
+}
+PROVIDE(__sec_size = __sec_end);
--- /dev/null
+++ b/ld/testsuite/ld-loongarch-elf/pcrel-const.s
@@ -0,0 +1,12 @@
+ .text
+ .align 2
+ .globl foo
+ .type foo, @function
+foo:
+ nop
+ la.global $r4,__sec_size
+ ldptr.w $r4,$r4,0
+ jr $r1
+ .size foo, .-foo
+ .data
+ .word 1
--- /dev/null
+++ b/ld/testsuite/ld-loongarch-elf/pr.exp
@@ -0,0 +1,39 @@
+# Expect script for LoongArch ELF linker tests
+# Copyright (C) 2022 Free Software Foundation, Inc.
+#
+# This file is part of the GNU Binutils.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+
+if ![istarget loongarch64-*-*] {
+ return
+}
+
+set link_tests [list \
+ [list \
+ "pcrel const" \
+ "-T pcrel-const.lds" "" \
+ "-mla-global-with-pcrel" \
+ { pcrel-const.s } \
+ [list \
+ [list objdump -D pcrel-const.d] \
+ ] \
+ "pcrel-const" \
+ ] \
+]
+
+run_ld_link_tests $link_tests

View File

@ -1,27 +0,0 @@
From 4233be14a34d754a70b8b6f6fa42d21f35c6e030 Mon Sep 17 00:00:00 2001
From: Alan Modra <amodra@gmail.com>
Date: Sat, 10 Sep 2022 07:30:57 +0930
Subject: [PATCH 043/160] Re: PR29466, APP/NO_APP with linefile
It looks like I copied the SIZE init across from
binutils/testsuite/config/default.exp without some necessary editing.
PR 29466
* testsuite/config/default.exp (SIZE): Adjust relative path.
(cherry picked from commit 1180f540d5f2f7751b5309bdd6c38d69fcf699e7)
---
gas/testsuite/config/default.exp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/gas/testsuite/config/default.exp
+++ b/gas/testsuite/config/default.exp
@@ -53,7 +53,7 @@ if ![info exists NMFLAGS] then {
}
if ![info exists SIZE] then {
- set SIZE [findfile $base_dir/size]
+ set SIZE [findfile $base_dir/../../binutils/size]
}
if ![info exists SIZEFLAGS] then {

View File

@ -1,38 +0,0 @@
From 4d7bba23a39fba18d6d13a2941a3c232011a7064 Mon Sep 17 00:00:00 2001
From: Alan Modra <amodra@gmail.com>
Date: Fri, 16 Sep 2022 18:08:44 +0930
Subject: [PATCH 050/160] PowerPC64 pcrel got relocs against local symbols
Not that anyone would want to indirect via the GOT when an address can
be loaded directly with pla, the following:
pld 3,x@got@pcrel
x:
leads to "Internal error in md_apply_fix", because the generic parts
of assembler fixup handling convert the fx_pcrel fixup to one without
a symbol. Stop that happening.
* config/tc-ppc.c (ppc_force_relocation): Add PLT_PCREL34 and
assorted GOT_PCREL34 relocs.
(cherry picked from commit 49c3ed081fed6b8e2b48fdc48f805f11e4589514)
---
gas/config/tc-ppc.c | 6 ++++++
1 file changed, 6 insertions(+)
--- a/gas/config/tc-ppc.c
+++ b/gas/config/tc-ppc.c
@@ -6676,6 +6676,12 @@ ppc_force_relocation (fixS *fix)
case BFD_RELOC_PPC_BA16_BRNTAKEN:
case BFD_RELOC_24_PLT_PCREL:
case BFD_RELOC_PPC64_TOC:
+ case BFD_RELOC_PPC64_PLT_PCREL34:
+ case BFD_RELOC_PPC64_GOT_PCREL34:
+ case BFD_RELOC_PPC64_GOT_TLSGD_PCREL34:
+ case BFD_RELOC_PPC64_GOT_TLSLD_PCREL34:
+ case BFD_RELOC_PPC64_GOT_TPREL_PCREL34:
+ case BFD_RELOC_PPC64_GOT_DTPREL_PCREL34:
return 1;
case BFD_RELOC_PPC_B26:
case BFD_RELOC_PPC_BA26:

View File

@ -1,94 +0,0 @@
From 010db38b54b589ca3e95b498aba2831064970171 Mon Sep 17 00:00:00 2001
From: Alan Modra <amodra@gmail.com>
Date: Wed, 21 Sep 2022 09:06:29 +0930
Subject: [PATCH 055/160] Re: PowerPC64 pcrel got relocs against local symbols
The last patch wasn't all that shiny. There are rather a lot more
relocations that can hit the assertion in md_apply_fix if the symbol
is local or absolute. Fix them all.
* config/tc-ppc.c (ppc_force_relocation): Add all relocs that
expect a symbol in md_apply_fix. Remove tls pcrel relocs
already covered in general tls match range.
(cherry picked from commit 8b168f1a1e09e337d2a970f204a0230c091bbe58)
---
gas/config/tc-ppc.c | 58 ++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 52 insertions(+), 6 deletions(-)
--- a/gas/config/tc-ppc.c
+++ b/gas/config/tc-ppc.c
@@ -6666,8 +6666,6 @@ ppc_force_relocation (fixS *fix)
int
ppc_force_relocation (fixS *fix)
{
- /* Branch prediction relocations must force a relocation, as must
- the vtable description relocs. */
switch (fix->fx_r_type)
{
case BFD_RELOC_PPC_B16_BRTAKEN:
@@ -6676,12 +6674,60 @@ ppc_force_relocation (fixS *fix)
case BFD_RELOC_PPC_BA16_BRNTAKEN:
case BFD_RELOC_24_PLT_PCREL:
case BFD_RELOC_PPC64_TOC:
+ case BFD_RELOC_16_GOTOFF:
+ case BFD_RELOC_LO16_GOTOFF:
+ case BFD_RELOC_HI16_GOTOFF:
+ case BFD_RELOC_HI16_S_GOTOFF:
+ case BFD_RELOC_LO16_PLTOFF:
+ case BFD_RELOC_HI16_PLTOFF:
+ case BFD_RELOC_HI16_S_PLTOFF:
+ case BFD_RELOC_GPREL16:
+ case BFD_RELOC_16_BASEREL:
+ case BFD_RELOC_LO16_BASEREL:
+ case BFD_RELOC_HI16_BASEREL:
+ case BFD_RELOC_HI16_S_BASEREL:
+ case BFD_RELOC_PPC_TOC16:
+ case BFD_RELOC_PPC64_TOC16_LO:
+ case BFD_RELOC_PPC64_TOC16_HI:
+ case BFD_RELOC_PPC64_TOC16_HA:
+ case BFD_RELOC_PPC64_PLTGOT16:
+ case BFD_RELOC_PPC64_PLTGOT16_LO:
+ case BFD_RELOC_PPC64_PLTGOT16_HI:
+ case BFD_RELOC_PPC64_PLTGOT16_HA:
+ case BFD_RELOC_PPC64_GOT16_DS:
+ case BFD_RELOC_PPC64_GOT16_LO_DS:
+ case BFD_RELOC_PPC64_PLT16_LO_DS:
+ case BFD_RELOC_PPC64_SECTOFF_DS:
+ case BFD_RELOC_PPC64_SECTOFF_LO_DS:
+ case BFD_RELOC_PPC64_TOC16_DS:
+ case BFD_RELOC_PPC64_TOC16_LO_DS:
+ case BFD_RELOC_PPC64_PLTGOT16_DS:
+ case BFD_RELOC_PPC64_PLTGOT16_LO_DS:
+ case BFD_RELOC_PPC_EMB_NADDR16:
+ case BFD_RELOC_PPC_EMB_NADDR16_LO:
+ case BFD_RELOC_PPC_EMB_NADDR16_HI:
+ case BFD_RELOC_PPC_EMB_NADDR16_HA:
+ case BFD_RELOC_PPC_EMB_SDAI16:
+ case BFD_RELOC_PPC_EMB_SDA2I16:
+ case BFD_RELOC_PPC_EMB_SDA2REL:
+ case BFD_RELOC_PPC_EMB_SDA21:
+ case BFD_RELOC_PPC_EMB_MRKREF:
+ case BFD_RELOC_PPC_EMB_RELSEC16:
+ case BFD_RELOC_PPC_EMB_RELST_LO:
+ case BFD_RELOC_PPC_EMB_RELST_HI:
+ case BFD_RELOC_PPC_EMB_RELST_HA:
+ case BFD_RELOC_PPC_EMB_BIT_FLD:
+ case BFD_RELOC_PPC_EMB_RELSDA:
+ case BFD_RELOC_PPC_VLE_SDA21:
+ case BFD_RELOC_PPC_VLE_SDA21_LO:
+ case BFD_RELOC_PPC_VLE_SDAREL_LO16A:
+ case BFD_RELOC_PPC_VLE_SDAREL_LO16D:
+ case BFD_RELOC_PPC_VLE_SDAREL_HI16A:
+ case BFD_RELOC_PPC_VLE_SDAREL_HI16D:
+ case BFD_RELOC_PPC_VLE_SDAREL_HA16A:
+ case BFD_RELOC_PPC_VLE_SDAREL_HA16D:
case BFD_RELOC_PPC64_PLT_PCREL34:
case BFD_RELOC_PPC64_GOT_PCREL34:
- case BFD_RELOC_PPC64_GOT_TLSGD_PCREL34:
- case BFD_RELOC_PPC64_GOT_TLSLD_PCREL34:
- case BFD_RELOC_PPC64_GOT_TPREL_PCREL34:
- case BFD_RELOC_PPC64_GOT_DTPREL_PCREL34:
return 1;
case BFD_RELOC_PPC_B26:
case BFD_RELOC_PPC_BA26:

View File

@ -1,89 +0,0 @@
From a98316d5cf970cbc99689797d84c2ea832bcdcbb Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Mon, 1 Aug 2022 16:02:39 -0700
Subject: [PATCH 058/160] elf: Reset alignment for each PT_LOAD segment
Reset alignment for each PT_LOAD segment to avoid using alignment from
the previous PT_LOAD segment.
bfd/
PR ld/29435
* elf.c (assign_file_positions_for_load_sections): Reset
alignment for each PT_LOAD segment.
ld/
PR ld/29435
* testsuite/ld-elf/pr29435.d: New file.
* testsuite/ld-elf/pr29435.s: Likewise.
(cherry picked from commit 59f214544c50ec7ebbca285ff2b4949f48671690)
---
bfd/elf.c | 7 ++++---
ld/testsuite/ld-elf/pr29435.d | 11 +++++++++++
ld/testsuite/ld-elf/pr29435.s | 6 ++++++
3 files changed, 21 insertions(+), 3 deletions(-)
create mode 100644 ld/testsuite/ld-elf/pr29435.d
create mode 100644 ld/testsuite/ld-elf/pr29435.s
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -5438,8 +5438,6 @@ assign_file_positions_for_load_sections
Elf_Internal_Phdr *p;
file_ptr off; /* Octets. */
bfd_size_type maxpagesize;
- bfd_size_type p_align;
- bool p_align_p = false;
unsigned int alloc, actual;
unsigned int i, j;
struct elf_segment_map **sorted_seg_map;
@@ -5524,7 +5522,6 @@ assign_file_positions_for_load_sections
qsort (sorted_seg_map, alloc, sizeof (*sorted_seg_map),
elf_sort_segments);
- p_align = bed->p_align;
maxpagesize = 1;
if ((abfd->flags & D_PAGED) != 0)
{
@@ -5559,6 +5556,8 @@ assign_file_positions_for_load_sections
asection **secpp;
bfd_vma off_adjust; /* Octets. */
bool no_contents;
+ bfd_size_type p_align;
+ bool p_align_p;
/* An ELF segment (described by Elf_Internal_Phdr) may contain a
number of sections with contents contributing to both p_filesz
@@ -5569,6 +5568,8 @@ assign_file_positions_for_load_sections
p = phdrs + m->idx;
p->p_type = m->p_type;
p->p_flags = m->p_flags;
+ p_align = bed->p_align;
+ p_align_p = false;
if (m->count == 0)
p->p_vaddr = m->p_vaddr_offset * opb;
--- /dev/null
+++ b/ld/testsuite/ld-elf/pr29435.d
@@ -0,0 +1,11 @@
+#ld: -shared -z separate-code -z relro
+#xfail: ![check_shared_lib_support]
+#xfail: ![check_relro_support]
+#readelf: -Wl
+
+#failif
+#...
+ +LOAD +0x[0-9a-f]+ 0x[0-9a-f]+ 0x[0-9a-f]+ 0x[0-9a-f]+ 0x[0-9a-f]+ .* 0x8000
+#...
+ +LOAD +0x[0-9a-f]+ 0x[0-9a-f]+ 0x[0-9a-f]+ 0x[0-9a-f]+ 0x[0-9a-f]+ .* 0x8000
+#...
--- /dev/null
+++ b/ld/testsuite/ld-elf/pr29435.s
@@ -0,0 +1,6 @@
+ .text
+ .balign 0x8000
+ .globl foo
+ .type foo, %function
+foo:
+ .byte 0

View File

@ -1,29 +0,0 @@
From 041c22e35de06d22566f4c71e4425c3351215e66 Mon Sep 17 00:00:00 2001
From: Alan Modra <amodra@gmail.com>
Date: Sun, 25 Sep 2022 12:07:36 +0930
Subject: [PATCH 063/160] PR29542, PowerPC gold internal error in
get_output_view,
We were attempting to set a BSS style section contents.
PR 29542
* powerpc.cc (Output_data_plt_powerpc::do_write): Don't set .plt,
.iplt or .lplt section contents when position independent.
(cherry picked from commit c21736aed1d4877e090df60362413669dbdc391d)
---
gold/powerpc.cc | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/gold/powerpc.cc
+++ b/gold/powerpc.cc
@@ -4338,7 +4338,8 @@ template<int size, bool big_endian>
void
Output_data_plt_powerpc<size, big_endian>::do_write(Output_file* of)
{
- if (!this->sym_ents_.empty())
+ if (!this->sym_ents_.empty()
+ && !parameters->options().output_is_position_independent())
{
const section_size_type offset = this->offset();
const section_size_type oview_size

View File

@ -1,301 +0,0 @@
From 88ac930a725b8aac8284a2738f03b843f4343dd0 Mon Sep 17 00:00:00 2001
From: Victor Do Nascimento <Victor.DoNascimento@arm.com>
Date: Thu, 17 Nov 2022 14:48:37 +0000
Subject: [PATCH 116/160] arm: Use DWARF numbering convention for
pseudo-register representation
The patch, initially submitted to trunk in
https://sourceware.org/pipermail/binutils/2022-July/122092.html ensures correct
support for handling .save directives for mixed-register type lists involving
the ra_auth_code pseudo-register, whereby the support first introduced in 2.39
(https://sourceware.org/pipermail/binutils/2022-May/120672.html) led to the
generation of unwinder code popping registers in reversed order.
gas/Changelog:
* config/tc-arm.c (REG_RA_AUTH_CODE): New.
(parse_dot_save): Likewise.
(parse_reg_list): Remove obsolete code.
(reg_names): Set ra_auth_code to 143.
(s_arm_unwind_save): Handle core and pseudo-register lists via
parse_dot_save.
(s_arm_unwind_save_mixed): Deleted.
(s_arm_unwind_save_pseudo): Handle one register at a time.
* testsuite/gas/arm/unwind-pacbti-m-readelf.d: Fix test.
* testsuite/gas/arm/unwind-pacbti-m.d: Likewise.
(cherry picked from commit 3a368c4c248f6e9f4bda3a5369befa17a4560293)
---
gas/config/tc-arm.c | 159 ++++++++++--------
.../gas/arm/unwind-pacbti-m-readelf.d | 4 +-
gas/testsuite/gas/arm/unwind-pacbti-m.d | 2 +-
3 files changed, 95 insertions(+), 70 deletions(-)
--- a/gas/config/tc-arm.c
+++ b/gas/config/tc-arm.c
@@ -742,6 +742,7 @@ const char * const reg_expected_msgs[] =
#define REG_SP 13
#define REG_LR 14
#define REG_PC 15
+#define REG_RA_AUTH_CODE 143
/* ARM instructions take 4bytes in the object file, Thumb instructions
take 2: */
@@ -1943,21 +1944,6 @@ parse_reg_list (char ** strp, enum reg_l
reg = arm_reg_parse (&str, rt);
- /* Skip over allowed registers of alternative types in mixed-type
- register lists. */
- if (reg == FAIL && rt == REG_TYPE_PSEUDO
- && ((reg = arm_reg_parse (&str, REG_TYPE_RN)) != FAIL))
- {
- cur_reg = reg;
- continue;
- }
- else if (reg == FAIL && rt == REG_TYPE_RN
- && ((reg = arm_reg_parse (&str, REG_TYPE_PSEUDO)) != FAIL))
- {
- cur_reg = reg;
- continue;
- }
-
if (etype == REGLIST_CLRM)
{
if (reg == REG_SP || reg == REG_PC)
@@ -4139,7 +4125,6 @@ s_arm_unwind_fnstart (int ignored ATTRIB
unwind.sp_restored = 0;
}
-
/* Parse a handlerdata directive. Creates the exception handling table entry
for the function. */
@@ -4297,15 +4282,19 @@ s_arm_unwind_personality (int ignored AT
/* Parse a directive saving pseudo registers. */
static void
-s_arm_unwind_save_pseudo (long range)
+s_arm_unwind_save_pseudo (int regno)
{
valueT op;
- if (range & (1 << 12))
+ switch (regno)
{
+ case REG_RA_AUTH_CODE:
/* Opcode for restoring RA_AUTH_CODE. */
op = 0xb4;
add_unwind_opcode (op, 1);
+ break;
+ default:
+ as_bad (_("Unknown register %d encountered\n"), regno);
}
}
@@ -4375,6 +4364,80 @@ s_arm_unwind_save_core (long range)
}
}
+/* Implement correct handling of .save lists enabling the split into
+sublists where necessary, while preserving correct sublist ordering. */
+
+static void
+parse_dot_save (char **str_p, int prev_reg)
+{
+ long core_regs = 0;
+ int reg;
+ int in_range = 0;
+
+ if (**str_p == ',')
+ *str_p += 1;
+ if (**str_p == '}')
+ {
+ *str_p += 1;
+ return;
+ }
+
+ while ((reg = arm_reg_parse (str_p, REG_TYPE_RN)) != FAIL)
+ {
+ if (!in_range)
+ {
+ if (core_regs & (1 << reg))
+ as_tsktsk (_("Warning: duplicated register (r%d) in register list"),
+ reg);
+ else if (reg <= prev_reg)
+ as_tsktsk (_("Warning: register list not in ascending order"));
+
+ core_regs |= (1 << reg);
+ prev_reg = reg;
+ if (skip_past_char(str_p, '-') != FAIL)
+ in_range = 1;
+ else if (skip_past_comma(str_p) == FAIL)
+ first_error (_("bad register list"));
+ }
+ else
+ {
+ int i;
+ if (reg <= prev_reg)
+ first_error (_("bad range in register list"));
+ for (i = prev_reg + 1; i <= reg; i++)
+ {
+ if (core_regs & (1 << i))
+ as_tsktsk (_("Warning: duplicated register (r%d) in register list"),
+ i);
+ else
+ core_regs |= 1 << i;
+ }
+ in_range = 0;
+ }
+ }
+ if (core_regs)
+ {
+ /* Higher register numbers go in higher memory addresses. When splitting a list,
+ right-most sublist should therefore be .saved first. Use recursion for this. */
+ parse_dot_save (str_p, reg);
+ /* We're back from recursion, so emit .save insn for sublist. */
+ s_arm_unwind_save_core (core_regs);
+ return;
+ }
+ /* Handle pseudo-regs, under assumption these are emitted singly. */
+ else if ((reg = arm_reg_parse (str_p, REG_TYPE_PSEUDO)) != FAIL)
+ {
+ /* Recurse for remainder of input. Note: No assumption is made regarding which
+ register in core register set holds pseudo-register. It's not considered in
+ ordering check beyond ensuring it's not sandwiched between 2 consecutive
+ registers. */
+ parse_dot_save (str_p, prev_reg + 1);
+ s_arm_unwind_save_pseudo (reg);
+ return;
+ }
+ else
+ as_bad (BAD_SYNTAX);
+}
/* Parse a directive saving FPA registers. */
@@ -4716,39 +4779,13 @@ s_arm_unwind_save_mmxwcg (void)
ignore_rest_of_line ();
}
-/* Convert range and mask_range into a sequence of s_arm_unwind_core
- and s_arm_unwind_pseudo operations. We assume that mask_range will
- not have consecutive bits set, or that one operation per bit is
- acceptable. */
-
-static void
-s_arm_unwind_save_mixed (long range, long mask_range)
-{
- while (mask_range)
- {
- long mask_bit = mask_range & -mask_range;
- long subrange = range & (mask_bit - 1);
-
- if (subrange)
- s_arm_unwind_save_core (subrange);
-
- s_arm_unwind_save_pseudo (mask_bit);
- range &= ~subrange;
- mask_range &= ~mask_bit;
- }
-
- if (range)
- s_arm_unwind_save_core (range);
-}
-
/* Parse an unwind_save directive.
If the argument is non-zero, this is a .vsave directive. */
static void
s_arm_unwind_save (int arch_v6)
{
- char *peek, *mask_peek;
- long range, mask_range;
+ char *peek;
struct reg_entry *reg;
bool had_brace = false;
@@ -4756,7 +4793,7 @@ s_arm_unwind_save (int arch_v6)
as_bad (MISSING_FNSTART);
/* Figure out what sort of save we have. */
- peek = mask_peek = input_line_pointer;
+ peek = input_line_pointer;
if (*peek == '{')
{
@@ -4788,20 +4825,13 @@ s_arm_unwind_save (int arch_v6)
case REG_TYPE_PSEUDO:
case REG_TYPE_RN:
- mask_range = parse_reg_list (&mask_peek, REGLIST_PSEUDO);
- range = parse_reg_list (&input_line_pointer, REGLIST_RN);
-
- if (range == FAIL || mask_range == FAIL)
- {
- as_bad (_("expected register list"));
- ignore_rest_of_line ();
- return;
- }
-
- demand_empty_rest_of_line ();
-
- s_arm_unwind_save_mixed (range, mask_range);
- return;
+ {
+ if (had_brace)
+ input_line_pointer++;
+ parse_dot_save (&input_line_pointer, -1);
+ demand_empty_rest_of_line ();
+ return;
+ }
case REG_TYPE_VFD:
if (arch_v6)
@@ -23993,12 +24023,8 @@ static const struct reg_entry reg_names[
/* XScale accumulator registers. */
REGNUM(acc,0,XSCALE), REGNUM(ACC,0,XSCALE),
- /* DWARF ABI defines RA_AUTH_CODE to 143. It also reserves 134-142 for future
- expansion. RA_AUTH_CODE here is given the value 143 % 134 to make it easy
- for tc_arm_regname_to_dw2regnum to translate to DWARF reg number using
- 134 + reg_number should the range 134 to 142 be used for more pseudo regs
- in the future. This also helps fit RA_AUTH_CODE into a bitmask. */
- REGDEF(ra_auth_code,12,PSEUDO),
+ /* AADWARF32 defines RA_AUTH_CODE to 143. */
+ REGDEF(ra_auth_code,143,PSEUDO),
};
#undef REGDEF
#undef REGNUM
@@ -27905,7 +27931,6 @@ create_unwind_entry (int have_data)
return 0;
}
-
/* Initialize the DWARF-2 unwind information for this procedure. */
void
--- a/gas/testsuite/gas/arm/unwind-pacbti-m-readelf.d
+++ b/gas/testsuite/gas/arm/unwind-pacbti-m-readelf.d
@@ -10,11 +10,11 @@ Unwind section '.ARM.exidx' at offset 0x
0x0 <foo>: @0x0
Compact model index: 1
- 0x84 0x00 pop {r14}
0xb4 pop {ra_auth_code}
0x84 0x00 pop {r14}
- 0xb4 pop {ra_auth_code}
0xa3 pop {r4, r5, r6, r7}
0xb4 pop {ra_auth_code}
+ 0x84 0x00 pop {r14}
+ 0xb4 pop {ra_auth_code}
0xa8 pop {r4, r14}
0xb0 finish
--- a/gas/testsuite/gas/arm/unwind-pacbti-m.d
+++ b/gas/testsuite/gas/arm/unwind-pacbti-m.d
@@ -8,4 +8,4 @@
.*: file format.*
Contents of section .ARM.extab:
- 0000 (00840281 b40084b4 b0a8b4a3|81028400 b48400b4 a3b4a8b0) 00000000 .*
+ 0000 (84b40281 84b4a300 b0a8b400|8102b484 00a3b484 00b4a8b0) 00000000 .*

View File

@ -1 +0,0 @@
1

View File

@ -10,9 +10,12 @@ choice
config GCC_USE_VERSION_8
bool "gcc 8.x"
config GCC_USE_VERSION_10
bool "gcc 10.x"
config GCC_USE_VERSION_11
bool "gcc 11.x"
config GCC_USE_VERSION_12
bool "gcc 12.x"
endchoice

View File

@ -3,6 +3,10 @@ config GCC_VERSION_8
default y if mips || mipsel || mips64 || mips64el
bool
config GCC_VERSION_10
default y if GCC_USE_VERSION_10
bool
config GCC_VERSION_12
default y if GCC_USE_VERSION_12
bool
@ -10,5 +14,6 @@ config GCC_VERSION_12
config GCC_VERSION
string
default "8.4.0" if GCC_VERSION_8
default "10.3.0" if GCC_VERSION_10
default "12.2.0" if GCC_VERSION_12
default "11.3.0"

View File

@ -33,6 +33,10 @@ ifeq ($(PKG_VERSION),8.4.0)
PKG_HASH:=e30a6e52d10e1f27ed55104ad233c30bd1e99cfb5ff98ab022dc941edd1b2dd4
endif
ifeq ($(PKG_VERSION),10.3.0)
PKG_HASH:=64f404c1a650f27fc33da242e1f2df54952e3963a49e06e73f6940f3223ac344
endif
ifeq ($(PKG_VERSION),11.3.0)
PKG_HASH:=b47cf2818691f5b1e21df2bb38c795fac2cfbd640ede2d0a5e1c89e338a3ac39
endif
@ -109,7 +113,6 @@ GCC_CONFIGURE:= \
$(if $(CONFIG_mips64)$(CONFIG_mips64el),--with-arch=mips64 \
--with-abi=$(call qstrip,$(CONFIG_MIPS64_ABI))) \
$(if $(CONFIG_arc),--with-cpu=$(CONFIG_CPU_TYPE)) \
$(if $(CONFIG_powerpc64), $(if $(CONFIG_USE_MUSL),--with-abi=elfv2)) \
--with-gmp=$(TOPDIR)/staging_dir/host \
--with-mpfr=$(TOPDIR)/staging_dir/host \
--with-mpc=$(TOPDIR)/staging_dir/host \

View File

@ -0,0 +1,24 @@
commit 81cc26c706b2bc8c8c1eb1a322e5c5157900836e
Author: Felix Fietkau <nbd@openwrt.org>
Date: Sun Oct 19 21:45:51 2014 +0000
gcc: do not assume that the Mac OS X filesystem is case insensitive
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
SVN-Revision: 42973
--- a/include/filenames.h
+++ b/include/filenames.h
@@ -44,11 +44,6 @@ extern "C" {
# define IS_DIR_SEPARATOR(c) IS_DOS_DIR_SEPARATOR (c)
# define IS_ABSOLUTE_PATH(f) IS_DOS_ABSOLUTE_PATH (f)
#else /* not DOSish */
-# if defined(__APPLE__)
-# ifndef HAVE_CASE_INSENSITIVE_FILE_SYSTEM
-# define HAVE_CASE_INSENSITIVE_FILE_SYSTEM 1
-# endif
-# endif /* __APPLE__ */
# define HAS_DRIVE_SPEC(f) (0)
# define IS_DIR_SEPARATOR(c) IS_UNIX_DIR_SEPARATOR (c)
# define IS_ABSOLUTE_PATH(f) IS_UNIX_ABSOLUTE_PATH (f)

View File

@ -0,0 +1,35 @@
commit 098bd91f5eae625c7d2ee621e10930fc4434e5e2
Author: Luka Perkov <luka@openwrt.org>
Date: Tue Feb 26 16:16:33 2013 +0000
gcc: don't build documentation
This closes #13039.
Signed-off-by: Luka Perkov <luka@openwrt.org>
SVN-Revision: 35807
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -3285,18 +3285,10 @@ doc/gcc.info: $(TEXI_GCC_FILES)
doc/gccint.info: $(TEXI_GCCINT_FILES)
doc/cppinternals.info: $(TEXI_CPPINT_FILES)
-doc/%.info: %.texi
- if [ x$(BUILD_INFO) = xinfo ]; then \
- $(MAKEINFO) $(MAKEINFOFLAGS) -I . -I $(gcc_docdir) \
- -I $(gcc_docdir)/include -o $@ $<; \
- fi
+doc/%.info:
# Duplicate entry to handle renaming of gccinstall.info
-doc/gccinstall.info: $(TEXI_GCCINSTALL_FILES)
- if [ x$(BUILD_INFO) = xinfo ]; then \
- $(MAKEINFO) $(MAKEINFOFLAGS) -I $(gcc_docdir) \
- -I $(gcc_docdir)/include -o $@ $<; \
- fi
+doc/gccinstall.info:
doc/cpp.dvi: $(TEXI_CPP_FILES)
doc/gcc.dvi: $(TEXI_GCC_FILES)

View File

@ -0,0 +1,20 @@
Fix https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84790.
MIPS16 functions have a static assembler prologue which clobbers
registers v0 and v1. Add these register clobbers to function call
instructions.
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -3132,6 +3132,12 @@ mips_emit_call_insn (rtx pattern, rtx or
emit_insn (gen_update_got_version ());
}
+ if (TARGET_MIPS16 && TARGET_USE_GOT)
+ {
+ clobber_reg (&CALL_INSN_FUNCTION_USAGE (insn), MIPS16_PIC_TEMP);
+ clobber_reg (&CALL_INSN_FUNCTION_USAGE (insn), MIPS_PROLOGUE_TEMP (word_mode));
+ }
+
if (TARGET_MIPS16
&& TARGET_EXPLICIT_RELOCS
&& TARGET_CALL_CLOBBERED_GP)

View File

@ -0,0 +1,13 @@
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -875,7 +875,9 @@ proper position among the other output f
#endif
#ifndef LINK_SSP_SPEC
-#ifdef TARGET_LIBC_PROVIDES_SSP
+#if DEFAULT_LIBC == LIBC_MUSL
+#define LINK_SSP_SPEC "-lssp_nonshared"
+#elif defined(TARGET_LIBC_PROVIDES_SSP)
#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
"|fstack-protector-strong|fstack-protector-explicit:}"
#else

View File

@ -0,0 +1,21 @@
commit ecf7671b769fe96f7b5134be442089f8bdba55d2
Author: Felix Fietkau <nbd@nbd.name>
Date: Thu Aug 4 20:29:45 2016 +0200
gcc: add a patch to generate better code with Os on mips
Also happens to reduce compressed code size a bit
Signed-off-by: Felix Fietkau <nbd@nbd.name>
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -20041,7 +20041,7 @@ mips_option_override (void)
flag_pcc_struct_return = 0;
/* Decide which rtx_costs structure to use. */
- if (optimize_size)
+ if (0 && optimize_size)
mips_cost = &mips_rtx_cost_optimize_size;
else
mips_cost = &mips_rtx_cost_data[mips_tune];

View File

@ -0,0 +1,33 @@
commit 8570c4be394cff7282f332f97da2ff569a927ddb
Author: Imre Kaloz <kaloz@openwrt.org>
Date: Wed Feb 2 20:06:12 2011 +0000
fixup arm soft-float symbols
SVN-Revision: 25325
--- a/libgcc/config/arm/t-linux
+++ b/libgcc/config/arm/t-linux
@@ -1,6 +1,10 @@
LIB1ASMSRC = arm/lib1funcs.S
LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx _clzsi2 _clzdi2 \
- _ctzsi2 _arm_addsubdf3 _arm_addsubsf3
+ _ctzsi2 _arm_addsubdf3 _arm_addsubsf3 \
+ _arm_negdf2 _arm_muldivdf3 _arm_cmpdf2 _arm_unorddf2 \
+ _arm_fixdfsi _arm_fixunsdfsi _arm_truncdfsf2 \
+ _arm_negsf2 _arm_muldivsf3 _arm_cmpsf2 _arm_unordsf2 \
+ _arm_fixsfsi _arm_fixunssfsi
# Just for these, we omit the frame pointer since it makes such a big
# difference.
--- a/gcc/config/arm/linux-elf.h
+++ b/gcc/config/arm/linux-elf.h
@@ -58,8 +58,6 @@
%{shared:-lc} \
%{!shared:%{profile:-lc_p}%{!profile:-lc}}"
-#define LIBGCC_SPEC "%{mfloat-abi=soft*:-lfloat} -lgcc"
-
#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
#define LINUX_TARGET_LINK_SPEC "%{h*} \

View File

@ -0,0 +1,44 @@
commit c96312958c0621e72c9b32da5bc224ffe2161384
Author: Felix Fietkau <nbd@openwrt.org>
Date: Mon Oct 19 23:26:09 2009 +0000
gcc: create a proper libgcc_pic.a static library for relinking (4.3.3+ for now, backport will follow)
SVN-Revision: 18086
--- a/libgcc/Makefile.in
+++ b/libgcc/Makefile.in
@@ -929,11 +929,12 @@ $(libgcov-driver-objects): %$(objext): $
# Static libraries.
libgcc.a: $(libgcc-objects)
+libgcc_pic.a: $(libgcc-s-objects)
libgcov.a: $(libgcov-objects)
libunwind.a: $(libunwind-objects)
libgcc_eh.a: $(libgcc-eh-objects)
-libgcc.a libgcov.a libunwind.a libgcc_eh.a:
+libgcc.a libgcov.a libunwind.a libgcc_eh.a libgcc_pic.a:
-rm -f $@
objects="$(objects)"; \
@@ -957,7 +958,7 @@ all: libunwind.a
endif
ifeq ($(enable_shared),yes)
-all: libgcc_eh.a libgcc_s$(SHLIB_EXT)
+all: libgcc_eh.a libgcc_pic.a libgcc_s$(SHLIB_EXT)
ifneq ($(LIBUNWIND),)
all: libunwind$(SHLIB_EXT)
libgcc_s$(SHLIB_EXT): libunwind$(SHLIB_EXT)
@@ -1163,6 +1164,10 @@ install-shared:
chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a
$(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a
+ $(INSTALL_DATA) libgcc_pic.a $(mapfile) $(DESTDIR)$(inst_libdir)/
+ chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_pic.a
+ $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_pic.a
+
$(subst @multilib_dir@,$(MULTIDIR),$(subst \
@shlib_base_name@,libgcc_s,$(subst \
@shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIB_INSTALL))))

View File

@ -0,0 +1,28 @@
commit 7edc8ca5456d9743dd0075eb3cc5b04f4f24c8cc
Author: Imre Kaloz <kaloz@openwrt.org>
Date: Wed Feb 2 19:34:36 2011 +0000
add armv4 fixup patches
SVN-Revision: 25322
--- a/gcc/config/arm/linux-eabi.h
+++ b/gcc/config/arm/linux-eabi.h
@@ -91,10 +91,15 @@
#define MUSL_DYNAMIC_LINKER \
"/lib/ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}%{mfdpic:-fdpic}.so.1"
+/* For armv4 we pass --fix-v4bx to linker to support EABI */
+#undef TARGET_FIX_V4BX_SPEC
+#define TARGET_FIX_V4BX_SPEC " %{mcpu=arm8|mcpu=arm810|mcpu=strongarm*"\
+ "|march=armv4|mcpu=fa526|mcpu=fa626:--fix-v4bx}"
+
/* At this point, bpabi.h will have clobbered LINK_SPEC. We want to
use the GNU/Linux version, not the generic BPABI version. */
#undef LINK_SPEC
-#define LINK_SPEC EABI_LINK_SPEC \
+#define LINK_SPEC EABI_LINK_SPEC TARGET_FIX_V4BX_SPEC \
LINUX_OR_ANDROID_LD (LINUX_TARGET_LINK_SPEC, \
LINUX_TARGET_LINK_SPEC " " ANDROID_LINK_SPEC)

View File

@ -0,0 +1,54 @@
commit dcfc40358b5a3cae7320c17f8d1cebd5ad5540cd
Author: Felix Fietkau <nbd@openwrt.org>
Date: Sun Feb 12 20:25:47 2012 +0000
gcc 4.6: port over the missing patch 850-use_shared_libgcc.patch to prevent libgcc crap from leaking into every single binary
SVN-Revision: 30486
--- a/gcc/config/arm/linux-eabi.h
+++ b/gcc/config/arm/linux-eabi.h
@@ -132,10 +132,6 @@
"%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} " \
LINUX_OR_ANDROID_LD (GNU_USER_TARGET_ENDFILE_SPEC, ANDROID_ENDFILE_SPEC)
-/* Use the default LIBGCC_SPEC, not the version in linux-elf.h, as we
- do not use -lfloat. */
-#undef LIBGCC_SPEC
-
/* Clear the instruction cache from `beg' to `end'. This is
implemented in lib1funcs.S, so ensure an error if this definition
is used. */
--- a/gcc/config/linux.h
+++ b/gcc/config/linux.h
@@ -66,6 +66,10 @@ see the files COPYING3 and COPYING.RUNTI
builtin_version ("CRuntime_Musl"); \
} while (0)
+#ifndef LIBGCC_SPEC
+#define LIBGCC_SPEC "%{static|static-libgcc:-lgcc}%{!static:%{!static-libgcc:-lgcc_s}}"
+#endif
+
/* Determine which dynamic linker to use depending on whether GLIBC or
uClibc or Bionic or musl is the default C library and whether
-muclibc or -mglibc or -mbionic or -mmusl has been passed to change
--- a/libgcc/mkmap-symver.awk
+++ b/libgcc/mkmap-symver.awk
@@ -136,5 +136,5 @@ function output(lib) {
else if (inherit[lib])
printf("} %s;\n", inherit[lib]);
else
- printf ("\n local:\n\t*;\n};\n");
+ printf ("\n\t*;\n};\n");
}
--- a/gcc/config/rs6000/linux.h
+++ b/gcc/config/rs6000/linux.h
@@ -62,6 +62,9 @@
#undef CPP_OS_DEFAULT_SPEC
#define CPP_OS_DEFAULT_SPEC "%(cpp_os_linux)"
+#undef LIBGCC_SPEC
+#define LIBGCC_SPEC "%{!static:%{!static-libgcc:-lgcc_s}} -lgcc"
+
#undef LINK_SHLIB_SPEC
#define LINK_SHLIB_SPEC "%{shared:-shared} %{!shared: %{static:-static}} \
%{static-pie:-static -pie --no-dynamic-linker -z text}"

View File

@ -0,0 +1,22 @@
commit 64661de100da1ec1061ef3e5e400285dce115e6b
Author: Felix Fietkau <nbd@openwrt.org>
Date: Sun May 10 13:16:35 2015 +0000
gcc: add some size optimization patches
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
SVN-Revision: 45664
--- a/libgcc/config/t-libunwind
+++ b/libgcc/config/t-libunwind
@@ -2,8 +2,7 @@
HOST_LIBGCC2_CFLAGS += -DUSE_GAS_SYMVER
-LIB2ADDEH = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c \
- $(srcdir)/unwind-compat.c $(srcdir)/unwind-dw2-fde-compat.c
+LIB2ADDEH = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c
LIB2ADDEHSTATIC = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c
# Override the default value from t-slibgcc-elf-ver and mention -lunwind

View File

@ -0,0 +1,11 @@
--- a/gcc/config/rs6000/rs6000-logue.c
+++ b/gcc/config/rs6000/rs6000-logue.c
@@ -348,7 +348,7 @@ rs6000_savres_strategy (rs6000_stack_t *
/* Define cutoff for using out-of-line functions to save registers. */
if (DEFAULT_ABI == ABI_V4 || TARGET_ELF)
{
- if (!optimize_size)
+ if (1)
{
strategy |= SAVE_INLINE_FPRS | REST_INLINE_FPRS;
strategy |= SAVE_INLINE_GPRS | REST_INLINE_GPRS;

View File

@ -0,0 +1,11 @@
--- a/libgcc/crtstuff.c
+++ b/libgcc/crtstuff.c
@@ -152,7 +152,7 @@ call_ ## FUNC (void) \
#endif
#if !defined(USE_TM_CLONE_REGISTRY) && defined(OBJECT_FORMAT_ELF)
-# define USE_TM_CLONE_REGISTRY 1
+# define USE_TM_CLONE_REGISTRY 0
#elif !defined(USE_TM_CLONE_REGISTRY)
# define USE_TM_CLONE_REGISTRY 0
#endif

View File

@ -0,0 +1,9 @@
--- a/libgcc/config/mips/t-mips16
+++ b/libgcc/config/mips/t-mips16
@@ -43,3 +43,6 @@ SYNC_CFLAGS = -mno-mips16
# Version these symbols if building libgcc.so.
SHLIB_MAPFILES += $(srcdir)/config/mips/libgcc-mips16.ver
+
+CRTSTUFF_T_CFLAGS += -mno-mips16
+CRTSTUFF_T_CFLAGS_S += -mno-mips16

View File

@ -0,0 +1,146 @@
commit 99368862e44740ff4fd33760893f04e14f9dbdf1
Author: Felix Fietkau <nbd@openwrt.org>
Date: Tue Jul 31 00:52:27 2007 +0000
Port the mbsd_multi patch from freewrt, which adds -fhonour-copts. This will emit warnings in packages that don't use our target cflags properly
SVN-Revision: 8256
This patch brings over a feature from MirBSD:
* -fhonour-copts
If this option is not given, it's warned (depending
on environment variables). This is to catch errors
of misbuilt packages which override CFLAGS themselves.
This patch was authored by Thorsten Glaser <tg at mirbsd.de>
with copyright assignment to the FSF in effect.
--- a/gcc/c-family/c-opts.c
+++ b/gcc/c-family/c-opts.c
@@ -107,6 +107,9 @@ static dump_flags_t original_dump_flags;
/* Whether any standard preincluded header has been preincluded. */
static bool done_preinclude;
+/* Check if a port honours COPTS. */
+static int honour_copts = 0;
+
static void handle_OPT_d (const char *);
static void set_std_cxx98 (int);
static void set_std_cxx11 (int);
@@ -455,6 +458,12 @@ c_common_handle_option (size_t scode, co
flag_no_builtin = !value;
break;
+ case OPT_fhonour_copts:
+ if (c_language == clk_c) {
+ honour_copts++;
+ }
+ break;
+
case OPT_fconstant_string_class_:
constant_string_class_name = arg;
break;
@@ -1168,6 +1177,47 @@ c_common_init (void)
return false;
}
+ if (c_language == clk_c) {
+ char *ev = getenv ("GCC_HONOUR_COPTS");
+ int evv;
+ if (ev == NULL)
+ evv = -1;
+ else if ((*ev == '0') || (*ev == '\0'))
+ evv = 0;
+ else if (*ev == '1')
+ evv = 1;
+ else if (*ev == '2')
+ evv = 2;
+ else if (*ev == 's')
+ evv = -1;
+ else {
+ warning (0, "unknown GCC_HONOUR_COPTS value, assuming 1");
+ evv = 1; /* maybe depend this on something like MIRBSD_NATIVE? */
+ }
+ if (evv == 1) {
+ if (honour_copts == 0) {
+ error ("someone does not honour COPTS at all in lenient mode");
+ return false;
+ } else if (honour_copts != 1) {
+ warning (0, "someone does not honour COPTS correctly, passed %d times",
+ honour_copts);
+ }
+ } else if (evv == 2) {
+ if (honour_copts == 0) {
+ error ("someone does not honour COPTS at all in strict mode");
+ return false;
+ } else if (honour_copts != 1) {
+ error ("someone does not honour COPTS correctly, passed %d times",
+ honour_copts);
+ return false;
+ }
+ } else if (evv == 0) {
+ if (honour_copts != 1)
+ inform (UNKNOWN_LOCATION, "someone does not honour COPTS correctly, passed %d times",
+ honour_copts);
+ }
+ }
+
return true;
}
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -1590,6 +1590,9 @@ C++ ObjC++ Optimization Alias(fexception
fhonor-std
C++ ObjC++ WarnRemoved
+fhonour-copts
+C ObjC C++ ObjC++ RejectNegative
+
fhosted
C ObjC
Assume normal C execution environment.
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -1660,6 +1660,9 @@ fguess-branch-probability
Common Report Var(flag_guess_branch_prob) Optimization
Enable guessing of branch probabilities.
+fhonour-copts
+Common RejectNegative
+
; Nonzero means ignore `#ident' directives. 0 means handle them.
; Generate position-independent code for executables if possible
; On SVR4 targets, it also controls whether or not to emit a
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -8171,6 +8171,17 @@ This option is only supported for C and
@option{-Wall} and by @option{-Wpedantic}, which can be disabled with
@option{-Wno-pointer-sign}.
+@item -fhonour-copts
+@opindex fhonour-copts
+If @env{GCC_HONOUR_COPTS} is set to 1, abort if this option is not
+given at least once, and warn if it is given more than once.
+If @env{GCC_HONOUR_COPTS} is set to 2, abort if this option is not
+given exactly once.
+If @env{GCC_HONOUR_COPTS} is set to 0 or unset, warn if this option
+is not given exactly once.
+The warning is quelled if @env{GCC_HONOUR_COPTS} is set to @samp{s}.
+This flag and environment variable only affect the C language.
+
@item -Wstack-protector
@opindex Wstack-protector
@opindex Wno-stack-protector
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -2318,6 +2318,9 @@ common_handle_option (struct gcc_options
/* Currently handled in a prescan. */
break;
+ case OPT_fhonour_copts:
+ break;
+
case OPT_Werror:
dc->warning_as_error_requested = value;
break;

View File

@ -0,0 +1,22 @@
Author: Jo-Philipp Wich <jow@openwrt.org>
Date: Sat Apr 21 03:02:39 2012 +0000
gcc: add patch to make the getenv() spec function nonfatal if requested environment variable is unset
SVN-Revision: 31390
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -9396,8 +9396,10 @@ getenv_spec_function (int argc, const ch
}
if (!value)
- fatal_error (input_location,
- "environment variable %qs not defined", varname);
+ {
+ warning (input_location, "environment variable %qs not defined", varname);
+ value = "";
+ }
/* We have to escape every character of the environment variable so
they are not interpreted as active spec characters. A

View File

@ -0,0 +1,111 @@
From da45b3fde60095756f5f6030f6012c23a3d34429 Mon Sep 17 00:00:00 2001
From: Andrew McDonnell <bugs@andrewmcdonnell.net>
Date: Fri, 3 Oct 2014 19:09:00 +0930
Subject: Add .note.GNU-stack section
See http://lists.busybox.net/pipermail/uclibc/2014-October/048671.html
Below copied from https://gcc.gnu.org/ml/gcc-patches/2014-09/msg02430.html
Re: [Patch, MIPS] Add .note.GNU-stack section
From: Steve Ellcey <sellcey at mips dot com>
On Wed, 2014-09-10 at 10:15 -0700, Eric Christopher wrote:
>
>
> On Wed, Sep 10, 2014 at 9:27 AM, <pinskia@gmail.com> wrote:
> This works except you did not update the assembly files in
> libgcc or glibc. We (Cavium) have the same patch in our tree
> for a few released versions.
> Mind just checking yours in then Andrew?
> Thanks!
> -eric
I talked to Andrew about what files he changed in GCC and created and
tested this new patch. Andrew also mentioned changing some assembly
files in glibc but I don't see any use of '.section .note.GNU-stack' in
any assembly files in glibc (for any platform) so I wasn't planning on
creating a glibc to add them to mips glibc assembly language files.
OK to check in this patch?
Steve Ellcey
sellcey@mips.com
2014-09-26 Steve Ellcey <sellcey@mips.com>
---
gcc/config/mips/mips.c | 3 +++
libgcc/config/mips/crti.S | 4 ++++
libgcc/config/mips/crtn.S | 3 +++
libgcc/config/mips/mips16.S | 4 ++++
libgcc/config/mips/vr4120-div.S | 4 ++++
5 files changed, 18 insertions(+)
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -22881,6 +22881,9 @@ mips_asm_file_end (void)
#define TARGET_ASM_FILE_END mips_asm_file_end
+#undef TARGET_ASM_FILE_END
+#define TARGET_ASM_FILE_END file_end_indicate_exec_stack
+
struct gcc_target targetm = TARGET_INITIALIZER;
#include "gt-mips.h"
--- a/libgcc/config/mips/crti.S
+++ b/libgcc/config/mips/crti.S
@@ -24,6 +24,10 @@ see the files COPYING3 and COPYING.RUNTI
/* An executable stack is *not* required for these functions. */
#include "gnustack.h"
+
+/* An executable stack is *not* required for these functions. */
+ .section .note.GNU-stack,"",%progbits
+
/* 4 slots for argument spill area. 1 for cpreturn, 1 for stack.
Return spill offset of 40 and 20. Aligned to 16 bytes for n32. */
--- a/libgcc/config/mips/crtn.S
+++ b/libgcc/config/mips/crtn.S
@@ -24,6 +24,9 @@ see the files COPYING3 and COPYING.RUNTI
/* An executable stack is *not* required for these functions. */
#include "gnustack.h"
+/* An executable stack is *not* required for these functions. */
+ .section .note.GNU-stack,"",%progbits
+
/* 4 slots for argument spill area. 1 for cpreturn, 1 for stack.
Return spill offset of 40 and 20. Aligned to 16 bytes for n32. */
--- a/libgcc/config/mips/mips16.S
+++ b/libgcc/config/mips/mips16.S
@@ -51,6 +51,10 @@ see the files COPYING3 and COPYING.RUNTI
values using the soft-float calling convention, but do the actual
operation using the hard floating point instructions. */
+/* An executable stack is *not* required for these functions. */
+ .section .note.GNU-stack,"",%progbits
+ .previous
+
#if defined _MIPS_SIM && (_MIPS_SIM == _ABIO32 || _MIPS_SIM == _ABIO64)
/* This file contains 32-bit assembly code. */
--- a/libgcc/config/mips/vr4120-div.S
+++ b/libgcc/config/mips/vr4120-div.S
@@ -29,6 +29,10 @@ see the files COPYING3 and COPYING.RUNTI
-mfix-vr4120. div and ddiv do not give the correct result when one
of the operands is negative. */
+/* An executable stack is *not* required for these functions. */
+ .section .note.GNU-stack,"",%progbits
+ .previous
+
.set nomips16
#define DIV \

View File

@ -0,0 +1,168 @@
From c0c62fa4256f805389f16ebfc4a60cf789129b50 Mon Sep 17 00:00:00 2001
From: BangLang Huang <banglang.huang@foxmail.com>
Date: Wed, 9 Nov 2016 10:36:49 +0800
Subject: [PATCH] libffi: fix MIPS softfloat build issue
Backported from github.com/libffi/libffi#272
Signed-off-by: BangLang Huang <banglang.huang@foxmail.com>
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
---
libffi/src/mips/n32.S | 17 +++++++++++++++++
libffi/src/mips/o32.S | 17 +++++++++++++++++
2 files changed, 34 insertions(+)
--- a/libffi/src/mips/n32.S
+++ b/libffi/src/mips/n32.S
@@ -107,6 +107,16 @@ loadregs:
REG_L t6, 3*FFI_SIZEOF_ARG($fp) # load the flags word into t6.
+#ifdef __mips_soft_float
+ REG_L a0, 0*FFI_SIZEOF_ARG(t9)
+ REG_L a1, 1*FFI_SIZEOF_ARG(t9)
+ REG_L a2, 2*FFI_SIZEOF_ARG(t9)
+ REG_L a3, 3*FFI_SIZEOF_ARG(t9)
+ REG_L a4, 4*FFI_SIZEOF_ARG(t9)
+ REG_L a5, 5*FFI_SIZEOF_ARG(t9)
+ REG_L a6, 6*FFI_SIZEOF_ARG(t9)
+ REG_L a7, 7*FFI_SIZEOF_ARG(t9)
+#else
and t4, t6, ((1<<FFI_FLAG_BITS)-1)
REG_L a0, 0*FFI_SIZEOF_ARG(t9)
beqz t4, arg1_next
@@ -193,6 +203,7 @@ arg7_next:
arg8_doublep:
l.d $f19, 7*FFI_SIZEOF_ARG(t9)
arg8_next:
+#endif
callit:
# Load the function pointer
@@ -214,6 +225,7 @@ retint:
b epilogue
retfloat:
+#ifndef __mips_soft_float
bne t6, FFI_TYPE_FLOAT, retdouble
jal t9
REG_L t4, 4*FFI_SIZEOF_ARG($fp)
@@ -272,6 +284,7 @@ retstruct_f_d:
s.s $f0, 0(t4)
s.d $f2, 8(t4)
b epilogue
+#endif
retstruct_d_soft:
bne t6, FFI_TYPE_STRUCT_D_SOFT, retstruct_f_soft
@@ -429,6 +442,7 @@ ffi_closure_N32:
REG_S a6, A6_OFF2($sp)
REG_S a7, A7_OFF2($sp)
+#ifndef __mips_soft_float
# Store all possible float/double registers.
s.d $f12, F12_OFF2($sp)
s.d $f13, F13_OFF2($sp)
@@ -438,6 +452,7 @@ ffi_closure_N32:
s.d $f17, F17_OFF2($sp)
s.d $f18, F18_OFF2($sp)
s.d $f19, F19_OFF2($sp)
+#endif
# Call ffi_closure_mips_inner_N32 to do the real work.
LA t9, ffi_closure_mips_inner_N32
@@ -458,6 +473,7 @@ cls_retint:
b cls_epilogue
cls_retfloat:
+#ifndef __mips_soft_float
bne v0, FFI_TYPE_FLOAT, cls_retdouble
l.s $f0, V0_OFF2($sp)
b cls_epilogue
@@ -500,6 +516,7 @@ cls_retstruct_f_d:
l.s $f0, V0_OFF2($sp)
l.d $f2, V1_OFF2($sp)
b cls_epilogue
+#endif
cls_retstruct_small2:
REG_L v0, V0_OFF2($sp)
--- a/libffi/src/mips/o32.S
+++ b/libffi/src/mips/o32.S
@@ -82,13 +82,16 @@ sixteen:
ADDU $sp, 4 * FFI_SIZEOF_ARG # adjust $sp to new args
+#ifndef __mips_soft_float
bnez t0, pass_d # make it quick for int
+#endif
REG_L a0, 0*FFI_SIZEOF_ARG($sp) # just go ahead and load the
REG_L a1, 1*FFI_SIZEOF_ARG($sp) # four regs.
REG_L a2, 2*FFI_SIZEOF_ARG($sp)
REG_L a3, 3*FFI_SIZEOF_ARG($sp)
b call_it
+#ifndef __mips_soft_float
pass_d:
bne t0, FFI_ARGS_D, pass_f
l.d $f12, 0*FFI_SIZEOF_ARG($sp) # load $fp regs from args
@@ -130,6 +133,7 @@ pass_f_d:
# bne t0, FFI_ARGS_F_D, call_it
l.s $f12, 0*FFI_SIZEOF_ARG($sp) # load $fp regs from args
l.d $f14, 2*FFI_SIZEOF_ARG($sp) # passing double and float
+#endif
call_it:
# Load the function pointer
@@ -158,14 +162,23 @@ retfloat:
bne t2, FFI_TYPE_FLOAT, retdouble
jalr t9
REG_L t0, SIZEOF_FRAME + 4*FFI_SIZEOF_ARG($fp)
+#ifndef __mips_soft_float
s.s $f0, 0(t0)
+#else
+ REG_S v0, 0(t0)
+#endif
b epilogue
retdouble:
bne t2, FFI_TYPE_DOUBLE, noretval
jalr t9
REG_L t0, SIZEOF_FRAME + 4*FFI_SIZEOF_ARG($fp)
+#ifndef __mips_soft_float
s.d $f0, 0(t0)
+#else
+ REG_S v1, 4(t0)
+ REG_S v0, 0(t0)
+#endif
b epilogue
noretval:
@@ -261,9 +274,11 @@ $LCFI7:
li $13, 1 # FFI_O32
bne $16, $13, 1f # Skip fp save if FFI_O32_SOFT_FLOAT
+#ifndef __mips_soft_float
# Store all possible float/double registers.
s.d $f12, FA_0_0_OFF2($fp)
s.d $f14, FA_1_0_OFF2($fp)
+#endif
1:
# Call ffi_closure_mips_inner_O32 to do the work.
la t9, ffi_closure_mips_inner_O32
@@ -281,6 +296,7 @@ $LCFI7:
li $13, 1 # FFI_O32
bne $16, $13, 1f # Skip fp restore if FFI_O32_SOFT_FLOAT
+#ifndef __mips_soft_float
li $9, FFI_TYPE_FLOAT
l.s $f0, V0_OFF2($fp)
beq $8, $9, closure_done
@@ -288,6 +304,7 @@ $LCFI7:
li $9, FFI_TYPE_DOUBLE
l.d $f0, V0_OFF2($fp)
beq $8, $9, closure_done
+#endif
1:
REG_L $3, V1_OFF2($fp)
REG_L $2, V0_OFF2($fp)

View File

@ -0,0 +1,67 @@
From dda6b050cd74a352670787a294596a9c56c21327 Mon Sep 17 00:00:00 2001
From: Yousong Zhou <yszhou4tech@gmail.com>
Date: Fri, 4 May 2018 18:20:53 +0800
Subject: [PATCH] gotools: fix compilation when making cross compiler
libgo is "the runtime support library for the Go programming language.
This library is intended for use with the Go frontend."
gccgo will link target files with libgo.so which depends on libgcc_s.so.1, but
the linker will complain that it cannot find it. That's because shared libgcc
is not present in the install directory yet. libgo.so was made without problem
because gcc will emit -lgcc_s when compiled with -shared option. When gotools
were being made, it was supplied with -static-libgcc thus no link option was
provided. Check LIBGO in gcc/go/gcc-spec.c for how gccgo make a builtin spec
for linking with libgo.so
- GccgoCrossCompilation, https://github.com/golang/go/wiki/GccgoCrossCompilation
- Cross-building instructions, http://www.eglibc.org/archives/patches/msg00078.html
When 3-pass GCC compilation is used, shared libgcc runtime libraries will be
available after gcc pass2 completed and will meet the gotools link requirement
at gcc pass3
---
gotools/Makefile.am | 4 +++-
gotools/Makefile.in | 4 +++-
2 files changed, 6 insertions(+), 2 deletions(-)
--- a/gotools/Makefile.am
+++ b/gotools/Makefile.am
@@ -26,6 +26,7 @@ PWD_COMMAND = $${PWDCMD-pwd}
STAMP = echo timestamp >
libgodir = ../$(target_noncanonical)/libgo
+libgccdir = ../$(target_noncanonical)/libgcc
LIBGODEP = $(libgodir)/libgo.la
LIBGOTOOL = $(libgodir)/libgotool.a
@@ -41,7 +42,8 @@ GOCFLAGS = $(CFLAGS_FOR_TARGET)
GOCOMPILE = $(GOCOMPILER) $(GOCFLAGS)
AM_GOCFLAGS = -I $(libgodir)
-AM_LDFLAGS = -L $(libgodir) -L $(libgodir)/.libs
+AM_LDFLAGS = -L $(libgodir) -L $(libgodir)/.libs \
+ -L $(libgccdir) -L $(libgccdir)/.libs -lgcc_s
GOLINK = $(GOCOMPILER) $(GOCFLAGS) $(AM_GOCFLAGS) $(LDFLAGS) $(AM_LDFLAGS) -o $@
libgosrcdir = $(srcdir)/../libgo/go
--- a/gotools/Makefile.in
+++ b/gotools/Makefile.in
@@ -337,6 +337,7 @@ mkinstalldirs = $(SHELL) $(toplevel_srcd
PWD_COMMAND = $${PWDCMD-pwd}
STAMP = echo timestamp >
libgodir = ../$(target_noncanonical)/libgo
+libgccdir = ../$(target_noncanonical)/libgcc
LIBGODEP = $(libgodir)/libgo.la
LIBGOTOOL = $(libgodir)/libgotool.a
@NATIVE_FALSE@GOCOMPILER = $(GOC)
@@ -346,7 +347,8 @@ LIBGOTOOL = $(libgodir)/libgotool.a
GOCFLAGS = $(CFLAGS_FOR_TARGET)
GOCOMPILE = $(GOCOMPILER) $(GOCFLAGS)
AM_GOCFLAGS = -I $(libgodir)
-AM_LDFLAGS = -L $(libgodir) -L $(libgodir)/.libs
+AM_LDFLAGS = -L $(libgodir) -L $(libgodir)/.libs \
+ -L $(libgccdir) -L $(libgccdir)/.libs -lgcc_s
GOLINK = $(GOCOMPILER) $(GOCFLAGS) $(AM_GOCFLAGS) $(LDFLAGS) $(AM_LDFLAGS) -o $@
libgosrcdir = $(srcdir)/../libgo/go
cmdsrcdir = $(libgosrcdir)/cmd

View File

@ -1,39 +0,0 @@
From d2356ebb0084a0d80dbfe33040c9afe938c15d19 Mon Sep 17 00:00:00 2001
From: Martin Liska <mliska@suse.cz>
Date: Mon, 11 Jul 2022 22:03:14 +0200
Subject: [PATCH] libsanitizer: cherry-pick 9cf13067cb5088626ba7 from upstream
9cf13067cb5088626ba7ee1ec4c42ec59c7995a0 [sanitizer] Remove #include <linux/fs.h> to resolve fsconfig_command/mount_attr conflict with glibc 2.36
(cherry picked from commit 2701442d0cf6292f6624443c15813d6d1a3562fe)
---
.../sanitizer_platform_limits_posix.cpp | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp
@@ -72,7 +72,9 @@
#include <sys/vt.h>
#include <linux/cdrom.h>
#include <linux/fd.h>
+#if SANITIZER_ANDROID
#include <linux/fs.h>
+#endif
#include <linux/hdreg.h>
#include <linux/input.h>
#include <linux/ioctl.h>
@@ -828,10 +830,10 @@ unsigned struct_ElfW_Phdr_sz = sizeof(El
unsigned IOCTL_EVIOCGPROP = IOCTL_NOT_PRESENT;
unsigned IOCTL_EVIOCSKEYCODE_V2 = IOCTL_NOT_PRESENT;
#endif
- unsigned IOCTL_FS_IOC_GETFLAGS = FS_IOC_GETFLAGS;
- unsigned IOCTL_FS_IOC_GETVERSION = FS_IOC_GETVERSION;
- unsigned IOCTL_FS_IOC_SETFLAGS = FS_IOC_SETFLAGS;
- unsigned IOCTL_FS_IOC_SETVERSION = FS_IOC_SETVERSION;
+ unsigned IOCTL_FS_IOC_GETFLAGS = _IOR('f', 1, long);
+ unsigned IOCTL_FS_IOC_GETVERSION = _IOR('v', 1, long);
+ unsigned IOCTL_FS_IOC_SETFLAGS = _IOW('f', 2, long);
+ unsigned IOCTL_FS_IOC_SETVERSION = _IOW('v', 2, long);
unsigned IOCTL_GIO_CMAP = GIO_CMAP;
unsigned IOCTL_GIO_FONT = GIO_FONT;
unsigned IOCTL_GIO_UNIMAP = GIO_UNIMAP;

View File

@ -7,13 +7,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=glibc
PKG_VERSION:=2.36
PKG_VERSION:=2.35
PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE_VERSION:=3aae843e9e9e6a2502e98ff44d2671b20a023f8e
PKG_MIRROR_HASH:=29bdd6ca699f297de500ea457741d0706d57a69836fa7d45e6cc2cc20484cad4
PKG_SOURCE_VERSION:=813a8d01716d4e099ec57194a93b14fa08b4beca
PKG_MIRROR_HASH:=8c8d92dde334f0e0f9a0949d25b2950db513ce8723c31ae0b0ef64730a00322f
PKG_SOURCE_URL:=https://sourceware.org/git/glibc.git
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz

View File

@ -82,7 +82,7 @@ provides them.
int totfails = 0;
int main (int argc, char *argv[]);
@@ -119,13 +103,3 @@ put8 (char *cp)
@@ -120,13 +104,3 @@ put8 (char *cp)
printf("%02x", t);
}
}
@ -627,7 +627,7 @@ provides them.
range [FROM - N + 1, FROM - 1]. If N is odd the first byte in FROM
--- a/stdlib/stdlib.h
+++ b/stdlib/stdlib.h
@@ -984,6 +984,12 @@ extern int getsubopt (char **__restrict
@@ -971,6 +971,12 @@ extern int getsubopt (char **__restrict
#endif

View File

@ -2,7 +2,7 @@ add /usr/lib to default search path for the dynamic linker
--- a/Makeconfig
+++ b/Makeconfig
@@ -631,6 +631,9 @@ else
@@ -618,6 +618,9 @@ else
default-rpath = $(libdir)
endif

View File

@ -21,44 +21,11 @@ ifneq ($(CONFIG_SDK)$(CONFIG_PACKAGE_kmod-b43)$(CONFIG_BRCMSMAC_USE_FW_FROM_WL),
BUILD_B43_TOOLS = y
endif
tools-y += autoconf
tools-y += autoconf-archive
tools-y += automake
tools-y += bc
tools-y += bison
tools-y += cmake
tools-y += cpio
tools-y += dosfstools
tools-y += e2fsprogs
tools-y += expat
tools-y += fakeroot
tools-y += findutils
tools-y += firmware-utils
tools-y += flex
tools-y += gengetopt
tools-y += libdeflate
tools-y += libressl
tools-y += libtool
tools-y += lzma
tools-y += m4
tools-y += make-ext4fs
tools-y += meson
tools-y += missing-macros
tools-y += mkimage
tools-y += mklibs
tools-y += mtd-utils
tools-y += mtools
tools-y += ninja
tools-y += padjffs2
tools-y += patch-image
tools-y += patchelf
tools-y += pkgconf
tools-y += quilt
tools-y += squashfskit4
tools-y += sstrip
tools-y += zip
tools-y += zlib
tools-y += zstd
tools-y += autoconf autoconf-archive automake bc bison cmake cpio dosfstools
tools-y += e2fsprogs expat fakeroot findutils firmware-utils flex gengetopt
tools-y += libressl libtool lzma m4 make-ext4fs meson missing-macros mkimage
tools-y += mklibs mtd-utils mtools ninja padjffs2 patch-image
tools-y += patchelf pkgconf quilt squashfskit4 sstrip zip zlib zstd
tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(BUILD_B43_TOOLS),y) += b43-tools
tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(BUILD_ISL),y) += isl
tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(BUILD_TOOLCHAIN),y) += gmp mpc mpfr
@ -89,7 +56,6 @@ $(curdir)/genext2fs/compile := $(curdir)/libtool/compile
$(curdir)/gengetopt/compile := $(curdir)/libtool/compile
$(curdir)/gmp/compile := $(curdir)/libtool/compile
$(curdir)/isl/compile := $(curdir)/gmp/compile
$(curdir)/libdeflate/compile := $(curdir)/cmake/compile
$(curdir)/libressl/compile := $(curdir)/pkgconf/compile
$(curdir)/libtool/compile := $(curdir)/automake/compile $(curdir)/missing-macros/compile
$(curdir)/lzma-old/compile := $(curdir)/zlib/compile

View File

@ -1,31 +0,0 @@
#
# Copyright (C) 2022 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
include $(TOPDIR)/rules.mk
PKG_NAME:=libdeflate
PKG_VERSION:=1.15
PKG_RELEASE:=1
PKG_SOURCE_URL:=https://github.com/ebiggers/libdeflate.git
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=v$(PKG_VERSION)
PKG_MIRROR_HASH:=122feff4543541b547dc89e832adf262c81911ae1acbccdc591f0353a85b600a
include $(INCLUDE_DIR)/host-build.mk
include $(INCLUDE_DIR)/cmake.mk
define Host/Install
$(INSTALL_BIN) $(HOST_BUILD_DIR)/programs/libdeflate-gzip $(STAGING_DIR_HOST)/bin/
$(LN) libdeflate-gzip $(STAGING_DIR_HOST)/bin/libdeflate-gunzip
endef
define Host/Clean
rm -f $(STAGING_DIR_HOST)/bin/libdeflate-gzip
rm -f $(STAGING_DIR_HOST)/bin/libdeflate-gunzip
endef
$(eval $(call HostBuild))