mirror of
https://github.com/home-assistant/operating-system.git
synced 2025-07-28 15:36:29 +00:00
Update buildroot to 2021.02.4 (#1522)
Signed-off-by: Stefan Agner <stefan@agner.ch>
This commit is contained in:
parent
382a3cc7be
commit
82764e7822
@ -1,3 +1,54 @@
|
||||
2021.02.4, released August 10th, 2021
|
||||
|
||||
Important / security related fixes.
|
||||
|
||||
Toolchain: Disable PIC/PIE for Microblaze (like for NIOS II)
|
||||
as it is not currently working.
|
||||
|
||||
binutils: fix linker assert failure on OpenRisc, or1k build
|
||||
issue with gcc < 5
|
||||
|
||||
gdb: Enable on NIOS II
|
||||
|
||||
utils/scanpypi: Various improvements
|
||||
|
||||
Defconfigs: stm32f469_disco: Fix kernel boot issue, Microchip
|
||||
sam9x60ek mmc_dev: Add missing toolchain/system options
|
||||
|
||||
Updated/fixed packages: apache, arm-trusted-firmware, audit,
|
||||
avahi, bind, binutils, bird, bluez5_utils, boinc, busybox,
|
||||
chrony, clamav, cryptsetup, cwiid, dnsmasq, docker-cli,
|
||||
docker-engine, dovecot, dovecot-pigeonhole, e2fsprogs, exiv2,
|
||||
fail2ban, fb-test-app, feh, fetchmail, flac, fluxbox, gawk,
|
||||
gcc, gcr, gdb, gdk-pixbuf, gesftpserver, glibc, go, gptfdisk,
|
||||
granite, grub2, gqrx, guile, hdparm, heirloom-mailx,
|
||||
ibrcommon, ibrdtn, ibrdtn-tools, ibrdtnd, intel-microcode,
|
||||
iodine, irqbalance, keepalived, libass, libconfig, libcurl,
|
||||
libfreeimage, libfuse3, libgcrypt, libgtk3, libgudev, libhtp,
|
||||
libjson, libkrb5, libloki, libmodsecurity, libndp,
|
||||
libnetfilter-log, libnfnetlink, libnice, libodb, libodb-boost,
|
||||
libodb-mysql, libodb-pgsql, libpcap, libqmi, libressl,
|
||||
librsvg, libtasn1, libtirpc, libuci, libxmlrpc,
|
||||
linux-firmware, linuxptp, lrzsz, ltp-testsuite, lvm2, mariadb,
|
||||
mbedtls, monit, mono, mosquitto, mpd, mpg123, mpv, nbd, neard,
|
||||
netsnmp, nettle, nginx-modsecurity, nmap, nodejs, ntp,
|
||||
openntpd, openpgm, openswan, pango, pcre2,
|
||||
perl-crypt-openssl-rsa, php, pixman, polkit, postgresql,
|
||||
proxychains-ng, putty, python, python-django,
|
||||
python-dataproperty, python-pysftp, python-urllib3, python3,
|
||||
qpdf, redis, ripgrep, ruby, samba4, spice, slirp, suricata,
|
||||
sysdig, tcpdump, tftpd, thrift, tor, tpm2-tools, trinity,
|
||||
uboot, uboot-tools, uclibc, util-linux, vlc, wireless-regdb,
|
||||
wireshark, wolfssl, xapp_fonttosfnt, xlib_libX11,
|
||||
xlib_libxshmfence, xserver_xorg-server
|
||||
|
||||
Issues resolved (http://bugs.uclibc.org):
|
||||
|
||||
#13586: grub failure with BR2_OPTIMIZE_3
|
||||
#13661: host-python2 build fails on aarch64
|
||||
#13836: package build failure when target install set to no..
|
||||
#13846: BR2_PACKAGE_LVM2_STANDARD_INSTALL should be default to..
|
||||
|
||||
2021.02.3, released June 12th, 2021
|
||||
|
||||
Important / security related fixes.
|
||||
|
@ -713,10 +713,17 @@ endmenu
|
||||
|
||||
comment "Security Hardening Options"
|
||||
|
||||
config BR2_PIC_PIE
|
||||
bool "Build code with PIC/PIE"
|
||||
config BR2_PIC_PIE_ARCH_SUPPORTS
|
||||
bool
|
||||
default y
|
||||
# Microblaze glibc toolchains don't work with PIC/PIE enabled
|
||||
depends on !BR2_microblaze
|
||||
# Nios2 toolchains produce non working binaries with -fPIC
|
||||
depends on !BR2_nios2
|
||||
|
||||
config BR2_PIC_PIE
|
||||
bool "Build code with PIC/PIE"
|
||||
depends on BR2_PIC_PIE_ARCH_SUPPORTS
|
||||
depends on BR2_SHARED_LIBS
|
||||
depends on BR2_TOOLCHAIN_SUPPORTS_PIE
|
||||
help
|
||||
@ -724,7 +731,7 @@ config BR2_PIC_PIE
|
||||
Position-Independent Executables (PIE).
|
||||
|
||||
comment "PIC/PIE needs a toolchain w/ PIE"
|
||||
depends on !BR2_nios2
|
||||
depends on BR2_PIC_PIE_ARCH_SUPPORTS
|
||||
depends on BR2_SHARED_LIBS
|
||||
depends on !BR2_TOOLCHAIN_SUPPORTS_PIE
|
||||
|
||||
@ -811,7 +818,7 @@ config BR2_RELRO_PARTIAL
|
||||
|
||||
config BR2_RELRO_FULL
|
||||
bool "Full"
|
||||
depends on !BR2_nios2 # BR2_PIC_PIE
|
||||
depends on BR2_PIC_PIE_ARCH_SUPPORTS
|
||||
depends on BR2_TOOLCHAIN_SUPPORTS_PIE
|
||||
select BR2_PIC_PIE
|
||||
help
|
||||
@ -820,7 +827,7 @@ config BR2_RELRO_FULL
|
||||
program loading, i.e every time an executable is started.
|
||||
|
||||
comment "RELRO Full needs a toolchain w/ PIE"
|
||||
depends on !BR2_nios2
|
||||
depends on BR2_PIC_PIE_ARCH_SUPPORTS
|
||||
depends on !BR2_TOOLCHAIN_SUPPORTS_PIE
|
||||
|
||||
endchoice
|
||||
|
@ -122,10 +122,7 @@ F: package/python-docopt/
|
||||
N: Anders Darander <anders@chargestorm.se>
|
||||
F: package/ktap/
|
||||
|
||||
N: André Hentschel <nerv@dawncrow.de>
|
||||
F: board/freescale/imx8qxpmek/
|
||||
F: configs/freescale_imx8qxpmek_defconfig
|
||||
F: package/freescale-imx/imx-sc-firmware/
|
||||
N: André Zwing <nerv@dawncrow.de>
|
||||
F: package/libkrb5/
|
||||
F: package/openal/
|
||||
F: package/p7zip/
|
||||
@ -180,6 +177,9 @@ F: package/sshguard/
|
||||
F: package/sunwait/
|
||||
F: package/sysdig/
|
||||
|
||||
N: Andy Shevchenko <andy.shevchenko@gmail.com>
|
||||
F: package/fb-test-app/
|
||||
|
||||
N: Anisse Astier <anisse@astier.eu>
|
||||
F: package/go/
|
||||
F: package/nghttp2/
|
||||
@ -519,7 +519,7 @@ F: package/rtl8821au/
|
||||
F: package/runc/
|
||||
F: package/tini/
|
||||
|
||||
N: Christophe Priouzeau <christophe.priouzeau@st.com>
|
||||
N: Christophe Priouzeau <christophe.priouzeau@foss.st.com>
|
||||
F: board/stmicroelectronics/stm32f429-disco/
|
||||
F: board/stmicroelectronics/stm32f469-disco/
|
||||
F: configs/stm32f429_disco_defconfig
|
||||
@ -1024,12 +1024,14 @@ F: package/xapian/
|
||||
|
||||
N: Giulio Benetti <giulio.benetti@benettiengineering.com>
|
||||
F: package/at/
|
||||
F: package/libfuse3/
|
||||
F: package/libnspr/
|
||||
F: package/libnss/
|
||||
F: package/minicom/
|
||||
F: package/nfs-utils/
|
||||
F: package/sunxi-mali-mainline/
|
||||
F: package/sunxi-mali-mainline-driver/
|
||||
F: package/udisks/
|
||||
|
||||
N: Gregory Dymarek <gregd72002@gmail.com>
|
||||
F: package/ding-libs/
|
||||
@ -1238,11 +1240,6 @@ F: package/sysrepo/
|
||||
N: Jan Pedersen <jp@jp-embedded.com>
|
||||
F: package/zip/
|
||||
|
||||
N: Jan Viktorin <viktorin@rehivetech.com>
|
||||
F: package/python-pexpect/
|
||||
F: package/python-ptyprocess/
|
||||
F: package/zynq-boot-bin/
|
||||
|
||||
N: Jarkko Sakkinen <jarkko.sakkinen@intel.com>
|
||||
F: package/quota/
|
||||
|
||||
@ -2134,6 +2131,7 @@ F: package/libtirpc/
|
||||
F: package/linux-backports/
|
||||
F: package/ltp-testsuite/
|
||||
F: package/nfs-utils/
|
||||
F: package/rpcbind/
|
||||
F: support/kconfig/
|
||||
|
||||
N: Phil Eichinger <phil.eichinger@gmail.com>
|
||||
@ -2211,7 +2209,7 @@ F: package/nanomsg/
|
||||
N: Ramon Fried <rfried.dev@gmail.com>
|
||||
F: package/bitwise/
|
||||
|
||||
N: Raphaël Mélotte <raphael.melotte@essensium.com>
|
||||
N: Raphaël Mélotte <raphael.melotte@mind.be>
|
||||
F: package/jbig2dec/
|
||||
F: package/python-boto3/
|
||||
F: package/python-botocore/
|
||||
@ -2726,9 +2724,6 @@ F: package/casync/
|
||||
F: package/gloox/
|
||||
F: package/tpm2-pkcs11/
|
||||
|
||||
N: Yann CARDAILLAC <ycardaillac@sepro-group.com>
|
||||
F: package/open62541/
|
||||
|
||||
N: Yann E. MORIN <yann.morin.1998@free.fr>
|
||||
F: board/friendlyarm/nanopi-neo/
|
||||
F: configs/friendlyarm_nanopi_neo_defconfig
|
||||
|
@ -92,9 +92,9 @@ all:
|
||||
.PHONY: all
|
||||
|
||||
# Set and export the version string
|
||||
export BR2_VERSION := 2021.02.3
|
||||
export BR2_VERSION := 2021.02.4
|
||||
# Actual time the release is cut (for reproducible builds)
|
||||
BR2_VERSION_EPOCH = 1623509900
|
||||
BR2_VERSION_EPOCH = 1628627000
|
||||
|
||||
# Save running make version since it's clobbered by the make package
|
||||
RUNNING_MAKE_VERSION := $(MAKE_VERSION)
|
||||
@ -1140,6 +1140,7 @@ help:
|
||||
@echo ' <pkg>-dirclean - Remove <pkg> build directory'
|
||||
@echo ' <pkg>-reconfigure - Restart the build from the configure step'
|
||||
@echo ' <pkg>-rebuild - Restart the build from the build step'
|
||||
@echo ' <pkg>-reinstall - Restart the build from the install step'
|
||||
$(foreach p,$(HELP_PACKAGES), \
|
||||
@echo $(sep) \
|
||||
@echo '$($(p)_NAME):' $(sep) \
|
||||
|
@ -0,0 +1,4 @@
|
||||
label stm32f469-disco-buildroot
|
||||
kernel /zImage
|
||||
devicetree /stm32f469-disco.dtb
|
||||
append console=ttySTM0,115200 root=/dev/mmcblk0p2 rw rootfstype=ext2 rootwait earlyprintk consoleblank=0 ignore_loglevel
|
@ -13,8 +13,6 @@ ${OUTPUT_DIR}/host/bin/openocd -f board/stm32f469discovery.cfg \
|
||||
-c "reset init" \
|
||||
-c "flash probe 0" \
|
||||
-c "flash info 0" \
|
||||
-c "flash write_image erase ${OUTPUT_DIR}/images/stm32f469i-disco.bin 0x08000000" \
|
||||
-c "flash write_image erase ${OUTPUT_DIR}/images/stm32f469-disco.dtb 0x08004000" \
|
||||
-c "flash write_image erase ${OUTPUT_DIR}/images/xipImage 0x08008000" \
|
||||
-c "flash write_image erase ${OUTPUT_DIR}/images/u-boot.bin 0x08000000" \
|
||||
-c "reset run" \
|
||||
-c "shutdown"
|
||||
|
@ -0,0 +1,27 @@
|
||||
image boot.vfat {
|
||||
vfat {
|
||||
files = {
|
||||
"zImage",
|
||||
"stm32f469-disco.dtb",
|
||||
"extlinux"
|
||||
}
|
||||
}
|
||||
size = 16M
|
||||
}
|
||||
|
||||
image sdcard.img {
|
||||
hdimage {
|
||||
}
|
||||
|
||||
partition u-boot {
|
||||
partition-type = 0xC
|
||||
image = "boot.vfat"
|
||||
}
|
||||
|
||||
partition rootfs {
|
||||
partition-type = 0x83
|
||||
image = "rootfs.ext2"
|
||||
size = 32M
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1 @@
|
||||
# CONFIG_XIP_KERNEL is not set
|
@ -1,33 +0,0 @@
|
||||
From c8f8f33c2f0460a34c9545b01a7972a7ed2df0e9 Mon Sep 17 00:00:00 2001
|
||||
From: Christophe Priouzeau <christophe.priouzeau@st.com>
|
||||
Date: Mon, 29 May 2017 13:38:16 +0200
|
||||
Subject: [PATCH] ARM: stm32f249-disco: don't force init= in /chosen/bootargs
|
||||
|
||||
There is no reason to override the kernel's default init= value, as
|
||||
this breaks userspace that assumes the kernel default of /init is
|
||||
used. Since stm32 is often used with a minimal bootloader
|
||||
(afboot-stm32) that doesn't provide any mechanism to override the DTB,
|
||||
we need to adjust the kernel command line in the Device Tree source.
|
||||
|
||||
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
|
||||
Signed-off-by: Christophe Priouzeau <christophe.priouzeau@st.com>
|
||||
---
|
||||
arch/arm/boot/dts/stm32f469-disco.dts | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/arch/arm/boot/dts/stm32f469-disco.dts b/arch/arm/boot/dts/stm32f469-disco.dts
|
||||
index 0dd56ef..93ee1b2 100644
|
||||
--- a/arch/arm/boot/dts/stm32f469-disco.dts
|
||||
+++ b/arch/arm/boot/dts/stm32f469-disco.dts
|
||||
@@ -53,7 +53,7 @@
|
||||
compatible = "st,stm32f469i-disco", "st,stm32f469";
|
||||
|
||||
chosen {
|
||||
- bootargs = "root=/dev/ram rdinit=/linuxrc";
|
||||
+ bootargs = "root=/dev/ram";
|
||||
stdout-path = "serial0:115200n8";
|
||||
};
|
||||
|
||||
--
|
||||
2.7.4
|
||||
|
4
buildroot/board/stmicroelectronics/stm32f469-disco/post-build.sh
Executable file
4
buildroot/board/stmicroelectronics/stm32f469-disco/post-build.sh
Executable file
@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
BOARD_DIR="$(dirname $0)"
|
||||
|
||||
install -m 0644 -D $BOARD_DIR/extlinux.conf $BINARIES_DIR/extlinux/extlinux.conf
|
@ -15,5 +15,17 @@ Flashing
|
||||
|
||||
./board/stmicroelectronics/stm32f469-disco/flash.sh output/
|
||||
|
||||
It will flash the minimal bootloader, the Device Tree Blob, and the
|
||||
kernel image which includes the root filesystem as initramfs.
|
||||
It will flash the U-boot bootloader.
|
||||
|
||||
Creating SD card
|
||||
----------------
|
||||
|
||||
Buildroot prepares an"sdcard.img" image in the output/images/ directory,
|
||||
ready to be dumped on a SD card. Launch the following command as root:
|
||||
|
||||
dd if=output/images/sdcard.img of=/dev/<your-sd-device>
|
||||
|
||||
*** WARNING! This will destroy all the card content. Use with care! ***
|
||||
|
||||
For details about the medium image layout and its content, see the
|
||||
definition in board/stmicroelectronics/stm32f469-disco/genimage.cfg.
|
||||
|
@ -175,4 +175,25 @@ config BR2_TARGET_ARM_TRUSTED_FIRMWARE_NEEDS_ARM32_TOOLCHAIN
|
||||
Select this option if your ATF board configuration requires
|
||||
an ARM32 bare metal toolchain to be available.
|
||||
|
||||
config BR2_TARGET_ARM_TRUSTED_FIRMWARE_SSP
|
||||
bool "Build with SSP"
|
||||
default y
|
||||
depends on BR2_TOOLCHAIN_HAS_SSP
|
||||
depends on !BR2_SSP_NONE
|
||||
help
|
||||
Say 'y' here if you want to build ATF with SSP.
|
||||
|
||||
Your board must have SSP support in ATF: it must have an
|
||||
implementation for plat_get_stack_protector_canary().
|
||||
|
||||
If you say 'y', the SSP level will be the level selected
|
||||
by the global SSP setting.
|
||||
|
||||
config BR2_TARGET_ARM_TRUSTED_FIRMWARE_SSP_LEVEL
|
||||
string
|
||||
default "none" if !BR2_TARGET_ARM_TRUSTED_FIRMWARE_SSP
|
||||
default "default" if BR2_SSP_REGULAR
|
||||
default "strong" if BR2_SSP_STRONG
|
||||
default "all" if BR2_SSP_ALL
|
||||
|
||||
endif
|
||||
|
@ -51,7 +51,8 @@ endif
|
||||
ARM_TRUSTED_FIRMWARE_MAKE_OPTS += \
|
||||
CROSS_COMPILE="$(TARGET_CROSS)" \
|
||||
$(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_ADDITIONAL_VARIABLES)) \
|
||||
PLAT=$(ARM_TRUSTED_FIRMWARE_PLATFORM)
|
||||
PLAT=$(ARM_TRUSTED_FIRMWARE_PLATFORM) \
|
||||
ENABLE_STACK_PROTECTOR=$(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_SSP_LEVEL))
|
||||
|
||||
ifeq ($(BR2_ARM_CPU_ARMV7A),y)
|
||||
ARM_TRUSTED_FIRMWARE_MAKE_OPTS += ARM_ARCH_MAJOR=7
|
||||
@ -100,14 +101,6 @@ ARM_TRUSTED_FIRMWARE_MAKE_OPTS += MV_DDR_PATH=$(MV_DDR_MARVELL_DIR)
|
||||
ARM_TRUSTED_FIRMWARE_DEPENDENCIES += mv-ddr-marvell
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_SSP_REGULAR),y)
|
||||
ARM_TRUSTED_FIRMWARE_MAKE_OPTS += ENABLE_STACK_PROTECTOR=default
|
||||
else ifeq ($(BR2_SSP_STRONG),y)
|
||||
ARM_TRUSTED_FIRMWARE_MAKE_OPTS += ENABLE_STACK_PROTECTOR=strong
|
||||
else ifeq ($(BR2_SSP_ALL),y)
|
||||
ARM_TRUSTED_FIRMWARE_MAKE_OPTS += ENABLE_STACK_PROTECTOR=all
|
||||
endif
|
||||
|
||||
ARM_TRUSTED_FIRMWARE_MAKE_TARGETS = all
|
||||
|
||||
ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE_FIP),y)
|
||||
|
@ -118,9 +118,11 @@ HOST_GRUB2_CONF_ENV = \
|
||||
GRUB2_CONF_ENV = \
|
||||
CPP="$(TARGET_CC) -E" \
|
||||
TARGET_CC="$(TARGET_CC)" \
|
||||
TARGET_CFLAGS="$(TARGET_CFLAGS)" \
|
||||
TARGET_CPPFLAGS="$(TARGET_CPPFLAGS) -fno-stack-protector" \
|
||||
TARGET_LDFLAGS="$(TARGET_LDFLAGS)" \
|
||||
CFLAGS="$(TARGET_CFLAGS) -Os" \
|
||||
TARGET_CFLAGS="$(TARGET_CFLAGS) -Os" \
|
||||
CPPFLAGS="$(TARGET_CPPFLAGS) -Os -fno-stack-protector" \
|
||||
TARGET_CPPFLAGS="$(TARGET_CPPFLAGS) -Os -fno-stack-protector" \
|
||||
TARGET_LDFLAGS="$(TARGET_LDFLAGS) -Os" \
|
||||
TARGET_NM="$(TARGET_NM)" \
|
||||
TARGET_OBJCOPY="$(TARGET_OBJCOPY)" \
|
||||
TARGET_STRIP="$(TARGET_CROSS)strip"
|
||||
|
@ -17,7 +17,7 @@ UBOOT_CPE_ID_PRODUCT = u-boot
|
||||
UBOOT_INSTALL_IMAGES = YES
|
||||
|
||||
# u-boot 2020.01+ needs make 4.0+
|
||||
UBOOT_DEPENDENCIES = $(BR2_MAKE_HOST_DEPENDENCY)
|
||||
UBOOT_DEPENDENCIES = host-pkgconf $(BR2_MAKE_HOST_DEPENDENCY)
|
||||
UBOOT_MAKE = $(BR2_MAKE)
|
||||
|
||||
ifeq ($(UBOOT_VERSION),custom)
|
||||
@ -307,6 +307,11 @@ define UBOOT_BUILD_CMDS
|
||||
cp -f $(UBOOT_CUSTOM_DTS_PATH) $(@D)/arch/$(UBOOT_ARCH)/dts/
|
||||
)
|
||||
$(TARGET_CONFIGURE_OPTS) \
|
||||
PKG_CONFIG="$(PKG_CONFIG_HOST_BINARY)" \
|
||||
PKG_CONFIG_SYSROOT_DIR="/" \
|
||||
PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 \
|
||||
PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 \
|
||||
PKG_CONFIG_LIBDIR="$(HOST_DIR)/lib/pkgconfig:$(HOST_DIR)/share/pkgconfig" \
|
||||
$(UBOOT_MAKE) -C $(@D) $(UBOOT_MAKE_OPTS) \
|
||||
$(UBOOT_MAKE_TARGET)
|
||||
$(if $(BR2_TARGET_UBOOT_FORMAT_SD),
|
||||
|
@ -1,6 +1,10 @@
|
||||
BR2_arm=y
|
||||
BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_4=y
|
||||
BR2_TOOLCHAIN_BUILDROOT_WCHAR=y
|
||||
BR2_PTHREAD_DEBUG=y
|
||||
BR2_TOOLCHAIN_BUILDROOT_CXX=y
|
||||
BR2_TARGET_GENERIC_HOSTNAME="sam9x60ek"
|
||||
BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y
|
||||
BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh"
|
||||
BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/microchip/sam9x60ek_mmc/genimage.cfg"
|
||||
BR2_LINUX_KERNEL=y
|
||||
|
@ -1,19 +1,25 @@
|
||||
BR2_arm=y
|
||||
BR2_cortex_m4=y
|
||||
BR2_GLOBAL_PATCH_DIR="board/stmicroelectronics/stm32f469-disco/patches"
|
||||
BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_11=y
|
||||
BR2_ROOTFS_POST_BUILD_SCRIPT="board/stmicroelectronics/common/stm32f4xx/stm32-post-build.sh"
|
||||
BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_12=y
|
||||
BR2_ROOTFS_POST_BUILD_SCRIPT="board/stmicroelectronics/common/stm32f4xx/stm32-post-build.sh board/stmicroelectronics/stm32f469-disco/post-build.sh"
|
||||
BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh"
|
||||
BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/stmicroelectronics/stm32f469-disco/genimage.cfg"
|
||||
BR2_LINUX_KERNEL=y
|
||||
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
|
||||
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="4.11"
|
||||
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.12.11"
|
||||
BR2_LINUX_KERNEL_DEFCONFIG="stm32"
|
||||
BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="$(LINUX_DIR)/arch/arm/configs/dram_0x00000000.config"
|
||||
BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="$(LINUX_DIR)/arch/arm/configs/dram_0x00000000.config board/stmicroelectronics/stm32f469-disco/linux.fragment"
|
||||
BR2_LINUX_KERNEL_IMAGE_TARGET_CUSTOM=y
|
||||
BR2_LINUX_KERNEL_IMAGE_TARGET_NAME="xipImage"
|
||||
BR2_LINUX_KERNEL_IMAGE_TARGET_NAME="zImage"
|
||||
BR2_LINUX_KERNEL_DTS_SUPPORT=y
|
||||
BR2_LINUX_KERNEL_INTREE_DTS_NAME="stm32f469-disco"
|
||||
BR2_PACKAGE_BUSYBOX_CONFIG="package/busybox/busybox-minimal.config"
|
||||
BR2_TARGET_ROOTFS_INITRAMFS=y
|
||||
BR2_TARGET_ROOTFS_EXT2=y
|
||||
BR2_TARGET_ROOTFS_EXT2_SIZE="32M"
|
||||
# BR2_TARGET_ROOTFS_TAR is not set
|
||||
BR2_TARGET_AFBOOT_STM32=y
|
||||
BR2_TARGET_UBOOT=y
|
||||
BR2_TARGET_UBOOT_BOARD_DEFCONFIG="stm32f469-discovery"
|
||||
BR2_PACKAGE_HOST_DOSFSTOOLS=y
|
||||
BR2_PACKAGE_HOST_GENIMAGE=y
|
||||
BR2_PACKAGE_HOST_MTOOLS=y
|
||||
BR2_PACKAGE_HOST_OPENOCD=y
|
||||
|
File diff suppressed because one or more lines are too long
Binary file not shown.
@ -174,13 +174,13 @@ List of Examples
|
||||
|
||||
---------------------------------------------------------------------
|
||||
|
||||
Buildroot 2021.02.3 manual generated on 2021-06-12 15:00:43 UTC from
|
||||
git revision 5293208a57
|
||||
Buildroot 2021.02.4 manual generated on 2021-08-10 20:33:55 UTC from
|
||||
git revision 004a792dcf
|
||||
|
||||
The Buildroot manual is written by the Buildroot developers. It is
|
||||
licensed under the GNU General Public License, version 2. Refer to
|
||||
the COPYING [http://git.buildroot.org/buildroot/tree/COPYING?id=
|
||||
5293208a57ce78f9fc958704d7df52f28532cde6] file in the Buildroot
|
||||
004a792dcf10e6c474070c9571f7504411e786cc] file in the Buildroot
|
||||
sources for the full text of this license.
|
||||
|
||||
Copyright © 2004-2020 The Buildroot developers
|
||||
@ -479,12 +479,9 @@ Mailing List
|
||||
page [http://lists.buildroot.org/mailman/listinfo/buildroot].
|
||||
|
||||
Mails that are sent to the mailing list are also available in the
|
||||
mailing list archives [http://lists.buildroot.org/pipermail/
|
||||
buildroot] and via Gmane [http://gmane.org], at
|
||||
gmane.comp.lib.uclibc.buildroot [http://dir.gmane.org/
|
||||
gmane.comp.lib.uclibc.buildroot]. Please search the mailing list
|
||||
archives before asking questions, since there is a good chance
|
||||
someone else has asked the same question before.
|
||||
mailing list archives, available through Mailman [http://
|
||||
lists.buildroot.org/pipermail/buildroot] or at lore.kernel.org
|
||||
[https://lore.kernel.org/buildroot/].
|
||||
|
||||
IRC
|
||||
|
||||
@ -494,7 +491,7 @@ IRC
|
||||
topics.
|
||||
|
||||
When asking for help on IRC, share relevant logs or pieces of
|
||||
code using a code sharing website, such as http://code.bulix.org.
|
||||
code using a code sharing website, such as https://paste.ack.tf/.
|
||||
|
||||
Note that for certain questions, posting to the mailing list may
|
||||
be better as it will reach more people, both developers and
|
||||
|
@ -21,11 +21,9 @@ http://lists.buildroot.org/mailman/listinfo/buildroot[mailing list info
|
||||
page].
|
||||
+
|
||||
Mails that are sent to the mailing list are also available in the
|
||||
http://lists.buildroot.org/pipermail/buildroot[mailing list archives] and
|
||||
via http://gmane.org[Gmane], at
|
||||
http://dir.gmane.org/gmane.comp.lib.uclibc.buildroot[+gmane.comp.lib.uclibc.buildroot+].
|
||||
Please search the mailing list archives before asking questions, since
|
||||
there is a good chance someone else has asked the same question before.
|
||||
mailing list archives, available through
|
||||
http://lists.buildroot.org/pipermail/buildroot[Mailman] or at
|
||||
https://lore.kernel.org/buildroot/[lore.kernel.org].
|
||||
|
||||
IRC::
|
||||
+
|
||||
@ -34,7 +32,7 @@ hosted on https://www.oftc.net/WebChat/[OFTC]. It is a useful place to
|
||||
ask quick questions or discuss on certain topics.
|
||||
+
|
||||
When asking for help on IRC, share relevant logs or pieces of code
|
||||
using a code sharing website, such as http://code.bulix.org.
|
||||
using a code sharing website, such as https://paste.ack.tf/.
|
||||
+
|
||||
Note that for certain questions, posting to the mailing list may be
|
||||
better as it will reach more people, both developers and users.
|
||||
|
@ -125,7 +125,7 @@ endif
|
||||
|
||||
config BR2_LINUX_KERNEL_VERSION
|
||||
string
|
||||
default "5.10.43" if BR2_LINUX_KERNEL_LATEST_VERSION
|
||||
default "5.10.57" if BR2_LINUX_KERNEL_LATEST_VERSION
|
||||
default "4.19.182-cip45" if BR2_LINUX_KERNEL_LATEST_CIP_VERSION
|
||||
default "4.19.165-cip41-rt18" if BR2_LINUX_KERNEL_LATEST_CIP_RT_VERSION
|
||||
default BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE \
|
||||
|
@ -1,11 +1,11 @@
|
||||
# From https://www.kernel.org/pub/linux/kernel/v5.x/sha256sums.asc
|
||||
sha256 83b81e433ba2f8ee143064fb163699ee857e26dd789006bc1e9edf1ccd0bd403 linux-5.10.43.tar.xz
|
||||
sha256 17ee750a4aeb1c883d721e730d1f7e2855124585e2f47766864a1359a7ebe33c linux-5.4.125.tar.xz
|
||||
sha256 00bbaeaac17f82d9a6d93cbc42cafd39d3b2fa3a6087333503d2344fa5e3142d linux-5.10.57.tar.xz
|
||||
sha256 0471d0ccb7953cdae7d235192588ac5d72344851969962676d1703e69084a37f linux-5.4.139.tar.xz
|
||||
# From https://www.kernel.org/pub/linux/kernel/v4.x/sha256sums.asc
|
||||
sha256 d13fa552be602825c443fcca90d6bdd72f4ebef809889ef015dba4593d3224ab linux-4.4.272.tar.xz
|
||||
sha256 f8bf0c390ae40ca736e104f10f744446bc534bf87ba1b6dbb2b7c9a8bece1058 linux-4.9.272.tar.xz
|
||||
sha256 e4eae297a6fefefd8ce4781d98178a7c1ee51ca0a4c8a7e46e61b121fbab8b2a linux-4.14.236.tar.xz
|
||||
sha256 aaaebdccf599f77148fe170642fa7dc2452cf994b5cbbb4d39cab9e7f4058896 linux-4.19.194.tar.xz
|
||||
sha256 4bdf66494be66a1da857f09b40b95026a0388e373fb01a206c60f67834746cb4 linux-4.4.279.tar.xz
|
||||
sha256 21edb57dea0fe04a51fcfb6d4e8c0c052787a20015bc74a0a0e63329601f2e07 linux-4.9.279.tar.xz
|
||||
sha256 7f235d454d703112e86574150652807f42abead92f3837da32ea86b4f148b371 linux-4.14.243.tar.xz
|
||||
sha256 f2827d0506622fcae0dae0bc72b2f016469210f50c2d3dd1bdd1211a813dca27 linux-4.19.202.tar.xz
|
||||
# Locally computed
|
||||
sha256 9f1de83c5c2bb582a33bd4ee892d45671901cd06af9dc159f0f499f1b5265b20 linux-cip-4.19.182-cip45.tar.gz
|
||||
sha256 0eeba6d6ecc45cf8f16458842b64d22e7064b9de9c31c11d1c395b08a47e3855 linux-cip-4.19.165-cip41-rt18.tar.gz
|
||||
|
@ -11,6 +11,7 @@ APACHE_LICENSE = Apache-2.0
|
||||
APACHE_LICENSE_FILES = LICENSE
|
||||
APACHE_CPE_ID_VENDOR = apache
|
||||
APACHE_CPE_ID_PRODUCT = http_server
|
||||
APACHE_SELINUX_MODULES = apache
|
||||
# Needed for mod_php
|
||||
APACHE_INSTALL_STAGING = YES
|
||||
# We have a patch touching configure.in and Makefile.in,
|
||||
|
@ -18,9 +18,9 @@ start(){
|
||||
|
||||
# Create dir to store log files in if one doesn't exist. Create
|
||||
# the directory with SELinux permissions if possible
|
||||
command -v matchpathcon >/dev/null 2>&1
|
||||
command -v selabel_lookup >/dev/null 2>&1
|
||||
if [ $? = 0 ]; then
|
||||
mkdir -p /var/log/audit -Z `matchpathcon -n /var/log/audit`
|
||||
mkdir -p /var/log/audit -Z `selabel_lookup -b file -k /var/log/audit`
|
||||
else
|
||||
mkdir -p /var/log/audit
|
||||
fi
|
||||
|
@ -0,0 +1,152 @@
|
||||
From 9d31939e55280a733d930b15ac9e4dda4497680c Mon Sep 17 00:00:00 2001
|
||||
From: Tommi Rantala <tommi.t.rantala@nokia.com>
|
||||
Date: Mon, 8 Feb 2021 11:04:43 +0200
|
||||
Subject: [PATCH] Fix NULL pointer crashes from #175
|
||||
|
||||
avahi-daemon is crashing when running "ping .local".
|
||||
The crash is due to failing assertion from NULL pointer.
|
||||
Add missing NULL pointer checks to fix it.
|
||||
|
||||
Introduced in #175 - merge commit 8f75a045709a780c8cf92a6a21e9d35b593bdecd
|
||||
|
||||
[Retrieved from:
|
||||
https://github.com/lathiat/avahi/commit/9d31939e55280a733d930b15ac9e4dda4497680c]
|
||||
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
|
||||
---
|
||||
avahi-core/browse-dns-server.c | 5 ++++-
|
||||
avahi-core/browse-domain.c | 5 ++++-
|
||||
avahi-core/browse-service-type.c | 3 +++
|
||||
avahi-core/browse-service.c | 3 +++
|
||||
avahi-core/browse.c | 3 +++
|
||||
avahi-core/resolve-address.c | 5 ++++-
|
||||
avahi-core/resolve-host-name.c | 5 ++++-
|
||||
avahi-core/resolve-service.c | 5 ++++-
|
||||
8 files changed, 29 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/avahi-core/browse-dns-server.c b/avahi-core/browse-dns-server.c
|
||||
index 049752e9..c2d914fa 100644
|
||||
--- a/avahi-core/browse-dns-server.c
|
||||
+++ b/avahi-core/browse-dns-server.c
|
||||
@@ -343,7 +343,10 @@ AvahiSDNSServerBrowser *avahi_s_dns_server_browser_new(
|
||||
AvahiSDNSServerBrowser* b;
|
||||
|
||||
b = avahi_s_dns_server_browser_prepare(server, interface, protocol, domain, type, aprotocol, flags, callback, userdata);
|
||||
+ if (!b)
|
||||
+ return NULL;
|
||||
+
|
||||
avahi_s_dns_server_browser_start(b);
|
||||
|
||||
return b;
|
||||
-}
|
||||
\ No newline at end of file
|
||||
+}
|
||||
diff --git a/avahi-core/browse-domain.c b/avahi-core/browse-domain.c
|
||||
index f145d56a..06fa70c0 100644
|
||||
--- a/avahi-core/browse-domain.c
|
||||
+++ b/avahi-core/browse-domain.c
|
||||
@@ -253,7 +253,10 @@ AvahiSDomainBrowser *avahi_s_domain_browser_new(
|
||||
AvahiSDomainBrowser *b;
|
||||
|
||||
b = avahi_s_domain_browser_prepare(server, interface, protocol, domain, type, flags, callback, userdata);
|
||||
+ if (!b)
|
||||
+ return NULL;
|
||||
+
|
||||
avahi_s_domain_browser_start(b);
|
||||
|
||||
return b;
|
||||
-}
|
||||
\ No newline at end of file
|
||||
+}
|
||||
diff --git a/avahi-core/browse-service-type.c b/avahi-core/browse-service-type.c
|
||||
index fdd22dcd..b1fc7af8 100644
|
||||
--- a/avahi-core/browse-service-type.c
|
||||
+++ b/avahi-core/browse-service-type.c
|
||||
@@ -171,6 +171,9 @@ AvahiSServiceTypeBrowser *avahi_s_service_type_browser_new(
|
||||
AvahiSServiceTypeBrowser *b;
|
||||
|
||||
b = avahi_s_service_type_browser_prepare(server, interface, protocol, domain, flags, callback, userdata);
|
||||
+ if (!b)
|
||||
+ return NULL;
|
||||
+
|
||||
avahi_s_service_type_browser_start(b);
|
||||
|
||||
return b;
|
||||
diff --git a/avahi-core/browse-service.c b/avahi-core/browse-service.c
|
||||
index 5531360c..63e0275a 100644
|
||||
--- a/avahi-core/browse-service.c
|
||||
+++ b/avahi-core/browse-service.c
|
||||
@@ -184,6 +184,9 @@ AvahiSServiceBrowser *avahi_s_service_browser_new(
|
||||
AvahiSServiceBrowser *b;
|
||||
|
||||
b = avahi_s_service_browser_prepare(server, interface, protocol, service_type, domain, flags, callback, userdata);
|
||||
+ if (!b)
|
||||
+ return NULL;
|
||||
+
|
||||
avahi_s_service_browser_start(b);
|
||||
|
||||
return b;
|
||||
diff --git a/avahi-core/browse.c b/avahi-core/browse.c
|
||||
index 2941e579..e8a915e9 100644
|
||||
--- a/avahi-core/browse.c
|
||||
+++ b/avahi-core/browse.c
|
||||
@@ -634,6 +634,9 @@ AvahiSRecordBrowser *avahi_s_record_browser_new(
|
||||
AvahiSRecordBrowser *b;
|
||||
|
||||
b = avahi_s_record_browser_prepare(server, interface, protocol, key, flags, callback, userdata);
|
||||
+ if (!b)
|
||||
+ return NULL;
|
||||
+
|
||||
avahi_s_record_browser_start_query(b);
|
||||
|
||||
return b;
|
||||
diff --git a/avahi-core/resolve-address.c b/avahi-core/resolve-address.c
|
||||
index ac0b29b1..e61dd242 100644
|
||||
--- a/avahi-core/resolve-address.c
|
||||
+++ b/avahi-core/resolve-address.c
|
||||
@@ -286,7 +286,10 @@ AvahiSAddressResolver *avahi_s_address_resolver_new(
|
||||
AvahiSAddressResolver *b;
|
||||
|
||||
b = avahi_s_address_resolver_prepare(server, interface, protocol, address, flags, callback, userdata);
|
||||
+ if (!b)
|
||||
+ return NULL;
|
||||
+
|
||||
avahi_s_address_resolver_start(b);
|
||||
|
||||
return b;
|
||||
-}
|
||||
\ No newline at end of file
|
||||
+}
|
||||
diff --git a/avahi-core/resolve-host-name.c b/avahi-core/resolve-host-name.c
|
||||
index 808b0e72..4e8e5973 100644
|
||||
--- a/avahi-core/resolve-host-name.c
|
||||
+++ b/avahi-core/resolve-host-name.c
|
||||
@@ -318,7 +318,10 @@ AvahiSHostNameResolver *avahi_s_host_name_resolver_new(
|
||||
AvahiSHostNameResolver *b;
|
||||
|
||||
b = avahi_s_host_name_resolver_prepare(server, interface, protocol, host_name, aprotocol, flags, callback, userdata);
|
||||
+ if (!b)
|
||||
+ return NULL;
|
||||
+
|
||||
avahi_s_host_name_resolver_start(b);
|
||||
|
||||
return b;
|
||||
-}
|
||||
\ No newline at end of file
|
||||
+}
|
||||
diff --git a/avahi-core/resolve-service.c b/avahi-core/resolve-service.c
|
||||
index 66bf3cae..43771763 100644
|
||||
--- a/avahi-core/resolve-service.c
|
||||
+++ b/avahi-core/resolve-service.c
|
||||
@@ -519,7 +519,10 @@ AvahiSServiceResolver *avahi_s_service_resolver_new(
|
||||
AvahiSServiceResolver *b;
|
||||
|
||||
b = avahi_s_service_resolver_prepare(server, interface, protocol, name, type, domain, aprotocol, flags, callback, userdata);
|
||||
+ if (!b)
|
||||
+ return NULL;
|
||||
+
|
||||
avahi_s_service_resolver_start(b);
|
||||
|
||||
return b;
|
||||
-}
|
||||
\ No newline at end of file
|
||||
+}
|
@ -9,12 +9,16 @@ AVAHI_SITE = https://github.com/lathiat/avahi/releases/download/v$(AVAHI_VERSION
|
||||
AVAHI_LICENSE = LGPL-2.1+
|
||||
AVAHI_LICENSE_FILES = LICENSE
|
||||
AVAHI_CPE_ID_VENDOR = avahi
|
||||
AVAHI_SELINUX_MODULES = avahi
|
||||
AVAHI_INSTALL_STAGING = YES
|
||||
|
||||
# CVE-2021-26720 is an issue in avahi-daemon-check-dns.sh, which is
|
||||
# part of the Debian packaging and not part of upstream avahi
|
||||
AVAHI_IGNORE_CVES += CVE-2021-26720
|
||||
|
||||
# 0001-Fix-NULL-pointer-crashes-from-175.patch
|
||||
AVAHI_IGNORE_CVES += CVE-2021-36217
|
||||
|
||||
AVAHI_CONF_ENV = \
|
||||
avahi_cv_sys_cxx_works=yes \
|
||||
DATADIRNAME=share
|
||||
|
@ -13,6 +13,7 @@ BIND_CONFIG_SCRIPTS = bind9-config isc-config.sh
|
||||
BIND_LICENSE = MPL-2.0
|
||||
BIND_LICENSE_FILES = COPYRIGHT
|
||||
BIND_CPE_ID_VENDOR = isc
|
||||
BIND_SELINUX_MODULES = bind
|
||||
# Only applies to RHEL6.x with DNSSEC validation on
|
||||
BIND_IGNORE_CVES = CVE-2017-3139
|
||||
# Library CVE and not used by bind but used by ISC DHCP
|
||||
|
@ -1,35 +0,0 @@
|
||||
From 93cf62b662499e560812145dd989056fcf14f00e Mon Sep 17 00:00:00 2001
|
||||
From: Giulio Benetti <giulio.benetti@benettiengineering.com>
|
||||
Date: Mon, 22 Mar 2021 13:30:07 +0100
|
||||
Subject: [PATCH] bfd/elf32-or1k: fix ld assert
|
||||
|
||||
Fixes https://sourceware.org/bugzilla/show_bug.cgi?id=27624
|
||||
|
||||
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
|
||||
---
|
||||
bfd/elf32-or1k.c | 9 ++++-----
|
||||
1 file changed, 4 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c
|
||||
index 2f200b197b..ae508540f5 100644
|
||||
--- a/bfd/elf32-or1k.c
|
||||
+++ b/bfd/elf32-or1k.c
|
||||
@@ -2535,11 +2535,10 @@ or1k_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
|
||||
if (h->type == STT_FUNC
|
||||
|| h->needs_plt)
|
||||
{
|
||||
- if (! bfd_link_pic (info)
|
||||
- && !h->def_dynamic
|
||||
- && !h->ref_dynamic
|
||||
- && h->root.type != bfd_link_hash_undefweak
|
||||
- && h->root.type != bfd_link_hash_undefined)
|
||||
+ if (h->plt.refcount <= 0
|
||||
+ || (SYMBOL_CALLS_LOCAL (info, h)
|
||||
+ || (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
|
||||
+ && h->root.type == bfd_link_hash_undefweak)))
|
||||
{
|
||||
/* This case can occur if we saw a PLT reloc in an input
|
||||
file, but the symbol was never referred to by a dynamic
|
||||
--
|
||||
2.25.1
|
||||
|
@ -0,0 +1,59 @@
|
||||
From 788cda9f9447e0fe67e582e8fb5adafd678d08b2 Mon Sep 17 00:00:00 2001
|
||||
From: Stafford Horne <shorne@gmail.com>
|
||||
Date: Sun, 2 May 2021 06:02:14 +0900
|
||||
Subject: [PATCH] or1k: Fix issue with plt link failure for local calls
|
||||
|
||||
When building protobuf we were seeing the assert failure:
|
||||
|
||||
/home/giuliobenetti/git/upstream/or1k-binutils-2.36.1/host/lib/gcc/or1k-buildroot-linux-uclibc/9.3.0/../../../../or1k-buildroot-linux-uclibc/bin/ld:
|
||||
BFD (GNU Binutils) 2.36.1 assertion fail elf32-or1k.c:2377
|
||||
/home/giuliobenetti/git/upstream/or1k-binutils-2.36.1/host/lib/gcc/or1k-buildroot-linux-uclibc/9.3.0/../../../../or1k-buildroot-linux-uclibc/bin/ld:
|
||||
BFD (GNU Binutils) 2.36.1 assertion fail elf32-or1k.c:2377
|
||||
/home/giuliobenetti/git/upstream/or1k-binutils-2.36.1/host/lib/gcc/or1k-buildroot-linux-uclibc/9.3.0/../../../../or1k-buildroot-linux-uclibc/bin/ld:
|
||||
BFD (GNU Binutils) 2.36.1 assertion fail elf32-or1k.c:2377
|
||||
collect2: error: ld returned 1 exit status
|
||||
|
||||
This failure happens while writing out PLT entries, there is a check
|
||||
"BFD_ASSERT (h->dynindx != -1)" to confirm all plt entries have dynamic
|
||||
symbol attributes. This was failing for symbols that were
|
||||
"forced_local" in previous linking code.
|
||||
|
||||
The fix adds logic to or1k_elf_adjust_dynamic_symbol to identify
|
||||
"forced_local" symbols and exclude them from the the PLT.
|
||||
|
||||
bfd/ChangeLog:
|
||||
|
||||
PR 27624
|
||||
* elf32-or1k.c (or1k_elf_adjust_dynamic_symbol): Change
|
||||
condition used to cleanup plt entries to cleanup forced local
|
||||
entries.
|
||||
|
||||
Cc: Giulio Benetti <giulio.benetti@benettiengineering.com>
|
||||
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
|
||||
---
|
||||
bfd/elf32-or1k.c | 9 ++++-----
|
||||
1 file changed, 4 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c
|
||||
index 2f200b197b8..1f2c88b0b3a 100644
|
||||
--- a/bfd/elf32-or1k.c
|
||||
+++ b/bfd/elf32-or1k.c
|
||||
@@ -2535,11 +2535,10 @@ or1k_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
|
||||
if (h->type == STT_FUNC
|
||||
|| h->needs_plt)
|
||||
{
|
||||
- if (! bfd_link_pic (info)
|
||||
- && !h->def_dynamic
|
||||
- && !h->ref_dynamic
|
||||
- && h->root.type != bfd_link_hash_undefweak
|
||||
- && h->root.type != bfd_link_hash_undefined)
|
||||
+ if (h->plt.refcount <= 0
|
||||
+ || (SYMBOL_CALLS_LOCAL (info, h)
|
||||
+ || (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
|
||||
+ && h->root.type == bfd_link_hash_undefweak)))
|
||||
{
|
||||
/* This case can occur if we saw a PLT reloc in an input
|
||||
file, but the symbol was never referred to by a dynamic
|
||||
--
|
||||
2.25.1
|
||||
|
@ -0,0 +1,256 @@
|
||||
From b10e6230dea0015bf3b7748580b82c551f9a3a4a Mon Sep 17 00:00:00 2001
|
||||
From: Stafford Horne <shorne@gmail.com>
|
||||
Date: Sun, 2 May 2021 06:02:15 +0900
|
||||
Subject: [PATCH] or1k: Implement relocation R_OR1K_GOT_AHI16 for gotha()
|
||||
|
||||
The gotha() relocation mnemonic will be outputted by OpenRISC GCC when
|
||||
using the -mcmodel=large option. This relocation is used along with
|
||||
got() to generate 32-bit GOT offsets. This increases the previous GOT
|
||||
offset limit from the previous 16-bit (64K) limit.
|
||||
|
||||
This is needed on large binaries where the GOT grows larger than 64k.
|
||||
|
||||
bfd/ChangeLog:
|
||||
|
||||
PR 21464
|
||||
* bfd-in2.h: Add BFD_RELOC_OR1K_GOT_AHI16 relocation.
|
||||
* elf32-or1k.c (or1k_elf_howto_table, or1k_reloc_map): Likewise.
|
||||
(or1k_final_link_relocate, or1k_elf_relocate_section,
|
||||
or1k_elf_check_relocs): Likewise.
|
||||
* libbfd.h (bfd_reloc_code_real_names): Likewise.
|
||||
* reloc.c: Likewise.
|
||||
|
||||
cpu/ChangeLog:
|
||||
|
||||
PR 21464
|
||||
* or1k.opc (or1k_imm16_relocs, parse_reloc): Define parse logic
|
||||
for gotha() relocation.
|
||||
|
||||
include/ChangeLog:
|
||||
|
||||
PR 21464
|
||||
* elf/or1k.h (elf_or1k_reloc_type): Define R_OR1K_GOT_AHI16 number.
|
||||
|
||||
opcodes/ChangeLog:
|
||||
|
||||
PR 21464
|
||||
* or1k-asm.c: Regenerate.
|
||||
|
||||
gas/ChangeLog:
|
||||
|
||||
PR 21464
|
||||
* testsuite/gas/or1k/reloc-1.s: Add test for new relocation.
|
||||
* testsuite/gas/or1k/reloc-1.d: Add test result for new
|
||||
relocation.
|
||||
|
||||
Cc: Giulio Benetti <giulio.benetti@benettiengineering.com>
|
||||
|
||||
fixup reloc, add tests
|
||||
|
||||
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
|
||||
---
|
||||
bfd/bfd-in2.h | 1 +
|
||||
bfd/elf32-or1k.c | 21 ++++++++++++++++++++-
|
||||
bfd/libbfd.h | 1 +
|
||||
bfd/reloc.c | 2 ++
|
||||
cpu/or1k.opc | 7 ++++++-
|
||||
gas/testsuite/gas/or1k/reloc-1.d | 4 +++-
|
||||
gas/testsuite/gas/or1k/reloc-1.s | 4 ++++
|
||||
include/elf/or1k.h | 1 +
|
||||
opcodes/or1k-asm.c | 7 ++++++-
|
||||
9 files changed, 44 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
|
||||
index e25da50aafb..530a41fca43 100644
|
||||
--- a/bfd/bfd-in2.h
|
||||
+++ b/bfd/bfd-in2.h
|
||||
@@ -5517,6 +5517,7 @@ then it may be truncated to 8 bits. */
|
||||
BFD_RELOC_OR1K_TLS_TPOFF,
|
||||
BFD_RELOC_OR1K_TLS_DTPOFF,
|
||||
BFD_RELOC_OR1K_TLS_DTPMOD,
|
||||
+ BFD_RELOC_OR1K_GOT_AHI16,
|
||||
|
||||
/* H8 elf Relocations. */
|
||||
BFD_RELOC_H8_DIR16A8,
|
||||
diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c
|
||||
index 1f2c88b0b3a..a4a64f73b7c 100644
|
||||
--- a/bfd/elf32-or1k.c
|
||||
+++ b/bfd/elf32-or1k.c
|
||||
@@ -808,6 +808,20 @@ static reloc_howto_type or1k_elf_howto_table[] =
|
||||
0, /* Source Mask. */
|
||||
0x03ffffff, /* Dest Mask. */
|
||||
TRUE), /* PC relative offset? */
|
||||
+
|
||||
+ HOWTO (R_OR1K_GOT_AHI16, /* type */
|
||||
+ 16, /* rightshift */
|
||||
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
+ 16, /* bitsize */
|
||||
+ FALSE, /* pc_relative */
|
||||
+ 0, /* bitpos */
|
||||
+ complain_overflow_signed, /* complain_on_overflow */
|
||||
+ bfd_elf_generic_reloc, /* special_function */
|
||||
+ "R_OR1K_GOT_AHI16", /* name */
|
||||
+ FALSE, /* partial_inplace */
|
||||
+ 0, /* src_mask */
|
||||
+ 0xffff, /* dst_mask */
|
||||
+ FALSE), /* pcrel_offset */
|
||||
};
|
||||
|
||||
/* Map BFD reloc types to Or1k ELF reloc types. */
|
||||
@@ -871,6 +885,7 @@ static const struct or1k_reloc_map or1k_reloc_map[] =
|
||||
{ BFD_RELOC_OR1K_TLS_IE_LO13, R_OR1K_TLS_IE_LO13 },
|
||||
{ BFD_RELOC_OR1K_SLO13, R_OR1K_SLO13 },
|
||||
{ BFD_RELOC_OR1K_PLTA26, R_OR1K_PLTA26 },
|
||||
+ { BFD_RELOC_OR1K_GOT_AHI16, R_OR1K_GOT_AHI16 },
|
||||
};
|
||||
|
||||
#define TLS_UNKNOWN 0
|
||||
@@ -1080,6 +1095,7 @@ or1k_final_link_relocate (reloc_howto_type *howto, bfd *input_bfd,
|
||||
switch (howto->type)
|
||||
{
|
||||
case R_OR1K_AHI16:
|
||||
+ case R_OR1K_GOT_AHI16:
|
||||
case R_OR1K_GOTOFF_AHI16:
|
||||
case R_OR1K_TLS_IE_AHI16:
|
||||
case R_OR1K_TLS_LE_AHI16:
|
||||
@@ -1344,6 +1360,7 @@ or1k_elf_relocate_section (bfd *output_bfd,
|
||||
}
|
||||
break;
|
||||
|
||||
+ case R_OR1K_GOT_AHI16:
|
||||
case R_OR1K_GOT16:
|
||||
case R_OR1K_GOT_PG21:
|
||||
case R_OR1K_GOT_LO13:
|
||||
@@ -1435,7 +1452,8 @@ or1k_elf_relocate_section (bfd *output_bfd,
|
||||
/* The GOT_PG21 and GOT_LO13 relocs are pc-relative,
|
||||
while the GOT16 reloc is GOT relative. */
|
||||
relocation = got_base + off;
|
||||
- if (r_type == R_OR1K_GOT16)
|
||||
+ if (r_type == R_OR1K_GOT16
|
||||
+ || r_type == R_OR1K_GOT_AHI16)
|
||||
relocation -= got_sym_value;
|
||||
|
||||
/* Addend should be zero. */
|
||||
@@ -1945,6 +1963,7 @@ or1k_elf_check_relocs (bfd *abfd,
|
||||
}
|
||||
break;
|
||||
|
||||
+ case R_OR1K_GOT_AHI16:
|
||||
case R_OR1K_GOT16:
|
||||
case R_OR1K_GOT_PG21:
|
||||
case R_OR1K_GOT_LO13:
|
||||
diff --git a/bfd/libbfd.h b/bfd/libbfd.h
|
||||
index 36284d71a9b..6e9e3190bb8 100644
|
||||
--- a/bfd/libbfd.h
|
||||
+++ b/bfd/libbfd.h
|
||||
@@ -2702,6 +2702,7 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
|
||||
"BFD_RELOC_OR1K_TLS_TPOFF",
|
||||
"BFD_RELOC_OR1K_TLS_DTPOFF",
|
||||
"BFD_RELOC_OR1K_TLS_DTPMOD",
|
||||
+ "BFD_RELOC_OR1K_GOT_AHI16",
|
||||
"BFD_RELOC_H8_DIR16A8",
|
||||
"BFD_RELOC_H8_DIR16R8",
|
||||
"BFD_RELOC_H8_DIR24A8",
|
||||
diff --git a/bfd/reloc.c b/bfd/reloc.c
|
||||
index e6446a78098..b0003ab1175 100644
|
||||
--- a/bfd/reloc.c
|
||||
+++ b/bfd/reloc.c
|
||||
@@ -6164,6 +6164,8 @@ ENUMX
|
||||
BFD_RELOC_OR1K_GOTPC_HI16
|
||||
ENUMX
|
||||
BFD_RELOC_OR1K_GOTPC_LO16
|
||||
+ENUMX
|
||||
+ BFD_RELOC_OR1K_GOT_AHI16
|
||||
ENUMX
|
||||
BFD_RELOC_OR1K_GOT16
|
||||
ENUMX
|
||||
diff --git a/cpu/or1k.opc b/cpu/or1k.opc
|
||||
index 5082a30cee1..85163fc96c9 100644
|
||||
--- a/cpu/or1k.opc
|
||||
+++ b/cpu/or1k.opc
|
||||
@@ -173,7 +173,7 @@ static const bfd_reloc_code_real_type or1k_imm16_relocs[][6] = {
|
||||
BFD_RELOC_OR1K_GOT_LO13,
|
||||
BFD_RELOC_UNUSED,
|
||||
BFD_RELOC_UNUSED,
|
||||
- BFD_RELOC_UNUSED },
|
||||
+ BFD_RELOC_OR1K_GOT_AHI16 },
|
||||
{ BFD_RELOC_OR1K_GOTPC_LO16,
|
||||
BFD_RELOC_UNUSED,
|
||||
BFD_RELOC_UNUSED,
|
||||
@@ -276,6 +276,11 @@ parse_reloc (const char **strp)
|
||||
str += 5;
|
||||
cls = RCLASS_TPOFF;
|
||||
}
|
||||
+ else if (strncasecmp (str, "got", 3) == 0)
|
||||
+ {
|
||||
+ str += 3;
|
||||
+ cls = RCLASS_GOT;
|
||||
+ }
|
||||
|
||||
if (strncasecmp (str, "hi(", 3) == 0)
|
||||
{
|
||||
diff --git a/gas/testsuite/gas/or1k/reloc-1.d b/gas/testsuite/gas/or1k/reloc-1.d
|
||||
index d1bcf5608bb..3a001c4ed99 100644
|
||||
--- a/gas/testsuite/gas/or1k/reloc-1.d
|
||||
+++ b/gas/testsuite/gas/or1k/reloc-1.d
|
||||
@@ -68,5 +68,7 @@ OFFSET TYPE VALUE
|
||||
000000ec R_OR1K_LO13 x
|
||||
000000f0 R_OR1K_GOT_LO13 x
|
||||
000000f4 R_OR1K_SLO13 x
|
||||
-
|
||||
+000000f8 R_OR1K_GOT_AHI16 x
|
||||
+000000fc R_OR1K_GOT_AHI16 x
|
||||
+00000100 R_OR1K_GOT_AHI16 x
|
||||
|
||||
diff --git a/gas/testsuite/gas/or1k/reloc-1.s b/gas/testsuite/gas/or1k/reloc-1.s
|
||||
index e76abef6532..562609aa869 100644
|
||||
--- a/gas/testsuite/gas/or1k/reloc-1.s
|
||||
+++ b/gas/testsuite/gas/or1k/reloc-1.s
|
||||
@@ -74,3 +74,7 @@
|
||||
l.lbz r5,po(x)(r3)
|
||||
l.lbz r5,gotpo(x)(r3)
|
||||
l.sb po(x)(r3),r6
|
||||
+
|
||||
+ l.movhi r4,gotha(x)
|
||||
+ l.ori r3,r4,gotha(x)
|
||||
+ l.addi r3,r4,gotha(x)
|
||||
diff --git a/include/elf/or1k.h b/include/elf/or1k.h
|
||||
index 0abef046202..7db3cad18eb 100644
|
||||
--- a/include/elf/or1k.h
|
||||
+++ b/include/elf/or1k.h
|
||||
@@ -77,6 +77,7 @@ START_RELOC_NUMBERS (elf_or1k_reloc_type)
|
||||
RELOC_NUMBER (R_OR1K_TLS_IE_LO13, 51)
|
||||
RELOC_NUMBER (R_OR1K_SLO13, 52)
|
||||
RELOC_NUMBER (R_OR1K_PLTA26, 53)
|
||||
+ RELOC_NUMBER (R_OR1K_GOT_AHI16, 54)
|
||||
END_RELOC_NUMBERS (R_OR1K_max)
|
||||
|
||||
#define EF_OR1K_NODELAY (1UL << 0)
|
||||
diff --git a/opcodes/or1k-asm.c b/opcodes/or1k-asm.c
|
||||
index 7d058d03f5f..332f4b7a9b5 100644
|
||||
--- a/opcodes/or1k-asm.c
|
||||
+++ b/opcodes/or1k-asm.c
|
||||
@@ -177,7 +177,7 @@ static const bfd_reloc_code_real_type or1k_imm16_relocs[][6] = {
|
||||
BFD_RELOC_OR1K_GOT_LO13,
|
||||
BFD_RELOC_UNUSED,
|
||||
BFD_RELOC_UNUSED,
|
||||
- BFD_RELOC_UNUSED },
|
||||
+ BFD_RELOC_OR1K_GOT_AHI16 },
|
||||
{ BFD_RELOC_OR1K_GOTPC_LO16,
|
||||
BFD_RELOC_UNUSED,
|
||||
BFD_RELOC_UNUSED,
|
||||
@@ -280,6 +280,11 @@ parse_reloc (const char **strp)
|
||||
str += 5;
|
||||
cls = RCLASS_TPOFF;
|
||||
}
|
||||
+ else if (strncasecmp (str, "got", 3) == 0)
|
||||
+ {
|
||||
+ str += 3;
|
||||
+ cls = RCLASS_GOT;
|
||||
+ }
|
||||
|
||||
if (strncasecmp (str, "hi(", 3) == 0)
|
||||
{
|
||||
--
|
||||
2.25.1
|
||||
|
@ -0,0 +1,61 @@
|
||||
From 0f61f76454a9420f158f626cb09a4fbc08c3709e Mon Sep 17 00:00:00 2001
|
||||
From: Stafford Horne <shorne@gmail.com>
|
||||
Date: Sun, 2 May 2021 06:02:16 +0900
|
||||
Subject: [PATCH] or1k: Avoid R_OR1K_GOT16 overflow failures in presence
|
||||
of R_OR1K_GOT_AHI16
|
||||
|
||||
Now that we support R_OR1K_GOT_AHI16 we can relax the R_OR1K_GOT16
|
||||
overflow validation check if the section has R_OR1K_GOT_AHI16.
|
||||
|
||||
We cannot simple disable R_OR1K_GOT16 overflow validation as there will
|
||||
still be binaries that will have only R_OR1K_GOT16. The
|
||||
R_OR1K_GOT_AHI16 relocation will only be added by GCC when building with
|
||||
the option -mcmodel=large.
|
||||
|
||||
This assumes that R_OR1K_GOT_AHI16 will come before R_OR1K_GOT16, which
|
||||
is the code pattern that will be emitted by GCC.
|
||||
|
||||
bfd/ChangeLog:
|
||||
|
||||
PR 21464
|
||||
* elf32-or1k.c (or1k_elf_relocate_section): Relax R_OR1K_GOT16
|
||||
overflow check if we have R_OR1K_GOT_AHI16 followed by
|
||||
R_OR1K_GOT16.
|
||||
|
||||
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
|
||||
---
|
||||
bfd/elf32-or1k.c | 11 +++++++++++
|
||||
1 file changed, 11 insertions(+)
|
||||
|
||||
diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c
|
||||
index a4a64f73b7c..07fff3602a3 100644
|
||||
--- a/bfd/elf32-or1k.c
|
||||
+++ b/bfd/elf32-or1k.c
|
||||
@@ -1248,6 +1248,7 @@ or1k_elf_relocate_section (bfd *output_bfd,
|
||||
asection *sgot, *splt;
|
||||
bfd_vma plt_base, got_base, got_sym_value;
|
||||
bfd_boolean ret_val = TRUE;
|
||||
+ bfd_boolean saw_gotha = FALSE;
|
||||
|
||||
if (htab == NULL)
|
||||
return FALSE;
|
||||
@@ -1456,6 +1457,16 @@ or1k_elf_relocate_section (bfd *output_bfd,
|
||||
|| r_type == R_OR1K_GOT_AHI16)
|
||||
relocation -= got_sym_value;
|
||||
|
||||
+ if (r_type == R_OR1K_GOT_AHI16)
|
||||
+ saw_gotha = TRUE;
|
||||
+
|
||||
+ /* If we have a R_OR1K_GOT16 followed by a R_OR1K_GOT_AHI16
|
||||
+ relocation we assume the code is doing the right thing to avoid
|
||||
+ overflows. Here we mask the lower 16-bit of the relocation to
|
||||
+ avoid overflow validation failures. */
|
||||
+ if (r_type == R_OR1K_GOT16 && saw_gotha)
|
||||
+ relocation &= 0xffff;
|
||||
+
|
||||
/* Addend should be zero. */
|
||||
if (rel->r_addend != 0)
|
||||
{
|
||||
--
|
||||
2.25.1
|
||||
|
@ -0,0 +1,500 @@
|
||||
From 36c7de7ef77ab0c30cb33e2c7ea7a6f4e3052c73 Mon Sep 17 00:00:00 2001
|
||||
From: Stafford Horne <shorne@gmail.com>
|
||||
Date: Sun, 2 May 2021 06:02:17 +0900
|
||||
Subject: [PATCH] or1k: Support large plt_relocs when generating plt
|
||||
entries
|
||||
|
||||
The current PLT generation code will generate invalid code when the PLT
|
||||
relocation offset exceeds 64k. This fixes the issue by detecting large
|
||||
plt_reloc offsets and generare code sequences to create larger plt
|
||||
relocations.
|
||||
|
||||
The "large" plt code needs 2 extra instructions to create 32-bit offsets.
|
||||
|
||||
bfd/ChangeLog:
|
||||
|
||||
PR 27746
|
||||
* elf32-or1k.c (PLT_ENTRY_SIZE_LARGE, PLT_MAX_INSN_COUNT,
|
||||
OR1K_ADD, OR1K_ORI): New macros to help with plt creation.
|
||||
(elf_or1k_link_hash_table): New field plt_count.
|
||||
(elf_or1k_link_hash_entry): New field plt_index.
|
||||
(elf_or1k_plt_entry_size): New function.
|
||||
(or1k_write_plt_entry): Update to support variable size PLTs.
|
||||
(or1k_elf_finish_dynamic_sections): Use new or1k_write_plt_entry
|
||||
API.
|
||||
(or1k_elf_finish_dynamic_symbol): Update to write large PLTs
|
||||
when needed.
|
||||
(allocate_dynrelocs): Use elf_or1k_plt_entry_size to account for
|
||||
PLT size.
|
||||
|
||||
ld/ChangeLog:
|
||||
|
||||
PR 27746
|
||||
testsuite/ld-or1k/or1k.exp (or1kplttests): Add tests for linking
|
||||
along with gotha() relocations.
|
||||
testsuite/ld-or1k/gotha1.dd: New file.
|
||||
testsuite/ld-or1k/gotha1.s: New file.
|
||||
testsuite/ld-or1k/gotha2.dd: New file.
|
||||
testsuite/ld-or1k/gotha2.s: New file
|
||||
testsuite/ld-or1k/pltlib.s (x): Define size to avoid link
|
||||
failure.
|
||||
|
||||
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
|
||||
---
|
||||
bfd/elf32-or1k.c | 149 ++++++++++++++++++++++++---------
|
||||
ld/testsuite/ld-or1k/gotha1.dd | 34 ++++++++
|
||||
ld/testsuite/ld-or1k/gotha1.s | 24 ++++++
|
||||
ld/testsuite/ld-or1k/gotha2.dd | 21 +++++
|
||||
ld/testsuite/ld-or1k/gotha2.s | 22 +++++
|
||||
ld/testsuite/ld-or1k/or1k.exp | 8 ++
|
||||
ld/testsuite/ld-or1k/pltlib.s | 1 +
|
||||
7 files changed, 220 insertions(+), 39 deletions(-)
|
||||
create mode 100644 ld/testsuite/ld-or1k/gotha1.dd
|
||||
create mode 100644 ld/testsuite/ld-or1k/gotha1.s
|
||||
create mode 100644 ld/testsuite/ld-or1k/gotha2.dd
|
||||
create mode 100644 ld/testsuite/ld-or1k/gotha2.s
|
||||
|
||||
diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c
|
||||
index 07fff3602a3..fcebbe5f23a 100644
|
||||
--- a/bfd/elf32-or1k.c
|
||||
+++ b/bfd/elf32-or1k.c
|
||||
@@ -30,10 +30,14 @@
|
||||
#define N_ONES(X) (((bfd_vma)2 << (X)) - 1)
|
||||
|
||||
#define PLT_ENTRY_SIZE 16
|
||||
+#define PLT_ENTRY_SIZE_LARGE (6*4)
|
||||
+#define PLT_MAX_INSN_COUNT 6
|
||||
|
||||
#define OR1K_MOVHI(D) (0x18000000 | (D << 21))
|
||||
#define OR1K_ADRP(D) (0x08000000 | (D << 21))
|
||||
#define OR1K_LWZ(D,A) (0x84000000 | (D << 21) | (A << 16))
|
||||
+#define OR1K_ADD(D,A,B) (0xE0000000 | (D << 21) | (A << 16) | (B << 11))
|
||||
+#define OR1K_ORI(D,A) (0xA8000000 | (D << 21) | (A << 16))
|
||||
#define OR1K_ORI0(D) (0xA8000000 | (D << 21))
|
||||
#define OR1K_JR(B) (0x44000000 | (B << 11))
|
||||
#define OR1K_NOP 0x15000000
|
||||
@@ -903,6 +907,8 @@ struct elf_or1k_link_hash_entry
|
||||
/* Track dynamic relocs copied for this symbol. */
|
||||
struct elf_dyn_relocs *dyn_relocs;
|
||||
|
||||
+ /* For calculating PLT size. */
|
||||
+ bfd_vma plt_index;
|
||||
/* Track type of TLS access. */
|
||||
unsigned char tls_type;
|
||||
};
|
||||
@@ -930,9 +936,20 @@ struct elf_or1k_link_hash_table
|
||||
/* Small local sym to section mapping cache. */
|
||||
struct sym_cache sym_sec;
|
||||
|
||||
+ bfd_vma plt_count;
|
||||
bfd_boolean saw_plta;
|
||||
};
|
||||
|
||||
+static size_t
|
||||
+elf_or1k_plt_entry_size (bfd_vma plt_index)
|
||||
+{
|
||||
+ bfd_vma plt_reloc;
|
||||
+
|
||||
+ plt_reloc = plt_index * sizeof (Elf32_External_Rela);
|
||||
+
|
||||
+ return (plt_reloc > 0xffff) ? PLT_ENTRY_SIZE_LARGE : PLT_ENTRY_SIZE;
|
||||
+}
|
||||
+
|
||||
/* Get the ELF linker hash table from a link_info structure. */
|
||||
#define or1k_elf_hash_table(p) \
|
||||
(elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
|
||||
@@ -2176,33 +2193,46 @@ or1k_elf_check_relocs (bfd *abfd,
|
||||
}
|
||||
|
||||
static void
|
||||
-or1k_write_plt_entry (bfd *output_bfd, bfd_byte *contents, unsigned insn1,
|
||||
- unsigned insn2, unsigned insn3, unsigned insnj)
|
||||
+or1k_write_plt_entry (bfd *output_bfd, bfd_byte *contents, unsigned insnj,
|
||||
+ unsigned insns[], size_t insn_count)
|
||||
{
|
||||
unsigned nodelay = elf_elfheader (output_bfd)->e_flags & EF_OR1K_NODELAY;
|
||||
- unsigned insn4;
|
||||
+ unsigned output_insns[PLT_MAX_INSN_COUNT];
|
||||
+
|
||||
+ /* Copy instructions into the output buffer. */
|
||||
+ for (size_t i = 0; i < insn_count; i++)
|
||||
+ output_insns[i] = insns[i];
|
||||
|
||||
/* Honor the no-delay-slot setting. */
|
||||
- if (insn3 == OR1K_NOP)
|
||||
+ if (insns[insn_count-1] == OR1K_NOP)
|
||||
{
|
||||
- insn4 = insn3;
|
||||
+ unsigned slot1, slot2;
|
||||
+
|
||||
if (nodelay)
|
||||
- insn3 = insnj;
|
||||
+ slot1 = insns[insn_count-2], slot2 = insnj;
|
||||
else
|
||||
- insn3 = insn2, insn2 = insnj;
|
||||
+ slot1 = insnj, slot2 = insns[insn_count-2];
|
||||
+
|
||||
+ output_insns[insn_count-2] = slot1;
|
||||
+ output_insns[insn_count-1] = slot2;
|
||||
+ output_insns[insn_count] = OR1K_NOP;
|
||||
}
|
||||
else
|
||||
{
|
||||
+ unsigned slot1, slot2;
|
||||
+
|
||||
if (nodelay)
|
||||
- insn4 = insnj;
|
||||
+ slot1 = insns[insn_count-1], slot2 = insnj;
|
||||
else
|
||||
- insn4 = insn3, insn3 = insnj;
|
||||
+ slot1 = insnj, slot2 = insns[insn_count-1];
|
||||
+
|
||||
+ output_insns[insn_count-1] = slot1;
|
||||
+ output_insns[insn_count] = slot2;
|
||||
}
|
||||
|
||||
- bfd_put_32 (output_bfd, insn1, contents);
|
||||
- bfd_put_32 (output_bfd, insn2, contents + 4);
|
||||
- bfd_put_32 (output_bfd, insn3, contents + 8);
|
||||
- bfd_put_32 (output_bfd, insn4, contents + 12);
|
||||
+ /* Write out the output buffer. */
|
||||
+ for (size_t i = 0; i < (insn_count+1); i++)
|
||||
+ bfd_put_32 (output_bfd, output_insns[i], contents + (i*4));
|
||||
}
|
||||
|
||||
/* Finish up the dynamic sections. */
|
||||
@@ -2269,7 +2299,8 @@ or1k_elf_finish_dynamic_sections (bfd *output_bfd,
|
||||
splt = htab->root.splt;
|
||||
if (splt && splt->size > 0)
|
||||
{
|
||||
- unsigned plt0, plt1, plt2;
|
||||
+ unsigned plt[PLT_MAX_INSN_COUNT];
|
||||
+ size_t plt_insn_count = 3;
|
||||
bfd_vma got_addr = sgot->output_section->vma + sgot->output_offset;
|
||||
|
||||
/* Note we force 16 byte alignment on the .got, so that
|
||||
@@ -2280,27 +2311,27 @@ or1k_elf_finish_dynamic_sections (bfd *output_bfd,
|
||||
bfd_vma pc = splt->output_section->vma + splt->output_offset;
|
||||
unsigned pa = ((got_addr >> 13) - (pc >> 13)) & 0x1fffff;
|
||||
unsigned po = got_addr & 0x1fff;
|
||||
- plt0 = OR1K_ADRP(12) | pa;
|
||||
- plt1 = OR1K_LWZ(15,12) | (po + 8);
|
||||
- plt2 = OR1K_LWZ(12,12) | (po + 4);
|
||||
+ plt[0] = OR1K_ADRP(12) | pa;
|
||||
+ plt[1] = OR1K_LWZ(15,12) | (po + 8);
|
||||
+ plt[2] = OR1K_LWZ(12,12) | (po + 4);
|
||||
}
|
||||
else if (bfd_link_pic (info))
|
||||
{
|
||||
- plt0 = OR1K_LWZ(15, 16) | 8; /* .got+8 */
|
||||
- plt1 = OR1K_LWZ(12, 16) | 4; /* .got+4 */
|
||||
- plt2 = OR1K_NOP;
|
||||
+ plt[0] = OR1K_LWZ(15, 16) | 8; /* .got+8 */
|
||||
+ plt[1] = OR1K_LWZ(12, 16) | 4; /* .got+4 */
|
||||
+ plt[2] = OR1K_NOP;
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned ha = ((got_addr + 0x8000) >> 16) & 0xffff;
|
||||
unsigned lo = got_addr & 0xffff;
|
||||
- plt0 = OR1K_MOVHI(12) | ha;
|
||||
- plt1 = OR1K_LWZ(15,12) | (lo + 8);
|
||||
- plt2 = OR1K_LWZ(12,12) | (lo + 4);
|
||||
+ plt[0] = OR1K_MOVHI(12) | ha;
|
||||
+ plt[1] = OR1K_LWZ(15,12) | (lo + 8);
|
||||
+ plt[2] = OR1K_LWZ(12,12) | (lo + 4);
|
||||
}
|
||||
|
||||
- or1k_write_plt_entry (output_bfd, splt->contents,
|
||||
- plt0, plt1, plt2, OR1K_JR(15));
|
||||
+ or1k_write_plt_entry (output_bfd, splt->contents, OR1K_JR(15),
|
||||
+ plt, plt_insn_count);
|
||||
|
||||
elf_section_data (splt->output_section)->this_hdr.sh_entsize = 4;
|
||||
}
|
||||
@@ -2343,7 +2374,8 @@ or1k_elf_finish_dynamic_symbol (bfd *output_bfd,
|
||||
|
||||
if (h->plt.offset != (bfd_vma) -1)
|
||||
{
|
||||
- unsigned int plt0, plt1, plt2;
|
||||
+ unsigned int plt[PLT_MAX_INSN_COUNT];
|
||||
+ size_t plt_insn_count = 3;
|
||||
asection *splt;
|
||||
asection *sgot;
|
||||
asection *srela;
|
||||
@@ -2355,6 +2387,7 @@ or1k_elf_finish_dynamic_symbol (bfd *output_bfd,
|
||||
bfd_vma got_offset;
|
||||
bfd_vma got_addr;
|
||||
Elf_Internal_Rela rela;
|
||||
+ bfd_boolean large_plt_entry;
|
||||
|
||||
/* This symbol has an entry in the procedure linkage table. Set
|
||||
it up. */
|
||||
@@ -2372,10 +2405,13 @@ or1k_elf_finish_dynamic_symbol (bfd *output_bfd,
|
||||
corresponds to this symbol. This is the index of this symbol
|
||||
in all the symbols for which we are making plt entries. The
|
||||
first entry in the procedure linkage table is reserved. */
|
||||
- plt_index = h->plt.offset / PLT_ENTRY_SIZE - 1;
|
||||
+ plt_index = ((struct elf_or1k_link_hash_entry *) h)->plt_index;
|
||||
plt_addr = plt_base_addr + h->plt.offset;
|
||||
plt_reloc = plt_index * sizeof (Elf32_External_Rela);
|
||||
|
||||
+ large_plt_entry = (elf_or1k_plt_entry_size (plt_index)
|
||||
+ == PLT_ENTRY_SIZE_LARGE);
|
||||
+
|
||||
/* Get the offset into the .got table of the entry that
|
||||
corresponds to this function. Each .got entry is 4 bytes.
|
||||
The first three are reserved. */
|
||||
@@ -2387,27 +2423,57 @@ or1k_elf_finish_dynamic_symbol (bfd *output_bfd,
|
||||
{
|
||||
unsigned pa = ((got_addr >> 13) - (plt_addr >> 13)) & 0x1fffff;
|
||||
unsigned po = (got_addr & 0x1fff);
|
||||
- plt0 = OR1K_ADRP(12) | pa;
|
||||
- plt1 = OR1K_LWZ(12,12) | po;
|
||||
- plt2 = OR1K_ORI0(11) | plt_reloc;
|
||||
+ plt[0] = OR1K_ADRP(12) | pa;
|
||||
+ plt[1] = OR1K_LWZ(12,12) | po;
|
||||
+ plt[2] = OR1K_ORI0(11) | plt_reloc;
|
||||
}
|
||||
else if (bfd_link_pic (info))
|
||||
{
|
||||
- plt0 = OR1K_LWZ(12,16) | got_offset;
|
||||
- plt1 = OR1K_ORI0(11) | plt_reloc;
|
||||
- plt2 = OR1K_NOP;
|
||||
+ if (large_plt_entry)
|
||||
+ {
|
||||
+ unsigned gotha = ((got_offset + 0x8000) >> 16) & 0xffff;
|
||||
+ unsigned got = got_offset & 0xffff;
|
||||
+ unsigned pltrelhi = (plt_reloc >> 16) & 0xffff;
|
||||
+ unsigned pltrello = plt_reloc & 0xffff;
|
||||
+
|
||||
+ plt[0] = OR1K_MOVHI(12) | gotha;
|
||||
+ plt[1] = OR1K_ADD(12,12,16);
|
||||
+ plt[2] = OR1K_LWZ(12,12) | got;
|
||||
+ plt[3] = OR1K_MOVHI(11) | pltrelhi;
|
||||
+ plt[4] = OR1K_ORI(11,11) | pltrello;
|
||||
+ plt_insn_count = 5;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ plt[0] = OR1K_LWZ(12,16) | got_offset;
|
||||
+ plt[1] = OR1K_ORI0(11) | plt_reloc;
|
||||
+ plt[2] = OR1K_NOP;
|
||||
+ }
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned ha = ((got_addr + 0x8000) >> 16) & 0xffff;
|
||||
unsigned lo = got_addr & 0xffff;
|
||||
- plt0 = OR1K_MOVHI(12) | ha;
|
||||
- plt1 = OR1K_LWZ(12,12) | lo;
|
||||
- plt2 = OR1K_ORI0(11) | plt_reloc;
|
||||
+ plt[0] = OR1K_MOVHI(12) | ha;
|
||||
+ plt[1] = OR1K_LWZ(12,12) | lo;
|
||||
+ plt[2] = OR1K_ORI0(11) | plt_reloc;
|
||||
+ }
|
||||
+
|
||||
+ /* For large code model we fixup the non-PIC PLT relocation instructions
|
||||
+ here. */
|
||||
+ if (large_plt_entry && !bfd_link_pic (info))
|
||||
+ {
|
||||
+ unsigned pltrelhi = (plt_reloc >> 16) & 0xffff;
|
||||
+ unsigned pltrello = plt_reloc & 0xffff;
|
||||
+
|
||||
+ plt[2] = OR1K_MOVHI(11) | pltrelhi;
|
||||
+ plt[3] = OR1K_ORI(11,11) | pltrello;
|
||||
+ plt[4] = OR1K_NOP;
|
||||
+ plt_insn_count = 5;
|
||||
}
|
||||
|
||||
or1k_write_plt_entry (output_bfd, splt->contents + h->plt.offset,
|
||||
- plt0, plt1, plt2, OR1K_JR(12));
|
||||
+ OR1K_JR(12), plt, plt_insn_count);
|
||||
|
||||
/* Fill in the entry in the global offset table. */
|
||||
bfd_put_32 (output_bfd, plt_addr, sgot->contents + got_offset);
|
||||
@@ -2699,11 +2765,16 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
|
||||
if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, bfd_link_pic (info), h))
|
||||
{
|
||||
asection *s = htab->root.splt;
|
||||
+ bfd_vma plt_index;
|
||||
+
|
||||
+ /* Track the index of our plt entry for use in calculating size. */
|
||||
+ plt_index = htab->plt_count++;
|
||||
+ ((struct elf_or1k_link_hash_entry *) h)->plt_index = plt_index;
|
||||
|
||||
/* If this is the first .plt entry, make room for the special
|
||||
first entry. */
|
||||
if (s->size == 0)
|
||||
- s->size = PLT_ENTRY_SIZE;
|
||||
+ s->size = elf_or1k_plt_entry_size (plt_index);
|
||||
|
||||
h->plt.offset = s->size;
|
||||
|
||||
@@ -2720,7 +2791,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
|
||||
}
|
||||
|
||||
/* Make room for this entry. */
|
||||
- s->size += PLT_ENTRY_SIZE;
|
||||
+ s->size += elf_or1k_plt_entry_size (plt_index);
|
||||
|
||||
/* We also need to make an entry in the .got.plt section, which
|
||||
will be placed in the .got section by the linker script. */
|
||||
diff --git a/ld/testsuite/ld-or1k/gotha1.dd b/ld/testsuite/ld-or1k/gotha1.dd
|
||||
new file mode 100644
|
||||
index 00000000000..0ad1f8f5399
|
||||
--- /dev/null
|
||||
+++ b/ld/testsuite/ld-or1k/gotha1.dd
|
||||
@@ -0,0 +1,34 @@
|
||||
+
|
||||
+.*\.x: file format elf32-or1k
|
||||
+
|
||||
+
|
||||
+Disassembly of section \.plt:
|
||||
+
|
||||
+[0-9a-f]+ <\.plt>:
|
||||
+ +[0-9a-f]+: 19 80 00 00 l\.movhi r12,0x0
|
||||
+ +[0-9a-f]+: 85 ec [0-9a-f]+ [0-9a-f]+ l\.lwz r15,[0-9]+\(r12\)
|
||||
+ +[0-9a-f]+: 44 00 78 00 l\.jr r15
|
||||
+ +[0-9a-f]+: 85 8c [0-9a-f]+ [0-9a-f]+ l\.lwz r12,[0-9]+\(r12\)
|
||||
+ +[0-9a-f]+: 19 80 00 00 l\.movhi r12,0x0
|
||||
+ +[0-9a-f]+: 85 8c [0-9a-f]+ [0-9a-f]+ l\.lwz r12,[0-9]+\(r12\)
|
||||
+ +[0-9a-f]+: 44 00 60 00 l\.jr r12
|
||||
+ +[0-9a-f]+: a9 60 00 00 l\.ori r11,r0,0x0
|
||||
+
|
||||
+Disassembly of section \.text:
|
||||
+
|
||||
+[0-9a-f]+ <_start>:
|
||||
+ +[0-9a-f]+: 9c 21 ff fc l\.addi r1,r1,-4
|
||||
+ +[0-9a-f]+: d4 01 48 00 l\.sw 0\(r1\),r9
|
||||
+ +[0-9a-f]+: 04 00 00 02 l\.jal [0-9a-f]+ <_start\+0x10>
|
||||
+ +[0-9a-f]+: 1a 60 00 00 l\.movhi r19,0x0
|
||||
+ +[0-9a-f]+: aa 73 [0-9a-f]+ [0-9a-f]+ l\.ori r19,r19,0x[0-9a-f]+
|
||||
+ +[0-9a-f]+: e2 73 48 00 l\.add r19,r19,r9
|
||||
+ +[0-9a-f]+: 1a 20 00 00 l\.movhi r17,0x0
|
||||
+ +[0-9a-f]+: e2 31 98 00 l\.add r17,r17,r19
|
||||
+ +[0-9a-f]+: 86 31 00 10 l\.lwz r17,16\(r17\)
|
||||
+ +[0-9a-f]+: 84 71 00 00 l\.lwz r3,0\(r17\)
|
||||
+ +[0-9a-f]+: 07 ff ff f2 l\.jal [0-9a-f]+ <\.plt\+0x10>
|
||||
+ +[0-9a-f]+: 15 00 00 00 l\.nop 0x0
|
||||
+ +[0-9a-f]+: 85 21 00 00 l\.lwz r9,0\(r1\)
|
||||
+ +[0-9a-f]+: 44 00 48 00 l\.jr r9
|
||||
+ +[0-9a-f]+: 9c 21 00 04 l\.addi r1,r1,4
|
||||
diff --git a/ld/testsuite/ld-or1k/gotha1.s b/ld/testsuite/ld-or1k/gotha1.s
|
||||
new file mode 100644
|
||||
index 00000000000..42b16db425c
|
||||
--- /dev/null
|
||||
+++ b/ld/testsuite/ld-or1k/gotha1.s
|
||||
@@ -0,0 +1,24 @@
|
||||
+ .data
|
||||
+ .p2align 16
|
||||
+
|
||||
+ .text
|
||||
+ .globl _start
|
||||
+_start:
|
||||
+ l.addi r1, r1, -4
|
||||
+ l.sw 0(r1), r9
|
||||
+
|
||||
+ l.jal 8
|
||||
+ l.movhi r19, gotpchi(_GLOBAL_OFFSET_TABLE_-4)
|
||||
+ l.ori r19, r19, gotpclo(_GLOBAL_OFFSET_TABLE_+0)
|
||||
+ l.add r19, r19, r9
|
||||
+
|
||||
+ l.movhi r17, gotha(x)
|
||||
+ l.add r17, r17, r19
|
||||
+ l.lwz r17, got(x)(r17)
|
||||
+ l.lwz r3, 0(r17)
|
||||
+
|
||||
+ l.jal plt(func)
|
||||
+ l.nop
|
||||
+ l.lwz r9, 0(r1)
|
||||
+ l.jr r9
|
||||
+ l.addi r1, r1, 4
|
||||
diff --git a/ld/testsuite/ld-or1k/gotha2.dd b/ld/testsuite/ld-or1k/gotha2.dd
|
||||
new file mode 100644
|
||||
index 00000000000..fe09da5466b
|
||||
--- /dev/null
|
||||
+++ b/ld/testsuite/ld-or1k/gotha2.dd
|
||||
@@ -0,0 +1,21 @@
|
||||
+
|
||||
+.*\.x: file format elf32-or1k
|
||||
+
|
||||
+
|
||||
+Disassembly of section \.text:
|
||||
+
|
||||
+[0-9a-f]+ <test>:
|
||||
+ +[0-9a-f]+: 9c 21 ff f8 l\.addi r1,r1,-8
|
||||
+ +[0-9a-f]+: d4 01 80 00 l\.sw 0\(r1\),r16
|
||||
+ +[0-9a-f]+: d4 01 48 04 l\.sw 4\(r1\),r9
|
||||
+ +[0-9a-f]+: 04 00 [0-9a-f]+ [0-9a-f]+ l\.jal [0-9a-f]+ <test\+0x14>
|
||||
+ +[0-9a-f]+: 1a 00 00 00 l\.movhi r16,0x0
|
||||
+ +[0-9a-f]+: aa 10 [0-9a-f]+ [0-9a-f]+ l\.ori r16,r16,0x[0-9a-f]+
|
||||
+ +[0-9a-f]+: e2 10 48 00 l\.add r16,r16,r9
|
||||
+ +[0-9a-f]+: 1a 20 00 00 l\.movhi r17,0x0
|
||||
+ +[0-9a-f]+: e2 31 80 00 l\.add r17,r17,r16
|
||||
+ +[0-9a-f]+: 86 31 00 0c l\.lwz r17,12\(r17\)
|
||||
+ +[0-9a-f]+: 85 21 00 04 l\.lwz r9,4\(r1\)
|
||||
+ +[0-9a-f]+: 86 01 00 00 l\.lwz r16,0\(r1\)
|
||||
+ +[0-9a-f]+: 44 00 48 00 l\.jr r9
|
||||
+ +[0-9a-f]+: 9c 21 00 08 l\.addi r1,r1,8
|
||||
diff --git a/ld/testsuite/ld-or1k/gotha2.s b/ld/testsuite/ld-or1k/gotha2.s
|
||||
new file mode 100644
|
||||
index 00000000000..164b282f2dd
|
||||
--- /dev/null
|
||||
+++ b/ld/testsuite/ld-or1k/gotha2.s
|
||||
@@ -0,0 +1,22 @@
|
||||
+ .section .text
|
||||
+ .align 4
|
||||
+ .global test
|
||||
+ .type test, @function
|
||||
+test:
|
||||
+ l.addi r1, r1, -8
|
||||
+ l.sw 0(r1), r16
|
||||
+ l.sw 4(r1), r9
|
||||
+
|
||||
+ l.jal 8
|
||||
+ l.movhi r16, gotpchi(_GLOBAL_OFFSET_TABLE_-4)
|
||||
+ l.ori r16, r16, gotpclo(_GLOBAL_OFFSET_TABLE_+0)
|
||||
+ l.add r16, r16, r9
|
||||
+
|
||||
+ l.movhi r17, gotha(i)
|
||||
+ l.add r17, r17, r16
|
||||
+ l.lwz r17, got(i)(r17)
|
||||
+
|
||||
+ l.lwz r9, 4(r1)
|
||||
+ l.lwz r16, 0(r1)
|
||||
+ l.jr r9
|
||||
+ l.addi r1, r1, 8
|
||||
diff --git a/ld/testsuite/ld-or1k/or1k.exp b/ld/testsuite/ld-or1k/or1k.exp
|
||||
index 24cdbe5fbf3..9cebc49b946 100644
|
||||
--- a/ld/testsuite/ld-or1k/or1k.exp
|
||||
+++ b/ld/testsuite/ld-or1k/or1k.exp
|
||||
@@ -53,6 +53,14 @@ set or1kplttests {
|
||||
"" {plt1.s}
|
||||
{{objdump -dr plt1.x.dd}}
|
||||
"plt1.x"}
|
||||
+ {"gotha exec plt" "tmpdir/libpltlib.so" ""
|
||||
+ "" {gotha1.s}
|
||||
+ {{objdump -dr gotha1.dd}}
|
||||
+ "gotha1.x"}
|
||||
+ {"gotha -fpic -shared" "-fpic -shared" ""
|
||||
+ "" {gotha2.s}
|
||||
+ {{objdump -dr gotha2.dd}}
|
||||
+ "gotha2.x"}
|
||||
}
|
||||
|
||||
# Not implemented yet
|
||||
diff --git a/ld/testsuite/ld-or1k/pltlib.s b/ld/testsuite/ld-or1k/pltlib.s
|
||||
index baf76ca1af7..8b4d7ba48fd 100644
|
||||
--- a/ld/testsuite/ld-or1k/pltlib.s
|
||||
+++ b/ld/testsuite/ld-or1k/pltlib.s
|
||||
@@ -1,5 +1,6 @@
|
||||
.section .data
|
||||
.globl x, y
|
||||
+ .size x, 4
|
||||
x: .long 33
|
||||
y: .long 44
|
||||
|
||||
--
|
||||
2.25.1
|
||||
|
@ -0,0 +1,50 @@
|
||||
From c3003947e4bad18faea4337fd2073feeb30ee078 Mon Sep 17 00:00:00 2001
|
||||
From: Giulio Benetti <giulio.benetti@benettiengineering.com>
|
||||
Date: Wed, 9 Jun 2021 17:28:27 +0200
|
||||
Subject: [PATCH] bfd/elf32-or1k: fix building with gcc version < 5
|
||||
|
||||
Gcc version >= 5 has standard C mode not set to -std=gnu11, so if we use
|
||||
an old compiler(i.e. gcc 4.9) build fails on:
|
||||
```
|
||||
elf32-or1k.c:2251:3: error: 'for' loop initial declarations are only allowed in
|
||||
C99 or C11 mode
|
||||
for (size_t i = 0; i < insn_count; i++)
|
||||
^
|
||||
```
|
||||
|
||||
So let's declare `size_t i` at the top of the function instead of inside
|
||||
for loop.
|
||||
|
||||
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
|
||||
---
|
||||
bfd/elf32-or1k.c | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c
|
||||
index 4ae7f324d33..32063ab0289 100644
|
||||
--- a/bfd/elf32-or1k.c
|
||||
+++ b/bfd/elf32-or1k.c
|
||||
@@ -2244,9 +2244,10 @@ or1k_write_plt_entry (bfd *output_bfd, bfd_byte *contents, unsigned insnj,
|
||||
{
|
||||
unsigned nodelay = elf_elfheader (output_bfd)->e_flags & EF_OR1K_NODELAY;
|
||||
unsigned output_insns[PLT_MAX_INSN_COUNT];
|
||||
+ size_t i;
|
||||
|
||||
/* Copy instructions into the output buffer. */
|
||||
- for (size_t i = 0; i < insn_count; i++)
|
||||
+ for (i = 0; i < insn_count; i++)
|
||||
output_insns[i] = insns[i];
|
||||
|
||||
/* Honor the no-delay-slot setting. */
|
||||
@@ -2277,7 +2278,7 @@ or1k_write_plt_entry (bfd *output_bfd, bfd_byte *contents, unsigned insnj,
|
||||
}
|
||||
|
||||
/* Write out the output buffer. */
|
||||
- for (size_t i = 0; i < (insn_count+1); i++)
|
||||
+ for (i = 0; i < (insn_count+1); i++)
|
||||
bfd_put_32 (output_bfd, output_insns[i], contents + (i*4));
|
||||
}
|
||||
|
||||
--
|
||||
2.25.1
|
||||
|
@ -0,0 +1,59 @@
|
||||
From 9af93e143a7fbdb75aa1ed37277f9250eb111628 Mon Sep 17 00:00:00 2001
|
||||
From: Giulio Benetti <giulio.benetti@benettiengineering.com>
|
||||
Date: Sat, 10 Jul 2021 17:57:34 +0200
|
||||
Subject: [PATCH] or1k: fix pc-relative relocation against dynamic on PC
|
||||
relative 26 bit relocation
|
||||
|
||||
When building openal we were seeing the assert failure:
|
||||
|
||||
/home/buildroot/autobuild/run/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/or1k-buildroot-linux-uclibc/9.3.0/../../../../or1k-buildroot-linux-uclibc/bin/ld: CMakeFiles/OpenAL.dir/al/source.cpp.o:
|
||||
pc-relative relocation against dynamic symbol alSourcePausev
|
||||
/home/buildroot/autobuild/run/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/or1k-buildroot-linux-uclibc/9.3.0/../../../../or1k-buildroot-linux-uclibc/bin/ld: CMakeFiles/OpenAL.dir/al/source.cpp.o:
|
||||
pc-relative relocation against dynamic symbol alSourceStopv
|
||||
/home/buildroot/autobuild/run/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/or1k-buildroot-linux-uclibc/9.3.0/../../../../or1k-buildroot-linux-uclibc/bin/ld: CMakeFiles/OpenAL.dir/al/source.cpp.o:
|
||||
pc-relative relocation against dynamic symbol alSourceRewindv
|
||||
/home/buildroot/autobuild/run/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/or1k-buildroot-linux-uclibc/9.3.0/../../../../or1k-buildroot-linux-uclibc/bin/ld: CMakeFiles/OpenAL.dir/al/source.cpp.o:
|
||||
pc-relative relocation against dynamic symbol alSourcePlayv
|
||||
collect2: error: ld returned 1 exit status
|
||||
|
||||
This happens because in R_OR1K_INSN_REL_26 case we can't reference local
|
||||
symbol as previously done but we need to make sure that calls to actual
|
||||
symbol always call the version of current object.
|
||||
|
||||
bfd/Changelog:
|
||||
|
||||
* elf32-or1k.c (or1k_elf_relocate_section): use a separate entry
|
||||
in switch case R_OR1K_INSN_REL_26 where we need to check for
|
||||
!SYMBOL_CALLS_LOCAL() instead of !SYMBOL_REFERENCES_LOCAL().
|
||||
|
||||
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
|
||||
---
|
||||
bfd/elf32-or1k.c | 12 ++++++++++++
|
||||
1 file changed, 12 insertions(+)
|
||||
|
||||
diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c
|
||||
index 4ae7f324d33..4f9092539f5 100644
|
||||
--- a/bfd/elf32-or1k.c
|
||||
+++ b/bfd/elf32-or1k.c
|
||||
@@ -1543,6 +1543,18 @@ or1k_elf_relocate_section (bfd *output_bfd,
|
||||
break;
|
||||
|
||||
case R_OR1K_INSN_REL_26:
|
||||
+ /* For a non-shared link, these will reference plt or call the
|
||||
+ version of actual object. */
|
||||
+ if (bfd_link_pic (info) && !SYMBOL_CALLS_LOCAL (info, h))
|
||||
+ {
|
||||
+ _bfd_error_handler
|
||||
+ (_("%pB: pc-relative relocation against dynamic symbol %s"),
|
||||
+ input_bfd, name);
|
||||
+ ret_val = FALSE;
|
||||
+ bfd_set_error (bfd_error_bad_value);
|
||||
+ }
|
||||
+ break;
|
||||
+
|
||||
case R_OR1K_PCREL_PG21:
|
||||
case R_OR1K_LO13:
|
||||
case R_OR1K_SLO13:
|
||||
--
|
||||
2.25.1
|
||||
|
@ -1,35 +0,0 @@
|
||||
From 1659226a96b1daecfd08c057d0d5c39309d207ee Mon Sep 17 00:00:00 2001
|
||||
From: Giulio Benetti <giulio.benetti@benettiengineering.com>
|
||||
Date: Mon, 22 Mar 2021 13:30:07 +0100
|
||||
Subject: [PATCH] bfd/elf32-or1k: fix ld assert
|
||||
|
||||
Fixes https://sourceware.org/bugzilla/show_bug.cgi?id=27624
|
||||
|
||||
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
|
||||
---
|
||||
bfd/elf32-or1k.c | 9 ++++-----
|
||||
1 file changed, 4 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c
|
||||
index 65938e5137..41908f8938 100644
|
||||
--- a/bfd/elf32-or1k.c
|
||||
+++ b/bfd/elf32-or1k.c
|
||||
@@ -2566,11 +2566,10 @@ or1k_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
|
||||
if (h->type == STT_FUNC
|
||||
|| h->needs_plt)
|
||||
{
|
||||
- if (! bfd_link_pic (info)
|
||||
- && !h->def_dynamic
|
||||
- && !h->ref_dynamic
|
||||
- && h->root.type != bfd_link_hash_undefweak
|
||||
- && h->root.type != bfd_link_hash_undefined)
|
||||
+ if (h->plt.refcount <= 0
|
||||
+ || (SYMBOL_CALLS_LOCAL (info, h)
|
||||
+ || (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
|
||||
+ && h->root.type == bfd_link_hash_undefweak)))
|
||||
{
|
||||
/* This case can occur if we saw a PLT reloc in an input
|
||||
file, but the symbol was never referred to by a dynamic
|
||||
--
|
||||
2.25.1
|
||||
|
@ -0,0 +1,59 @@
|
||||
From 651c3617a04a1d1f78e89623b81be7ba32ff59a5 Mon Sep 17 00:00:00 2001
|
||||
From: Stafford Horne <shorne@gmail.com>
|
||||
Date: Sun, 2 May 2021 06:02:14 +0900
|
||||
Subject: [PATCH] or1k: Fix issue with plt link failure for local calls
|
||||
|
||||
When building protobuf we were seeing the assert failure:
|
||||
|
||||
/home/giuliobenetti/git/upstream/or1k-binutils-2.36.1/host/lib/gcc/or1k-buildroot-linux-uclibc/9.3.0/../../../../or1k-buildroot-linux-uclibc/bin/ld:
|
||||
BFD (GNU Binutils) 2.36.1 assertion fail elf32-or1k.c:2377
|
||||
/home/giuliobenetti/git/upstream/or1k-binutils-2.36.1/host/lib/gcc/or1k-buildroot-linux-uclibc/9.3.0/../../../../or1k-buildroot-linux-uclibc/bin/ld:
|
||||
BFD (GNU Binutils) 2.36.1 assertion fail elf32-or1k.c:2377
|
||||
/home/giuliobenetti/git/upstream/or1k-binutils-2.36.1/host/lib/gcc/or1k-buildroot-linux-uclibc/9.3.0/../../../../or1k-buildroot-linux-uclibc/bin/ld:
|
||||
BFD (GNU Binutils) 2.36.1 assertion fail elf32-or1k.c:2377
|
||||
collect2: error: ld returned 1 exit status
|
||||
|
||||
This failure happens while writing out PLT entries, there is a check
|
||||
"BFD_ASSERT (h->dynindx != -1)" to confirm all plt entries have dynamic
|
||||
symbol attributes. This was failing for symbols that were
|
||||
"forced_local" in previous linking code.
|
||||
|
||||
The fix adds logic to or1k_elf_adjust_dynamic_symbol to identify
|
||||
"forced_local" symbols and exclude them from the the PLT.
|
||||
|
||||
bfd/ChangeLog:
|
||||
|
||||
PR 27624
|
||||
* elf32-or1k.c (or1k_elf_adjust_dynamic_symbol): Change
|
||||
condition used to cleanup plt entries to cleanup forced local
|
||||
entries.
|
||||
|
||||
Cc: Giulio Benetti <giulio.benetti@benettiengineering.com>
|
||||
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
|
||||
---
|
||||
bfd/elf32-or1k.c | 9 ++++-----
|
||||
1 file changed, 4 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c
|
||||
index 31ef758a926..58246875546 100644
|
||||
--- a/bfd/elf32-or1k.c
|
||||
+++ b/bfd/elf32-or1k.c
|
||||
@@ -2535,11 +2535,10 @@ or1k_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
|
||||
if (h->type == STT_FUNC
|
||||
|| h->needs_plt)
|
||||
{
|
||||
- if (! bfd_link_pic (info)
|
||||
- && !h->def_dynamic
|
||||
- && !h->ref_dynamic
|
||||
- && h->root.type != bfd_link_hash_undefweak
|
||||
- && h->root.type != bfd_link_hash_undefined)
|
||||
+ if (h->plt.refcount <= 0
|
||||
+ || (SYMBOL_CALLS_LOCAL (info, h)
|
||||
+ || (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
|
||||
+ && h->root.type == bfd_link_hash_undefweak)))
|
||||
{
|
||||
/* This case can occur if we saw a PLT reloc in an input
|
||||
file, but the symbol was never referred to by a dynamic
|
||||
--
|
||||
2.25.1
|
||||
|
@ -0,0 +1,256 @@
|
||||
From 5fb945116ba058eb8f032f94ab2e0c71024388ec Mon Sep 17 00:00:00 2001
|
||||
From: Stafford Horne <shorne@gmail.com>
|
||||
Date: Sun, 2 May 2021 06:02:15 +0900
|
||||
Subject: [PATCH] or1k: Implement relocation R_OR1K_GOT_AHI16 for gotha()
|
||||
|
||||
The gotha() relocation mnemonic will be outputted by OpenRISC GCC when
|
||||
using the -mcmodel=large option. This relocation is used along with
|
||||
got() to generate 32-bit GOT offsets. This increases the previous GOT
|
||||
offset limit from the previous 16-bit (64K) limit.
|
||||
|
||||
This is needed on large binaries where the GOT grows larger than 64k.
|
||||
|
||||
bfd/ChangeLog:
|
||||
|
||||
PR 21464
|
||||
* bfd-in2.h: Add BFD_RELOC_OR1K_GOT_AHI16 relocation.
|
||||
* elf32-or1k.c (or1k_elf_howto_table, or1k_reloc_map): Likewise.
|
||||
(or1k_final_link_relocate, or1k_elf_relocate_section,
|
||||
or1k_elf_check_relocs): Likewise.
|
||||
* libbfd.h (bfd_reloc_code_real_names): Likewise.
|
||||
* reloc.c: Likewise.
|
||||
|
||||
cpu/ChangeLog:
|
||||
|
||||
PR 21464
|
||||
* or1k.opc (or1k_imm16_relocs, parse_reloc): Define parse logic
|
||||
for gotha() relocation.
|
||||
|
||||
include/ChangeLog:
|
||||
|
||||
PR 21464
|
||||
* elf/or1k.h (elf_or1k_reloc_type): Define R_OR1K_GOT_AHI16 number.
|
||||
|
||||
opcodes/ChangeLog:
|
||||
|
||||
PR 21464
|
||||
* or1k-asm.c: Regenerate.
|
||||
|
||||
gas/ChangeLog:
|
||||
|
||||
PR 21464
|
||||
* testsuite/gas/or1k/reloc-1.s: Add test for new relocation.
|
||||
* testsuite/gas/or1k/reloc-1.d: Add test result for new
|
||||
relocation.
|
||||
|
||||
Cc: Giulio Benetti <giulio.benetti@benettiengineering.com>
|
||||
|
||||
fixup reloc, add tests
|
||||
|
||||
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
|
||||
---
|
||||
bfd/bfd-in2.h | 1 +
|
||||
bfd/elf32-or1k.c | 21 ++++++++++++++++++++-
|
||||
bfd/libbfd.h | 1 +
|
||||
bfd/reloc.c | 2 ++
|
||||
cpu/or1k.opc | 7 ++++++-
|
||||
gas/testsuite/gas/or1k/reloc-1.d | 4 +++-
|
||||
gas/testsuite/gas/or1k/reloc-1.s | 4 ++++
|
||||
include/elf/or1k.h | 1 +
|
||||
opcodes/or1k-asm.c | 7 ++++++-
|
||||
9 files changed, 44 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
|
||||
index 7c13bc8c91a..ae1082a67c2 100644
|
||||
--- a/bfd/bfd-in2.h
|
||||
+++ b/bfd/bfd-in2.h
|
||||
@@ -5017,6 +5017,7 @@ then it may be truncated to 8 bits. */
|
||||
BFD_RELOC_OR1K_TLS_TPOFF,
|
||||
BFD_RELOC_OR1K_TLS_DTPOFF,
|
||||
BFD_RELOC_OR1K_TLS_DTPMOD,
|
||||
+ BFD_RELOC_OR1K_GOT_AHI16,
|
||||
|
||||
/* H8 elf Relocations. */
|
||||
BFD_RELOC_H8_DIR16A8,
|
||||
diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c
|
||||
index 58246875546..1273fbacb3c 100644
|
||||
--- a/bfd/elf32-or1k.c
|
||||
+++ b/bfd/elf32-or1k.c
|
||||
@@ -808,6 +808,20 @@ static reloc_howto_type or1k_elf_howto_table[] =
|
||||
0, /* Source Mask. */
|
||||
0x03ffffff, /* Dest Mask. */
|
||||
TRUE), /* PC relative offset? */
|
||||
+
|
||||
+ HOWTO (R_OR1K_GOT_AHI16, /* type */
|
||||
+ 16, /* rightshift */
|
||||
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
+ 16, /* bitsize */
|
||||
+ FALSE, /* pc_relative */
|
||||
+ 0, /* bitpos */
|
||||
+ complain_overflow_signed, /* complain_on_overflow */
|
||||
+ bfd_elf_generic_reloc, /* special_function */
|
||||
+ "R_OR1K_GOT_AHI16", /* name */
|
||||
+ FALSE, /* partial_inplace */
|
||||
+ 0, /* src_mask */
|
||||
+ 0xffff, /* dst_mask */
|
||||
+ FALSE), /* pcrel_offset */
|
||||
};
|
||||
|
||||
/* Map BFD reloc types to Or1k ELF reloc types. */
|
||||
@@ -871,6 +885,7 @@ static const struct or1k_reloc_map or1k_reloc_map[] =
|
||||
{ BFD_RELOC_OR1K_TLS_IE_LO13, R_OR1K_TLS_IE_LO13 },
|
||||
{ BFD_RELOC_OR1K_SLO13, R_OR1K_SLO13 },
|
||||
{ BFD_RELOC_OR1K_PLTA26, R_OR1K_PLTA26 },
|
||||
+ { BFD_RELOC_OR1K_GOT_AHI16, R_OR1K_GOT_AHI16 },
|
||||
};
|
||||
|
||||
#define TLS_UNKNOWN 0
|
||||
@@ -1080,6 +1095,7 @@ or1k_final_link_relocate (reloc_howto_type *howto, bfd *input_bfd,
|
||||
switch (howto->type)
|
||||
{
|
||||
case R_OR1K_AHI16:
|
||||
+ case R_OR1K_GOT_AHI16:
|
||||
case R_OR1K_GOTOFF_AHI16:
|
||||
case R_OR1K_TLS_IE_AHI16:
|
||||
case R_OR1K_TLS_LE_AHI16:
|
||||
@@ -1344,6 +1360,7 @@ or1k_elf_relocate_section (bfd *output_bfd,
|
||||
}
|
||||
break;
|
||||
|
||||
+ case R_OR1K_GOT_AHI16:
|
||||
case R_OR1K_GOT16:
|
||||
case R_OR1K_GOT_PG21:
|
||||
case R_OR1K_GOT_LO13:
|
||||
@@ -1435,7 +1452,8 @@ or1k_elf_relocate_section (bfd *output_bfd,
|
||||
/* The GOT_PG21 and GOT_LO13 relocs are pc-relative,
|
||||
while the GOT16 reloc is GOT relative. */
|
||||
relocation = got_base + off;
|
||||
- if (r_type == R_OR1K_GOT16)
|
||||
+ if (r_type == R_OR1K_GOT16
|
||||
+ || r_type == R_OR1K_GOT_AHI16)
|
||||
relocation -= got_sym_value;
|
||||
|
||||
/* Addend should be zero. */
|
||||
@@ -1943,6 +1961,7 @@ or1k_elf_check_relocs (bfd *abfd,
|
||||
}
|
||||
break;
|
||||
|
||||
+ case R_OR1K_GOT_AHI16:
|
||||
case R_OR1K_GOT16:
|
||||
case R_OR1K_GOT_PG21:
|
||||
case R_OR1K_GOT_LO13:
|
||||
diff --git a/bfd/libbfd.h b/bfd/libbfd.h
|
||||
index d97d4e57a77..9edc71e0558 100644
|
||||
--- a/bfd/libbfd.h
|
||||
+++ b/bfd/libbfd.h
|
||||
@@ -2704,6 +2704,7 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
|
||||
"BFD_RELOC_OR1K_TLS_TPOFF",
|
||||
"BFD_RELOC_OR1K_TLS_DTPOFF",
|
||||
"BFD_RELOC_OR1K_TLS_DTPMOD",
|
||||
+ "BFD_RELOC_OR1K_GOT_AHI16",
|
||||
"BFD_RELOC_H8_DIR16A8",
|
||||
"BFD_RELOC_H8_DIR16R8",
|
||||
"BFD_RELOC_H8_DIR24A8",
|
||||
diff --git a/bfd/reloc.c b/bfd/reloc.c
|
||||
index 33cd67150cf..f57ad14a501 100644
|
||||
--- a/bfd/reloc.c
|
||||
+++ b/bfd/reloc.c
|
||||
@@ -6175,6 +6175,8 @@ ENUMX
|
||||
BFD_RELOC_OR1K_GOTPC_HI16
|
||||
ENUMX
|
||||
BFD_RELOC_OR1K_GOTPC_LO16
|
||||
+ENUMX
|
||||
+ BFD_RELOC_OR1K_GOT_AHI16
|
||||
ENUMX
|
||||
BFD_RELOC_OR1K_GOT16
|
||||
ENUMX
|
||||
diff --git a/cpu/or1k.opc b/cpu/or1k.opc
|
||||
index f0adcbb00a5..5d20a1f33a7 100644
|
||||
--- a/cpu/or1k.opc
|
||||
+++ b/cpu/or1k.opc
|
||||
@@ -193,7 +193,7 @@ static const bfd_reloc_code_real_type or1k_imm16_relocs[][6] = {
|
||||
BFD_RELOC_OR1K_GOT_LO13,
|
||||
BFD_RELOC_UNUSED,
|
||||
BFD_RELOC_UNUSED,
|
||||
- BFD_RELOC_UNUSED },
|
||||
+ BFD_RELOC_OR1K_GOT_AHI16 },
|
||||
{ BFD_RELOC_OR1K_GOTPC_LO16,
|
||||
BFD_RELOC_UNUSED,
|
||||
BFD_RELOC_UNUSED,
|
||||
@@ -296,6 +296,11 @@ parse_reloc (const char **strp)
|
||||
str += 5;
|
||||
cls = RCLASS_TPOFF;
|
||||
}
|
||||
+ else if (strncasecmp (str, "got", 3) == 0)
|
||||
+ {
|
||||
+ str += 3;
|
||||
+ cls = RCLASS_GOT;
|
||||
+ }
|
||||
|
||||
if (strncasecmp (str, "hi(", 3) == 0)
|
||||
{
|
||||
diff --git a/gas/testsuite/gas/or1k/reloc-1.d b/gas/testsuite/gas/or1k/reloc-1.d
|
||||
index d1bcf5608bb..3a001c4ed99 100644
|
||||
--- a/gas/testsuite/gas/or1k/reloc-1.d
|
||||
+++ b/gas/testsuite/gas/or1k/reloc-1.d
|
||||
@@ -68,5 +68,7 @@ OFFSET TYPE VALUE
|
||||
000000ec R_OR1K_LO13 x
|
||||
000000f0 R_OR1K_GOT_LO13 x
|
||||
000000f4 R_OR1K_SLO13 x
|
||||
-
|
||||
+000000f8 R_OR1K_GOT_AHI16 x
|
||||
+000000fc R_OR1K_GOT_AHI16 x
|
||||
+00000100 R_OR1K_GOT_AHI16 x
|
||||
|
||||
diff --git a/gas/testsuite/gas/or1k/reloc-1.s b/gas/testsuite/gas/or1k/reloc-1.s
|
||||
index e76abef6532..562609aa869 100644
|
||||
--- a/gas/testsuite/gas/or1k/reloc-1.s
|
||||
+++ b/gas/testsuite/gas/or1k/reloc-1.s
|
||||
@@ -74,3 +74,7 @@
|
||||
l.lbz r5,po(x)(r3)
|
||||
l.lbz r5,gotpo(x)(r3)
|
||||
l.sb po(x)(r3),r6
|
||||
+
|
||||
+ l.movhi r4,gotha(x)
|
||||
+ l.ori r3,r4,gotha(x)
|
||||
+ l.addi r3,r4,gotha(x)
|
||||
diff --git a/include/elf/or1k.h b/include/elf/or1k.h
|
||||
index a215ef5c17e..dff37d875f2 100644
|
||||
--- a/include/elf/or1k.h
|
||||
+++ b/include/elf/or1k.h
|
||||
@@ -77,6 +77,7 @@ START_RELOC_NUMBERS (elf_or1k_reloc_type)
|
||||
RELOC_NUMBER (R_OR1K_TLS_IE_LO13, 51)
|
||||
RELOC_NUMBER (R_OR1K_SLO13, 52)
|
||||
RELOC_NUMBER (R_OR1K_PLTA26, 53)
|
||||
+ RELOC_NUMBER (R_OR1K_GOT_AHI16, 54)
|
||||
END_RELOC_NUMBERS (R_OR1K_max)
|
||||
|
||||
#define EF_OR1K_NODELAY (1UL << 0)
|
||||
diff --git a/opcodes/or1k-asm.c b/opcodes/or1k-asm.c
|
||||
index 4715c4f2826..a72a4e85363 100644
|
||||
--- a/opcodes/or1k-asm.c
|
||||
+++ b/opcodes/or1k-asm.c
|
||||
@@ -177,7 +177,7 @@ static const bfd_reloc_code_real_type or1k_imm16_relocs[][6] = {
|
||||
BFD_RELOC_OR1K_GOT_LO13,
|
||||
BFD_RELOC_UNUSED,
|
||||
BFD_RELOC_UNUSED,
|
||||
- BFD_RELOC_UNUSED },
|
||||
+ BFD_RELOC_OR1K_GOT_AHI16 },
|
||||
{ BFD_RELOC_OR1K_GOTPC_LO16,
|
||||
BFD_RELOC_UNUSED,
|
||||
BFD_RELOC_UNUSED,
|
||||
@@ -280,6 +280,11 @@ parse_reloc (const char **strp)
|
||||
str += 5;
|
||||
cls = RCLASS_TPOFF;
|
||||
}
|
||||
+ else if (strncasecmp (str, "got", 3) == 0)
|
||||
+ {
|
||||
+ str += 3;
|
||||
+ cls = RCLASS_GOT;
|
||||
+ }
|
||||
|
||||
if (strncasecmp (str, "hi(", 3) == 0)
|
||||
{
|
||||
--
|
||||
2.25.1
|
||||
|
@ -0,0 +1,61 @@
|
||||
From d92116c7df340ff40063c5c97d202e7e87400027 Mon Sep 17 00:00:00 2001
|
||||
From: Stafford Horne <shorne@gmail.com>
|
||||
Date: Sun, 2 May 2021 06:02:16 +0900
|
||||
Subject: [PATCH] or1k: Avoid R_OR1K_GOT16 overflow failures in presence of
|
||||
R_OR1K_GOT_AHI16
|
||||
|
||||
Now that we support R_OR1K_GOT_AHI16 we can relax the R_OR1K_GOT16
|
||||
overflow validation check if the section has R_OR1K_GOT_AHI16.
|
||||
|
||||
We cannot simple disable R_OR1K_GOT16 overflow validation as there will
|
||||
still be binaries that will have only R_OR1K_GOT16. The
|
||||
R_OR1K_GOT_AHI16 relocation will only be added by GCC when building with
|
||||
the option -mcmodel=large.
|
||||
|
||||
This assumes that R_OR1K_GOT_AHI16 will come before R_OR1K_GOT16, which
|
||||
is the code pattern that will be emitted by GCC.
|
||||
|
||||
bfd/ChangeLog:
|
||||
|
||||
PR 21464
|
||||
* elf32-or1k.c (or1k_elf_relocate_section): Relax R_OR1K_GOT16
|
||||
overflow check if we have R_OR1K_GOT_AHI16 followed by
|
||||
R_OR1K_GOT16.
|
||||
|
||||
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
|
||||
---
|
||||
bfd/elf32-or1k.c | 11 +++++++++++
|
||||
1 file changed, 11 insertions(+)
|
||||
|
||||
diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c
|
||||
index 1273fbacb3c..ce2c4fdb3bd 100644
|
||||
--- a/bfd/elf32-or1k.c
|
||||
+++ b/bfd/elf32-or1k.c
|
||||
@@ -1248,6 +1248,7 @@ or1k_elf_relocate_section (bfd *output_bfd,
|
||||
asection *sgot, *splt;
|
||||
bfd_vma plt_base, got_base, got_sym_value;
|
||||
bfd_boolean ret_val = TRUE;
|
||||
+ bfd_boolean saw_gotha = FALSE;
|
||||
|
||||
if (htab == NULL)
|
||||
return FALSE;
|
||||
@@ -1456,6 +1457,16 @@ or1k_elf_relocate_section (bfd *output_bfd,
|
||||
|| r_type == R_OR1K_GOT_AHI16)
|
||||
relocation -= got_sym_value;
|
||||
|
||||
+ if (r_type == R_OR1K_GOT_AHI16)
|
||||
+ saw_gotha = TRUE;
|
||||
+
|
||||
+ /* If we have a R_OR1K_GOT16 followed by a R_OR1K_GOT_AHI16
|
||||
+ relocation we assume the code is doing the right thing to avoid
|
||||
+ overflows. Here we mask the lower 16-bit of the relocation to
|
||||
+ avoid overflow validation failures. */
|
||||
+ if (r_type == R_OR1K_GOT16 && saw_gotha)
|
||||
+ relocation &= 0xffff;
|
||||
+
|
||||
/* Addend should be zero. */
|
||||
if (rel->r_addend != 0)
|
||||
{
|
||||
--
|
||||
2.25.1
|
||||
|
@ -0,0 +1,500 @@
|
||||
From cba29e387040eaa401c52eb20e7cab5a4401185c Mon Sep 17 00:00:00 2001
|
||||
From: Stafford Horne <shorne@gmail.com>
|
||||
Date: Sun, 2 May 2021 06:02:17 +0900
|
||||
Subject: [PATCH] or1k: Support large plt_relocs when generating plt
|
||||
entries
|
||||
|
||||
The current PLT generation code will generate invalid code when the PLT
|
||||
relocation offset exceeds 64k. This fixes the issue by detecting large
|
||||
plt_reloc offsets and generare code sequences to create larger plt
|
||||
relocations.
|
||||
|
||||
The "large" plt code needs 2 extra instructions to create 32-bit offsets.
|
||||
|
||||
bfd/ChangeLog:
|
||||
|
||||
PR 27746
|
||||
* elf32-or1k.c (PLT_ENTRY_SIZE_LARGE, PLT_MAX_INSN_COUNT,
|
||||
OR1K_ADD, OR1K_ORI): New macros to help with plt creation.
|
||||
(elf_or1k_link_hash_table): New field plt_count.
|
||||
(elf_or1k_link_hash_entry): New field plt_index.
|
||||
(elf_or1k_plt_entry_size): New function.
|
||||
(or1k_write_plt_entry): Update to support variable size PLTs.
|
||||
(or1k_elf_finish_dynamic_sections): Use new or1k_write_plt_entry
|
||||
API.
|
||||
(or1k_elf_finish_dynamic_symbol): Update to write large PLTs
|
||||
when needed.
|
||||
(allocate_dynrelocs): Use elf_or1k_plt_entry_size to account for
|
||||
PLT size.
|
||||
|
||||
ld/ChangeLog:
|
||||
|
||||
PR 27746
|
||||
testsuite/ld-or1k/or1k.exp (or1kplttests): Add tests for linking
|
||||
along with gotha() relocations.
|
||||
testsuite/ld-or1k/gotha1.dd: New file.
|
||||
testsuite/ld-or1k/gotha1.s: New file.
|
||||
testsuite/ld-or1k/gotha2.dd: New file.
|
||||
testsuite/ld-or1k/gotha2.s: New file
|
||||
testsuite/ld-or1k/pltlib.s (x): Define size to avoid link
|
||||
failure.
|
||||
|
||||
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
|
||||
---
|
||||
bfd/elf32-or1k.c | 149 ++++++++++++++++++++++++---------
|
||||
ld/testsuite/ld-or1k/gotha1.dd | 34 ++++++++
|
||||
ld/testsuite/ld-or1k/gotha1.s | 24 ++++++
|
||||
ld/testsuite/ld-or1k/gotha2.dd | 21 +++++
|
||||
ld/testsuite/ld-or1k/gotha2.s | 22 +++++
|
||||
ld/testsuite/ld-or1k/or1k.exp | 8 ++
|
||||
ld/testsuite/ld-or1k/pltlib.s | 1 +
|
||||
7 files changed, 220 insertions(+), 39 deletions(-)
|
||||
create mode 100644 ld/testsuite/ld-or1k/gotha1.dd
|
||||
create mode 100644 ld/testsuite/ld-or1k/gotha1.s
|
||||
create mode 100644 ld/testsuite/ld-or1k/gotha2.dd
|
||||
create mode 100644 ld/testsuite/ld-or1k/gotha2.s
|
||||
|
||||
diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c
|
||||
index ce2c4fdb3bd..8b021b79d92 100644
|
||||
--- a/bfd/elf32-or1k.c
|
||||
+++ b/bfd/elf32-or1k.c
|
||||
@@ -30,10 +30,14 @@
|
||||
#define N_ONES(X) (((bfd_vma)2 << (X)) - 1)
|
||||
|
||||
#define PLT_ENTRY_SIZE 16
|
||||
+#define PLT_ENTRY_SIZE_LARGE (6*4)
|
||||
+#define PLT_MAX_INSN_COUNT 6
|
||||
|
||||
#define OR1K_MOVHI(D) (0x18000000 | (D << 21))
|
||||
#define OR1K_ADRP(D) (0x08000000 | (D << 21))
|
||||
#define OR1K_LWZ(D,A) (0x84000000 | (D << 21) | (A << 16))
|
||||
+#define OR1K_ADD(D,A,B) (0xE0000000 | (D << 21) | (A << 16) | (B << 11))
|
||||
+#define OR1K_ORI(D,A) (0xA8000000 | (D << 21) | (A << 16))
|
||||
#define OR1K_ORI0(D) (0xA8000000 | (D << 21))
|
||||
#define OR1K_JR(B) (0x44000000 | (B << 11))
|
||||
#define OR1K_NOP 0x15000000
|
||||
@@ -903,6 +907,8 @@ struct elf_or1k_link_hash_entry
|
||||
/* Track dynamic relocs copied for this symbol. */
|
||||
struct elf_dyn_relocs *dyn_relocs;
|
||||
|
||||
+ /* For calculating PLT size. */
|
||||
+ bfd_vma plt_index;
|
||||
/* Track type of TLS access. */
|
||||
unsigned char tls_type;
|
||||
};
|
||||
@@ -930,9 +936,20 @@ struct elf_or1k_link_hash_table
|
||||
/* Small local sym to section mapping cache. */
|
||||
struct sym_cache sym_sec;
|
||||
|
||||
+ bfd_vma plt_count;
|
||||
bfd_boolean saw_plta;
|
||||
};
|
||||
|
||||
+static size_t
|
||||
+elf_or1k_plt_entry_size (bfd_vma plt_index)
|
||||
+{
|
||||
+ bfd_vma plt_reloc;
|
||||
+
|
||||
+ plt_reloc = plt_index * sizeof (Elf32_External_Rela);
|
||||
+
|
||||
+ return (plt_reloc > 0xffff) ? PLT_ENTRY_SIZE_LARGE : PLT_ENTRY_SIZE;
|
||||
+}
|
||||
+
|
||||
/* Get the ELF linker hash table from a link_info structure. */
|
||||
#define or1k_elf_hash_table(p) \
|
||||
(elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
|
||||
@@ -2173,33 +2190,46 @@ or1k_elf_check_relocs (bfd *abfd,
|
||||
}
|
||||
|
||||
static void
|
||||
-or1k_write_plt_entry (bfd *output_bfd, bfd_byte *contents, unsigned insn1,
|
||||
- unsigned insn2, unsigned insn3, unsigned insnj)
|
||||
+or1k_write_plt_entry (bfd *output_bfd, bfd_byte *contents, unsigned insnj,
|
||||
+ unsigned insns[], size_t insn_count)
|
||||
{
|
||||
unsigned nodelay = elf_elfheader (output_bfd)->e_flags & EF_OR1K_NODELAY;
|
||||
- unsigned insn4;
|
||||
+ unsigned output_insns[PLT_MAX_INSN_COUNT];
|
||||
+
|
||||
+ /* Copy instructions into the output buffer. */
|
||||
+ for (size_t i = 0; i < insn_count; i++)
|
||||
+ output_insns[i] = insns[i];
|
||||
|
||||
/* Honor the no-delay-slot setting. */
|
||||
- if (insn3 == OR1K_NOP)
|
||||
+ if (insns[insn_count-1] == OR1K_NOP)
|
||||
{
|
||||
- insn4 = insn3;
|
||||
+ unsigned slot1, slot2;
|
||||
+
|
||||
if (nodelay)
|
||||
- insn3 = insnj;
|
||||
+ slot1 = insns[insn_count-2], slot2 = insnj;
|
||||
else
|
||||
- insn3 = insn2, insn2 = insnj;
|
||||
+ slot1 = insnj, slot2 = insns[insn_count-2];
|
||||
+
|
||||
+ output_insns[insn_count-2] = slot1;
|
||||
+ output_insns[insn_count-1] = slot2;
|
||||
+ output_insns[insn_count] = OR1K_NOP;
|
||||
}
|
||||
else
|
||||
{
|
||||
+ unsigned slot1, slot2;
|
||||
+
|
||||
if (nodelay)
|
||||
- insn4 = insnj;
|
||||
+ slot1 = insns[insn_count-1], slot2 = insnj;
|
||||
else
|
||||
- insn4 = insn3, insn3 = insnj;
|
||||
+ slot1 = insnj, slot2 = insns[insn_count-1];
|
||||
+
|
||||
+ output_insns[insn_count-1] = slot1;
|
||||
+ output_insns[insn_count] = slot2;
|
||||
}
|
||||
|
||||
- bfd_put_32 (output_bfd, insn1, contents);
|
||||
- bfd_put_32 (output_bfd, insn2, contents + 4);
|
||||
- bfd_put_32 (output_bfd, insn3, contents + 8);
|
||||
- bfd_put_32 (output_bfd, insn4, contents + 12);
|
||||
+ /* Write out the output buffer. */
|
||||
+ for (size_t i = 0; i < (insn_count+1); i++)
|
||||
+ bfd_put_32 (output_bfd, output_insns[i], contents + (i*4));
|
||||
}
|
||||
|
||||
/* Finish up the dynamic sections. */
|
||||
@@ -2266,7 +2296,8 @@ or1k_elf_finish_dynamic_sections (bfd *output_bfd,
|
||||
splt = htab->root.splt;
|
||||
if (splt && splt->size > 0)
|
||||
{
|
||||
- unsigned plt0, plt1, plt2;
|
||||
+ unsigned plt[PLT_MAX_INSN_COUNT];
|
||||
+ size_t plt_insn_count = 3;
|
||||
bfd_vma got_addr = sgot->output_section->vma + sgot->output_offset;
|
||||
|
||||
/* Note we force 16 byte alignment on the .got, so that
|
||||
@@ -2277,27 +2308,27 @@ or1k_elf_finish_dynamic_sections (bfd *output_bfd,
|
||||
bfd_vma pc = splt->output_section->vma + splt->output_offset;
|
||||
unsigned pa = ((got_addr >> 13) - (pc >> 13)) & 0x1fffff;
|
||||
unsigned po = got_addr & 0x1fff;
|
||||
- plt0 = OR1K_ADRP(12) | pa;
|
||||
- plt1 = OR1K_LWZ(15,12) | (po + 8);
|
||||
- plt2 = OR1K_LWZ(12,12) | (po + 4);
|
||||
+ plt[0] = OR1K_ADRP(12) | pa;
|
||||
+ plt[1] = OR1K_LWZ(15,12) | (po + 8);
|
||||
+ plt[2] = OR1K_LWZ(12,12) | (po + 4);
|
||||
}
|
||||
else if (bfd_link_pic (info))
|
||||
{
|
||||
- plt0 = OR1K_LWZ(15, 16) | 8; /* .got+8 */
|
||||
- plt1 = OR1K_LWZ(12, 16) | 4; /* .got+4 */
|
||||
- plt2 = OR1K_NOP;
|
||||
+ plt[0] = OR1K_LWZ(15, 16) | 8; /* .got+8 */
|
||||
+ plt[1] = OR1K_LWZ(12, 16) | 4; /* .got+4 */
|
||||
+ plt[2] = OR1K_NOP;
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned ha = ((got_addr + 0x8000) >> 16) & 0xffff;
|
||||
unsigned lo = got_addr & 0xffff;
|
||||
- plt0 = OR1K_MOVHI(12) | ha;
|
||||
- plt1 = OR1K_LWZ(15,12) | (lo + 8);
|
||||
- plt2 = OR1K_LWZ(12,12) | (lo + 4);
|
||||
+ plt[0] = OR1K_MOVHI(12) | ha;
|
||||
+ plt[1] = OR1K_LWZ(15,12) | (lo + 8);
|
||||
+ plt[2] = OR1K_LWZ(12,12) | (lo + 4);
|
||||
}
|
||||
|
||||
- or1k_write_plt_entry (output_bfd, splt->contents,
|
||||
- plt0, plt1, plt2, OR1K_JR(15));
|
||||
+ or1k_write_plt_entry (output_bfd, splt->contents, OR1K_JR(15),
|
||||
+ plt, plt_insn_count);
|
||||
|
||||
elf_section_data (splt->output_section)->this_hdr.sh_entsize = 4;
|
||||
}
|
||||
@@ -2340,7 +2371,8 @@ or1k_elf_finish_dynamic_symbol (bfd *output_bfd,
|
||||
|
||||
if (h->plt.offset != (bfd_vma) -1)
|
||||
{
|
||||
- unsigned int plt0, plt1, plt2;
|
||||
+ unsigned int plt[PLT_MAX_INSN_COUNT];
|
||||
+ size_t plt_insn_count = 3;
|
||||
asection *splt;
|
||||
asection *sgot;
|
||||
asection *srela;
|
||||
@@ -2352,6 +2384,7 @@ or1k_elf_finish_dynamic_symbol (bfd *output_bfd,
|
||||
bfd_vma got_offset;
|
||||
bfd_vma got_addr;
|
||||
Elf_Internal_Rela rela;
|
||||
+ bfd_boolean large_plt_entry;
|
||||
|
||||
/* This symbol has an entry in the procedure linkage table. Set
|
||||
it up. */
|
||||
@@ -2369,10 +2402,13 @@ or1k_elf_finish_dynamic_symbol (bfd *output_bfd,
|
||||
corresponds to this symbol. This is the index of this symbol
|
||||
in all the symbols for which we are making plt entries. The
|
||||
first entry in the procedure linkage table is reserved. */
|
||||
- plt_index = h->plt.offset / PLT_ENTRY_SIZE - 1;
|
||||
+ plt_index = ((struct elf_or1k_link_hash_entry *) h)->plt_index;
|
||||
plt_addr = plt_base_addr + h->plt.offset;
|
||||
plt_reloc = plt_index * sizeof (Elf32_External_Rela);
|
||||
|
||||
+ large_plt_entry = (elf_or1k_plt_entry_size (plt_index)
|
||||
+ == PLT_ENTRY_SIZE_LARGE);
|
||||
+
|
||||
/* Get the offset into the .got table of the entry that
|
||||
corresponds to this function. Each .got entry is 4 bytes.
|
||||
The first three are reserved. */
|
||||
@@ -2384,27 +2420,57 @@ or1k_elf_finish_dynamic_symbol (bfd *output_bfd,
|
||||
{
|
||||
unsigned pa = ((got_addr >> 13) - (plt_addr >> 13)) & 0x1fffff;
|
||||
unsigned po = (got_addr & 0x1fff);
|
||||
- plt0 = OR1K_ADRP(12) | pa;
|
||||
- plt1 = OR1K_LWZ(12,12) | po;
|
||||
- plt2 = OR1K_ORI0(11) | plt_reloc;
|
||||
+ plt[0] = OR1K_ADRP(12) | pa;
|
||||
+ plt[1] = OR1K_LWZ(12,12) | po;
|
||||
+ plt[2] = OR1K_ORI0(11) | plt_reloc;
|
||||
}
|
||||
else if (bfd_link_pic (info))
|
||||
{
|
||||
- plt0 = OR1K_LWZ(12,16) | got_offset;
|
||||
- plt1 = OR1K_ORI0(11) | plt_reloc;
|
||||
- plt2 = OR1K_NOP;
|
||||
+ if (large_plt_entry)
|
||||
+ {
|
||||
+ unsigned gotha = ((got_offset + 0x8000) >> 16) & 0xffff;
|
||||
+ unsigned got = got_offset & 0xffff;
|
||||
+ unsigned pltrelhi = (plt_reloc >> 16) & 0xffff;
|
||||
+ unsigned pltrello = plt_reloc & 0xffff;
|
||||
+
|
||||
+ plt[0] = OR1K_MOVHI(12) | gotha;
|
||||
+ plt[1] = OR1K_ADD(12,12,16);
|
||||
+ plt[2] = OR1K_LWZ(12,12) | got;
|
||||
+ plt[3] = OR1K_MOVHI(11) | pltrelhi;
|
||||
+ plt[4] = OR1K_ORI(11,11) | pltrello;
|
||||
+ plt_insn_count = 5;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ plt[0] = OR1K_LWZ(12,16) | got_offset;
|
||||
+ plt[1] = OR1K_ORI0(11) | plt_reloc;
|
||||
+ plt[2] = OR1K_NOP;
|
||||
+ }
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned ha = ((got_addr + 0x8000) >> 16) & 0xffff;
|
||||
unsigned lo = got_addr & 0xffff;
|
||||
- plt0 = OR1K_MOVHI(12) | ha;
|
||||
- plt1 = OR1K_LWZ(12,12) | lo;
|
||||
- plt2 = OR1K_ORI0(11) | plt_reloc;
|
||||
+ plt[0] = OR1K_MOVHI(12) | ha;
|
||||
+ plt[1] = OR1K_LWZ(12,12) | lo;
|
||||
+ plt[2] = OR1K_ORI0(11) | plt_reloc;
|
||||
+ }
|
||||
+
|
||||
+ /* For large code model we fixup the non-PIC PLT relocation instructions
|
||||
+ here. */
|
||||
+ if (large_plt_entry && !bfd_link_pic (info))
|
||||
+ {
|
||||
+ unsigned pltrelhi = (plt_reloc >> 16) & 0xffff;
|
||||
+ unsigned pltrello = plt_reloc & 0xffff;
|
||||
+
|
||||
+ plt[2] = OR1K_MOVHI(11) | pltrelhi;
|
||||
+ plt[3] = OR1K_ORI(11,11) | pltrello;
|
||||
+ plt[4] = OR1K_NOP;
|
||||
+ plt_insn_count = 5;
|
||||
}
|
||||
|
||||
or1k_write_plt_entry (output_bfd, splt->contents + h->plt.offset,
|
||||
- plt0, plt1, plt2, OR1K_JR(12));
|
||||
+ OR1K_JR(12), plt, plt_insn_count);
|
||||
|
||||
/* Fill in the entry in the global offset table. We initialize it to
|
||||
point to the top of the plt. This is done to lazy lookup the actual
|
||||
@@ -2699,11 +2765,16 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
|
||||
if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, bfd_link_pic (info), h))
|
||||
{
|
||||
asection *s = htab->root.splt;
|
||||
+ bfd_vma plt_index;
|
||||
+
|
||||
+ /* Track the index of our plt entry for use in calculating size. */
|
||||
+ plt_index = htab->plt_count++;
|
||||
+ ((struct elf_or1k_link_hash_entry *) h)->plt_index = plt_index;
|
||||
|
||||
/* If this is the first .plt entry, make room for the special
|
||||
first entry. */
|
||||
if (s->size == 0)
|
||||
- s->size = PLT_ENTRY_SIZE;
|
||||
+ s->size = elf_or1k_plt_entry_size (plt_index);
|
||||
|
||||
h->plt.offset = s->size;
|
||||
|
||||
@@ -2720,7 +2791,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
|
||||
}
|
||||
|
||||
/* Make room for this entry. */
|
||||
- s->size += PLT_ENTRY_SIZE;
|
||||
+ s->size += elf_or1k_plt_entry_size (plt_index);
|
||||
|
||||
/* We also need to make an entry in the .got.plt section, which
|
||||
will be placed in the .got section by the linker script. */
|
||||
diff --git a/ld/testsuite/ld-or1k/gotha1.dd b/ld/testsuite/ld-or1k/gotha1.dd
|
||||
new file mode 100644
|
||||
index 00000000000..0ad1f8f5399
|
||||
--- /dev/null
|
||||
+++ b/ld/testsuite/ld-or1k/gotha1.dd
|
||||
@@ -0,0 +1,34 @@
|
||||
+
|
||||
+.*\.x: file format elf32-or1k
|
||||
+
|
||||
+
|
||||
+Disassembly of section \.plt:
|
||||
+
|
||||
+[0-9a-f]+ <\.plt>:
|
||||
+ +[0-9a-f]+: 19 80 00 00 l\.movhi r12,0x0
|
||||
+ +[0-9a-f]+: 85 ec [0-9a-f]+ [0-9a-f]+ l\.lwz r15,[0-9]+\(r12\)
|
||||
+ +[0-9a-f]+: 44 00 78 00 l\.jr r15
|
||||
+ +[0-9a-f]+: 85 8c [0-9a-f]+ [0-9a-f]+ l\.lwz r12,[0-9]+\(r12\)
|
||||
+ +[0-9a-f]+: 19 80 00 00 l\.movhi r12,0x0
|
||||
+ +[0-9a-f]+: 85 8c [0-9a-f]+ [0-9a-f]+ l\.lwz r12,[0-9]+\(r12\)
|
||||
+ +[0-9a-f]+: 44 00 60 00 l\.jr r12
|
||||
+ +[0-9a-f]+: a9 60 00 00 l\.ori r11,r0,0x0
|
||||
+
|
||||
+Disassembly of section \.text:
|
||||
+
|
||||
+[0-9a-f]+ <_start>:
|
||||
+ +[0-9a-f]+: 9c 21 ff fc l\.addi r1,r1,-4
|
||||
+ +[0-9a-f]+: d4 01 48 00 l\.sw 0\(r1\),r9
|
||||
+ +[0-9a-f]+: 04 00 00 02 l\.jal [0-9a-f]+ <_start\+0x10>
|
||||
+ +[0-9a-f]+: 1a 60 00 00 l\.movhi r19,0x0
|
||||
+ +[0-9a-f]+: aa 73 [0-9a-f]+ [0-9a-f]+ l\.ori r19,r19,0x[0-9a-f]+
|
||||
+ +[0-9a-f]+: e2 73 48 00 l\.add r19,r19,r9
|
||||
+ +[0-9a-f]+: 1a 20 00 00 l\.movhi r17,0x0
|
||||
+ +[0-9a-f]+: e2 31 98 00 l\.add r17,r17,r19
|
||||
+ +[0-9a-f]+: 86 31 00 10 l\.lwz r17,16\(r17\)
|
||||
+ +[0-9a-f]+: 84 71 00 00 l\.lwz r3,0\(r17\)
|
||||
+ +[0-9a-f]+: 07 ff ff f2 l\.jal [0-9a-f]+ <\.plt\+0x10>
|
||||
+ +[0-9a-f]+: 15 00 00 00 l\.nop 0x0
|
||||
+ +[0-9a-f]+: 85 21 00 00 l\.lwz r9,0\(r1\)
|
||||
+ +[0-9a-f]+: 44 00 48 00 l\.jr r9
|
||||
+ +[0-9a-f]+: 9c 21 00 04 l\.addi r1,r1,4
|
||||
diff --git a/ld/testsuite/ld-or1k/gotha1.s b/ld/testsuite/ld-or1k/gotha1.s
|
||||
new file mode 100644
|
||||
index 00000000000..42b16db425c
|
||||
--- /dev/null
|
||||
+++ b/ld/testsuite/ld-or1k/gotha1.s
|
||||
@@ -0,0 +1,24 @@
|
||||
+ .data
|
||||
+ .p2align 16
|
||||
+
|
||||
+ .text
|
||||
+ .globl _start
|
||||
+_start:
|
||||
+ l.addi r1, r1, -4
|
||||
+ l.sw 0(r1), r9
|
||||
+
|
||||
+ l.jal 8
|
||||
+ l.movhi r19, gotpchi(_GLOBAL_OFFSET_TABLE_-4)
|
||||
+ l.ori r19, r19, gotpclo(_GLOBAL_OFFSET_TABLE_+0)
|
||||
+ l.add r19, r19, r9
|
||||
+
|
||||
+ l.movhi r17, gotha(x)
|
||||
+ l.add r17, r17, r19
|
||||
+ l.lwz r17, got(x)(r17)
|
||||
+ l.lwz r3, 0(r17)
|
||||
+
|
||||
+ l.jal plt(func)
|
||||
+ l.nop
|
||||
+ l.lwz r9, 0(r1)
|
||||
+ l.jr r9
|
||||
+ l.addi r1, r1, 4
|
||||
diff --git a/ld/testsuite/ld-or1k/gotha2.dd b/ld/testsuite/ld-or1k/gotha2.dd
|
||||
new file mode 100644
|
||||
index 00000000000..fe09da5466b
|
||||
--- /dev/null
|
||||
+++ b/ld/testsuite/ld-or1k/gotha2.dd
|
||||
@@ -0,0 +1,21 @@
|
||||
+
|
||||
+.*\.x: file format elf32-or1k
|
||||
+
|
||||
+
|
||||
+Disassembly of section \.text:
|
||||
+
|
||||
+[0-9a-f]+ <test>:
|
||||
+ +[0-9a-f]+: 9c 21 ff f8 l\.addi r1,r1,-8
|
||||
+ +[0-9a-f]+: d4 01 80 00 l\.sw 0\(r1\),r16
|
||||
+ +[0-9a-f]+: d4 01 48 04 l\.sw 4\(r1\),r9
|
||||
+ +[0-9a-f]+: 04 00 [0-9a-f]+ [0-9a-f]+ l\.jal [0-9a-f]+ <test\+0x14>
|
||||
+ +[0-9a-f]+: 1a 00 00 00 l\.movhi r16,0x0
|
||||
+ +[0-9a-f]+: aa 10 [0-9a-f]+ [0-9a-f]+ l\.ori r16,r16,0x[0-9a-f]+
|
||||
+ +[0-9a-f]+: e2 10 48 00 l\.add r16,r16,r9
|
||||
+ +[0-9a-f]+: 1a 20 00 00 l\.movhi r17,0x0
|
||||
+ +[0-9a-f]+: e2 31 80 00 l\.add r17,r17,r16
|
||||
+ +[0-9a-f]+: 86 31 00 0c l\.lwz r17,12\(r17\)
|
||||
+ +[0-9a-f]+: 85 21 00 04 l\.lwz r9,4\(r1\)
|
||||
+ +[0-9a-f]+: 86 01 00 00 l\.lwz r16,0\(r1\)
|
||||
+ +[0-9a-f]+: 44 00 48 00 l\.jr r9
|
||||
+ +[0-9a-f]+: 9c 21 00 08 l\.addi r1,r1,8
|
||||
diff --git a/ld/testsuite/ld-or1k/gotha2.s b/ld/testsuite/ld-or1k/gotha2.s
|
||||
new file mode 100644
|
||||
index 00000000000..164b282f2dd
|
||||
--- /dev/null
|
||||
+++ b/ld/testsuite/ld-or1k/gotha2.s
|
||||
@@ -0,0 +1,22 @@
|
||||
+ .section .text
|
||||
+ .align 4
|
||||
+ .global test
|
||||
+ .type test, @function
|
||||
+test:
|
||||
+ l.addi r1, r1, -8
|
||||
+ l.sw 0(r1), r16
|
||||
+ l.sw 4(r1), r9
|
||||
+
|
||||
+ l.jal 8
|
||||
+ l.movhi r16, gotpchi(_GLOBAL_OFFSET_TABLE_-4)
|
||||
+ l.ori r16, r16, gotpclo(_GLOBAL_OFFSET_TABLE_+0)
|
||||
+ l.add r16, r16, r9
|
||||
+
|
||||
+ l.movhi r17, gotha(i)
|
||||
+ l.add r17, r17, r16
|
||||
+ l.lwz r17, got(i)(r17)
|
||||
+
|
||||
+ l.lwz r9, 4(r1)
|
||||
+ l.lwz r16, 0(r1)
|
||||
+ l.jr r9
|
||||
+ l.addi r1, r1, 8
|
||||
diff --git a/ld/testsuite/ld-or1k/or1k.exp b/ld/testsuite/ld-or1k/or1k.exp
|
||||
index 7592e8307c1..8e19ec6c31a 100644
|
||||
--- a/ld/testsuite/ld-or1k/or1k.exp
|
||||
+++ b/ld/testsuite/ld-or1k/or1k.exp
|
||||
@@ -53,6 +53,14 @@ set or1kplttests {
|
||||
"" {plt1.s}
|
||||
{{objdump -dr plt1.x.dd}}
|
||||
"plt1.x"}
|
||||
+ {"gotha exec plt" "tmpdir/libpltlib.so" ""
|
||||
+ "" {gotha1.s}
|
||||
+ {{objdump -dr gotha1.dd}}
|
||||
+ "gotha1.x"}
|
||||
+ {"gotha -fpic -shared" "-fpic -shared" ""
|
||||
+ "" {gotha2.s}
|
||||
+ {{objdump -dr gotha2.dd}}
|
||||
+ "gotha2.x"}
|
||||
}
|
||||
|
||||
# Not implemented yet
|
||||
diff --git a/ld/testsuite/ld-or1k/pltlib.s b/ld/testsuite/ld-or1k/pltlib.s
|
||||
index baf76ca1af7..8b4d7ba48fd 100644
|
||||
--- a/ld/testsuite/ld-or1k/pltlib.s
|
||||
+++ b/ld/testsuite/ld-or1k/pltlib.s
|
||||
@@ -1,5 +1,6 @@
|
||||
.section .data
|
||||
.globl x, y
|
||||
+ .size x, 4
|
||||
x: .long 33
|
||||
y: .long 44
|
||||
|
||||
--
|
||||
2.25.1
|
||||
|
@ -0,0 +1,50 @@
|
||||
From c3003947e4bad18faea4337fd2073feeb30ee078 Mon Sep 17 00:00:00 2001
|
||||
From: Giulio Benetti <giulio.benetti@benettiengineering.com>
|
||||
Date: Wed, 9 Jun 2021 17:28:27 +0200
|
||||
Subject: [PATCH] bfd/elf32-or1k: fix building with gcc version < 5
|
||||
|
||||
Gcc version >= 5 has standard C mode not set to -std=gnu11, so if we use
|
||||
an old compiler(i.e. gcc 4.9) build fails on:
|
||||
```
|
||||
elf32-or1k.c:2251:3: error: 'for' loop initial declarations are only allowed in
|
||||
C99 or C11 mode
|
||||
for (size_t i = 0; i < insn_count; i++)
|
||||
^
|
||||
```
|
||||
|
||||
So let's declare `size_t i` at the top of the function instead of inside
|
||||
for loop.
|
||||
|
||||
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
|
||||
---
|
||||
bfd/elf32-or1k.c | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c
|
||||
index 4ae7f324d33..32063ab0289 100644
|
||||
--- a/bfd/elf32-or1k.c
|
||||
+++ b/bfd/elf32-or1k.c
|
||||
@@ -2244,9 +2244,10 @@ or1k_write_plt_entry (bfd *output_bfd, bfd_byte *contents, unsigned insnj,
|
||||
{
|
||||
unsigned nodelay = elf_elfheader (output_bfd)->e_flags & EF_OR1K_NODELAY;
|
||||
unsigned output_insns[PLT_MAX_INSN_COUNT];
|
||||
+ size_t i;
|
||||
|
||||
/* Copy instructions into the output buffer. */
|
||||
- for (size_t i = 0; i < insn_count; i++)
|
||||
+ for (i = 0; i < insn_count; i++)
|
||||
output_insns[i] = insns[i];
|
||||
|
||||
/* Honor the no-delay-slot setting. */
|
||||
@@ -2277,7 +2278,7 @@ or1k_write_plt_entry (bfd *output_bfd, bfd_byte *contents, unsigned insnj,
|
||||
}
|
||||
|
||||
/* Write out the output buffer. */
|
||||
- for (size_t i = 0; i < (insn_count+1); i++)
|
||||
+ for (i = 0; i < (insn_count+1); i++)
|
||||
bfd_put_32 (output_bfd, output_insns[i], contents + (i*4));
|
||||
}
|
||||
|
||||
--
|
||||
2.25.1
|
||||
|
@ -0,0 +1,59 @@
|
||||
From 9af93e143a7fbdb75aa1ed37277f9250eb111628 Mon Sep 17 00:00:00 2001
|
||||
From: Giulio Benetti <giulio.benetti@benettiengineering.com>
|
||||
Date: Sat, 10 Jul 2021 17:57:34 +0200
|
||||
Subject: [PATCH] or1k: fix pc-relative relocation against dynamic on PC
|
||||
relative 26 bit relocation
|
||||
|
||||
When building openal we were seeing the assert failure:
|
||||
|
||||
/home/buildroot/autobuild/run/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/or1k-buildroot-linux-uclibc/9.3.0/../../../../or1k-buildroot-linux-uclibc/bin/ld: CMakeFiles/OpenAL.dir/al/source.cpp.o:
|
||||
pc-relative relocation against dynamic symbol alSourcePausev
|
||||
/home/buildroot/autobuild/run/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/or1k-buildroot-linux-uclibc/9.3.0/../../../../or1k-buildroot-linux-uclibc/bin/ld: CMakeFiles/OpenAL.dir/al/source.cpp.o:
|
||||
pc-relative relocation against dynamic symbol alSourceStopv
|
||||
/home/buildroot/autobuild/run/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/or1k-buildroot-linux-uclibc/9.3.0/../../../../or1k-buildroot-linux-uclibc/bin/ld: CMakeFiles/OpenAL.dir/al/source.cpp.o:
|
||||
pc-relative relocation against dynamic symbol alSourceRewindv
|
||||
/home/buildroot/autobuild/run/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/or1k-buildroot-linux-uclibc/9.3.0/../../../../or1k-buildroot-linux-uclibc/bin/ld: CMakeFiles/OpenAL.dir/al/source.cpp.o:
|
||||
pc-relative relocation against dynamic symbol alSourcePlayv
|
||||
collect2: error: ld returned 1 exit status
|
||||
|
||||
This happens because in R_OR1K_INSN_REL_26 case we can't reference local
|
||||
symbol as previously done but we need to make sure that calls to actual
|
||||
symbol always call the version of current object.
|
||||
|
||||
bfd/Changelog:
|
||||
|
||||
* elf32-or1k.c (or1k_elf_relocate_section): use a separate entry
|
||||
in switch case R_OR1K_INSN_REL_26 where we need to check for
|
||||
!SYMBOL_CALLS_LOCAL() instead of !SYMBOL_REFERENCES_LOCAL().
|
||||
|
||||
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
|
||||
---
|
||||
bfd/elf32-or1k.c | 12 ++++++++++++
|
||||
1 file changed, 12 insertions(+)
|
||||
|
||||
diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c
|
||||
index 4ae7f324d33..4f9092539f5 100644
|
||||
--- a/bfd/elf32-or1k.c
|
||||
+++ b/bfd/elf32-or1k.c
|
||||
@@ -1543,6 +1543,18 @@ or1k_elf_relocate_section (bfd *output_bfd,
|
||||
break;
|
||||
|
||||
case R_OR1K_INSN_REL_26:
|
||||
+ /* For a non-shared link, these will reference plt or call the
|
||||
+ version of actual object. */
|
||||
+ if (bfd_link_pic (info) && !SYMBOL_CALLS_LOCAL (info, h))
|
||||
+ {
|
||||
+ _bfd_error_handler
|
||||
+ (_("%pB: pc-relative relocation against dynamic symbol %s"),
|
||||
+ input_bfd, name);
|
||||
+ ret_val = FALSE;
|
||||
+ bfd_set_error (bfd_error_bad_value);
|
||||
+ }
|
||||
+ break;
|
||||
+
|
||||
case R_OR1K_PCREL_PG21:
|
||||
case R_OR1K_LO13:
|
||||
case R_OR1K_SLO13:
|
||||
--
|
||||
2.25.1
|
||||
|
@ -1,35 +0,0 @@
|
||||
From 1659226a96b1daecfd08c057d0d5c39309d207ee Mon Sep 17 00:00:00 2001
|
||||
From: Giulio Benetti <giulio.benetti@benettiengineering.com>
|
||||
Date: Mon, 22 Mar 2021 13:30:07 +0100
|
||||
Subject: [PATCH] bfd/elf32-or1k: fix ld assert
|
||||
|
||||
Fixes https://sourceware.org/bugzilla/show_bug.cgi?id=27624
|
||||
|
||||
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
|
||||
---
|
||||
bfd/elf32-or1k.c | 9 ++++-----
|
||||
1 file changed, 4 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c
|
||||
index 65938e5137..41908f8938 100644
|
||||
--- a/bfd/elf32-or1k.c
|
||||
+++ b/bfd/elf32-or1k.c
|
||||
@@ -2566,11 +2566,10 @@ or1k_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
|
||||
if (h->type == STT_FUNC
|
||||
|| h->needs_plt)
|
||||
{
|
||||
- if (! bfd_link_pic (info)
|
||||
- && !h->def_dynamic
|
||||
- && !h->ref_dynamic
|
||||
- && h->root.type != bfd_link_hash_undefweak
|
||||
- && h->root.type != bfd_link_hash_undefined)
|
||||
+ if (h->plt.refcount <= 0
|
||||
+ || (SYMBOL_CALLS_LOCAL (info, h)
|
||||
+ || (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
|
||||
+ && h->root.type == bfd_link_hash_undefweak)))
|
||||
{
|
||||
/* This case can occur if we saw a PLT reloc in an input
|
||||
file, but the symbol was never referred to by a dynamic
|
||||
--
|
||||
2.25.1
|
||||
|
@ -0,0 +1,59 @@
|
||||
From baf313f84b106a5a29f01796afd857e69abf8b08 Mon Sep 17 00:00:00 2001
|
||||
From: Stafford Horne <shorne@gmail.com>
|
||||
Date: Sun, 2 May 2021 06:02:14 +0900
|
||||
Subject: [PATCH] or1k: Fix issue with plt link failure for local calls
|
||||
|
||||
When building protobuf we were seeing the assert failure:
|
||||
|
||||
/home/giuliobenetti/git/upstream/or1k-binutils-2.36.1/host/lib/gcc/or1k-buildroot-linux-uclibc/9.3.0/../../../../or1k-buildroot-linux-uclibc/bin/ld:
|
||||
BFD (GNU Binutils) 2.36.1 assertion fail elf32-or1k.c:2377
|
||||
/home/giuliobenetti/git/upstream/or1k-binutils-2.36.1/host/lib/gcc/or1k-buildroot-linux-uclibc/9.3.0/../../../../or1k-buildroot-linux-uclibc/bin/ld:
|
||||
BFD (GNU Binutils) 2.36.1 assertion fail elf32-or1k.c:2377
|
||||
/home/giuliobenetti/git/upstream/or1k-binutils-2.36.1/host/lib/gcc/or1k-buildroot-linux-uclibc/9.3.0/../../../../or1k-buildroot-linux-uclibc/bin/ld:
|
||||
BFD (GNU Binutils) 2.36.1 assertion fail elf32-or1k.c:2377
|
||||
collect2: error: ld returned 1 exit status
|
||||
|
||||
This failure happens while writing out PLT entries, there is a check
|
||||
"BFD_ASSERT (h->dynindx != -1)" to confirm all plt entries have dynamic
|
||||
symbol attributes. This was failing for symbols that were
|
||||
"forced_local" in previous linking code.
|
||||
|
||||
The fix adds logic to or1k_elf_adjust_dynamic_symbol to identify
|
||||
"forced_local" symbols and exclude them from the the PLT.
|
||||
|
||||
bfd/ChangeLog:
|
||||
|
||||
PR 27624
|
||||
* elf32-or1k.c (or1k_elf_adjust_dynamic_symbol): Change
|
||||
condition used to cleanup plt entries to cleanup forced local
|
||||
entries.
|
||||
|
||||
Cc: Giulio Benetti <giulio.benetti@benettiengineering.com>
|
||||
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
|
||||
---
|
||||
bfd/elf32-or1k.c | 9 ++++-----
|
||||
1 file changed, 4 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c
|
||||
index 7c02d004cc7..bbfa2bfe614 100644
|
||||
--- a/bfd/elf32-or1k.c
|
||||
+++ b/bfd/elf32-or1k.c
|
||||
@@ -2568,11 +2568,10 @@ or1k_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
|
||||
if (h->type == STT_FUNC
|
||||
|| h->needs_plt)
|
||||
{
|
||||
- if (! bfd_link_pic (info)
|
||||
- && !h->def_dynamic
|
||||
- && !h->ref_dynamic
|
||||
- && h->root.type != bfd_link_hash_undefweak
|
||||
- && h->root.type != bfd_link_hash_undefined)
|
||||
+ if (h->plt.refcount <= 0
|
||||
+ || (SYMBOL_CALLS_LOCAL (info, h)
|
||||
+ || (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
|
||||
+ && h->root.type == bfd_link_hash_undefweak)))
|
||||
{
|
||||
/* This case can occur if we saw a PLT reloc in an input
|
||||
file, but the symbol was never referred to by a dynamic
|
||||
--
|
||||
2.25.1
|
||||
|
@ -0,0 +1,256 @@
|
||||
From c67656e248d6dadaa2729975a17c8dd03afe48d0 Mon Sep 17 00:00:00 2001
|
||||
From: Stafford Horne <shorne@gmail.com>
|
||||
Date: Sun, 2 May 2021 06:02:15 +0900
|
||||
Subject: [PATCH] or1k: Implement relocation R_OR1K_GOT_AHI16 for gotha()
|
||||
|
||||
The gotha() relocation mnemonic will be outputted by OpenRISC GCC when
|
||||
using the -mcmodel=large option. This relocation is used along with
|
||||
got() to generate 32-bit GOT offsets. This increases the previous GOT
|
||||
offset limit from the previous 16-bit (64K) limit.
|
||||
|
||||
This is needed on large binaries where the GOT grows larger than 64k.
|
||||
|
||||
bfd/ChangeLog:
|
||||
|
||||
PR 21464
|
||||
* bfd-in2.h: Add BFD_RELOC_OR1K_GOT_AHI16 relocation.
|
||||
* elf32-or1k.c (or1k_elf_howto_table, or1k_reloc_map): Likewise.
|
||||
(or1k_final_link_relocate, or1k_elf_relocate_section,
|
||||
or1k_elf_check_relocs): Likewise.
|
||||
* libbfd.h (bfd_reloc_code_real_names): Likewise.
|
||||
* reloc.c: Likewise.
|
||||
|
||||
cpu/ChangeLog:
|
||||
|
||||
PR 21464
|
||||
* or1k.opc (or1k_imm16_relocs, parse_reloc): Define parse logic
|
||||
for gotha() relocation.
|
||||
|
||||
include/ChangeLog:
|
||||
|
||||
PR 21464
|
||||
* elf/or1k.h (elf_or1k_reloc_type): Define R_OR1K_GOT_AHI16 number.
|
||||
|
||||
opcodes/ChangeLog:
|
||||
|
||||
PR 21464
|
||||
* or1k-asm.c: Regenerate.
|
||||
|
||||
gas/ChangeLog:
|
||||
|
||||
PR 21464
|
||||
* testsuite/gas/or1k/reloc-1.s: Add test for new relocation.
|
||||
* testsuite/gas/or1k/reloc-1.d: Add test result for new
|
||||
relocation.
|
||||
|
||||
Cc: Giulio Benetti <giulio.benetti@benettiengineering.com>
|
||||
|
||||
fixup reloc, add tests
|
||||
|
||||
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
|
||||
---
|
||||
bfd/bfd-in2.h | 1 +
|
||||
bfd/elf32-or1k.c | 21 ++++++++++++++++++++-
|
||||
bfd/libbfd.h | 1 +
|
||||
bfd/reloc.c | 2 ++
|
||||
cpu/or1k.opc | 7 ++++++-
|
||||
gas/testsuite/gas/or1k/reloc-1.d | 4 +++-
|
||||
gas/testsuite/gas/or1k/reloc-1.s | 4 ++++
|
||||
include/elf/or1k.h | 1 +
|
||||
opcodes/or1k-asm.c | 7 ++++++-
|
||||
9 files changed, 44 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
|
||||
index df6f9f45673..ab861395e93 100644
|
||||
--- a/bfd/bfd-in2.h
|
||||
+++ b/bfd/bfd-in2.h
|
||||
@@ -5041,6 +5041,7 @@ then it may be truncated to 8 bits. */
|
||||
BFD_RELOC_OR1K_TLS_TPOFF,
|
||||
BFD_RELOC_OR1K_TLS_DTPOFF,
|
||||
BFD_RELOC_OR1K_TLS_DTPMOD,
|
||||
+ BFD_RELOC_OR1K_GOT_AHI16,
|
||||
|
||||
/* H8 elf Relocations. */
|
||||
BFD_RELOC_H8_DIR16A8,
|
||||
diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c
|
||||
index bbfa2bfe614..8e395827123 100644
|
||||
--- a/bfd/elf32-or1k.c
|
||||
+++ b/bfd/elf32-or1k.c
|
||||
@@ -808,6 +808,20 @@ static reloc_howto_type or1k_elf_howto_table[] =
|
||||
0, /* Source Mask. */
|
||||
0x03ffffff, /* Dest Mask. */
|
||||
TRUE), /* PC relative offset? */
|
||||
+
|
||||
+ HOWTO (R_OR1K_GOT_AHI16, /* type */
|
||||
+ 16, /* rightshift */
|
||||
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
+ 16, /* bitsize */
|
||||
+ FALSE, /* pc_relative */
|
||||
+ 0, /* bitpos */
|
||||
+ complain_overflow_signed, /* complain_on_overflow */
|
||||
+ bfd_elf_generic_reloc, /* special_function */
|
||||
+ "R_OR1K_GOT_AHI16", /* name */
|
||||
+ FALSE, /* partial_inplace */
|
||||
+ 0, /* src_mask */
|
||||
+ 0xffff, /* dst_mask */
|
||||
+ FALSE), /* pcrel_offset */
|
||||
};
|
||||
|
||||
/* Map BFD reloc types to Or1k ELF reloc types. */
|
||||
@@ -871,6 +885,7 @@ static const struct or1k_reloc_map or1k_reloc_map[] =
|
||||
{ BFD_RELOC_OR1K_TLS_IE_LO13, R_OR1K_TLS_IE_LO13 },
|
||||
{ BFD_RELOC_OR1K_SLO13, R_OR1K_SLO13 },
|
||||
{ BFD_RELOC_OR1K_PLTA26, R_OR1K_PLTA26 },
|
||||
+ { BFD_RELOC_OR1K_GOT_AHI16, R_OR1K_GOT_AHI16 },
|
||||
};
|
||||
|
||||
/* tls_type is a mask used to track how each symbol is accessed,
|
||||
@@ -1113,6 +1128,7 @@ or1k_final_link_relocate (reloc_howto_type *howto, bfd *input_bfd,
|
||||
switch (howto->type)
|
||||
{
|
||||
case R_OR1K_AHI16:
|
||||
+ case R_OR1K_GOT_AHI16:
|
||||
case R_OR1K_GOTOFF_AHI16:
|
||||
case R_OR1K_TLS_IE_AHI16:
|
||||
case R_OR1K_TLS_LE_AHI16:
|
||||
@@ -1375,6 +1391,7 @@ or1k_elf_relocate_section (bfd *output_bfd,
|
||||
}
|
||||
break;
|
||||
|
||||
+ case R_OR1K_GOT_AHI16:
|
||||
case R_OR1K_GOT16:
|
||||
case R_OR1K_GOT_PG21:
|
||||
case R_OR1K_GOT_LO13:
|
||||
@@ -1466,7 +1483,8 @@ or1k_elf_relocate_section (bfd *output_bfd,
|
||||
/* The GOT_PG21 and GOT_LO13 relocs are pc-relative,
|
||||
while the GOT16 reloc is GOT relative. */
|
||||
relocation = got_base + off;
|
||||
- if (r_type == R_OR1K_GOT16)
|
||||
+ if (r_type == R_OR1K_GOT16
|
||||
+ || r_type == R_OR1K_GOT_AHI16)
|
||||
relocation -= got_sym_value;
|
||||
|
||||
/* Addend should be zero. */
|
||||
@@ -1992,6 +2010,7 @@ or1k_elf_check_relocs (bfd *abfd,
|
||||
}
|
||||
break;
|
||||
|
||||
+ case R_OR1K_GOT_AHI16:
|
||||
case R_OR1K_GOT16:
|
||||
case R_OR1K_GOT_PG21:
|
||||
case R_OR1K_GOT_LO13:
|
||||
diff --git a/bfd/libbfd.h b/bfd/libbfd.h
|
||||
index b97534fc9fe..795c9b9d27f 100644
|
||||
--- a/bfd/libbfd.h
|
||||
+++ b/bfd/libbfd.h
|
||||
@@ -2755,6 +2755,7 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
|
||||
"BFD_RELOC_OR1K_TLS_TPOFF",
|
||||
"BFD_RELOC_OR1K_TLS_DTPOFF",
|
||||
"BFD_RELOC_OR1K_TLS_DTPMOD",
|
||||
+ "BFD_RELOC_OR1K_GOT_AHI16",
|
||||
"BFD_RELOC_H8_DIR16A8",
|
||||
"BFD_RELOC_H8_DIR16R8",
|
||||
"BFD_RELOC_H8_DIR24A8",
|
||||
diff --git a/bfd/reloc.c b/bfd/reloc.c
|
||||
index 9aba84ca81e..1e021febef2 100644
|
||||
--- a/bfd/reloc.c
|
||||
+++ b/bfd/reloc.c
|
||||
@@ -6175,6 +6175,8 @@ ENUMX
|
||||
BFD_RELOC_OR1K_GOTPC_HI16
|
||||
ENUMX
|
||||
BFD_RELOC_OR1K_GOTPC_LO16
|
||||
+ENUMX
|
||||
+ BFD_RELOC_OR1K_GOT_AHI16
|
||||
ENUMX
|
||||
BFD_RELOC_OR1K_GOT16
|
||||
ENUMX
|
||||
diff --git a/cpu/or1k.opc b/cpu/or1k.opc
|
||||
index f0adcbb00a5..5d20a1f33a7 100644
|
||||
--- a/cpu/or1k.opc
|
||||
+++ b/cpu/or1k.opc
|
||||
@@ -193,7 +193,7 @@ static const bfd_reloc_code_real_type or1k_imm16_relocs[][6] = {
|
||||
BFD_RELOC_OR1K_GOT_LO13,
|
||||
BFD_RELOC_UNUSED,
|
||||
BFD_RELOC_UNUSED,
|
||||
- BFD_RELOC_UNUSED },
|
||||
+ BFD_RELOC_OR1K_GOT_AHI16 },
|
||||
{ BFD_RELOC_OR1K_GOTPC_LO16,
|
||||
BFD_RELOC_UNUSED,
|
||||
BFD_RELOC_UNUSED,
|
||||
@@ -296,6 +296,11 @@ parse_reloc (const char **strp)
|
||||
str += 5;
|
||||
cls = RCLASS_TPOFF;
|
||||
}
|
||||
+ else if (strncasecmp (str, "got", 3) == 0)
|
||||
+ {
|
||||
+ str += 3;
|
||||
+ cls = RCLASS_GOT;
|
||||
+ }
|
||||
|
||||
if (strncasecmp (str, "hi(", 3) == 0)
|
||||
{
|
||||
diff --git a/gas/testsuite/gas/or1k/reloc-1.d b/gas/testsuite/gas/or1k/reloc-1.d
|
||||
index d1bcf5608bb..3a001c4ed99 100644
|
||||
--- a/gas/testsuite/gas/or1k/reloc-1.d
|
||||
+++ b/gas/testsuite/gas/or1k/reloc-1.d
|
||||
@@ -68,5 +68,7 @@ OFFSET TYPE VALUE
|
||||
000000ec R_OR1K_LO13 x
|
||||
000000f0 R_OR1K_GOT_LO13 x
|
||||
000000f4 R_OR1K_SLO13 x
|
||||
-
|
||||
+000000f8 R_OR1K_GOT_AHI16 x
|
||||
+000000fc R_OR1K_GOT_AHI16 x
|
||||
+00000100 R_OR1K_GOT_AHI16 x
|
||||
|
||||
diff --git a/gas/testsuite/gas/or1k/reloc-1.s b/gas/testsuite/gas/or1k/reloc-1.s
|
||||
index e76abef6532..562609aa869 100644
|
||||
--- a/gas/testsuite/gas/or1k/reloc-1.s
|
||||
+++ b/gas/testsuite/gas/or1k/reloc-1.s
|
||||
@@ -74,3 +74,7 @@
|
||||
l.lbz r5,po(x)(r3)
|
||||
l.lbz r5,gotpo(x)(r3)
|
||||
l.sb po(x)(r3),r6
|
||||
+
|
||||
+ l.movhi r4,gotha(x)
|
||||
+ l.ori r3,r4,gotha(x)
|
||||
+ l.addi r3,r4,gotha(x)
|
||||
diff --git a/include/elf/or1k.h b/include/elf/or1k.h
|
||||
index a215ef5c17e..dff37d875f2 100644
|
||||
--- a/include/elf/or1k.h
|
||||
+++ b/include/elf/or1k.h
|
||||
@@ -77,6 +77,7 @@ START_RELOC_NUMBERS (elf_or1k_reloc_type)
|
||||
RELOC_NUMBER (R_OR1K_TLS_IE_LO13, 51)
|
||||
RELOC_NUMBER (R_OR1K_SLO13, 52)
|
||||
RELOC_NUMBER (R_OR1K_PLTA26, 53)
|
||||
+ RELOC_NUMBER (R_OR1K_GOT_AHI16, 54)
|
||||
END_RELOC_NUMBERS (R_OR1K_max)
|
||||
|
||||
#define EF_OR1K_NODELAY (1UL << 0)
|
||||
diff --git a/opcodes/or1k-asm.c b/opcodes/or1k-asm.c
|
||||
index 5f3c6c74b12..e0c49b3b8cd 100644
|
||||
--- a/opcodes/or1k-asm.c
|
||||
+++ b/opcodes/or1k-asm.c
|
||||
@@ -177,7 +177,7 @@ static const bfd_reloc_code_real_type or1k_imm16_relocs[][6] = {
|
||||
BFD_RELOC_OR1K_GOT_LO13,
|
||||
BFD_RELOC_UNUSED,
|
||||
BFD_RELOC_UNUSED,
|
||||
- BFD_RELOC_UNUSED },
|
||||
+ BFD_RELOC_OR1K_GOT_AHI16 },
|
||||
{ BFD_RELOC_OR1K_GOTPC_LO16,
|
||||
BFD_RELOC_UNUSED,
|
||||
BFD_RELOC_UNUSED,
|
||||
@@ -280,6 +280,11 @@ parse_reloc (const char **strp)
|
||||
str += 5;
|
||||
cls = RCLASS_TPOFF;
|
||||
}
|
||||
+ else if (strncasecmp (str, "got", 3) == 0)
|
||||
+ {
|
||||
+ str += 3;
|
||||
+ cls = RCLASS_GOT;
|
||||
+ }
|
||||
|
||||
if (strncasecmp (str, "hi(", 3) == 0)
|
||||
{
|
||||
--
|
||||
2.25.1
|
||||
|
@ -0,0 +1,61 @@
|
||||
From 097b83a1c9c694a14e6081cee034bf24f16875c1 Mon Sep 17 00:00:00 2001
|
||||
From: Stafford Horne <shorne@gmail.com>
|
||||
Date: Sun, 2 May 2021 06:02:16 +0900
|
||||
Subject: [PATCH] or1k: Avoid R_OR1K_GOT16 overflow failures in presence of
|
||||
R_OR1K_GOT_AHI16
|
||||
|
||||
Now that we support R_OR1K_GOT_AHI16 we can relax the R_OR1K_GOT16
|
||||
overflow validation check if the section has R_OR1K_GOT_AHI16.
|
||||
|
||||
We cannot simple disable R_OR1K_GOT16 overflow validation as there will
|
||||
still be binaries that will have only R_OR1K_GOT16. The
|
||||
R_OR1K_GOT_AHI16 relocation will only be added by GCC when building with
|
||||
the option -mcmodel=large.
|
||||
|
||||
This assumes that R_OR1K_GOT_AHI16 will come before R_OR1K_GOT16, which
|
||||
is the code pattern that will be emitted by GCC.
|
||||
|
||||
bfd/ChangeLog:
|
||||
|
||||
PR 21464
|
||||
* elf32-or1k.c (or1k_elf_relocate_section): Relax R_OR1K_GOT16
|
||||
overflow check if we have R_OR1K_GOT_AHI16 followed by
|
||||
R_OR1K_GOT16.
|
||||
|
||||
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
|
||||
---
|
||||
bfd/elf32-or1k.c | 11 +++++++++++
|
||||
1 file changed, 11 insertions(+)
|
||||
|
||||
diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c
|
||||
index 8e395827123..9f315bfda99 100644
|
||||
--- a/bfd/elf32-or1k.c
|
||||
+++ b/bfd/elf32-or1k.c
|
||||
@@ -1280,6 +1280,7 @@ or1k_elf_relocate_section (bfd *output_bfd,
|
||||
asection *sgot, *splt;
|
||||
bfd_vma plt_base, got_base, got_sym_value;
|
||||
bfd_boolean ret_val = TRUE;
|
||||
+ bfd_boolean saw_gotha = FALSE;
|
||||
|
||||
if (htab == NULL)
|
||||
return FALSE;
|
||||
@@ -1487,6 +1488,16 @@ or1k_elf_relocate_section (bfd *output_bfd,
|
||||
|| r_type == R_OR1K_GOT_AHI16)
|
||||
relocation -= got_sym_value;
|
||||
|
||||
+ if (r_type == R_OR1K_GOT_AHI16)
|
||||
+ saw_gotha = TRUE;
|
||||
+
|
||||
+ /* If we have a R_OR1K_GOT16 followed by a R_OR1K_GOT_AHI16
|
||||
+ relocation we assume the code is doing the right thing to avoid
|
||||
+ overflows. Here we mask the lower 16-bit of the relocation to
|
||||
+ avoid overflow validation failures. */
|
||||
+ if (r_type == R_OR1K_GOT16 && saw_gotha)
|
||||
+ relocation &= 0xffff;
|
||||
+
|
||||
/* Addend should be zero. */
|
||||
if (rel->r_addend != 0)
|
||||
{
|
||||
--
|
||||
2.25.1
|
||||
|
@ -0,0 +1,500 @@
|
||||
From c87692eb894b4b86eced7b7ba205f9bf27c2c213 Mon Sep 17 00:00:00 2001
|
||||
From: Stafford Horne <shorne@gmail.com>
|
||||
Date: Sun, 2 May 2021 06:02:17 +0900
|
||||
Subject: [PATCH] or1k: Support large plt_relocs when generating plt
|
||||
entries
|
||||
|
||||
The current PLT generation code will generate invalid code when the PLT
|
||||
relocation offset exceeds 64k. This fixes the issue by detecting large
|
||||
plt_reloc offsets and generare code sequences to create larger plt
|
||||
relocations.
|
||||
|
||||
The "large" plt code needs 2 extra instructions to create 32-bit offsets.
|
||||
|
||||
bfd/ChangeLog:
|
||||
|
||||
PR 27746
|
||||
* elf32-or1k.c (PLT_ENTRY_SIZE_LARGE, PLT_MAX_INSN_COUNT,
|
||||
OR1K_ADD, OR1K_ORI): New macros to help with plt creation.
|
||||
(elf_or1k_link_hash_table): New field plt_count.
|
||||
(elf_or1k_link_hash_entry): New field plt_index.
|
||||
(elf_or1k_plt_entry_size): New function.
|
||||
(or1k_write_plt_entry): Update to support variable size PLTs.
|
||||
(or1k_elf_finish_dynamic_sections): Use new or1k_write_plt_entry
|
||||
API.
|
||||
(or1k_elf_finish_dynamic_symbol): Update to write large PLTs
|
||||
when needed.
|
||||
(allocate_dynrelocs): Use elf_or1k_plt_entry_size to account for
|
||||
PLT size.
|
||||
|
||||
ld/ChangeLog:
|
||||
|
||||
PR 27746
|
||||
testsuite/ld-or1k/or1k.exp (or1kplttests): Add tests for linking
|
||||
along with gotha() relocations.
|
||||
testsuite/ld-or1k/gotha1.dd: New file.
|
||||
testsuite/ld-or1k/gotha1.s: New file.
|
||||
testsuite/ld-or1k/gotha2.dd: New file.
|
||||
testsuite/ld-or1k/gotha2.s: New file
|
||||
testsuite/ld-or1k/pltlib.s (x): Define size to avoid link
|
||||
failure.
|
||||
|
||||
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
|
||||
---
|
||||
bfd/elf32-or1k.c | 149 ++++++++++++++++++++++++---------
|
||||
ld/testsuite/ld-or1k/gotha1.dd | 34 ++++++++
|
||||
ld/testsuite/ld-or1k/gotha1.s | 24 ++++++
|
||||
ld/testsuite/ld-or1k/gotha2.dd | 21 +++++
|
||||
ld/testsuite/ld-or1k/gotha2.s | 22 +++++
|
||||
ld/testsuite/ld-or1k/or1k.exp | 8 ++
|
||||
ld/testsuite/ld-or1k/pltlib.s | 1 +
|
||||
7 files changed, 220 insertions(+), 39 deletions(-)
|
||||
create mode 100644 ld/testsuite/ld-or1k/gotha1.dd
|
||||
create mode 100644 ld/testsuite/ld-or1k/gotha1.s
|
||||
create mode 100644 ld/testsuite/ld-or1k/gotha2.dd
|
||||
create mode 100644 ld/testsuite/ld-or1k/gotha2.s
|
||||
|
||||
diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c
|
||||
index 9f315bfda99..7a14eaa3a46 100644
|
||||
--- a/bfd/elf32-or1k.c
|
||||
+++ b/bfd/elf32-or1k.c
|
||||
@@ -30,10 +30,14 @@
|
||||
#define N_ONES(X) (((bfd_vma)2 << (X)) - 1)
|
||||
|
||||
#define PLT_ENTRY_SIZE 16
|
||||
+#define PLT_ENTRY_SIZE_LARGE (6*4)
|
||||
+#define PLT_MAX_INSN_COUNT 6
|
||||
|
||||
#define OR1K_MOVHI(D) (0x18000000 | (D << 21))
|
||||
#define OR1K_ADRP(D) (0x08000000 | (D << 21))
|
||||
#define OR1K_LWZ(D,A) (0x84000000 | (D << 21) | (A << 16))
|
||||
+#define OR1K_ADD(D,A,B) (0xE0000000 | (D << 21) | (A << 16) | (B << 11))
|
||||
+#define OR1K_ORI(D,A) (0xA8000000 | (D << 21) | (A << 16))
|
||||
#define OR1K_ORI0(D) (0xA8000000 | (D << 21))
|
||||
#define OR1K_JR(B) (0x44000000 | (B << 11))
|
||||
#define OR1K_NOP 0x15000000
|
||||
@@ -907,6 +911,8 @@ struct elf_or1k_link_hash_entry
|
||||
{
|
||||
struct elf_link_hash_entry root;
|
||||
|
||||
+ /* For calculating PLT size. */
|
||||
+ bfd_vma plt_index;
|
||||
/* Track type of TLS access. */
|
||||
unsigned char tls_type;
|
||||
};
|
||||
@@ -934,9 +940,20 @@ struct elf_or1k_link_hash_table
|
||||
/* Small local sym to section mapping cache. */
|
||||
struct sym_cache sym_sec;
|
||||
|
||||
+ bfd_vma plt_count;
|
||||
bfd_boolean saw_plta;
|
||||
};
|
||||
|
||||
+static size_t
|
||||
+elf_or1k_plt_entry_size (bfd_vma plt_index)
|
||||
+{
|
||||
+ bfd_vma plt_reloc;
|
||||
+
|
||||
+ plt_reloc = plt_index * sizeof (Elf32_External_Rela);
|
||||
+
|
||||
+ return (plt_reloc > 0xffff) ? PLT_ENTRY_SIZE_LARGE : PLT_ENTRY_SIZE;
|
||||
+}
|
||||
+
|
||||
/* Get the ELF linker hash table from a link_info structure. */
|
||||
#define or1k_elf_hash_table(p) \
|
||||
(elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
|
||||
@@ -2224,33 +2241,46 @@ or1k_elf_check_relocs (bfd *abfd,
|
||||
}
|
||||
|
||||
static void
|
||||
-or1k_write_plt_entry (bfd *output_bfd, bfd_byte *contents, unsigned insn1,
|
||||
- unsigned insn2, unsigned insn3, unsigned insnj)
|
||||
+or1k_write_plt_entry (bfd *output_bfd, bfd_byte *contents, unsigned insnj,
|
||||
+ unsigned insns[], size_t insn_count)
|
||||
{
|
||||
unsigned nodelay = elf_elfheader (output_bfd)->e_flags & EF_OR1K_NODELAY;
|
||||
- unsigned insn4;
|
||||
+ unsigned output_insns[PLT_MAX_INSN_COUNT];
|
||||
+
|
||||
+ /* Copy instructions into the output buffer. */
|
||||
+ for (size_t i = 0; i < insn_count; i++)
|
||||
+ output_insns[i] = insns[i];
|
||||
|
||||
/* Honor the no-delay-slot setting. */
|
||||
- if (insn3 == OR1K_NOP)
|
||||
+ if (insns[insn_count-1] == OR1K_NOP)
|
||||
{
|
||||
- insn4 = insn3;
|
||||
+ unsigned slot1, slot2;
|
||||
+
|
||||
if (nodelay)
|
||||
- insn3 = insnj;
|
||||
+ slot1 = insns[insn_count-2], slot2 = insnj;
|
||||
else
|
||||
- insn3 = insn2, insn2 = insnj;
|
||||
+ slot1 = insnj, slot2 = insns[insn_count-2];
|
||||
+
|
||||
+ output_insns[insn_count-2] = slot1;
|
||||
+ output_insns[insn_count-1] = slot2;
|
||||
+ output_insns[insn_count] = OR1K_NOP;
|
||||
}
|
||||
else
|
||||
{
|
||||
+ unsigned slot1, slot2;
|
||||
+
|
||||
if (nodelay)
|
||||
- insn4 = insnj;
|
||||
+ slot1 = insns[insn_count-1], slot2 = insnj;
|
||||
else
|
||||
- insn4 = insn3, insn3 = insnj;
|
||||
+ slot1 = insnj, slot2 = insns[insn_count-1];
|
||||
+
|
||||
+ output_insns[insn_count-1] = slot1;
|
||||
+ output_insns[insn_count] = slot2;
|
||||
}
|
||||
|
||||
- bfd_put_32 (output_bfd, insn1, contents);
|
||||
- bfd_put_32 (output_bfd, insn2, contents + 4);
|
||||
- bfd_put_32 (output_bfd, insn3, contents + 8);
|
||||
- bfd_put_32 (output_bfd, insn4, contents + 12);
|
||||
+ /* Write out the output buffer. */
|
||||
+ for (size_t i = 0; i < (insn_count+1); i++)
|
||||
+ bfd_put_32 (output_bfd, output_insns[i], contents + (i*4));
|
||||
}
|
||||
|
||||
/* Finish up the dynamic sections. */
|
||||
@@ -2317,7 +2347,8 @@ or1k_elf_finish_dynamic_sections (bfd *output_bfd,
|
||||
splt = htab->root.splt;
|
||||
if (splt && splt->size > 0)
|
||||
{
|
||||
- unsigned plt0, plt1, plt2;
|
||||
+ unsigned plt[PLT_MAX_INSN_COUNT];
|
||||
+ size_t plt_insn_count = 3;
|
||||
bfd_vma got_addr = sgot->output_section->vma + sgot->output_offset;
|
||||
|
||||
/* Note we force 16 byte alignment on the .got, so that
|
||||
@@ -2328,27 +2359,27 @@ or1k_elf_finish_dynamic_sections (bfd *output_bfd,
|
||||
bfd_vma pc = splt->output_section->vma + splt->output_offset;
|
||||
unsigned pa = ((got_addr >> 13) - (pc >> 13)) & 0x1fffff;
|
||||
unsigned po = got_addr & 0x1fff;
|
||||
- plt0 = OR1K_ADRP(12) | pa;
|
||||
- plt1 = OR1K_LWZ(15,12) | (po + 8);
|
||||
- plt2 = OR1K_LWZ(12,12) | (po + 4);
|
||||
+ plt[0] = OR1K_ADRP(12) | pa;
|
||||
+ plt[1] = OR1K_LWZ(15,12) | (po + 8);
|
||||
+ plt[2] = OR1K_LWZ(12,12) | (po + 4);
|
||||
}
|
||||
else if (bfd_link_pic (info))
|
||||
{
|
||||
- plt0 = OR1K_LWZ(15, 16) | 8; /* .got+8 */
|
||||
- plt1 = OR1K_LWZ(12, 16) | 4; /* .got+4 */
|
||||
- plt2 = OR1K_NOP;
|
||||
+ plt[0] = OR1K_LWZ(15, 16) | 8; /* .got+8 */
|
||||
+ plt[1] = OR1K_LWZ(12, 16) | 4; /* .got+4 */
|
||||
+ plt[2] = OR1K_NOP;
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned ha = ((got_addr + 0x8000) >> 16) & 0xffff;
|
||||
unsigned lo = got_addr & 0xffff;
|
||||
- plt0 = OR1K_MOVHI(12) | ha;
|
||||
- plt1 = OR1K_LWZ(15,12) | (lo + 8);
|
||||
- plt2 = OR1K_LWZ(12,12) | (lo + 4);
|
||||
+ plt[0] = OR1K_MOVHI(12) | ha;
|
||||
+ plt[1] = OR1K_LWZ(15,12) | (lo + 8);
|
||||
+ plt[2] = OR1K_LWZ(12,12) | (lo + 4);
|
||||
}
|
||||
|
||||
- or1k_write_plt_entry (output_bfd, splt->contents,
|
||||
- plt0, plt1, plt2, OR1K_JR(15));
|
||||
+ or1k_write_plt_entry (output_bfd, splt->contents, OR1K_JR(15),
|
||||
+ plt, plt_insn_count);
|
||||
|
||||
elf_section_data (splt->output_section)->this_hdr.sh_entsize = 4;
|
||||
}
|
||||
@@ -2391,7 +2422,8 @@ or1k_elf_finish_dynamic_symbol (bfd *output_bfd,
|
||||
|
||||
if (h->plt.offset != (bfd_vma) -1)
|
||||
{
|
||||
- unsigned int plt0, plt1, plt2;
|
||||
+ unsigned int plt[PLT_MAX_INSN_COUNT];
|
||||
+ size_t plt_insn_count = 3;
|
||||
asection *splt;
|
||||
asection *sgot;
|
||||
asection *srela;
|
||||
@@ -2403,6 +2435,7 @@ or1k_elf_finish_dynamic_symbol (bfd *output_bfd,
|
||||
bfd_vma got_offset;
|
||||
bfd_vma got_addr;
|
||||
Elf_Internal_Rela rela;
|
||||
+ bfd_boolean large_plt_entry;
|
||||
|
||||
/* This symbol has an entry in the procedure linkage table. Set
|
||||
it up. */
|
||||
@@ -2420,10 +2453,13 @@ or1k_elf_finish_dynamic_symbol (bfd *output_bfd,
|
||||
corresponds to this symbol. This is the index of this symbol
|
||||
in all the symbols for which we are making plt entries. The
|
||||
first entry in the procedure linkage table is reserved. */
|
||||
- plt_index = h->plt.offset / PLT_ENTRY_SIZE - 1;
|
||||
+ plt_index = ((struct elf_or1k_link_hash_entry *) h)->plt_index;
|
||||
plt_addr = plt_base_addr + h->plt.offset;
|
||||
plt_reloc = plt_index * sizeof (Elf32_External_Rela);
|
||||
|
||||
+ large_plt_entry = (elf_or1k_plt_entry_size (plt_index)
|
||||
+ == PLT_ENTRY_SIZE_LARGE);
|
||||
+
|
||||
/* Get the offset into the .got table of the entry that
|
||||
corresponds to this function. Each .got entry is 4 bytes.
|
||||
The first three are reserved. */
|
||||
@@ -2435,27 +2471,57 @@ or1k_elf_finish_dynamic_symbol (bfd *output_bfd,
|
||||
{
|
||||
unsigned pa = ((got_addr >> 13) - (plt_addr >> 13)) & 0x1fffff;
|
||||
unsigned po = (got_addr & 0x1fff);
|
||||
- plt0 = OR1K_ADRP(12) | pa;
|
||||
- plt1 = OR1K_LWZ(12,12) | po;
|
||||
- plt2 = OR1K_ORI0(11) | plt_reloc;
|
||||
+ plt[0] = OR1K_ADRP(12) | pa;
|
||||
+ plt[1] = OR1K_LWZ(12,12) | po;
|
||||
+ plt[2] = OR1K_ORI0(11) | plt_reloc;
|
||||
}
|
||||
else if (bfd_link_pic (info))
|
||||
{
|
||||
- plt0 = OR1K_LWZ(12,16) | got_offset;
|
||||
- plt1 = OR1K_ORI0(11) | plt_reloc;
|
||||
- plt2 = OR1K_NOP;
|
||||
+ if (large_plt_entry)
|
||||
+ {
|
||||
+ unsigned gotha = ((got_offset + 0x8000) >> 16) & 0xffff;
|
||||
+ unsigned got = got_offset & 0xffff;
|
||||
+ unsigned pltrelhi = (plt_reloc >> 16) & 0xffff;
|
||||
+ unsigned pltrello = plt_reloc & 0xffff;
|
||||
+
|
||||
+ plt[0] = OR1K_MOVHI(12) | gotha;
|
||||
+ plt[1] = OR1K_ADD(12,12,16);
|
||||
+ plt[2] = OR1K_LWZ(12,12) | got;
|
||||
+ plt[3] = OR1K_MOVHI(11) | pltrelhi;
|
||||
+ plt[4] = OR1K_ORI(11,11) | pltrello;
|
||||
+ plt_insn_count = 5;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ plt[0] = OR1K_LWZ(12,16) | got_offset;
|
||||
+ plt[1] = OR1K_ORI0(11) | plt_reloc;
|
||||
+ plt[2] = OR1K_NOP;
|
||||
+ }
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned ha = ((got_addr + 0x8000) >> 16) & 0xffff;
|
||||
unsigned lo = got_addr & 0xffff;
|
||||
- plt0 = OR1K_MOVHI(12) | ha;
|
||||
- plt1 = OR1K_LWZ(12,12) | lo;
|
||||
- plt2 = OR1K_ORI0(11) | plt_reloc;
|
||||
+ plt[0] = OR1K_MOVHI(12) | ha;
|
||||
+ plt[1] = OR1K_LWZ(12,12) | lo;
|
||||
+ plt[2] = OR1K_ORI0(11) | plt_reloc;
|
||||
+ }
|
||||
+
|
||||
+ /* For large code model we fixup the non-PIC PLT relocation instructions
|
||||
+ here. */
|
||||
+ if (large_plt_entry && !bfd_link_pic (info))
|
||||
+ {
|
||||
+ unsigned pltrelhi = (plt_reloc >> 16) & 0xffff;
|
||||
+ unsigned pltrello = plt_reloc & 0xffff;
|
||||
+
|
||||
+ plt[2] = OR1K_MOVHI(11) | pltrelhi;
|
||||
+ plt[3] = OR1K_ORI(11,11) | pltrello;
|
||||
+ plt[4] = OR1K_NOP;
|
||||
+ plt_insn_count = 5;
|
||||
}
|
||||
|
||||
or1k_write_plt_entry (output_bfd, splt->contents + h->plt.offset,
|
||||
- plt0, plt1, plt2, OR1K_JR(12));
|
||||
+ OR1K_JR(12), plt, plt_insn_count);
|
||||
|
||||
/* Fill in the entry in the global offset table. We initialize it to
|
||||
point to the top of the plt. This is done to lazy lookup the actual
|
||||
@@ -2779,11 +2845,16 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
|
||||
if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, bfd_link_pic (info), h))
|
||||
{
|
||||
asection *splt = htab->root.splt;
|
||||
+ bfd_vma plt_index;
|
||||
+
|
||||
+ /* Track the index of our plt entry for use in calculating size. */
|
||||
+ plt_index = htab->plt_count++;
|
||||
+ ((struct elf_or1k_link_hash_entry *) h)->plt_index = plt_index;
|
||||
|
||||
/* If this is the first .plt entry, make room for the special
|
||||
first entry. */
|
||||
if (splt->size == 0)
|
||||
- splt->size = PLT_ENTRY_SIZE;
|
||||
+ splt->size = elf_or1k_plt_entry_size (plt_index);
|
||||
|
||||
h->plt.offset = splt->size;
|
||||
|
||||
@@ -2800,7 +2871,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
|
||||
}
|
||||
|
||||
/* Make room for this entry. */
|
||||
- splt->size += PLT_ENTRY_SIZE;
|
||||
+ splt->size += elf_or1k_plt_entry_size (plt_index);
|
||||
|
||||
/* We also need to make an entry in the .got.plt section, which
|
||||
will be placed in the .got section by the linker script. */
|
||||
diff --git a/ld/testsuite/ld-or1k/gotha1.dd b/ld/testsuite/ld-or1k/gotha1.dd
|
||||
new file mode 100644
|
||||
index 00000000000..0ad1f8f5399
|
||||
--- /dev/null
|
||||
+++ b/ld/testsuite/ld-or1k/gotha1.dd
|
||||
@@ -0,0 +1,34 @@
|
||||
+
|
||||
+.*\.x: file format elf32-or1k
|
||||
+
|
||||
+
|
||||
+Disassembly of section \.plt:
|
||||
+
|
||||
+[0-9a-f]+ <\.plt>:
|
||||
+ +[0-9a-f]+: 19 80 00 00 l\.movhi r12,0x0
|
||||
+ +[0-9a-f]+: 85 ec [0-9a-f]+ [0-9a-f]+ l\.lwz r15,[0-9]+\(r12\)
|
||||
+ +[0-9a-f]+: 44 00 78 00 l\.jr r15
|
||||
+ +[0-9a-f]+: 85 8c [0-9a-f]+ [0-9a-f]+ l\.lwz r12,[0-9]+\(r12\)
|
||||
+ +[0-9a-f]+: 19 80 00 00 l\.movhi r12,0x0
|
||||
+ +[0-9a-f]+: 85 8c [0-9a-f]+ [0-9a-f]+ l\.lwz r12,[0-9]+\(r12\)
|
||||
+ +[0-9a-f]+: 44 00 60 00 l\.jr r12
|
||||
+ +[0-9a-f]+: a9 60 00 00 l\.ori r11,r0,0x0
|
||||
+
|
||||
+Disassembly of section \.text:
|
||||
+
|
||||
+[0-9a-f]+ <_start>:
|
||||
+ +[0-9a-f]+: 9c 21 ff fc l\.addi r1,r1,-4
|
||||
+ +[0-9a-f]+: d4 01 48 00 l\.sw 0\(r1\),r9
|
||||
+ +[0-9a-f]+: 04 00 00 02 l\.jal [0-9a-f]+ <_start\+0x10>
|
||||
+ +[0-9a-f]+: 1a 60 00 00 l\.movhi r19,0x0
|
||||
+ +[0-9a-f]+: aa 73 [0-9a-f]+ [0-9a-f]+ l\.ori r19,r19,0x[0-9a-f]+
|
||||
+ +[0-9a-f]+: e2 73 48 00 l\.add r19,r19,r9
|
||||
+ +[0-9a-f]+: 1a 20 00 00 l\.movhi r17,0x0
|
||||
+ +[0-9a-f]+: e2 31 98 00 l\.add r17,r17,r19
|
||||
+ +[0-9a-f]+: 86 31 00 10 l\.lwz r17,16\(r17\)
|
||||
+ +[0-9a-f]+: 84 71 00 00 l\.lwz r3,0\(r17\)
|
||||
+ +[0-9a-f]+: 07 ff ff f2 l\.jal [0-9a-f]+ <\.plt\+0x10>
|
||||
+ +[0-9a-f]+: 15 00 00 00 l\.nop 0x0
|
||||
+ +[0-9a-f]+: 85 21 00 00 l\.lwz r9,0\(r1\)
|
||||
+ +[0-9a-f]+: 44 00 48 00 l\.jr r9
|
||||
+ +[0-9a-f]+: 9c 21 00 04 l\.addi r1,r1,4
|
||||
diff --git a/ld/testsuite/ld-or1k/gotha1.s b/ld/testsuite/ld-or1k/gotha1.s
|
||||
new file mode 100644
|
||||
index 00000000000..42b16db425c
|
||||
--- /dev/null
|
||||
+++ b/ld/testsuite/ld-or1k/gotha1.s
|
||||
@@ -0,0 +1,24 @@
|
||||
+ .data
|
||||
+ .p2align 16
|
||||
+
|
||||
+ .text
|
||||
+ .globl _start
|
||||
+_start:
|
||||
+ l.addi r1, r1, -4
|
||||
+ l.sw 0(r1), r9
|
||||
+
|
||||
+ l.jal 8
|
||||
+ l.movhi r19, gotpchi(_GLOBAL_OFFSET_TABLE_-4)
|
||||
+ l.ori r19, r19, gotpclo(_GLOBAL_OFFSET_TABLE_+0)
|
||||
+ l.add r19, r19, r9
|
||||
+
|
||||
+ l.movhi r17, gotha(x)
|
||||
+ l.add r17, r17, r19
|
||||
+ l.lwz r17, got(x)(r17)
|
||||
+ l.lwz r3, 0(r17)
|
||||
+
|
||||
+ l.jal plt(func)
|
||||
+ l.nop
|
||||
+ l.lwz r9, 0(r1)
|
||||
+ l.jr r9
|
||||
+ l.addi r1, r1, 4
|
||||
diff --git a/ld/testsuite/ld-or1k/gotha2.dd b/ld/testsuite/ld-or1k/gotha2.dd
|
||||
new file mode 100644
|
||||
index 00000000000..fe09da5466b
|
||||
--- /dev/null
|
||||
+++ b/ld/testsuite/ld-or1k/gotha2.dd
|
||||
@@ -0,0 +1,21 @@
|
||||
+
|
||||
+.*\.x: file format elf32-or1k
|
||||
+
|
||||
+
|
||||
+Disassembly of section \.text:
|
||||
+
|
||||
+[0-9a-f]+ <test>:
|
||||
+ +[0-9a-f]+: 9c 21 ff f8 l\.addi r1,r1,-8
|
||||
+ +[0-9a-f]+: d4 01 80 00 l\.sw 0\(r1\),r16
|
||||
+ +[0-9a-f]+: d4 01 48 04 l\.sw 4\(r1\),r9
|
||||
+ +[0-9a-f]+: 04 00 [0-9a-f]+ [0-9a-f]+ l\.jal [0-9a-f]+ <test\+0x14>
|
||||
+ +[0-9a-f]+: 1a 00 00 00 l\.movhi r16,0x0
|
||||
+ +[0-9a-f]+: aa 10 [0-9a-f]+ [0-9a-f]+ l\.ori r16,r16,0x[0-9a-f]+
|
||||
+ +[0-9a-f]+: e2 10 48 00 l\.add r16,r16,r9
|
||||
+ +[0-9a-f]+: 1a 20 00 00 l\.movhi r17,0x0
|
||||
+ +[0-9a-f]+: e2 31 80 00 l\.add r17,r17,r16
|
||||
+ +[0-9a-f]+: 86 31 00 0c l\.lwz r17,12\(r17\)
|
||||
+ +[0-9a-f]+: 85 21 00 04 l\.lwz r9,4\(r1\)
|
||||
+ +[0-9a-f]+: 86 01 00 00 l\.lwz r16,0\(r1\)
|
||||
+ +[0-9a-f]+: 44 00 48 00 l\.jr r9
|
||||
+ +[0-9a-f]+: 9c 21 00 08 l\.addi r1,r1,8
|
||||
diff --git a/ld/testsuite/ld-or1k/gotha2.s b/ld/testsuite/ld-or1k/gotha2.s
|
||||
new file mode 100644
|
||||
index 00000000000..164b282f2dd
|
||||
--- /dev/null
|
||||
+++ b/ld/testsuite/ld-or1k/gotha2.s
|
||||
@@ -0,0 +1,22 @@
|
||||
+ .section .text
|
||||
+ .align 4
|
||||
+ .global test
|
||||
+ .type test, @function
|
||||
+test:
|
||||
+ l.addi r1, r1, -8
|
||||
+ l.sw 0(r1), r16
|
||||
+ l.sw 4(r1), r9
|
||||
+
|
||||
+ l.jal 8
|
||||
+ l.movhi r16, gotpchi(_GLOBAL_OFFSET_TABLE_-4)
|
||||
+ l.ori r16, r16, gotpclo(_GLOBAL_OFFSET_TABLE_+0)
|
||||
+ l.add r16, r16, r9
|
||||
+
|
||||
+ l.movhi r17, gotha(i)
|
||||
+ l.add r17, r17, r16
|
||||
+ l.lwz r17, got(i)(r17)
|
||||
+
|
||||
+ l.lwz r9, 4(r1)
|
||||
+ l.lwz r16, 0(r1)
|
||||
+ l.jr r9
|
||||
+ l.addi r1, r1, 8
|
||||
diff --git a/ld/testsuite/ld-or1k/or1k.exp b/ld/testsuite/ld-or1k/or1k.exp
|
||||
index 7592e8307c1..8e19ec6c31a 100644
|
||||
--- a/ld/testsuite/ld-or1k/or1k.exp
|
||||
+++ b/ld/testsuite/ld-or1k/or1k.exp
|
||||
@@ -53,6 +53,14 @@ set or1kplttests {
|
||||
"" {plt1.s}
|
||||
{{objdump -dr plt1.x.dd}}
|
||||
"plt1.x"}
|
||||
+ {"gotha exec plt" "tmpdir/libpltlib.so" ""
|
||||
+ "" {gotha1.s}
|
||||
+ {{objdump -dr gotha1.dd}}
|
||||
+ "gotha1.x"}
|
||||
+ {"gotha -fpic -shared" "-fpic -shared" ""
|
||||
+ "" {gotha2.s}
|
||||
+ {{objdump -dr gotha2.dd}}
|
||||
+ "gotha2.x"}
|
||||
}
|
||||
|
||||
# Not implemented yet
|
||||
diff --git a/ld/testsuite/ld-or1k/pltlib.s b/ld/testsuite/ld-or1k/pltlib.s
|
||||
index baf76ca1af7..8b4d7ba48fd 100644
|
||||
--- a/ld/testsuite/ld-or1k/pltlib.s
|
||||
+++ b/ld/testsuite/ld-or1k/pltlib.s
|
||||
@@ -1,5 +1,6 @@
|
||||
.section .data
|
||||
.globl x, y
|
||||
+ .size x, 4
|
||||
x: .long 33
|
||||
y: .long 44
|
||||
|
||||
--
|
||||
2.25.1
|
||||
|
@ -0,0 +1,50 @@
|
||||
From c3003947e4bad18faea4337fd2073feeb30ee078 Mon Sep 17 00:00:00 2001
|
||||
From: Giulio Benetti <giulio.benetti@benettiengineering.com>
|
||||
Date: Wed, 9 Jun 2021 17:28:27 +0200
|
||||
Subject: [PATCH] bfd/elf32-or1k: fix building with gcc version < 5
|
||||
|
||||
Gcc version >= 5 has standard C mode not set to -std=gnu11, so if we use
|
||||
an old compiler(i.e. gcc 4.9) build fails on:
|
||||
```
|
||||
elf32-or1k.c:2251:3: error: 'for' loop initial declarations are only allowed in
|
||||
C99 or C11 mode
|
||||
for (size_t i = 0; i < insn_count; i++)
|
||||
^
|
||||
```
|
||||
|
||||
So let's declare `size_t i` at the top of the function instead of inside
|
||||
for loop.
|
||||
|
||||
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
|
||||
---
|
||||
bfd/elf32-or1k.c | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c
|
||||
index 4ae7f324d33..32063ab0289 100644
|
||||
--- a/bfd/elf32-or1k.c
|
||||
+++ b/bfd/elf32-or1k.c
|
||||
@@ -2244,9 +2244,10 @@ or1k_write_plt_entry (bfd *output_bfd, bfd_byte *contents, unsigned insnj,
|
||||
{
|
||||
unsigned nodelay = elf_elfheader (output_bfd)->e_flags & EF_OR1K_NODELAY;
|
||||
unsigned output_insns[PLT_MAX_INSN_COUNT];
|
||||
+ size_t i;
|
||||
|
||||
/* Copy instructions into the output buffer. */
|
||||
- for (size_t i = 0; i < insn_count; i++)
|
||||
+ for (i = 0; i < insn_count; i++)
|
||||
output_insns[i] = insns[i];
|
||||
|
||||
/* Honor the no-delay-slot setting. */
|
||||
@@ -2277,7 +2278,7 @@ or1k_write_plt_entry (bfd *output_bfd, bfd_byte *contents, unsigned insnj,
|
||||
}
|
||||
|
||||
/* Write out the output buffer. */
|
||||
- for (size_t i = 0; i < (insn_count+1); i++)
|
||||
+ for (i = 0; i < (insn_count+1); i++)
|
||||
bfd_put_32 (output_bfd, output_insns[i], contents + (i*4));
|
||||
}
|
||||
|
||||
--
|
||||
2.25.1
|
||||
|
@ -0,0 +1,59 @@
|
||||
From 9af93e143a7fbdb75aa1ed37277f9250eb111628 Mon Sep 17 00:00:00 2001
|
||||
From: Giulio Benetti <giulio.benetti@benettiengineering.com>
|
||||
Date: Sat, 10 Jul 2021 17:57:34 +0200
|
||||
Subject: [PATCH] or1k: fix pc-relative relocation against dynamic on PC
|
||||
relative 26 bit relocation
|
||||
|
||||
When building openal we were seeing the assert failure:
|
||||
|
||||
/home/buildroot/autobuild/run/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/or1k-buildroot-linux-uclibc/9.3.0/../../../../or1k-buildroot-linux-uclibc/bin/ld: CMakeFiles/OpenAL.dir/al/source.cpp.o:
|
||||
pc-relative relocation against dynamic symbol alSourcePausev
|
||||
/home/buildroot/autobuild/run/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/or1k-buildroot-linux-uclibc/9.3.0/../../../../or1k-buildroot-linux-uclibc/bin/ld: CMakeFiles/OpenAL.dir/al/source.cpp.o:
|
||||
pc-relative relocation against dynamic symbol alSourceStopv
|
||||
/home/buildroot/autobuild/run/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/or1k-buildroot-linux-uclibc/9.3.0/../../../../or1k-buildroot-linux-uclibc/bin/ld: CMakeFiles/OpenAL.dir/al/source.cpp.o:
|
||||
pc-relative relocation against dynamic symbol alSourceRewindv
|
||||
/home/buildroot/autobuild/run/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/or1k-buildroot-linux-uclibc/9.3.0/../../../../or1k-buildroot-linux-uclibc/bin/ld: CMakeFiles/OpenAL.dir/al/source.cpp.o:
|
||||
pc-relative relocation against dynamic symbol alSourcePlayv
|
||||
collect2: error: ld returned 1 exit status
|
||||
|
||||
This happens because in R_OR1K_INSN_REL_26 case we can't reference local
|
||||
symbol as previously done but we need to make sure that calls to actual
|
||||
symbol always call the version of current object.
|
||||
|
||||
bfd/Changelog:
|
||||
|
||||
* elf32-or1k.c (or1k_elf_relocate_section): use a separate entry
|
||||
in switch case R_OR1K_INSN_REL_26 where we need to check for
|
||||
!SYMBOL_CALLS_LOCAL() instead of !SYMBOL_REFERENCES_LOCAL().
|
||||
|
||||
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
|
||||
---
|
||||
bfd/elf32-or1k.c | 12 ++++++++++++
|
||||
1 file changed, 12 insertions(+)
|
||||
|
||||
diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c
|
||||
index 4ae7f324d33..4f9092539f5 100644
|
||||
--- a/bfd/elf32-or1k.c
|
||||
+++ b/bfd/elf32-or1k.c
|
||||
@@ -1543,6 +1543,18 @@ or1k_elf_relocate_section (bfd *output_bfd,
|
||||
break;
|
||||
|
||||
case R_OR1K_INSN_REL_26:
|
||||
+ /* For a non-shared link, these will reference plt or call the
|
||||
+ version of actual object. */
|
||||
+ if (bfd_link_pic (info) && !SYMBOL_CALLS_LOCAL (info, h))
|
||||
+ {
|
||||
+ _bfd_error_handler
|
||||
+ (_("%pB: pc-relative relocation against dynamic symbol %s"),
|
||||
+ input_bfd, name);
|
||||
+ ret_val = FALSE;
|
||||
+ bfd_set_error (bfd_error_bad_value);
|
||||
+ }
|
||||
+ break;
|
||||
+
|
||||
case R_OR1K_PCREL_PG21:
|
||||
case R_OR1K_LO13:
|
||||
case R_OR1K_SLO13:
|
||||
--
|
||||
2.25.1
|
||||
|
@ -1,35 +0,0 @@
|
||||
From 1659226a96b1daecfd08c057d0d5c39309d207ee Mon Sep 17 00:00:00 2001
|
||||
From: Giulio Benetti <giulio.benetti@benettiengineering.com>
|
||||
Date: Mon, 22 Mar 2021 13:30:07 +0100
|
||||
Subject: [PATCH] bfd/elf32-or1k: fix ld assert
|
||||
|
||||
Fixes https://sourceware.org/bugzilla/show_bug.cgi?id=27624
|
||||
|
||||
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
|
||||
---
|
||||
bfd/elf32-or1k.c | 9 ++++-----
|
||||
1 file changed, 4 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c
|
||||
index 65938e5137..41908f8938 100644
|
||||
--- a/bfd/elf32-or1k.c
|
||||
+++ b/bfd/elf32-or1k.c
|
||||
@@ -2566,11 +2566,10 @@ or1k_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
|
||||
if (h->type == STT_FUNC
|
||||
|| h->needs_plt)
|
||||
{
|
||||
- if (! bfd_link_pic (info)
|
||||
- && !h->def_dynamic
|
||||
- && !h->ref_dynamic
|
||||
- && h->root.type != bfd_link_hash_undefweak
|
||||
- && h->root.type != bfd_link_hash_undefined)
|
||||
+ if (h->plt.refcount <= 0
|
||||
+ || (SYMBOL_CALLS_LOCAL (info, h)
|
||||
+ || (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
|
||||
+ && h->root.type == bfd_link_hash_undefweak)))
|
||||
{
|
||||
/* This case can occur if we saw a PLT reloc in an input
|
||||
file, but the symbol was never referred to by a dynamic
|
||||
--
|
||||
2.25.1
|
||||
|
@ -0,0 +1,59 @@
|
||||
From b5fdaa85790dff45fd2c3fd15405c16dbc50a074 Mon Sep 17 00:00:00 2001
|
||||
From: Stafford Horne <shorne@gmail.com>
|
||||
Date: Sun, 2 May 2021 06:02:14 +0900
|
||||
Subject: [PATCH] or1k: Fix issue with plt link failure for local calls
|
||||
|
||||
When building protobuf we were seeing the assert failure:
|
||||
|
||||
/home/giuliobenetti/git/upstream/or1k-binutils-2.36.1/host/lib/gcc/or1k-buildroot-linux-uclibc/9.3.0/../../../../or1k-buildroot-linux-uclibc/bin/ld:
|
||||
BFD (GNU Binutils) 2.36.1 assertion fail elf32-or1k.c:2377
|
||||
/home/giuliobenetti/git/upstream/or1k-binutils-2.36.1/host/lib/gcc/or1k-buildroot-linux-uclibc/9.3.0/../../../../or1k-buildroot-linux-uclibc/bin/ld:
|
||||
BFD (GNU Binutils) 2.36.1 assertion fail elf32-or1k.c:2377
|
||||
/home/giuliobenetti/git/upstream/or1k-binutils-2.36.1/host/lib/gcc/or1k-buildroot-linux-uclibc/9.3.0/../../../../or1k-buildroot-linux-uclibc/bin/ld:
|
||||
BFD (GNU Binutils) 2.36.1 assertion fail elf32-or1k.c:2377
|
||||
collect2: error: ld returned 1 exit status
|
||||
|
||||
This failure happens while writing out PLT entries, there is a check
|
||||
"BFD_ASSERT (h->dynindx != -1)" to confirm all plt entries have dynamic
|
||||
symbol attributes. This was failing for symbols that were
|
||||
"forced_local" in previous linking code.
|
||||
|
||||
The fix adds logic to or1k_elf_adjust_dynamic_symbol to identify
|
||||
"forced_local" symbols and exclude them from the the PLT.
|
||||
|
||||
bfd/ChangeLog:
|
||||
|
||||
PR 27624
|
||||
* elf32-or1k.c (or1k_elf_adjust_dynamic_symbol): Change
|
||||
condition used to cleanup plt entries to cleanup forced local
|
||||
entries.
|
||||
|
||||
Cc: Giulio Benetti <giulio.benetti@benettiengineering.com>
|
||||
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
|
||||
---
|
||||
bfd/elf32-or1k.c | 9 ++++-----
|
||||
1 file changed, 4 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c
|
||||
index 65938e51378..4f82cc4c667 100644
|
||||
--- a/bfd/elf32-or1k.c
|
||||
+++ b/bfd/elf32-or1k.c
|
||||
@@ -2566,11 +2566,10 @@ or1k_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
|
||||
if (h->type == STT_FUNC
|
||||
|| h->needs_plt)
|
||||
{
|
||||
- if (! bfd_link_pic (info)
|
||||
- && !h->def_dynamic
|
||||
- && !h->ref_dynamic
|
||||
- && h->root.type != bfd_link_hash_undefweak
|
||||
- && h->root.type != bfd_link_hash_undefined)
|
||||
+ if (h->plt.refcount <= 0
|
||||
+ || (SYMBOL_CALLS_LOCAL (info, h)
|
||||
+ || (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
|
||||
+ && h->root.type == bfd_link_hash_undefweak)))
|
||||
{
|
||||
/* This case can occur if we saw a PLT reloc in an input
|
||||
file, but the symbol was never referred to by a dynamic
|
||||
--
|
||||
2.25.1
|
||||
|
@ -0,0 +1,256 @@
|
||||
From 141dee7402871c7b3994838c3eddf64a92d67be7 Mon Sep 17 00:00:00 2001
|
||||
From: Stafford Horne <shorne@gmail.com>
|
||||
Date: Sun, 2 May 2021 06:02:15 +0900
|
||||
Subject: [PATCH] or1k: Implement relocation R_OR1K_GOT_AHI16 for gotha()
|
||||
|
||||
The gotha() relocation mnemonic will be outputted by OpenRISC GCC when
|
||||
using the -mcmodel=large option. This relocation is used along with
|
||||
got() to generate 32-bit GOT offsets. This increases the previous GOT
|
||||
offset limit from the previous 16-bit (64K) limit.
|
||||
|
||||
This is needed on large binaries where the GOT grows larger than 64k.
|
||||
|
||||
bfd/ChangeLog:
|
||||
|
||||
PR 21464
|
||||
* bfd-in2.h: Add BFD_RELOC_OR1K_GOT_AHI16 relocation.
|
||||
* elf32-or1k.c (or1k_elf_howto_table, or1k_reloc_map): Likewise.
|
||||
(or1k_final_link_relocate, or1k_elf_relocate_section,
|
||||
or1k_elf_check_relocs): Likewise.
|
||||
* libbfd.h (bfd_reloc_code_real_names): Likewise.
|
||||
* reloc.c: Likewise.
|
||||
|
||||
cpu/ChangeLog:
|
||||
|
||||
PR 21464
|
||||
* or1k.opc (or1k_imm16_relocs, parse_reloc): Define parse logic
|
||||
for gotha() relocation.
|
||||
|
||||
include/ChangeLog:
|
||||
|
||||
PR 21464
|
||||
* elf/or1k.h (elf_or1k_reloc_type): Define R_OR1K_GOT_AHI16 number.
|
||||
|
||||
opcodes/ChangeLog:
|
||||
|
||||
PR 21464
|
||||
* or1k-asm.c: Regenerate.
|
||||
|
||||
gas/ChangeLog:
|
||||
|
||||
PR 21464
|
||||
* testsuite/gas/or1k/reloc-1.s: Add test for new relocation.
|
||||
* testsuite/gas/or1k/reloc-1.d: Add test result for new
|
||||
relocation.
|
||||
|
||||
Cc: Giulio Benetti <giulio.benetti@benettiengineering.com>
|
||||
|
||||
fixup reloc, add tests
|
||||
|
||||
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
|
||||
---
|
||||
bfd/bfd-in2.h | 1 +
|
||||
bfd/elf32-or1k.c | 21 ++++++++++++++++++++-
|
||||
bfd/libbfd.h | 1 +
|
||||
bfd/reloc.c | 2 ++
|
||||
cpu/or1k.opc | 7 ++++++-
|
||||
gas/testsuite/gas/or1k/reloc-1.d | 4 +++-
|
||||
gas/testsuite/gas/or1k/reloc-1.s | 4 ++++
|
||||
include/elf/or1k.h | 1 +
|
||||
opcodes/or1k-asm.c | 7 ++++++-
|
||||
9 files changed, 44 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
|
||||
index 7eff85b7eaa..e76b9e7a319 100644
|
||||
--- a/bfd/bfd-in2.h
|
||||
+++ b/bfd/bfd-in2.h
|
||||
@@ -5048,6 +5048,7 @@ then it may be truncated to 8 bits. */
|
||||
BFD_RELOC_OR1K_TLS_TPOFF,
|
||||
BFD_RELOC_OR1K_TLS_DTPOFF,
|
||||
BFD_RELOC_OR1K_TLS_DTPMOD,
|
||||
+ BFD_RELOC_OR1K_GOT_AHI16,
|
||||
|
||||
/* H8 elf Relocations. */
|
||||
BFD_RELOC_H8_DIR16A8,
|
||||
diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c
|
||||
index 4f82cc4c667..48461854a96 100644
|
||||
--- a/bfd/elf32-or1k.c
|
||||
+++ b/bfd/elf32-or1k.c
|
||||
@@ -808,6 +808,20 @@ static reloc_howto_type or1k_elf_howto_table[] =
|
||||
0, /* Source Mask. */
|
||||
0x03ffffff, /* Dest Mask. */
|
||||
TRUE), /* PC relative offset? */
|
||||
+
|
||||
+ HOWTO (R_OR1K_GOT_AHI16, /* type */
|
||||
+ 16, /* rightshift */
|
||||
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
+ 16, /* bitsize */
|
||||
+ FALSE, /* pc_relative */
|
||||
+ 0, /* bitpos */
|
||||
+ complain_overflow_signed, /* complain_on_overflow */
|
||||
+ bfd_elf_generic_reloc, /* special_function */
|
||||
+ "R_OR1K_GOT_AHI16", /* name */
|
||||
+ FALSE, /* partial_inplace */
|
||||
+ 0, /* src_mask */
|
||||
+ 0xffff, /* dst_mask */
|
||||
+ FALSE), /* pcrel_offset */
|
||||
};
|
||||
|
||||
/* Map BFD reloc types to Or1k ELF reloc types. */
|
||||
@@ -871,6 +885,7 @@ static const struct or1k_reloc_map or1k_reloc_map[] =
|
||||
{ BFD_RELOC_OR1K_TLS_IE_LO13, R_OR1K_TLS_IE_LO13 },
|
||||
{ BFD_RELOC_OR1K_SLO13, R_OR1K_SLO13 },
|
||||
{ BFD_RELOC_OR1K_PLTA26, R_OR1K_PLTA26 },
|
||||
+ { BFD_RELOC_OR1K_GOT_AHI16, R_OR1K_GOT_AHI16 },
|
||||
};
|
||||
|
||||
/* tls_type is a mask used to track how each symbol is accessed,
|
||||
@@ -1111,6 +1126,7 @@ or1k_final_link_relocate (reloc_howto_type *howto, bfd *input_bfd,
|
||||
switch (howto->type)
|
||||
{
|
||||
case R_OR1K_AHI16:
|
||||
+ case R_OR1K_GOT_AHI16:
|
||||
case R_OR1K_GOTOFF_AHI16:
|
||||
case R_OR1K_TLS_IE_AHI16:
|
||||
case R_OR1K_TLS_LE_AHI16:
|
||||
@@ -1373,6 +1389,7 @@ or1k_elf_relocate_section (bfd *output_bfd,
|
||||
}
|
||||
break;
|
||||
|
||||
+ case R_OR1K_GOT_AHI16:
|
||||
case R_OR1K_GOT16:
|
||||
case R_OR1K_GOT_PG21:
|
||||
case R_OR1K_GOT_LO13:
|
||||
@@ -1464,7 +1481,8 @@ or1k_elf_relocate_section (bfd *output_bfd,
|
||||
/* The GOT_PG21 and GOT_LO13 relocs are pc-relative,
|
||||
while the GOT16 reloc is GOT relative. */
|
||||
relocation = got_base + off;
|
||||
- if (r_type == R_OR1K_GOT16)
|
||||
+ if (r_type == R_OR1K_GOT16
|
||||
+ || r_type == R_OR1K_GOT_AHI16)
|
||||
relocation -= got_sym_value;
|
||||
|
||||
/* Addend should be zero. */
|
||||
@@ -1990,6 +2008,7 @@ or1k_elf_check_relocs (bfd *abfd,
|
||||
}
|
||||
break;
|
||||
|
||||
+ case R_OR1K_GOT_AHI16:
|
||||
case R_OR1K_GOT16:
|
||||
case R_OR1K_GOT_PG21:
|
||||
case R_OR1K_GOT_LO13:
|
||||
diff --git a/bfd/libbfd.h b/bfd/libbfd.h
|
||||
index 7271a2ad5a1..e0ee2dafc07 100644
|
||||
--- a/bfd/libbfd.h
|
||||
+++ b/bfd/libbfd.h
|
||||
@@ -2757,6 +2757,7 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
|
||||
"BFD_RELOC_OR1K_TLS_TPOFF",
|
||||
"BFD_RELOC_OR1K_TLS_DTPOFF",
|
||||
"BFD_RELOC_OR1K_TLS_DTPMOD",
|
||||
+ "BFD_RELOC_OR1K_GOT_AHI16",
|
||||
"BFD_RELOC_H8_DIR16A8",
|
||||
"BFD_RELOC_H8_DIR16R8",
|
||||
"BFD_RELOC_H8_DIR24A8",
|
||||
diff --git a/bfd/reloc.c b/bfd/reloc.c
|
||||
index 4f4b95a0b7f..fe94e0d8f91 100644
|
||||
--- a/bfd/reloc.c
|
||||
+++ b/bfd/reloc.c
|
||||
@@ -6204,6 +6204,8 @@ ENUMX
|
||||
BFD_RELOC_OR1K_GOTPC_HI16
|
||||
ENUMX
|
||||
BFD_RELOC_OR1K_GOTPC_LO16
|
||||
+ENUMX
|
||||
+ BFD_RELOC_OR1K_GOT_AHI16
|
||||
ENUMX
|
||||
BFD_RELOC_OR1K_GOT16
|
||||
ENUMX
|
||||
diff --git a/cpu/or1k.opc b/cpu/or1k.opc
|
||||
index f0adcbb00a5..5d20a1f33a7 100644
|
||||
--- a/cpu/or1k.opc
|
||||
+++ b/cpu/or1k.opc
|
||||
@@ -193,7 +193,7 @@ static const bfd_reloc_code_real_type or1k_imm16_relocs[][6] = {
|
||||
BFD_RELOC_OR1K_GOT_LO13,
|
||||
BFD_RELOC_UNUSED,
|
||||
BFD_RELOC_UNUSED,
|
||||
- BFD_RELOC_UNUSED },
|
||||
+ BFD_RELOC_OR1K_GOT_AHI16 },
|
||||
{ BFD_RELOC_OR1K_GOTPC_LO16,
|
||||
BFD_RELOC_UNUSED,
|
||||
BFD_RELOC_UNUSED,
|
||||
@@ -296,6 +296,11 @@ parse_reloc (const char **strp)
|
||||
str += 5;
|
||||
cls = RCLASS_TPOFF;
|
||||
}
|
||||
+ else if (strncasecmp (str, "got", 3) == 0)
|
||||
+ {
|
||||
+ str += 3;
|
||||
+ cls = RCLASS_GOT;
|
||||
+ }
|
||||
|
||||
if (strncasecmp (str, "hi(", 3) == 0)
|
||||
{
|
||||
diff --git a/gas/testsuite/gas/or1k/reloc-1.d b/gas/testsuite/gas/or1k/reloc-1.d
|
||||
index d1bcf5608bb..3a001c4ed99 100644
|
||||
--- a/gas/testsuite/gas/or1k/reloc-1.d
|
||||
+++ b/gas/testsuite/gas/or1k/reloc-1.d
|
||||
@@ -68,5 +68,7 @@ OFFSET TYPE VALUE
|
||||
000000ec R_OR1K_LO13 x
|
||||
000000f0 R_OR1K_GOT_LO13 x
|
||||
000000f4 R_OR1K_SLO13 x
|
||||
-
|
||||
+000000f8 R_OR1K_GOT_AHI16 x
|
||||
+000000fc R_OR1K_GOT_AHI16 x
|
||||
+00000100 R_OR1K_GOT_AHI16 x
|
||||
|
||||
diff --git a/gas/testsuite/gas/or1k/reloc-1.s b/gas/testsuite/gas/or1k/reloc-1.s
|
||||
index e76abef6532..562609aa869 100644
|
||||
--- a/gas/testsuite/gas/or1k/reloc-1.s
|
||||
+++ b/gas/testsuite/gas/or1k/reloc-1.s
|
||||
@@ -74,3 +74,7 @@
|
||||
l.lbz r5,po(x)(r3)
|
||||
l.lbz r5,gotpo(x)(r3)
|
||||
l.sb po(x)(r3),r6
|
||||
+
|
||||
+ l.movhi r4,gotha(x)
|
||||
+ l.ori r3,r4,gotha(x)
|
||||
+ l.addi r3,r4,gotha(x)
|
||||
diff --git a/include/elf/or1k.h b/include/elf/or1k.h
|
||||
index 7f281481061..69ab90584a2 100644
|
||||
--- a/include/elf/or1k.h
|
||||
+++ b/include/elf/or1k.h
|
||||
@@ -77,6 +77,7 @@ START_RELOC_NUMBERS (elf_or1k_reloc_type)
|
||||
RELOC_NUMBER (R_OR1K_TLS_IE_LO13, 51)
|
||||
RELOC_NUMBER (R_OR1K_SLO13, 52)
|
||||
RELOC_NUMBER (R_OR1K_PLTA26, 53)
|
||||
+ RELOC_NUMBER (R_OR1K_GOT_AHI16, 54)
|
||||
END_RELOC_NUMBERS (R_OR1K_max)
|
||||
|
||||
#define EF_OR1K_NODELAY (1UL << 0)
|
||||
diff --git a/opcodes/or1k-asm.c b/opcodes/or1k-asm.c
|
||||
index 045ab6230b6..fdccf67f9e1 100644
|
||||
--- a/opcodes/or1k-asm.c
|
||||
+++ b/opcodes/or1k-asm.c
|
||||
@@ -177,7 +177,7 @@ static const bfd_reloc_code_real_type or1k_imm16_relocs[][6] = {
|
||||
BFD_RELOC_OR1K_GOT_LO13,
|
||||
BFD_RELOC_UNUSED,
|
||||
BFD_RELOC_UNUSED,
|
||||
- BFD_RELOC_UNUSED },
|
||||
+ BFD_RELOC_OR1K_GOT_AHI16 },
|
||||
{ BFD_RELOC_OR1K_GOTPC_LO16,
|
||||
BFD_RELOC_UNUSED,
|
||||
BFD_RELOC_UNUSED,
|
||||
@@ -280,6 +280,11 @@ parse_reloc (const char **strp)
|
||||
str += 5;
|
||||
cls = RCLASS_TPOFF;
|
||||
}
|
||||
+ else if (strncasecmp (str, "got", 3) == 0)
|
||||
+ {
|
||||
+ str += 3;
|
||||
+ cls = RCLASS_GOT;
|
||||
+ }
|
||||
|
||||
if (strncasecmp (str, "hi(", 3) == 0)
|
||||
{
|
||||
--
|
||||
2.25.1
|
||||
|
@ -0,0 +1,61 @@
|
||||
From de914df5f2ba23a9f6f1fbf6efdc22e1b045901c Mon Sep 17 00:00:00 2001
|
||||
From: Stafford Horne <shorne@gmail.com>
|
||||
Date: Sun, 2 May 2021 06:02:16 +0900
|
||||
Subject: [PATCH] or1k: Avoid R_OR1K_GOT16 overflow failures in presence of
|
||||
R_OR1K_GOT_AHI16
|
||||
|
||||
Now that we support R_OR1K_GOT_AHI16 we can relax the R_OR1K_GOT16
|
||||
overflow validation check if the section has R_OR1K_GOT_AHI16.
|
||||
|
||||
We cannot simple disable R_OR1K_GOT16 overflow validation as there will
|
||||
still be binaries that will have only R_OR1K_GOT16. The
|
||||
R_OR1K_GOT_AHI16 relocation will only be added by GCC when building with
|
||||
the option -mcmodel=large.
|
||||
|
||||
This assumes that R_OR1K_GOT_AHI16 will come before R_OR1K_GOT16, which
|
||||
is the code pattern that will be emitted by GCC.
|
||||
|
||||
bfd/ChangeLog:
|
||||
|
||||
PR 21464
|
||||
* elf32-or1k.c (or1k_elf_relocate_section): Relax R_OR1K_GOT16
|
||||
overflow check if we have R_OR1K_GOT_AHI16 followed by
|
||||
R_OR1K_GOT16.
|
||||
|
||||
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
|
||||
---
|
||||
bfd/elf32-or1k.c | 11 +++++++++++
|
||||
1 file changed, 11 insertions(+)
|
||||
|
||||
diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c
|
||||
index 48461854a96..44e67f2b84b 100644
|
||||
--- a/bfd/elf32-or1k.c
|
||||
+++ b/bfd/elf32-or1k.c
|
||||
@@ -1278,6 +1278,7 @@ or1k_elf_relocate_section (bfd *output_bfd,
|
||||
asection *sgot, *splt;
|
||||
bfd_vma plt_base, got_base, got_sym_value;
|
||||
bfd_boolean ret_val = TRUE;
|
||||
+ bfd_boolean saw_gotha = FALSE;
|
||||
|
||||
if (htab == NULL)
|
||||
return FALSE;
|
||||
@@ -1485,6 +1486,16 @@ or1k_elf_relocate_section (bfd *output_bfd,
|
||||
|| r_type == R_OR1K_GOT_AHI16)
|
||||
relocation -= got_sym_value;
|
||||
|
||||
+ if (r_type == R_OR1K_GOT_AHI16)
|
||||
+ saw_gotha = TRUE;
|
||||
+
|
||||
+ /* If we have a R_OR1K_GOT16 followed by a R_OR1K_GOT_AHI16
|
||||
+ relocation we assume the code is doing the right thing to avoid
|
||||
+ overflows. Here we mask the lower 16-bit of the relocation to
|
||||
+ avoid overflow validation failures. */
|
||||
+ if (r_type == R_OR1K_GOT16 && saw_gotha)
|
||||
+ relocation &= 0xffff;
|
||||
+
|
||||
/* Addend should be zero. */
|
||||
if (rel->r_addend != 0)
|
||||
{
|
||||
--
|
||||
2.25.1
|
||||
|
@ -0,0 +1,500 @@
|
||||
From 4a7b357d0c802685bee7706bafb9702c821286e1 Mon Sep 17 00:00:00 2001
|
||||
From: Stafford Horne <shorne@gmail.com>
|
||||
Date: Sun, 2 May 2021 06:02:17 +0900
|
||||
Subject: [PATCH] or1k: Support large plt_relocs when generating plt
|
||||
entries
|
||||
|
||||
The current PLT generation code will generate invalid code when the PLT
|
||||
relocation offset exceeds 64k. This fixes the issue by detecting large
|
||||
plt_reloc offsets and generare code sequences to create larger plt
|
||||
relocations.
|
||||
|
||||
The "large" plt code needs 2 extra instructions to create 32-bit offsets.
|
||||
|
||||
bfd/ChangeLog:
|
||||
|
||||
PR 27746
|
||||
* elf32-or1k.c (PLT_ENTRY_SIZE_LARGE, PLT_MAX_INSN_COUNT,
|
||||
OR1K_ADD, OR1K_ORI): New macros to help with plt creation.
|
||||
(elf_or1k_link_hash_table): New field plt_count.
|
||||
(elf_or1k_link_hash_entry): New field plt_index.
|
||||
(elf_or1k_plt_entry_size): New function.
|
||||
(or1k_write_plt_entry): Update to support variable size PLTs.
|
||||
(or1k_elf_finish_dynamic_sections): Use new or1k_write_plt_entry
|
||||
API.
|
||||
(or1k_elf_finish_dynamic_symbol): Update to write large PLTs
|
||||
when needed.
|
||||
(allocate_dynrelocs): Use elf_or1k_plt_entry_size to account for
|
||||
PLT size.
|
||||
|
||||
ld/ChangeLog:
|
||||
|
||||
PR 27746
|
||||
testsuite/ld-or1k/or1k.exp (or1kplttests): Add tests for linking
|
||||
along with gotha() relocations.
|
||||
testsuite/ld-or1k/gotha1.dd: New file.
|
||||
testsuite/ld-or1k/gotha1.s: New file.
|
||||
testsuite/ld-or1k/gotha2.dd: New file.
|
||||
testsuite/ld-or1k/gotha2.s: New file
|
||||
testsuite/ld-or1k/pltlib.s (x): Define size to avoid link
|
||||
failure.
|
||||
|
||||
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
|
||||
---
|
||||
bfd/elf32-or1k.c | 149 ++++++++++++++++++++++++---------
|
||||
ld/testsuite/ld-or1k/gotha1.dd | 34 ++++++++
|
||||
ld/testsuite/ld-or1k/gotha1.s | 24 ++++++
|
||||
ld/testsuite/ld-or1k/gotha2.dd | 21 +++++
|
||||
ld/testsuite/ld-or1k/gotha2.s | 22 +++++
|
||||
ld/testsuite/ld-or1k/or1k.exp | 8 ++
|
||||
ld/testsuite/ld-or1k/pltlib.s | 1 +
|
||||
7 files changed, 220 insertions(+), 39 deletions(-)
|
||||
create mode 100644 ld/testsuite/ld-or1k/gotha1.dd
|
||||
create mode 100644 ld/testsuite/ld-or1k/gotha1.s
|
||||
create mode 100644 ld/testsuite/ld-or1k/gotha2.dd
|
||||
create mode 100644 ld/testsuite/ld-or1k/gotha2.s
|
||||
|
||||
diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c
|
||||
index 44e67f2b84b..3da68e52425 100644
|
||||
--- a/bfd/elf32-or1k.c
|
||||
+++ b/bfd/elf32-or1k.c
|
||||
@@ -30,10 +30,14 @@
|
||||
#define N_ONES(X) (((bfd_vma)2 << (X)) - 1)
|
||||
|
||||
#define PLT_ENTRY_SIZE 16
|
||||
+#define PLT_ENTRY_SIZE_LARGE (6*4)
|
||||
+#define PLT_MAX_INSN_COUNT 6
|
||||
|
||||
#define OR1K_MOVHI(D) (0x18000000 | (D << 21))
|
||||
#define OR1K_ADRP(D) (0x08000000 | (D << 21))
|
||||
#define OR1K_LWZ(D,A) (0x84000000 | (D << 21) | (A << 16))
|
||||
+#define OR1K_ADD(D,A,B) (0xE0000000 | (D << 21) | (A << 16) | (B << 11))
|
||||
+#define OR1K_ORI(D,A) (0xA8000000 | (D << 21) | (A << 16))
|
||||
#define OR1K_ORI0(D) (0xA8000000 | (D << 21))
|
||||
#define OR1K_JR(B) (0x44000000 | (B << 11))
|
||||
#define OR1K_NOP 0x15000000
|
||||
@@ -907,6 +911,8 @@ struct elf_or1k_link_hash_entry
|
||||
{
|
||||
struct elf_link_hash_entry root;
|
||||
|
||||
+ /* For calculating PLT size. */
|
||||
+ bfd_vma plt_index;
|
||||
/* Track type of TLS access. */
|
||||
unsigned char tls_type;
|
||||
};
|
||||
@@ -931,9 +937,20 @@ struct elf_or1k_link_hash_table
|
||||
{
|
||||
struct elf_link_hash_table root;
|
||||
|
||||
+ bfd_vma plt_count;
|
||||
bfd_boolean saw_plta;
|
||||
};
|
||||
|
||||
+static size_t
|
||||
+elf_or1k_plt_entry_size (bfd_vma plt_index)
|
||||
+{
|
||||
+ bfd_vma plt_reloc;
|
||||
+
|
||||
+ plt_reloc = plt_index * sizeof (Elf32_External_Rela);
|
||||
+
|
||||
+ return (plt_reloc > 0xffff) ? PLT_ENTRY_SIZE_LARGE : PLT_ENTRY_SIZE;
|
||||
+}
|
||||
+
|
||||
/* Get the ELF linker hash table from a link_info structure. */
|
||||
#define or1k_elf_hash_table(p) \
|
||||
((is_elf_hash_table ((p)->hash) \
|
||||
@@ -2222,33 +2239,46 @@ or1k_elf_check_relocs (bfd *abfd,
|
||||
}
|
||||
|
||||
static void
|
||||
-or1k_write_plt_entry (bfd *output_bfd, bfd_byte *contents, unsigned insn1,
|
||||
- unsigned insn2, unsigned insn3, unsigned insnj)
|
||||
+or1k_write_plt_entry (bfd *output_bfd, bfd_byte *contents, unsigned insnj,
|
||||
+ unsigned insns[], size_t insn_count)
|
||||
{
|
||||
unsigned nodelay = elf_elfheader (output_bfd)->e_flags & EF_OR1K_NODELAY;
|
||||
- unsigned insn4;
|
||||
+ unsigned output_insns[PLT_MAX_INSN_COUNT];
|
||||
+
|
||||
+ /* Copy instructions into the output buffer. */
|
||||
+ for (size_t i = 0; i < insn_count; i++)
|
||||
+ output_insns[i] = insns[i];
|
||||
|
||||
/* Honor the no-delay-slot setting. */
|
||||
- if (insn3 == OR1K_NOP)
|
||||
+ if (insns[insn_count-1] == OR1K_NOP)
|
||||
{
|
||||
- insn4 = insn3;
|
||||
+ unsigned slot1, slot2;
|
||||
+
|
||||
if (nodelay)
|
||||
- insn3 = insnj;
|
||||
+ slot1 = insns[insn_count-2], slot2 = insnj;
|
||||
else
|
||||
- insn3 = insn2, insn2 = insnj;
|
||||
+ slot1 = insnj, slot2 = insns[insn_count-2];
|
||||
+
|
||||
+ output_insns[insn_count-2] = slot1;
|
||||
+ output_insns[insn_count-1] = slot2;
|
||||
+ output_insns[insn_count] = OR1K_NOP;
|
||||
}
|
||||
else
|
||||
{
|
||||
+ unsigned slot1, slot2;
|
||||
+
|
||||
if (nodelay)
|
||||
- insn4 = insnj;
|
||||
+ slot1 = insns[insn_count-1], slot2 = insnj;
|
||||
else
|
||||
- insn4 = insn3, insn3 = insnj;
|
||||
+ slot1 = insnj, slot2 = insns[insn_count-1];
|
||||
+
|
||||
+ output_insns[insn_count-1] = slot1;
|
||||
+ output_insns[insn_count] = slot2;
|
||||
}
|
||||
|
||||
- bfd_put_32 (output_bfd, insn1, contents);
|
||||
- bfd_put_32 (output_bfd, insn2, contents + 4);
|
||||
- bfd_put_32 (output_bfd, insn3, contents + 8);
|
||||
- bfd_put_32 (output_bfd, insn4, contents + 12);
|
||||
+ /* Write out the output buffer. */
|
||||
+ for (size_t i = 0; i < (insn_count+1); i++)
|
||||
+ bfd_put_32 (output_bfd, output_insns[i], contents + (i*4));
|
||||
}
|
||||
|
||||
/* Finish up the dynamic sections. */
|
||||
@@ -2315,7 +2345,8 @@ or1k_elf_finish_dynamic_sections (bfd *output_bfd,
|
||||
splt = htab->root.splt;
|
||||
if (splt && splt->size > 0)
|
||||
{
|
||||
- unsigned plt0, plt1, plt2;
|
||||
+ unsigned plt[PLT_MAX_INSN_COUNT];
|
||||
+ size_t plt_insn_count = 3;
|
||||
bfd_vma got_addr = sgot->output_section->vma + sgot->output_offset;
|
||||
|
||||
/* Note we force 16 byte alignment on the .got, so that
|
||||
@@ -2326,27 +2357,27 @@ or1k_elf_finish_dynamic_sections (bfd *output_bfd,
|
||||
bfd_vma pc = splt->output_section->vma + splt->output_offset;
|
||||
unsigned pa = ((got_addr >> 13) - (pc >> 13)) & 0x1fffff;
|
||||
unsigned po = got_addr & 0x1fff;
|
||||
- plt0 = OR1K_ADRP(12) | pa;
|
||||
- plt1 = OR1K_LWZ(15,12) | (po + 8);
|
||||
- plt2 = OR1K_LWZ(12,12) | (po + 4);
|
||||
+ plt[0] = OR1K_ADRP(12) | pa;
|
||||
+ plt[1] = OR1K_LWZ(15,12) | (po + 8);
|
||||
+ plt[2] = OR1K_LWZ(12,12) | (po + 4);
|
||||
}
|
||||
else if (bfd_link_pic (info))
|
||||
{
|
||||
- plt0 = OR1K_LWZ(15, 16) | 8; /* .got+8 */
|
||||
- plt1 = OR1K_LWZ(12, 16) | 4; /* .got+4 */
|
||||
- plt2 = OR1K_NOP;
|
||||
+ plt[0] = OR1K_LWZ(15, 16) | 8; /* .got+8 */
|
||||
+ plt[1] = OR1K_LWZ(12, 16) | 4; /* .got+4 */
|
||||
+ plt[2] = OR1K_NOP;
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned ha = ((got_addr + 0x8000) >> 16) & 0xffff;
|
||||
unsigned lo = got_addr & 0xffff;
|
||||
- plt0 = OR1K_MOVHI(12) | ha;
|
||||
- plt1 = OR1K_LWZ(15,12) | (lo + 8);
|
||||
- plt2 = OR1K_LWZ(12,12) | (lo + 4);
|
||||
+ plt[0] = OR1K_MOVHI(12) | ha;
|
||||
+ plt[1] = OR1K_LWZ(15,12) | (lo + 8);
|
||||
+ plt[2] = OR1K_LWZ(12,12) | (lo + 4);
|
||||
}
|
||||
|
||||
- or1k_write_plt_entry (output_bfd, splt->contents,
|
||||
- plt0, plt1, plt2, OR1K_JR(15));
|
||||
+ or1k_write_plt_entry (output_bfd, splt->contents, OR1K_JR(15),
|
||||
+ plt, plt_insn_count);
|
||||
|
||||
elf_section_data (splt->output_section)->this_hdr.sh_entsize = 4;
|
||||
}
|
||||
@@ -2389,7 +2420,8 @@ or1k_elf_finish_dynamic_symbol (bfd *output_bfd,
|
||||
|
||||
if (h->plt.offset != (bfd_vma) -1)
|
||||
{
|
||||
- unsigned int plt0, plt1, plt2;
|
||||
+ unsigned int plt[PLT_MAX_INSN_COUNT];
|
||||
+ size_t plt_insn_count = 3;
|
||||
asection *splt;
|
||||
asection *sgot;
|
||||
asection *srela;
|
||||
@@ -2401,6 +2433,7 @@ or1k_elf_finish_dynamic_symbol (bfd *output_bfd,
|
||||
bfd_vma got_offset;
|
||||
bfd_vma got_addr;
|
||||
Elf_Internal_Rela rela;
|
||||
+ bfd_boolean large_plt_entry;
|
||||
|
||||
/* This symbol has an entry in the procedure linkage table. Set
|
||||
it up. */
|
||||
@@ -2418,10 +2451,13 @@ or1k_elf_finish_dynamic_symbol (bfd *output_bfd,
|
||||
corresponds to this symbol. This is the index of this symbol
|
||||
in all the symbols for which we are making plt entries. The
|
||||
first entry in the procedure linkage table is reserved. */
|
||||
- plt_index = h->plt.offset / PLT_ENTRY_SIZE - 1;
|
||||
+ plt_index = ((struct elf_or1k_link_hash_entry *) h)->plt_index;
|
||||
plt_addr = plt_base_addr + h->plt.offset;
|
||||
plt_reloc = plt_index * sizeof (Elf32_External_Rela);
|
||||
|
||||
+ large_plt_entry = (elf_or1k_plt_entry_size (plt_index)
|
||||
+ == PLT_ENTRY_SIZE_LARGE);
|
||||
+
|
||||
/* Get the offset into the .got table of the entry that
|
||||
corresponds to this function. Each .got entry is 4 bytes.
|
||||
The first three are reserved. */
|
||||
@@ -2433,27 +2469,57 @@ or1k_elf_finish_dynamic_symbol (bfd *output_bfd,
|
||||
{
|
||||
unsigned pa = ((got_addr >> 13) - (plt_addr >> 13)) & 0x1fffff;
|
||||
unsigned po = (got_addr & 0x1fff);
|
||||
- plt0 = OR1K_ADRP(12) | pa;
|
||||
- plt1 = OR1K_LWZ(12,12) | po;
|
||||
- plt2 = OR1K_ORI0(11) | plt_reloc;
|
||||
+ plt[0] = OR1K_ADRP(12) | pa;
|
||||
+ plt[1] = OR1K_LWZ(12,12) | po;
|
||||
+ plt[2] = OR1K_ORI0(11) | plt_reloc;
|
||||
}
|
||||
else if (bfd_link_pic (info))
|
||||
{
|
||||
- plt0 = OR1K_LWZ(12,16) | got_offset;
|
||||
- plt1 = OR1K_ORI0(11) | plt_reloc;
|
||||
- plt2 = OR1K_NOP;
|
||||
+ if (large_plt_entry)
|
||||
+ {
|
||||
+ unsigned gotha = ((got_offset + 0x8000) >> 16) & 0xffff;
|
||||
+ unsigned got = got_offset & 0xffff;
|
||||
+ unsigned pltrelhi = (plt_reloc >> 16) & 0xffff;
|
||||
+ unsigned pltrello = plt_reloc & 0xffff;
|
||||
+
|
||||
+ plt[0] = OR1K_MOVHI(12) | gotha;
|
||||
+ plt[1] = OR1K_ADD(12,12,16);
|
||||
+ plt[2] = OR1K_LWZ(12,12) | got;
|
||||
+ plt[3] = OR1K_MOVHI(11) | pltrelhi;
|
||||
+ plt[4] = OR1K_ORI(11,11) | pltrello;
|
||||
+ plt_insn_count = 5;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ plt[0] = OR1K_LWZ(12,16) | got_offset;
|
||||
+ plt[1] = OR1K_ORI0(11) | plt_reloc;
|
||||
+ plt[2] = OR1K_NOP;
|
||||
+ }
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned ha = ((got_addr + 0x8000) >> 16) & 0xffff;
|
||||
unsigned lo = got_addr & 0xffff;
|
||||
- plt0 = OR1K_MOVHI(12) | ha;
|
||||
- plt1 = OR1K_LWZ(12,12) | lo;
|
||||
- plt2 = OR1K_ORI0(11) | plt_reloc;
|
||||
+ plt[0] = OR1K_MOVHI(12) | ha;
|
||||
+ plt[1] = OR1K_LWZ(12,12) | lo;
|
||||
+ plt[2] = OR1K_ORI0(11) | plt_reloc;
|
||||
+ }
|
||||
+
|
||||
+ /* For large code model we fixup the non-PIC PLT relocation instructions
|
||||
+ here. */
|
||||
+ if (large_plt_entry && !bfd_link_pic (info))
|
||||
+ {
|
||||
+ unsigned pltrelhi = (plt_reloc >> 16) & 0xffff;
|
||||
+ unsigned pltrello = plt_reloc & 0xffff;
|
||||
+
|
||||
+ plt[2] = OR1K_MOVHI(11) | pltrelhi;
|
||||
+ plt[3] = OR1K_ORI(11,11) | pltrello;
|
||||
+ plt[4] = OR1K_NOP;
|
||||
+ plt_insn_count = 5;
|
||||
}
|
||||
|
||||
or1k_write_plt_entry (output_bfd, splt->contents + h->plt.offset,
|
||||
- plt0, plt1, plt2, OR1K_JR(12));
|
||||
+ OR1K_JR(12), plt, plt_insn_count);
|
||||
|
||||
/* Fill in the entry in the global offset table. We initialize it to
|
||||
point to the top of the plt. This is done to lazy lookup the actual
|
||||
@@ -2777,11 +2843,16 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
|
||||
if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, bfd_link_pic (info), h))
|
||||
{
|
||||
asection *splt = htab->root.splt;
|
||||
+ bfd_vma plt_index;
|
||||
+
|
||||
+ /* Track the index of our plt entry for use in calculating size. */
|
||||
+ plt_index = htab->plt_count++;
|
||||
+ ((struct elf_or1k_link_hash_entry *) h)->plt_index = plt_index;
|
||||
|
||||
/* If this is the first .plt entry, make room for the special
|
||||
first entry. */
|
||||
if (splt->size == 0)
|
||||
- splt->size = PLT_ENTRY_SIZE;
|
||||
+ splt->size = elf_or1k_plt_entry_size (plt_index);
|
||||
|
||||
h->plt.offset = splt->size;
|
||||
|
||||
@@ -2798,7 +2869,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
|
||||
}
|
||||
|
||||
/* Make room for this entry. */
|
||||
- splt->size += PLT_ENTRY_SIZE;
|
||||
+ splt->size += elf_or1k_plt_entry_size (plt_index);
|
||||
|
||||
/* We also need to make an entry in the .got.plt section, which
|
||||
will be placed in the .got section by the linker script. */
|
||||
diff --git a/ld/testsuite/ld-or1k/gotha1.dd b/ld/testsuite/ld-or1k/gotha1.dd
|
||||
new file mode 100644
|
||||
index 00000000000..0ad1f8f5399
|
||||
--- /dev/null
|
||||
+++ b/ld/testsuite/ld-or1k/gotha1.dd
|
||||
@@ -0,0 +1,34 @@
|
||||
+
|
||||
+.*\.x: file format elf32-or1k
|
||||
+
|
||||
+
|
||||
+Disassembly of section \.plt:
|
||||
+
|
||||
+[0-9a-f]+ <\.plt>:
|
||||
+ +[0-9a-f]+: 19 80 00 00 l\.movhi r12,0x0
|
||||
+ +[0-9a-f]+: 85 ec [0-9a-f]+ [0-9a-f]+ l\.lwz r15,[0-9]+\(r12\)
|
||||
+ +[0-9a-f]+: 44 00 78 00 l\.jr r15
|
||||
+ +[0-9a-f]+: 85 8c [0-9a-f]+ [0-9a-f]+ l\.lwz r12,[0-9]+\(r12\)
|
||||
+ +[0-9a-f]+: 19 80 00 00 l\.movhi r12,0x0
|
||||
+ +[0-9a-f]+: 85 8c [0-9a-f]+ [0-9a-f]+ l\.lwz r12,[0-9]+\(r12\)
|
||||
+ +[0-9a-f]+: 44 00 60 00 l\.jr r12
|
||||
+ +[0-9a-f]+: a9 60 00 00 l\.ori r11,r0,0x0
|
||||
+
|
||||
+Disassembly of section \.text:
|
||||
+
|
||||
+[0-9a-f]+ <_start>:
|
||||
+ +[0-9a-f]+: 9c 21 ff fc l\.addi r1,r1,-4
|
||||
+ +[0-9a-f]+: d4 01 48 00 l\.sw 0\(r1\),r9
|
||||
+ +[0-9a-f]+: 04 00 00 02 l\.jal [0-9a-f]+ <_start\+0x10>
|
||||
+ +[0-9a-f]+: 1a 60 00 00 l\.movhi r19,0x0
|
||||
+ +[0-9a-f]+: aa 73 [0-9a-f]+ [0-9a-f]+ l\.ori r19,r19,0x[0-9a-f]+
|
||||
+ +[0-9a-f]+: e2 73 48 00 l\.add r19,r19,r9
|
||||
+ +[0-9a-f]+: 1a 20 00 00 l\.movhi r17,0x0
|
||||
+ +[0-9a-f]+: e2 31 98 00 l\.add r17,r17,r19
|
||||
+ +[0-9a-f]+: 86 31 00 10 l\.lwz r17,16\(r17\)
|
||||
+ +[0-9a-f]+: 84 71 00 00 l\.lwz r3,0\(r17\)
|
||||
+ +[0-9a-f]+: 07 ff ff f2 l\.jal [0-9a-f]+ <\.plt\+0x10>
|
||||
+ +[0-9a-f]+: 15 00 00 00 l\.nop 0x0
|
||||
+ +[0-9a-f]+: 85 21 00 00 l\.lwz r9,0\(r1\)
|
||||
+ +[0-9a-f]+: 44 00 48 00 l\.jr r9
|
||||
+ +[0-9a-f]+: 9c 21 00 04 l\.addi r1,r1,4
|
||||
diff --git a/ld/testsuite/ld-or1k/gotha1.s b/ld/testsuite/ld-or1k/gotha1.s
|
||||
new file mode 100644
|
||||
index 00000000000..42b16db425c
|
||||
--- /dev/null
|
||||
+++ b/ld/testsuite/ld-or1k/gotha1.s
|
||||
@@ -0,0 +1,24 @@
|
||||
+ .data
|
||||
+ .p2align 16
|
||||
+
|
||||
+ .text
|
||||
+ .globl _start
|
||||
+_start:
|
||||
+ l.addi r1, r1, -4
|
||||
+ l.sw 0(r1), r9
|
||||
+
|
||||
+ l.jal 8
|
||||
+ l.movhi r19, gotpchi(_GLOBAL_OFFSET_TABLE_-4)
|
||||
+ l.ori r19, r19, gotpclo(_GLOBAL_OFFSET_TABLE_+0)
|
||||
+ l.add r19, r19, r9
|
||||
+
|
||||
+ l.movhi r17, gotha(x)
|
||||
+ l.add r17, r17, r19
|
||||
+ l.lwz r17, got(x)(r17)
|
||||
+ l.lwz r3, 0(r17)
|
||||
+
|
||||
+ l.jal plt(func)
|
||||
+ l.nop
|
||||
+ l.lwz r9, 0(r1)
|
||||
+ l.jr r9
|
||||
+ l.addi r1, r1, 4
|
||||
diff --git a/ld/testsuite/ld-or1k/gotha2.dd b/ld/testsuite/ld-or1k/gotha2.dd
|
||||
new file mode 100644
|
||||
index 00000000000..fe09da5466b
|
||||
--- /dev/null
|
||||
+++ b/ld/testsuite/ld-or1k/gotha2.dd
|
||||
@@ -0,0 +1,21 @@
|
||||
+
|
||||
+.*\.x: file format elf32-or1k
|
||||
+
|
||||
+
|
||||
+Disassembly of section \.text:
|
||||
+
|
||||
+[0-9a-f]+ <test>:
|
||||
+ +[0-9a-f]+: 9c 21 ff f8 l\.addi r1,r1,-8
|
||||
+ +[0-9a-f]+: d4 01 80 00 l\.sw 0\(r1\),r16
|
||||
+ +[0-9a-f]+: d4 01 48 04 l\.sw 4\(r1\),r9
|
||||
+ +[0-9a-f]+: 04 00 [0-9a-f]+ [0-9a-f]+ l\.jal [0-9a-f]+ <test\+0x14>
|
||||
+ +[0-9a-f]+: 1a 00 00 00 l\.movhi r16,0x0
|
||||
+ +[0-9a-f]+: aa 10 [0-9a-f]+ [0-9a-f]+ l\.ori r16,r16,0x[0-9a-f]+
|
||||
+ +[0-9a-f]+: e2 10 48 00 l\.add r16,r16,r9
|
||||
+ +[0-9a-f]+: 1a 20 00 00 l\.movhi r17,0x0
|
||||
+ +[0-9a-f]+: e2 31 80 00 l\.add r17,r17,r16
|
||||
+ +[0-9a-f]+: 86 31 00 0c l\.lwz r17,12\(r17\)
|
||||
+ +[0-9a-f]+: 85 21 00 04 l\.lwz r9,4\(r1\)
|
||||
+ +[0-9a-f]+: 86 01 00 00 l\.lwz r16,0\(r1\)
|
||||
+ +[0-9a-f]+: 44 00 48 00 l\.jr r9
|
||||
+ +[0-9a-f]+: 9c 21 00 08 l\.addi r1,r1,8
|
||||
diff --git a/ld/testsuite/ld-or1k/gotha2.s b/ld/testsuite/ld-or1k/gotha2.s
|
||||
new file mode 100644
|
||||
index 00000000000..164b282f2dd
|
||||
--- /dev/null
|
||||
+++ b/ld/testsuite/ld-or1k/gotha2.s
|
||||
@@ -0,0 +1,22 @@
|
||||
+ .section .text
|
||||
+ .align 4
|
||||
+ .global test
|
||||
+ .type test, @function
|
||||
+test:
|
||||
+ l.addi r1, r1, -8
|
||||
+ l.sw 0(r1), r16
|
||||
+ l.sw 4(r1), r9
|
||||
+
|
||||
+ l.jal 8
|
||||
+ l.movhi r16, gotpchi(_GLOBAL_OFFSET_TABLE_-4)
|
||||
+ l.ori r16, r16, gotpclo(_GLOBAL_OFFSET_TABLE_+0)
|
||||
+ l.add r16, r16, r9
|
||||
+
|
||||
+ l.movhi r17, gotha(i)
|
||||
+ l.add r17, r17, r16
|
||||
+ l.lwz r17, got(i)(r17)
|
||||
+
|
||||
+ l.lwz r9, 4(r1)
|
||||
+ l.lwz r16, 0(r1)
|
||||
+ l.jr r9
|
||||
+ l.addi r1, r1, 8
|
||||
diff --git a/ld/testsuite/ld-or1k/or1k.exp b/ld/testsuite/ld-or1k/or1k.exp
|
||||
index 8bb943aacc9..f10949e89aa 100644
|
||||
--- a/ld/testsuite/ld-or1k/or1k.exp
|
||||
+++ b/ld/testsuite/ld-or1k/or1k.exp
|
||||
@@ -53,6 +53,14 @@ set or1kplttests {
|
||||
"" {plt1.s}
|
||||
{{objdump -dr plt1.x.dd}}
|
||||
"plt1.x"}
|
||||
+ {"gotha exec plt" "tmpdir/libpltlib.so" ""
|
||||
+ "" {gotha1.s}
|
||||
+ {{objdump -dr gotha1.dd}}
|
||||
+ "gotha1.x"}
|
||||
+ {"gotha -fpic -shared" "-fpic -shared" ""
|
||||
+ "" {gotha2.s}
|
||||
+ {{objdump -dr gotha2.dd}}
|
||||
+ "gotha2.x"}
|
||||
}
|
||||
|
||||
# Not implemented yet
|
||||
diff --git a/ld/testsuite/ld-or1k/pltlib.s b/ld/testsuite/ld-or1k/pltlib.s
|
||||
index baf76ca1af7..8b4d7ba48fd 100644
|
||||
--- a/ld/testsuite/ld-or1k/pltlib.s
|
||||
+++ b/ld/testsuite/ld-or1k/pltlib.s
|
||||
@@ -1,5 +1,6 @@
|
||||
.section .data
|
||||
.globl x, y
|
||||
+ .size x, 4
|
||||
x: .long 33
|
||||
y: .long 44
|
||||
|
||||
--
|
||||
2.25.1
|
||||
|
@ -0,0 +1,50 @@
|
||||
From c3003947e4bad18faea4337fd2073feeb30ee078 Mon Sep 17 00:00:00 2001
|
||||
From: Giulio Benetti <giulio.benetti@benettiengineering.com>
|
||||
Date: Wed, 9 Jun 2021 17:28:27 +0200
|
||||
Subject: [PATCH] bfd/elf32-or1k: fix building with gcc version < 5
|
||||
|
||||
Gcc version >= 5 has standard C mode not set to -std=gnu11, so if we use
|
||||
an old compiler(i.e. gcc 4.9) build fails on:
|
||||
```
|
||||
elf32-or1k.c:2251:3: error: 'for' loop initial declarations are only allowed in
|
||||
C99 or C11 mode
|
||||
for (size_t i = 0; i < insn_count; i++)
|
||||
^
|
||||
```
|
||||
|
||||
So let's declare `size_t i` at the top of the function instead of inside
|
||||
for loop.
|
||||
|
||||
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
|
||||
---
|
||||
bfd/elf32-or1k.c | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c
|
||||
index 4ae7f324d33..32063ab0289 100644
|
||||
--- a/bfd/elf32-or1k.c
|
||||
+++ b/bfd/elf32-or1k.c
|
||||
@@ -2244,9 +2244,10 @@ or1k_write_plt_entry (bfd *output_bfd, bfd_byte *contents, unsigned insnj,
|
||||
{
|
||||
unsigned nodelay = elf_elfheader (output_bfd)->e_flags & EF_OR1K_NODELAY;
|
||||
unsigned output_insns[PLT_MAX_INSN_COUNT];
|
||||
+ size_t i;
|
||||
|
||||
/* Copy instructions into the output buffer. */
|
||||
- for (size_t i = 0; i < insn_count; i++)
|
||||
+ for (i = 0; i < insn_count; i++)
|
||||
output_insns[i] = insns[i];
|
||||
|
||||
/* Honor the no-delay-slot setting. */
|
||||
@@ -2277,7 +2278,7 @@ or1k_write_plt_entry (bfd *output_bfd, bfd_byte *contents, unsigned insnj,
|
||||
}
|
||||
|
||||
/* Write out the output buffer. */
|
||||
- for (size_t i = 0; i < (insn_count+1); i++)
|
||||
+ for (i = 0; i < (insn_count+1); i++)
|
||||
bfd_put_32 (output_bfd, output_insns[i], contents + (i*4));
|
||||
}
|
||||
|
||||
--
|
||||
2.25.1
|
||||
|
@ -0,0 +1,59 @@
|
||||
From 9af93e143a7fbdb75aa1ed37277f9250eb111628 Mon Sep 17 00:00:00 2001
|
||||
From: Giulio Benetti <giulio.benetti@benettiengineering.com>
|
||||
Date: Sat, 10 Jul 2021 17:57:34 +0200
|
||||
Subject: [PATCH] or1k: fix pc-relative relocation against dynamic on PC
|
||||
relative 26 bit relocation
|
||||
|
||||
When building openal we were seeing the assert failure:
|
||||
|
||||
/home/buildroot/autobuild/run/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/or1k-buildroot-linux-uclibc/9.3.0/../../../../or1k-buildroot-linux-uclibc/bin/ld: CMakeFiles/OpenAL.dir/al/source.cpp.o:
|
||||
pc-relative relocation against dynamic symbol alSourcePausev
|
||||
/home/buildroot/autobuild/run/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/or1k-buildroot-linux-uclibc/9.3.0/../../../../or1k-buildroot-linux-uclibc/bin/ld: CMakeFiles/OpenAL.dir/al/source.cpp.o:
|
||||
pc-relative relocation against dynamic symbol alSourceStopv
|
||||
/home/buildroot/autobuild/run/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/or1k-buildroot-linux-uclibc/9.3.0/../../../../or1k-buildroot-linux-uclibc/bin/ld: CMakeFiles/OpenAL.dir/al/source.cpp.o:
|
||||
pc-relative relocation against dynamic symbol alSourceRewindv
|
||||
/home/buildroot/autobuild/run/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/or1k-buildroot-linux-uclibc/9.3.0/../../../../or1k-buildroot-linux-uclibc/bin/ld: CMakeFiles/OpenAL.dir/al/source.cpp.o:
|
||||
pc-relative relocation against dynamic symbol alSourcePlayv
|
||||
collect2: error: ld returned 1 exit status
|
||||
|
||||
This happens because in R_OR1K_INSN_REL_26 case we can't reference local
|
||||
symbol as previously done but we need to make sure that calls to actual
|
||||
symbol always call the version of current object.
|
||||
|
||||
bfd/Changelog:
|
||||
|
||||
* elf32-or1k.c (or1k_elf_relocate_section): use a separate entry
|
||||
in switch case R_OR1K_INSN_REL_26 where we need to check for
|
||||
!SYMBOL_CALLS_LOCAL() instead of !SYMBOL_REFERENCES_LOCAL().
|
||||
|
||||
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
|
||||
---
|
||||
bfd/elf32-or1k.c | 12 ++++++++++++
|
||||
1 file changed, 12 insertions(+)
|
||||
|
||||
diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c
|
||||
index 4ae7f324d33..4f9092539f5 100644
|
||||
--- a/bfd/elf32-or1k.c
|
||||
+++ b/bfd/elf32-or1k.c
|
||||
@@ -1543,6 +1543,18 @@ or1k_elf_relocate_section (bfd *output_bfd,
|
||||
break;
|
||||
|
||||
case R_OR1K_INSN_REL_26:
|
||||
+ /* For a non-shared link, these will reference plt or call the
|
||||
+ version of actual object. */
|
||||
+ if (bfd_link_pic (info) && !SYMBOL_CALLS_LOCAL (info, h))
|
||||
+ {
|
||||
+ _bfd_error_handler
|
||||
+ (_("%pB: pc-relative relocation against dynamic symbol %s"),
|
||||
+ input_bfd, name);
|
||||
+ ret_val = FALSE;
|
||||
+ bfd_set_error (bfd_error_bad_value);
|
||||
+ }
|
||||
+ break;
|
||||
+
|
||||
case R_OR1K_PCREL_PG21:
|
||||
case R_OR1K_LO13:
|
||||
case R_OR1K_SLO13:
|
||||
--
|
||||
2.25.1
|
||||
|
@ -9,6 +9,7 @@ BIRD_SITE = ftp://bird.network.cz/pub/bird
|
||||
BIRD_LICENSE = GPL-2.0+
|
||||
BIRD_LICENSE_FILES = README
|
||||
BIRD_CPE_ID_VENDOR = nic
|
||||
BIRD_SELINUX_MODULES = bird
|
||||
BIRD_DEPENDENCIES = host-flex host-bison
|
||||
|
||||
ifeq ($(BR2_PACKAGE_BIRD_CLIENT),y)
|
||||
|
@ -1,5 +1,5 @@
|
||||
config BR2_PACKAGE_BLUEZ5_UTILS
|
||||
bool "bluez-utils 5.x"
|
||||
bool "bluez-utils"
|
||||
depends on BR2_USE_WCHAR # libglib2
|
||||
depends on BR2_TOOLCHAIN_HAS_THREADS # dbus, libglib2
|
||||
depends on BR2_USE_MMU # dbus
|
||||
@ -9,17 +9,12 @@ config BR2_PACKAGE_BLUEZ5_UTILS
|
||||
select BR2_PACKAGE_DBUS
|
||||
select BR2_PACKAGE_LIBGLIB2
|
||||
help
|
||||
bluez utils version 5.x
|
||||
BlueZ utils
|
||||
|
||||
With this release BlueZ only supports the new Bluetooth
|
||||
Management kernel interface (introduced in Linux 3.4).
|
||||
Provides Stack, Library and Tooling for Bluetooth Classic
|
||||
and Bluetooth LE.
|
||||
|
||||
For Low Energy support at least kernel version 3.5 is
|
||||
needed.
|
||||
|
||||
The API is not backward compatible with BlueZ 4.
|
||||
|
||||
Bluez utils will use systemd and/or udev if enabled.
|
||||
BlueZ utils will use systemd and/or udev if enabled.
|
||||
|
||||
http://www.bluez.org
|
||||
http://www.kernel.org/pub/linux/bluetooth
|
||||
@ -31,7 +26,7 @@ config BR2_PACKAGE_BLUEZ5_UTILS_OBEX
|
||||
depends on BR2_INSTALL_LIBSTDCPP
|
||||
select BR2_PACKAGE_LIBICAL
|
||||
help
|
||||
Enable the OBEX support in Bluez 5.x.
|
||||
Enable OBEX support.
|
||||
|
||||
comment "OBEX support needs a toolchain w/ C++"
|
||||
depends on !BR2_INSTALL_LIBSTDCPP
|
||||
@ -40,75 +35,77 @@ config BR2_PACKAGE_BLUEZ5_UTILS_CLIENT
|
||||
bool "build CLI client"
|
||||
select BR2_PACKAGE_READLINE
|
||||
help
|
||||
Enable the Bluez 5.x command line client.
|
||||
Build the command line client "bluetoothctl".
|
||||
|
||||
config BR2_PACKAGE_BLUEZ5_UTILS_DEPRECATED
|
||||
bool "install deprecated tool"
|
||||
bool "install deprecated tools"
|
||||
depends on BR2_PACKAGE_BLUEZ5_UTILS_CLIENT
|
||||
help
|
||||
Build BlueZ 5.x deprecated tools. These currently include:
|
||||
Build deprecated tools. These currently include:
|
||||
hciattach, hciconfig, hcitool, hcidump, rfcomm, sdptool,
|
||||
ciptool, gatttool.
|
||||
|
||||
config BR2_PACKAGE_BLUEZ5_UTILS_EXPERIMENTAL
|
||||
bool "build experimental obexd plugin"
|
||||
bool "build experimental tools"
|
||||
help
|
||||
Build BlueZ 5.x experimental Nokia OBEX PC Suite plugin
|
||||
Build experimental tools. This is currently only the
|
||||
"Nokia OBEX PC Suite tool". So, only if OBEX support is
|
||||
enabled this option has an effect.
|
||||
|
||||
config BR2_PACKAGE_BLUEZ5_UTILS_PLUGINS_HEALTH
|
||||
bool "build health plugin"
|
||||
help
|
||||
Build BlueZ 5.x health plugin
|
||||
Build plugin for health profiles.
|
||||
|
||||
config BR2_PACKAGE_BLUEZ5_UTILS_PLUGINS_MESH
|
||||
bool "build mesh profile"
|
||||
bool "build mesh plugin"
|
||||
depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_12 # ell
|
||||
select BR2_PACKAGE_ELL
|
||||
select BR2_PACKAGE_JSON_C
|
||||
select BR2_PACKAGE_READLINE
|
||||
help
|
||||
Build BlueZ 5.x mesh plugin
|
||||
Build plugin for Mesh support.
|
||||
|
||||
comment "mesh profile needs a toolchain w/ headers >= 4.12"
|
||||
depends on !BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_12
|
||||
|
||||
config BR2_PACKAGE_BLUEZ5_UTILS_PLUGINS_MIDI
|
||||
bool "build midi profile"
|
||||
bool "build midi plugin"
|
||||
select BR2_PACKAGE_ALSA_LIB
|
||||
select BR2_PACKAGE_ALSA_LIB_SEQ
|
||||
help
|
||||
Build BlueZ 5.x midi plugin
|
||||
Build MIDI support via ALSA sequencer.
|
||||
|
||||
config BR2_PACKAGE_BLUEZ5_UTILS_PLUGINS_NFC
|
||||
bool "build nfc plugin"
|
||||
help
|
||||
Build BlueZ 5.x nfc plugin
|
||||
Build plugin for NFC pairing.
|
||||
|
||||
config BR2_PACKAGE_BLUEZ5_UTILS_PLUGINS_SAP
|
||||
bool "build sap plugin"
|
||||
help
|
||||
Build BlueZ 5.x sap plugin
|
||||
Build plugin for SAP profile.
|
||||
|
||||
config BR2_PACKAGE_BLUEZ5_UTILS_PLUGINS_SIXAXIS
|
||||
bool "build sixaxis plugin"
|
||||
depends on BR2_PACKAGE_HAS_UDEV
|
||||
help
|
||||
Build BlueZ 5.x sixaxis plugin (support Sony Dualshock
|
||||
Build sixaxis plugin (support Sony Dualshock
|
||||
controller)
|
||||
|
||||
comment "sixaxis plugin needs udev /dev management"
|
||||
depends on !BR2_PACKAGE_HAS_UDEV
|
||||
|
||||
config BR2_PACKAGE_BLUEZ5_UTILS_TEST
|
||||
bool "build tests"
|
||||
bool "install test scripts"
|
||||
help
|
||||
Build BlueZ 5.x tests
|
||||
Install the python test scripts from the "test" directory.
|
||||
|
||||
config BR2_PACKAGE_BLUEZ5_UTILS_TOOLS_HID2HCI
|
||||
bool "build hid2hci tool"
|
||||
depends on BR2_PACKAGE_HAS_UDEV
|
||||
help
|
||||
Build BlueZ 5.x hid2hci tool
|
||||
Build hid2hci tool
|
||||
|
||||
comment "hid2hci tool needs udev /dev management"
|
||||
depends on !BR2_PACKAGE_HAS_UDEV
|
||||
|
@ -11,6 +11,7 @@ BOINC_SITE = \
|
||||
BOINC_LICENSE = LGPL-3.0+
|
||||
BOINC_LICENSE_FILES = COPYING COPYING.LESSER
|
||||
BOINC_CPE_ID_VENDOR = rom_walton
|
||||
BOINC_SELINUX_MODULES = boinc
|
||||
BOINC_DEPENDENCIES = host-pkgconf libcurl openssl
|
||||
BOINC_AUTORECONF = YES
|
||||
BOINC_CONF_ENV = ac_cv_path__libcurl_config=$(STAGING_DIR)/usr/bin/curl-config
|
||||
|
@ -1,41 +0,0 @@
|
||||
From b4828612abe378491693c9036db19e4f64768307 Mon Sep 17 00:00:00 2001
|
||||
From: Bernd Kuhls <bernd.kuhls@t-online.de>
|
||||
Date: Sun, 10 Jan 2021 13:15:04 +0100
|
||||
Subject: [PATCH] update_passwd: fix context variable
|
||||
|
||||
Commit
|
||||
https://git.busybox.net/busybox/commit/libbb/update_passwd.c?id=2496616b0a8d1c80cd1416b73a4847b59b9f969a
|
||||
|
||||
changed the variable used from context to seuser but forgot this
|
||||
change resulting in build errors detected by buildroot autobuilders:
|
||||
|
||||
http://autobuild.buildroot.net/results/b89/b89b7d0f0601bb706e76cea31cf4e43326e5540c//build-end.log
|
||||
|
||||
libbb/update_passwd.c:51:11: error: 'context' undeclared (first use in
|
||||
this function); did you mean 'ucontext'?
|
||||
freecon(context);
|
||||
|
||||
Patch sent upstream:
|
||||
http://lists.busybox.net/pipermail/busybox/2021-January/088467.html
|
||||
|
||||
Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
|
||||
---
|
||||
libbb/update_passwd.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libbb/update_passwd.c b/libbb/update_passwd.c
|
||||
index 7b67f30cd..a228075cc 100644
|
||||
--- a/libbb/update_passwd.c
|
||||
+++ b/libbb/update_passwd.c
|
||||
@@ -48,7 +48,7 @@ static void check_selinux_update_passwd(const char *username)
|
||||
bb_simple_error_msg_and_die("SELinux: access denied");
|
||||
}
|
||||
if (ENABLE_FEATURE_CLEAN_UP)
|
||||
- freecon(context);
|
||||
+ freecon(seuser);
|
||||
}
|
||||
#else
|
||||
# define check_selinux_update_passwd(username) ((void)0)
|
||||
--
|
||||
2.29.2
|
||||
|
@ -1,58 +0,0 @@
|
||||
From f25d254dfd4243698c31a4f3153d4ac72aa9e9bd Mon Sep 17 00:00:00 2001
|
||||
From: Samuel Sapalski <samuel.sapalski@nokia.com>
|
||||
Date: Wed, 3 Mar 2021 16:31:22 +0100
|
||||
Subject: [PATCH] decompress_gunzip: Fix DoS if gzip is corrupt
|
||||
|
||||
On certain corrupt gzip files, huft_build will set the error bit on
|
||||
the result pointer. If afterwards abort_unzip is called huft_free
|
||||
might run into a segmentation fault or an invalid pointer to
|
||||
free(p).
|
||||
|
||||
In order to mitigate this, we check in huft_free if the error bit
|
||||
is set and clear it before the linked list is freed.
|
||||
|
||||
Signed-off-by: Samuel Sapalski <samuel.sapalski@nokia.com>
|
||||
Signed-off-by: Peter Kaestle <peter.kaestle@nokia.com>
|
||||
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
||||
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
|
||||
---
|
||||
archival/libarchive/decompress_gunzip.c | 12 ++++++++++--
|
||||
1 file changed, 10 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/archival/libarchive/decompress_gunzip.c b/archival/libarchive/decompress_gunzip.c
|
||||
index eb3b64930..e93cd5005 100644
|
||||
--- a/archival/libarchive/decompress_gunzip.c
|
||||
+++ b/archival/libarchive/decompress_gunzip.c
|
||||
@@ -220,10 +220,20 @@ static const uint8_t border[] ALIGN1 = {
|
||||
* each table.
|
||||
* t: table to free
|
||||
*/
|
||||
+#define BAD_HUFT(p) ((uintptr_t)(p) & 1)
|
||||
+#define ERR_RET ((huft_t*)(uintptr_t)1)
|
||||
static void huft_free(huft_t *p)
|
||||
{
|
||||
huft_t *q;
|
||||
|
||||
+ /*
|
||||
+ * If 'p' has the error bit set we have to clear it, otherwise we might run
|
||||
+ * into a segmentation fault or an invalid pointer to free(p)
|
||||
+ */
|
||||
+ if (BAD_HUFT(p)) {
|
||||
+ p = (huft_t*)((uintptr_t)(p) ^ (uintptr_t)(ERR_RET));
|
||||
+ }
|
||||
+
|
||||
/* Go through linked list, freeing from the malloced (t[-1]) address. */
|
||||
while (p) {
|
||||
q = (--p)->v.t;
|
||||
@@ -289,8 +299,6 @@ static unsigned fill_bitbuffer(STATE_PARAM unsigned bitbuffer, unsigned *current
|
||||
* or a valid pointer to a Huffman table, ORed with 0x1 if incompete table
|
||||
* is given: "fixed inflate" decoder feeds us such data.
|
||||
*/
|
||||
-#define BAD_HUFT(p) ((uintptr_t)(p) & 1)
|
||||
-#define ERR_RET ((huft_t*)(uintptr_t)1)
|
||||
static huft_t* huft_build(const unsigned *b, const unsigned n,
|
||||
const unsigned s, const struct cp_ext *cp_ext,
|
||||
unsigned *m)
|
||||
--
|
||||
2.20.1
|
||||
|
@ -1,5 +1,5 @@
|
||||
# From https://busybox.net/downloads/busybox-1.33.0.tar.bz2.sha256
|
||||
sha256 d568681c91a85edc6710770cebc1e80e042ad74d305b5c2e6d57a5f3de3b8fbd busybox-1.33.0.tar.bz2
|
||||
# From https://busybox.net/downloads/busybox-1.33.1.tar.bz2.sha256
|
||||
sha256 12cec6bd2b16d8a9446dd16130f2b92982f1819f6e1c5f5887b6db03f5660d28 busybox-1.33.1.tar.bz2
|
||||
# Locally computed
|
||||
sha256 bbfc9843646d483c334664f651c208b9839626891d8f17604db2146962f43548 LICENSE
|
||||
sha256 b5a136ed67798e51fe2e0ca0b2a21cb01b904ff0c9f7d563a6292e276607e58f archival/libarchive/bz/LICENSE
|
||||
|
@ -4,16 +4,13 @@
|
||||
#
|
||||
################################################################################
|
||||
|
||||
BUSYBOX_VERSION = 1.33.0
|
||||
BUSYBOX_VERSION = 1.33.1
|
||||
BUSYBOX_SITE = https://www.busybox.net/downloads
|
||||
BUSYBOX_SOURCE = busybox-$(BUSYBOX_VERSION).tar.bz2
|
||||
BUSYBOX_LICENSE = GPL-2.0, bzip2-1.0.4
|
||||
BUSYBOX_LICENSE_FILES = LICENSE archival/libarchive/bz/LICENSE
|
||||
BUSYBOX_CPE_ID_VENDOR = busybox
|
||||
|
||||
# 0004-decompress_gunzip-Fix-DoS-if-gzip-is-corrupt.patch
|
||||
BUSYBOX_IGNORE_CVES += CVE-2021-28831
|
||||
|
||||
define BUSYBOX_HELP_CMDS
|
||||
@echo ' busybox-menuconfig - Run BusyBox menuconfig'
|
||||
endef
|
||||
|
@ -9,6 +9,7 @@ CHRONY_SITE = http://download.tuxfamily.org/chrony
|
||||
CHRONY_LICENSE = GPL-2.0
|
||||
CHRONY_LICENSE_FILES = COPYING
|
||||
CHRONY_CPE_ID_VENDOR = tuxfamily
|
||||
CHRONY_SELINUX_MODULES = chronyd
|
||||
CHRONY_DEPENDENCIES = host-pkgconf
|
||||
|
||||
CHRONY_CONF_OPTS = \
|
||||
|
@ -4,6 +4,10 @@ After=syslog.target network.target
|
||||
Conflicts=systemd-timesyncd.service
|
||||
|
||||
[Service]
|
||||
# Turn off DNSSEC validation for hostname look-ups, since those need the
|
||||
# correct time to work, but we likely won't acquire that without NTP. Let's
|
||||
# break this chicken-and-egg cycle here.
|
||||
Environment=SYSTEMD_NSS_RESOLVE_VALIDATE=0
|
||||
ExecStart=/usr/sbin/chronyd -n
|
||||
Restart=always
|
||||
|
||||
|
@ -11,6 +11,7 @@ CLAMAV_LICENSE_FILES = COPYING COPYING.bzip2 COPYING.file COPYING.getopt \
|
||||
COPYING.LGPL COPYING.llvm COPYING.lzma COPYING.pcre COPYING.regex \
|
||||
COPYING.unrar COPYING.zlib
|
||||
CLAMAV_CPE_ID_VENDOR = clamav
|
||||
CLAMAV_SELINUX_MODULES = clamav
|
||||
CLAMAV_DEPENDENCIES = \
|
||||
host-pkgconf \
|
||||
libcurl \
|
||||
|
@ -33,6 +33,12 @@ else
|
||||
CRYPTSETUP_CONF_OPTS += --with-crypto_backend=kernel
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_PACKAGE_SYSTEMD_TMPFILES),y)
|
||||
CRYPTSETUP_CONF_OPTS += --with-tmpfilesdir=/usr/lib/tmpfiles.d
|
||||
else
|
||||
CRYPTSETUP_CONF_OPTS += --without-tmpfilesdir
|
||||
endif
|
||||
|
||||
HOST_CRYPTSETUP_DEPENDENCIES = \
|
||||
host-pkgconf \
|
||||
host-lvm2 \
|
||||
|
@ -11,7 +11,7 @@ config BR2_PACKAGE_CWIID
|
||||
A collection of Linux tools written in C for interfacing to
|
||||
the Nintendo Wiimote.
|
||||
|
||||
http://abstrakraft.org/cwiid/
|
||||
https://github.com/abstrakraft/cwiid
|
||||
|
||||
if BR2_PACKAGE_CWIID
|
||||
config BR2_PACKAGE_CWIID_WMGUI
|
||||
|
@ -15,6 +15,7 @@ DNSMASQ_DEPENDENCIES = host-pkgconf $(TARGET_NLS_DEPENDENCIES)
|
||||
DNSMASQ_LICENSE = GPL-2.0 or GPL-3.0
|
||||
DNSMASQ_LICENSE_FILES = COPYING COPYING-v3
|
||||
DNSMASQ_CPE_ID_VENDOR = thekelleys
|
||||
DNSMASQ_SELINUX_MODULES = dnsmasq
|
||||
|
||||
DNSMASQ_I18N = $(if $(BR2_SYSTEM_ENABLE_NLS),-i18n)
|
||||
|
||||
|
@ -1,3 +1,3 @@
|
||||
# Locally calculated
|
||||
sha256 eda53b96ab83a59502df2e5e00ab7ee867243259407ef454be55e695303c1113 docker-cli-20.10.6.tar.gz
|
||||
sha256 0a7848b1b5031483de075433506d0448ddf834368d9c73770e453e0b89b49747 docker-cli-20.10.7.tar.gz
|
||||
sha256 2d81ea060825006fc8f3fe28aa5dc0ffeb80faf325b612c955229157b8c10dc0 LICENSE
|
||||
|
@ -4,7 +4,7 @@
|
||||
#
|
||||
################################################################################
|
||||
|
||||
DOCKER_CLI_VERSION = 20.10.6
|
||||
DOCKER_CLI_VERSION = 20.10.7
|
||||
DOCKER_CLI_SITE = $(call github,docker,cli,v$(DOCKER_CLI_VERSION))
|
||||
|
||||
DOCKER_CLI_LICENSE = Apache-2.0
|
||||
|
@ -1,74 +0,0 @@
|
||||
From 7b9c2905883df5171fda10a364a81b8c6176c8e2 Mon Sep 17 00:00:00 2001
|
||||
From: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
|
||||
Date: Mon, 26 Apr 2021 15:28:40 +0900
|
||||
Subject: [PATCH] fix port forwarding with ipv6.disable=1
|
||||
|
||||
Make `docker run -p 80:80` functional again on environments with kernel boot parameter `ipv6.disable=1`.
|
||||
|
||||
Fix moby/moby issue 42288
|
||||
|
||||
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
|
||||
[Upstream: https://github.com/moby/libnetwork/pull/2635,
|
||||
https://github.com/moby/moby/pull/42322]
|
||||
[Rework path/drop test for docker-engine]
|
||||
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
|
||||
---
|
||||
vendor/github.com/docker/libnetwork/drivers/bridge/port_mapping.go | 31 +++++++++++++++++++++++++++++++
|
||||
1 file changed, 35 insertions(+), 0 deletion(-)
|
||||
|
||||
diff --git a/vendor/github.com/docker/libnetwork/drivers/bridge/port_mapping.go b/vendor/github.com/docker/libnetwork/drivers/bridge/port_mapping.go
|
||||
index 946130ec..17bf36f9 100644
|
||||
--- a/vendor/github.com/docker/libnetwork/drivers/bridge/port_mapping.go
|
||||
+++ b/vendor/github.com/docker/libnetwork/drivers/bridge/port_mapping.go
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"net"
|
||||
+ "sync"
|
||||
|
||||
"github.com/docker/libnetwork/types"
|
||||
"github.com/ishidawataru/sctp"
|
||||
@@ -50,6 +51,13 @@ func (n *bridgeNetwork) allocatePortsInternal(bindings []types.PortBinding, cont
|
||||
bs = append(bs, bIPv4)
|
||||
}
|
||||
|
||||
+ // skip adding implicit v6 addr, when the kernel was booted with `ipv6.disable=1`
|
||||
+ // https://github.com/moby/moby/issues/42288
|
||||
+ isV6Binding := c.HostIP != nil && c.HostIP.To4() == nil
|
||||
+ if !isV6Binding && !IsV6Listenable() {
|
||||
+ continue
|
||||
+ }
|
||||
+
|
||||
// Allocate IPv6 Port mappings
|
||||
// If the container has no IPv6 address, allow proxying host IPv6 traffic to it
|
||||
// by setting up the binding with the IPv4 interface if the userland proxy is enabled
|
||||
@@ -211,3 +219,26 @@ func (n *bridgeNetwork) releasePort(bnd types.PortBinding) error {
|
||||
|
||||
return portmapper.Unmap(host)
|
||||
}
|
||||
+
|
||||
+var (
|
||||
+ v6ListenableCached bool
|
||||
+ v6ListenableOnce sync.Once
|
||||
+)
|
||||
+
|
||||
+// IsV6Listenable returns true when `[::1]:0` is listenable.
|
||||
+// IsV6Listenable returns false mostly when the kernel was booted with `ipv6.disable=1` option.
|
||||
+func IsV6Listenable() bool {
|
||||
+ v6ListenableOnce.Do(func() {
|
||||
+ ln, err := net.Listen("tcp6", "[::1]:0")
|
||||
+ if err != nil {
|
||||
+ // When the kernel was booted with `ipv6.disable=1`,
|
||||
+ // we get err "listen tcp6 [::1]:0: socket: address family not supported by protocol"
|
||||
+ // https://github.com/moby/moby/issues/42288
|
||||
+ logrus.Debugf("port_mapping: v6Listenable=false (%v)", err)
|
||||
+ } else {
|
||||
+ v6ListenableCached = true
|
||||
+ ln.Close()
|
||||
+ }
|
||||
+ })
|
||||
+ return v6ListenableCached
|
||||
+}
|
||||
--
|
||||
2.20.1
|
||||
|
@ -1,3 +1,3 @@
|
||||
# Locally calculated
|
||||
sha256 fd7f5571b1f64f26b5ca520a3e1fefb33c190f3732b931051c23a76bdba5000e docker-engine-20.10.6.tar.gz
|
||||
sha256 b80142035de46904605fb7b8f18075cd94154f8c3d67ff346ea554d1e9d579b9 docker-engine-20.10.7.tar.gz
|
||||
sha256 7c87873291f289713ac5df48b1f2010eb6963752bbd6b530416ab99fc37914a8 LICENSE
|
||||
|
@ -4,7 +4,7 @@
|
||||
#
|
||||
################################################################################
|
||||
|
||||
DOCKER_ENGINE_VERSION = 20.10.6
|
||||
DOCKER_ENGINE_VERSION = 20.10.7
|
||||
DOCKER_ENGINE_SITE = $(call github,moby,moby,v$(DOCKER_ENGINE_VERSION))
|
||||
|
||||
DOCKER_ENGINE_LICENSE = Apache-2.0
|
||||
|
@ -1,3 +1,3 @@
|
||||
# Locally computed after checking signature
|
||||
sha256 68ca0f78a3caa6b090a469f45c395c44cf16da8fcb3345755b1ca436c9ffb2d2 dovecot-2.3-pigeonhole-0.5.14.tar.gz
|
||||
sha256 e1498f50cef74c351a57474cc423b008627ab1ab60724b859283ead6d00550d0 dovecot-2.3-pigeonhole-0.5.15.tar.gz
|
||||
sha256 fc9e9522216f2a9a28b31300e3c73c1df56acc27dfae951bf516e7995366b51a COPYING
|
||||
|
@ -4,7 +4,7 @@
|
||||
#
|
||||
################################################################################
|
||||
|
||||
DOVECOT_PIGEONHOLE_VERSION = 0.5.14
|
||||
DOVECOT_PIGEONHOLE_VERSION = 0.5.15
|
||||
DOVECOT_PIGEONHOLE_SOURCE = dovecot-2.3-pigeonhole-$(DOVECOT_PIGEONHOLE_VERSION).tar.gz
|
||||
DOVECOT_PIGEONHOLE_SITE = https://pigeonhole.dovecot.org/releases/2.3
|
||||
DOVECOT_PIGEONHOLE_LICENSE = LGPL-2.1
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Locally computed after checking signature
|
||||
sha256 c8b3d7f3af1e558a3ff0f970309d4013a4d3ce136f8c02a53a3b05f345b9a34a dovecot-2.3.14.tar.gz
|
||||
sha256 21bbdd5d45957a99133de8b7e71813ecb73d9476c89dfc63479e9102b3553590 dovecot-2.3.15.tar.gz
|
||||
sha256 319a9830aab406109cd67cb45496587566a8123203d66d037b209ca3e13de02a COPYING
|
||||
sha256 dc626520dcd53a22f727af3ee42c770e56c97a64fe3adb063799d8ab032fe551 COPYING.LGPL
|
||||
sha256 52b8c95fabb19575281874b661ef7968ea47e8f5d74ba0dd40ce512e52b3fc97 COPYING.MIT
|
||||
|
@ -5,7 +5,7 @@
|
||||
################################################################################
|
||||
|
||||
DOVECOT_VERSION_MAJOR = 2.3
|
||||
DOVECOT_VERSION = $(DOVECOT_VERSION_MAJOR).14
|
||||
DOVECOT_VERSION = $(DOVECOT_VERSION_MAJOR).15
|
||||
DOVECOT_SITE = https://dovecot.org/releases/$(DOVECOT_VERSION_MAJOR)
|
||||
DOVECOT_INSTALL_STAGING = YES
|
||||
DOVECOT_LICENSE = LGPL-2.1, MIT, Public Domain, BSD-3-Clause, Unicode-DFS-2015
|
||||
@ -18,6 +18,10 @@ DOVECOT_DEPENDENCIES = \
|
||||
# add host-gettext for AM_ICONV macro
|
||||
DOVECOT_DEPENDENCIES += host-gettext
|
||||
|
||||
# CVE-2016-4983 is an issue in a postinstall script in the dovecot rpm, which
|
||||
# is part of the Red Hat packaging and not part of upstream dovecot
|
||||
DOVECOT_IGNORE_CVES += CVE-2016-4983
|
||||
|
||||
DOVECOT_CONF_ENV = \
|
||||
RPCGEN=__disable_RPCGEN_rquota \
|
||||
i_cv_epoll_works=yes \
|
||||
|
@ -27,6 +27,7 @@ HOST_E2FSPROGS_CONF_OPTS = \
|
||||
--disable-defrag \
|
||||
--disable-e2initrd-helper \
|
||||
--disable-fuse2fs \
|
||||
--disable-fsck \
|
||||
--disable-libblkid \
|
||||
--disable-libuuid \
|
||||
--disable-testio-debug \
|
||||
|
@ -0,0 +1,54 @@
|
||||
From 4bb57da5fb0bb0d7e747b9e325e9ec0876ffc1f9 Mon Sep 17 00:00:00 2001
|
||||
From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
|
||||
Date: Sat, 31 Jul 2021 16:36:50 +0200
|
||||
Subject: [PATCH] add BUILD_WITH_STACK_PROTECTOR option
|
||||
|
||||
Add BUILD_WITH_STACK_PROTECTOR to avoid the following build failure with
|
||||
toolchains that don't support stack-protector:
|
||||
|
||||
/home/buildroot/autobuild/instance-3/output-1/host/opt/ext-toolchain/bin/../lib/gcc/mipsel-buildroot-linux-uclibc/9.3.0/../../../../mipsel-buildroot-linux-uclibc/bin/ld: utils.cpp:(.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag[_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag]+0xd0): undefined reference to `__stack_chk_fail'
|
||||
|
||||
Indeed, support for -fstack-protector-strong can't be detected through
|
||||
check_cxx_compiler_flag as some toolchains need to link with -lssp to
|
||||
enable SSP support
|
||||
|
||||
Fixes:
|
||||
- http://autobuild.buildroot.org/results/ae4635899124c602c70d2b342a76f95c34aa4a3d
|
||||
|
||||
Upstream: https://github.com/Exiv2/exiv2/commit/f31c0eba098889899d29b7b0da830aee2b62a7b8
|
||||
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
|
||||
---
|
||||
CMakeLists.txt | 1 +
|
||||
cmake/compilerFlags.cmake | 4 ++--
|
||||
2 files changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 6f0da06a..0746ee14 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -47,6 +47,7 @@ mark_as_advanced(
|
||||
EXIV2_TEAM_USE_SANITIZERS
|
||||
)
|
||||
|
||||
+option( BUILD_WITH_STACK_PROTECTOR "Build with stack protector" ON )
|
||||
option( BUILD_WITH_CCACHE "Use ccache to speed up compilations" OFF )
|
||||
option( BUILD_WITH_COVERAGE "Add compiler flags to generate coverage stats" OFF )
|
||||
|
||||
diff --git a/cmake/compilerFlags.cmake b/cmake/compilerFlags.cmake
|
||||
index 35faf501..0a646e50 100644
|
||||
--- a/cmake/compilerFlags.cmake
|
||||
+++ b/cmake/compilerFlags.cmake
|
||||
@@ -33,8 +33,8 @@ if ( MINGW OR UNIX OR MSYS ) # MINGW, Linux, APPLE, CYGWIN
|
||||
endif()
|
||||
if(HAS_FCF_PROTECTION)
|
||||
add_compile_options(-fcf-protection)
|
||||
- endif()
|
||||
- if(HAS_FSTACK_PROTECTOR_STRONG)
|
||||
+ endif()
|
||||
+ if(BUILD_WITH_STACK_PROTECTOR AND HAS_FSTACK_PROTECTOR_STRONG)
|
||||
add_compile_options(-fstack-protector-strong)
|
||||
endif()
|
||||
endif()
|
||||
--
|
||||
2.31.1
|
||||
|
@ -1,58 +0,0 @@
|
||||
From 2f6d2e5795382f0d6e22f5aea52e8104110d24ad Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
|
||||
Date: Sun, 19 Jul 2020 16:29:15 +0200
|
||||
Subject: [PATCH] cmake/compilerFlags.cmake: properly detect availability of
|
||||
flags
|
||||
|
||||
Instead of relying on fragile and complex logic to decide if a
|
||||
compiler flag is available or not, use the check_c_compiler_flag()
|
||||
macro provided by the CMake standard library.
|
||||
|
||||
This for example avoids using -fcf-protection on architectures that
|
||||
don't support this option.
|
||||
|
||||
[Upstream: https://github.com/Exiv2/exiv2/pull/1252. The submitted
|
||||
patch is slightly different than this one, due to other changes
|
||||
between 0.27.3 and master.]
|
||||
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
|
||||
---
|
||||
cmake/compilerFlags.cmake | 18 +++++++++++-------
|
||||
1 file changed, 11 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/cmake/compilerFlags.cmake b/cmake/compilerFlags.cmake
|
||||
index 0418aa61..be430977 100644
|
||||
--- a/cmake/compilerFlags.cmake
|
||||
+++ b/cmake/compilerFlags.cmake
|
||||
@@ -1,4 +1,5 @@
|
||||
# These flags applies to exiv2lib, the applications, and to the xmp code
|
||||
+include(CheckCCompilerFlag)
|
||||
|
||||
if ( MINGW OR UNIX OR MSYS ) # MINGW, Linux, APPLE, CYGWIN
|
||||
if (${CMAKE_CXX_COMPILER_ID} STREQUAL GNU)
|
||||
@@ -25,13 +26,16 @@ if ( MINGW OR UNIX OR MSYS ) # MINGW, Linux, APPLE, CYGWIN
|
||||
|
||||
# This fails under Fedora, MinGW GCC 8.3.0 and CYGWIN/MSYS 9.3.0
|
||||
if (NOT (MINGW OR CMAKE_HOST_SOLARIS OR CYGWIN OR MSYS) )
|
||||
- if (COMPILER_IS_GCC AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0)
|
||||
- add_compile_options(-fstack-clash-protection -fcf-protection)
|
||||
- endif()
|
||||
-
|
||||
- if( (COMPILER_IS_GCC AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 5.0) # Not in GCC 4.8
|
||||
- OR (COMPILER_IS_CLANG AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 3.7) # Not in Clang 3.4.2
|
||||
- )
|
||||
+ check_c_compiler_flag(-fstack-clash-protection HAS_FSTACK_CLASH_PROTECTION)
|
||||
+ check_c_compiler_flag(-fcf-protection HAS_FCF_PROTECTION)
|
||||
+ check_c_compiler_flag(-fstack-protector-strong HAS_FSTACK_PROTECTOR_STRONG)
|
||||
+ if(HAS_FSTACK_CLASH_PROTECTION)
|
||||
+ add_compile_options(-fstack-clash-protection)
|
||||
+ endif()
|
||||
+ if(GCC_HAS_FCF_PROTECTION)
|
||||
+ add_compile_options(-fcf-protection)
|
||||
+ endif()
|
||||
+ if(GCC_HAS_FSTACK_PROTECTOR_STRONG)
|
||||
add_compile_options(-fstack-protector-strong)
|
||||
endif()
|
||||
endif()
|
||||
---
|
||||
2.26.2
|
||||
|
@ -1,3 +1,3 @@
|
||||
# Locally calculated
|
||||
sha256 6398bc743c32b85b2cb2a604273b8c90aa4eb0fd7c1700bf66cbb2712b4f00c1 exiv2-0.27.3.tar.gz
|
||||
sha256 84366dba7c162af9a7603bcd6c16f40fe0e9af294ba2fd2f66ffffb9fbec904e exiv2-0.27.4-Source.tar.gz
|
||||
sha256 a7ba75cb966aca374711e2af49e5f3aea6a4443a803440f5d93e73a5a1222f66 COPYING
|
||||
|
@ -4,14 +4,17 @@
|
||||
#
|
||||
################################################################################
|
||||
|
||||
EXIV2_VERSION = 0.27.3
|
||||
EXIV2_SITE = $(call github,Exiv2,exiv2,v$(EXIV2_VERSION))
|
||||
EXIV2_VERSION = 0.27.4
|
||||
EXIV2_SOURCE = exiv2-$(EXIV2_VERSION)-Source.tar.gz
|
||||
EXIV2_SITE = https://exiv2.org/builds
|
||||
EXIV2_INSTALL_STAGING = YES
|
||||
EXIV2_LICENSE = GPL-2.0+
|
||||
EXIV2_LICENSE_FILES = COPYING
|
||||
EXIV2_CPE_ID_VENDOR = exiv2
|
||||
|
||||
EXIV2_CONF_OPTS += -DEXIV2_BUILD_SAMPLES=OFF
|
||||
EXIV2_CONF_OPTS += \
|
||||
-DBUILD_WITH_STACK_PROTECTOR=OFF \
|
||||
-DEXIV2_BUILD_SAMPLES=OFF
|
||||
|
||||
ifeq ($(BR2_PACKAGE_EXIV2_LENSDATA),y)
|
||||
EXIV2_CONF_OPTS += -DEXIV2_ENABLE_LENSDATA=ON
|
||||
|
@ -0,0 +1,158 @@
|
||||
From 410a6ce5c80dd981c22752da034f2529b5eee844 Mon Sep 17 00:00:00 2001
|
||||
From: sebres <serg.brester@sebres.de>
|
||||
Date: Mon, 21 Jun 2021 17:12:53 +0200
|
||||
Subject: [PATCH] fixed possible RCE vulnerability, unset escape variable
|
||||
(default tilde) stops consider "~" char after new-line as composing escape
|
||||
sequence
|
||||
|
||||
[Retrieved from:
|
||||
https://github.com/fail2ban/fail2ban/commit/410a6ce5c80dd981c22752da034f2529b5eee844]
|
||||
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
|
||||
---
|
||||
config/action.d/complain.conf | 2 +-
|
||||
config/action.d/dshield.conf | 2 +-
|
||||
config/action.d/mail-buffered.conf | 8 ++++----
|
||||
config/action.d/mail-whois-lines.conf | 2 +-
|
||||
config/action.d/mail-whois.conf | 6 +++---
|
||||
config/action.d/mail.conf | 6 +++---
|
||||
6 files changed, 13 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/config/action.d/complain.conf b/config/action.d/complain.conf
|
||||
index 3a5f882c9f..4d73b05859 100644
|
||||
--- a/config/action.d/complain.conf
|
||||
+++ b/config/action.d/complain.conf
|
||||
@@ -102,7 +102,7 @@ logpath = /dev/null
|
||||
# Notes.: Your system mail command. Is passed 2 args: subject and recipient
|
||||
# Values: CMD
|
||||
#
|
||||
-mailcmd = mail -s
|
||||
+mailcmd = mail -E 'set escape' -s
|
||||
|
||||
# Option: mailargs
|
||||
# Notes.: Additional arguments to mail command. e.g. for standard Unix mail:
|
||||
diff --git a/config/action.d/dshield.conf b/config/action.d/dshield.conf
|
||||
index c128bef348..3d5a7a53a9 100644
|
||||
--- a/config/action.d/dshield.conf
|
||||
+++ b/config/action.d/dshield.conf
|
||||
@@ -179,7 +179,7 @@ tcpflags =
|
||||
# Notes.: Your system mail command. Is passed 2 args: subject and recipient
|
||||
# Values: CMD
|
||||
#
|
||||
-mailcmd = mail -s
|
||||
+mailcmd = mail -E 'set escape' -s
|
||||
|
||||
# Option: mailargs
|
||||
# Notes.: Additional arguments to mail command. e.g. for standard Unix mail:
|
||||
diff --git a/config/action.d/mail-buffered.conf b/config/action.d/mail-buffered.conf
|
||||
index 325f185b2f..79b841049c 100644
|
||||
--- a/config/action.d/mail-buffered.conf
|
||||
+++ b/config/action.d/mail-buffered.conf
|
||||
@@ -17,7 +17,7 @@ actionstart = printf %%b "Hi,\n
|
||||
The jail <name> has been started successfully.\n
|
||||
Output will be buffered until <lines> lines are available.\n
|
||||
Regards,\n
|
||||
- Fail2Ban"|mail -s "[Fail2Ban] <name>: started on <fq-hostname>" <dest>
|
||||
+ Fail2Ban"|mail -E 'set escape' -s "[Fail2Ban] <name>: started on <fq-hostname>" <dest>
|
||||
|
||||
# Option: actionstop
|
||||
# Notes.: command executed at the stop of jail (or at the end of Fail2Ban)
|
||||
@@ -28,13 +28,13 @@ actionstop = if [ -f <tmpfile> ]; then
|
||||
These hosts have been banned by Fail2Ban.\n
|
||||
`cat <tmpfile>`
|
||||
Regards,\n
|
||||
- Fail2Ban"|mail -s "[Fail2Ban] <name>: Summary from <fq-hostname>" <dest>
|
||||
+ Fail2Ban"|mail -E 'set escape' -s "[Fail2Ban] <name>: Summary from <fq-hostname>" <dest>
|
||||
rm <tmpfile>
|
||||
fi
|
||||
printf %%b "Hi,\n
|
||||
The jail <name> has been stopped.\n
|
||||
Regards,\n
|
||||
- Fail2Ban"|mail -s "[Fail2Ban] <name>: stopped on <fq-hostname>" <dest>
|
||||
+ Fail2Ban"|mail -E 'set escape' -s "[Fail2Ban] <name>: stopped on <fq-hostname>" <dest>
|
||||
|
||||
# Option: actioncheck
|
||||
# Notes.: command executed once before each actionban command
|
||||
@@ -55,7 +55,7 @@ actionban = printf %%b "`date`: <ip> (<failures> failures)\n" >> <tmpfile>
|
||||
These hosts have been banned by Fail2Ban.\n
|
||||
`cat <tmpfile>`
|
||||
\nRegards,\n
|
||||
- Fail2Ban"|mail -s "[Fail2Ban] <name>: Summary" <dest>
|
||||
+ Fail2Ban"|mail -E 'set escape' -s "[Fail2Ban] <name>: Summary" <dest>
|
||||
rm <tmpfile>
|
||||
fi
|
||||
|
||||
diff --git a/config/action.d/mail-whois-lines.conf b/config/action.d/mail-whois-lines.conf
|
||||
index 3a3e56b2c7..d2818cb9b9 100644
|
||||
--- a/config/action.d/mail-whois-lines.conf
|
||||
+++ b/config/action.d/mail-whois-lines.conf
|
||||
@@ -72,7 +72,7 @@ actionunban =
|
||||
# Notes.: Your system mail command. Is passed 2 args: subject and recipient
|
||||
# Values: CMD
|
||||
#
|
||||
-mailcmd = mail -s
|
||||
+mailcmd = mail -E 'set escape' -s
|
||||
|
||||
# Default name of the chain
|
||||
#
|
||||
diff --git a/config/action.d/mail-whois.conf b/config/action.d/mail-whois.conf
|
||||
index 7fea34c40d..ab33b616dc 100644
|
||||
--- a/config/action.d/mail-whois.conf
|
||||
+++ b/config/action.d/mail-whois.conf
|
||||
@@ -20,7 +20,7 @@ norestored = 1
|
||||
actionstart = printf %%b "Hi,\n
|
||||
The jail <name> has been started successfully.\n
|
||||
Regards,\n
|
||||
- Fail2Ban"|mail -s "[Fail2Ban] <name>: started on <fq-hostname>" <dest>
|
||||
+ Fail2Ban"|mail -E 'set escape' -s "[Fail2Ban] <name>: started on <fq-hostname>" <dest>
|
||||
|
||||
# Option: actionstop
|
||||
# Notes.: command executed at the stop of jail (or at the end of Fail2Ban)
|
||||
@@ -29,7 +29,7 @@ actionstart = printf %%b "Hi,\n
|
||||
actionstop = printf %%b "Hi,\n
|
||||
The jail <name> has been stopped.\n
|
||||
Regards,\n
|
||||
- Fail2Ban"|mail -s "[Fail2Ban] <name>: stopped on <fq-hostname>" <dest>
|
||||
+ Fail2Ban"|mail -E 'set escape' -s "[Fail2Ban] <name>: stopped on <fq-hostname>" <dest>
|
||||
|
||||
# Option: actioncheck
|
||||
# Notes.: command executed once before each actionban command
|
||||
@@ -49,7 +49,7 @@ actionban = printf %%b "Hi,\n
|
||||
Here is more information about <ip> :\n
|
||||
`%(_whois_command)s`\n
|
||||
Regards,\n
|
||||
- Fail2Ban"|mail -s "[Fail2Ban] <name>: banned <ip> from <fq-hostname>" <dest>
|
||||
+ Fail2Ban"|mail -E 'set escape' -s "[Fail2Ban] <name>: banned <ip> from <fq-hostname>" <dest>
|
||||
|
||||
# Option: actionunban
|
||||
# Notes.: command executed when unbanning an IP. Take care that the
|
||||
diff --git a/config/action.d/mail.conf b/config/action.d/mail.conf
|
||||
index 5d8c0e154c..f4838ddcb6 100644
|
||||
--- a/config/action.d/mail.conf
|
||||
+++ b/config/action.d/mail.conf
|
||||
@@ -16,7 +16,7 @@ norestored = 1
|
||||
actionstart = printf %%b "Hi,\n
|
||||
The jail <name> has been started successfully.\n
|
||||
Regards,\n
|
||||
- Fail2Ban"|mail -s "[Fail2Ban] <name>: started on <fq-hostname>" <dest>
|
||||
+ Fail2Ban"|mail -E 'set escape' -s "[Fail2Ban] <name>: started on <fq-hostname>" <dest>
|
||||
|
||||
# Option: actionstop
|
||||
# Notes.: command executed at the stop of jail (or at the end of Fail2Ban)
|
||||
@@ -25,7 +25,7 @@ actionstart = printf %%b "Hi,\n
|
||||
actionstop = printf %%b "Hi,\n
|
||||
The jail <name> has been stopped.\n
|
||||
Regards,\n
|
||||
- Fail2Ban"|mail -s "[Fail2Ban] <name>: stopped on <fq-hostname>" <dest>
|
||||
+ Fail2Ban"|mail -E 'set escape' -s "[Fail2Ban] <name>: stopped on <fq-hostname>" <dest>
|
||||
|
||||
# Option: actioncheck
|
||||
# Notes.: command executed once before each actionban command
|
||||
@@ -43,7 +43,7 @@ actionban = printf %%b "Hi,\n
|
||||
The IP <ip> has just been banned by Fail2Ban after
|
||||
<failures> attempts against <name>.\n
|
||||
Regards,\n
|
||||
- Fail2Ban"|mail -s "[Fail2Ban] <name>: banned <ip> from <fq-hostname>" <dest>
|
||||
+ Fail2Ban"|mail -E 'set escape' -s "[Fail2Ban] <name>: banned <ip> from <fq-hostname>" <dest>
|
||||
|
||||
# Option: actionunban
|
||||
# Notes.: command executed when unbanning an IP. Take care that the
|
@ -1,3 +1,3 @@
|
||||
# sha256 locally computed
|
||||
sha256 71d2a52b66bb0f87ac3812246bdd3819ec561913cd44afd39130a342f043aa6d fail2ban-0.11.1.tar.gz
|
||||
sha256 383108e5f8644cefb288537950923b7520f642e7e114efb843f6e7ea9268b1e0 fail2ban-0.11.2.tar.gz
|
||||
sha256 a75fec0260742fe6275d63ff6a5d97b924b28766558306b3fa4069763096929b COPYING
|
||||
|
@ -4,13 +4,16 @@
|
||||
#
|
||||
################################################################################
|
||||
|
||||
FAIL2BAN_VERSION = 0.11.1
|
||||
FAIL2BAN_VERSION = 0.11.2
|
||||
FAIL2BAN_SITE = $(call github,fail2ban,fail2ban,$(FAIL2BAN_VERSION))
|
||||
FAIL2BAN_LICENSE = GPL-2.0+
|
||||
FAIL2BAN_LICENSE_FILES = COPYING
|
||||
FAIL2BAN_CPE_ID_VENDOR = fail2ban
|
||||
FAIL2BAN_SETUP_TYPE = distutils
|
||||
|
||||
# 0001-fixed-possible-RCE-vulnerability-unset-escape-variable.patch
|
||||
FAIL2BAN_IGNORE_CVES += CVE-2021-32749
|
||||
|
||||
ifeq ($(BR2_PACKAGE_PYTHON3),y)
|
||||
define FAIL2BAN_PYTHON_2TO3
|
||||
$(HOST_DIR)/bin/2to3 --write --nobackups --no-diffs $(@D)/bin/* $(@D)/fail2ban
|
||||
|
@ -10,6 +10,7 @@ FEH_SITE = http://feh.finalrewind.org
|
||||
FEH_DEPENDENCIES = imlib2 libpng xlib_libXt
|
||||
FEH_LICENSE = MIT
|
||||
FEH_LICENSE_FILES = COPYING
|
||||
FEH_CPE_ID_VENDOR = feh_project
|
||||
|
||||
ifeq ($(BR2_PACKAGE_LIBCURL),y)
|
||||
FEH_DEPENDENCIES += libcurl
|
||||
|
@ -1,6 +1,6 @@
|
||||
# From https://sourceforge.net/p/fetchmail/mailman/message/37249830/
|
||||
sha256 302dc9bcdc6927dedf375d2baaead2347557faa70d98b1da83f2409fa6fb259f fetchmail-6.4.18.tar.xz
|
||||
# From https://sourceforge.net/p/fetchmail/mailman/message/37327392/
|
||||
sha256 c82141ae2e8f0039ceb0c5c2eda43c5e93ad0bf7f9c6bb628092b3be74386176 fetchmail-6.4.20.tar.xz
|
||||
# From https://sourceforge.net/projects/fetchmail/files/branch_6.4/
|
||||
sha1 1fd3e4f30bd9ba7bdcaed5edfca080dc6f66377e fetchmail-6.4.18.tar.xz
|
||||
sha1 ac6a6c4afa105e097d025340cf78b32e0c3b0c8e fetchmail-6.4.20.tar.xz
|
||||
# Locally computed:
|
||||
sha256 8e3ec4863456a26fcd1cf84fadd4146efcb2fd8515bcec482e0f2b7060108895 COPYING
|
||||
sha256 6346b5aa04e258fa4326272ea92372d796b4382aa963535ae98a3bb5f8cd5aeb COPYING
|
||||
|
@ -5,7 +5,7 @@
|
||||
################################################################################
|
||||
|
||||
FETCHMAIL_VERSION_MAJOR = 6.4
|
||||
FETCHMAIL_VERSION = $(FETCHMAIL_VERSION_MAJOR).18
|
||||
FETCHMAIL_VERSION = $(FETCHMAIL_VERSION_MAJOR).20
|
||||
FETCHMAIL_SOURCE = fetchmail-$(FETCHMAIL_VERSION).tar.xz
|
||||
FETCHMAIL_SITE = http://downloads.sourceforge.net/project/fetchmail/branch_$(FETCHMAIL_VERSION_MAJOR)
|
||||
FETCHMAIL_LICENSE = GPL-2.0; some exceptions are mentioned in COPYING
|
||||
|
@ -17,7 +17,7 @@ FLAC_CPE_ID_VENDOR = flac_project
|
||||
FLAC_AUTORECONF = YES
|
||||
|
||||
FLAC_CONF_OPTS = \
|
||||
--disable-cpplibs \
|
||||
$(if $(BR2_INSTALL_LIBSTDCPP),--enable-cpplibs,--disable-cpplibs) \
|
||||
--disable-xmms-plugin \
|
||||
--disable-altivec
|
||||
|
||||
|
25
buildroot/package/fluxbox/0001-fixes-bug-1138.patch
Normal file
25
buildroot/package/fluxbox/0001-fixes-bug-1138.patch
Normal file
@ -0,0 +1,25 @@
|
||||
From 22866c4d30f5b289c429c5ca88d800200db4fc4f Mon Sep 17 00:00:00 2001
|
||||
From: John Sennesael <john@aminking.com>
|
||||
Date: Mon, 2 Nov 2015 15:14:32 -0600
|
||||
Subject: [PATCH] fixes bug #1138
|
||||
|
||||
[Retrieved from:
|
||||
https://github.com/fluxbox/fluxbox/commit/22866c4d30f5b289c429c5ca88d800200db4fc4f]
|
||||
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
|
||||
---
|
||||
util/fluxbox-remote.cc | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/util/fluxbox-remote.cc b/util/fluxbox-remote.cc
|
||||
index 59852e6a..504015b5 100644
|
||||
--- a/util/fluxbox-remote.cc
|
||||
+++ b/util/fluxbox-remote.cc
|
||||
@@ -73,7 +73,7 @@ int main(int argc, char **argv) {
|
||||
if (strcmp(cmd, "result") == 0) {
|
||||
XTextProperty text_prop;
|
||||
if (XGetTextProperty(disp, root, &text_prop, atom_result) != 0
|
||||
- && text_prop.value > 0
|
||||
+ && text_prop.value != 0
|
||||
&& text_prop.nitems > 0) {
|
||||
|
||||
printf("%s", text_prop.value);
|
@ -39,5 +39,11 @@ endef
|
||||
|
||||
GAWK_POST_INSTALL_TARGET_HOOKS += GAWK_CREATE_SYMLINK
|
||||
|
||||
define HOST_GAWK_CREATE_SYMLINK
|
||||
ln -sf gawk $(HOST_DIR)/usr/bin/awk
|
||||
endef
|
||||
|
||||
HOST_GAWK_POST_INSTALL_HOOKS += HOST_GAWK_CREATE_SYMLINK
|
||||
|
||||
$(eval $(autotools-package))
|
||||
$(eval $(host-autotools-package))
|
||||
|
@ -1,50 +0,0 @@
|
||||
From 0a59aa440a4c125b81504c777b066ae4eb1f09f0 Mon Sep 17 00:00:00 2001
|
||||
From: Max Filippov <jcmvbkbc@gmail.com>
|
||||
Date: Tue, 24 Sep 2019 04:15:17 -0700
|
||||
Subject: [PATCH] xtensa: fix PR target/91880
|
||||
|
||||
Xtensa hwloop_optimize segfaults when zero overhead loop is about to be
|
||||
inserted as the first instruction of the function.
|
||||
Insert zero overhead loop instruction into new basic block before the
|
||||
loop when basic block that precedes the loop is empty.
|
||||
|
||||
2019-09-26 Max Filippov <jcmvbkbc@gmail.com>
|
||||
gcc/
|
||||
* config/xtensa/xtensa.c (hwloop_optimize): Insert zero overhead
|
||||
loop instruction into new basic block before the loop when basic
|
||||
block that precedes the loop is empty.
|
||||
|
||||
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
|
||||
Signed-off-by: Romain Naour <romain.naour@gmail.com>
|
||||
---
|
||||
Backported from: r276166
|
||||
|
||||
gcc/config/xtensa/xtensa.c | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c
|
||||
index ee5612441e2..2527468d57d 100644
|
||||
--- a/gcc/config/xtensa/xtensa.c
|
||||
+++ b/gcc/config/xtensa/xtensa.c
|
||||
@@ -4235,7 +4235,9 @@ hwloop_optimize (hwloop_info loop)
|
||||
|
||||
seq = get_insns ();
|
||||
|
||||
- if (!single_succ_p (entry_bb) || vec_safe_length (loop->incoming) > 1)
|
||||
+ entry_after = BB_END (entry_bb);
|
||||
+ if (!single_succ_p (entry_bb) || vec_safe_length (loop->incoming) > 1
|
||||
+ || !entry_after)
|
||||
{
|
||||
basic_block new_bb;
|
||||
edge e;
|
||||
@@ -4256,7 +4258,6 @@ hwloop_optimize (hwloop_info loop)
|
||||
}
|
||||
else
|
||||
{
|
||||
- entry_after = BB_END (entry_bb);
|
||||
while (DEBUG_INSN_P (entry_after)
|
||||
|| (NOTE_P (entry_after)
|
||||
&& NOTE_KIND (entry_after) != NOTE_INSN_BASIC_BLOCK))
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,81 +0,0 @@
|
||||
From 811c8d628045c3d248144fc560a4bf80209ca16e Mon Sep 17 00:00:00 2001
|
||||
From: Romain Naour <romain.naour@gmail.com>
|
||||
Date: Thu, 21 May 2020 15:58:02 +0200
|
||||
Subject: [PATCH] gcc/Makefile.in: move SELFTEST_DEPS before including language
|
||||
makefile fragments
|
||||
|
||||
As reported by several Buildroot users [1][2][3], the gcc build
|
||||
may fail while running selftests makefile target.
|
||||
|
||||
The problem only occurs when ccache is used with gcc 9 and 10,
|
||||
probably due to a race condition.
|
||||
|
||||
While debuging with "make -p" we can notice that s-selftest-c target
|
||||
contain only "cc1" as dependency instead of cc1 and SELFTEST_DEPS [4].
|
||||
|
||||
s-selftest-c: cc1
|
||||
|
||||
While the build is failing, the s-selftest-c dependencies recipe is
|
||||
still running and reported as a bug by make.
|
||||
|
||||
"Dependencies recipe running (THIS IS A BUG)."
|
||||
|
||||
A change [5] in gcc 9 seems to introduce the problem since we can't
|
||||
reproduce this problem with gcc 8.
|
||||
|
||||
As suggested by Yann E. MORIN [6], move SELFTEST_DEPS before
|
||||
including language makefile fragments.
|
||||
|
||||
With the fix applied, the s-seltest-c dependency contains
|
||||
SELFTEST_DEPS value.
|
||||
|
||||
s-selftest-c: cc1 xgcc specs stmp-int-hdrs ../../gcc/testsuite/selftests
|
||||
|
||||
[1] http://lists.busybox.net/pipermail/buildroot/2020-May/282171.html
|
||||
[2] http://lists.busybox.net/pipermail/buildroot/2020-May/282766.html
|
||||
[3] https://github.com/cirosantilli/linux-kernel-module-cheat/issues/108
|
||||
[4] https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/c/Make-lang.in;h=bfae6fd2549c4f728816cd355fa9739dcc08fcde;hb=033eb5671769a4c681a44aad08a454e667e08502#l120
|
||||
[5] https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=033eb5671769a4c681a44aad08a454e667e08502
|
||||
[6] http://lists.busybox.net/pipermail/buildroot/2020-May/283213.html
|
||||
|
||||
Upstream status: https://gcc.gnu.org/pipermail/gcc-patches/2020-May/546248.html
|
||||
|
||||
Signed-off-by: Romain Naour <romain.naour@gmail.com>
|
||||
Cc: Ben Dakin-Norris <ben.dakin-norris@navtechradar.com>
|
||||
Cc: Maxim Kochetkov <fido_max@inbox.ru>
|
||||
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
|
||||
Cc: Yann E. MORIN <yann.morin.1998@free.fr>
|
||||
Cc: Cc: David Malcolm <dmalcolm@gcc.gnu.org>
|
||||
---
|
||||
This patch should be backported to gcc 10 and gcc 9.
|
||||
---
|
||||
gcc/Makefile.in | 6 ++++--
|
||||
1 file changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
|
||||
index abae872cd63..e2ef3c46afc 100644
|
||||
--- a/gcc/Makefile.in
|
||||
+++ b/gcc/Makefile.in
|
||||
@@ -1686,6 +1686,10 @@ $(FULL_DRIVER_NAME): ./xgcc
|
||||
rm -f $@
|
||||
$(LN_S) $< $@
|
||||
|
||||
+# SELFTEST_DEPS need to be set before including language makefile fragments.
|
||||
+# Otherwise $(SELFTEST_DEPS) is empty when used from various <LANG>/Make-lang.in.
|
||||
+SELFTEST_DEPS = $(GCC_PASSES) stmp-int-hdrs $(srcdir)/testsuite/selftests
|
||||
+
|
||||
#
|
||||
# Language makefile fragments.
|
||||
|
||||
@@ -1950,8 +1954,6 @@ DEVNULL=$(if $(findstring mingw,$(build)),nul,/dev/null)
|
||||
SELFTEST_FLAGS = -nostdinc $(DEVNULL) -S -o $(DEVNULL) \
|
||||
-fself-test=$(srcdir)/testsuite/selftests
|
||||
|
||||
-SELFTEST_DEPS = $(GCC_PASSES) stmp-int-hdrs $(srcdir)/testsuite/selftests
|
||||
-
|
||||
# Run the selftests during the build once we have a driver and the frontend,
|
||||
# so that self-test failures are caught as early as possible.
|
||||
# Use "s-selftest-FE" to ensure that we only run the selftests if the
|
||||
--
|
||||
2.25.4
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 1383012ae409ed91903b2b76ee15137bc1f89900 Mon Sep 17 00:00:00 2001
|
||||
From 014db5e5febec94e35c13ce89ee6b389328873a1 Mon Sep 17 00:00:00 2001
|
||||
From: shorne <shorne@138bc75d-0d04-0410-961f-82ee72b054a4>
|
||||
Date: Sat, 31 Aug 2019 06:00:56 +0000
|
||||
Subject: [PATCH] or1k: Fix issue with set_got clobbering LR (r9)
|
||||
@ -101,5 +101,5 @@ index 2dad51cd46b..88f3f02630f 100644
|
||||
(clobber (reg:SI LR_REGNUM))]
|
||||
""
|
||||
--
|
||||
2.24.1
|
||||
2.31.1
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 2aefc4ee703ce3ff70ad25915005cacfbaae0c49 Mon Sep 17 00:00:00 2001
|
||||
From f80e9941739fb3973b61fc6a5abddef5ad2faf73 Mon Sep 17 00:00:00 2001
|
||||
From: Bernd Kuhls <bernd.kuhls@t-online.de>
|
||||
Date: Fri, 27 Mar 2020 21:23:53 +0100
|
||||
Subject: [PATCH] gcc: define _REENTRANT for OpenRISC when -pthread is passed
|
||||
@ -14,7 +14,7 @@ Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/gcc/config/or1k/linux.h b/gcc/config/or1k/linux.h
|
||||
index 4b2f7b6e1fd..b00d23ddfa0 100644
|
||||
index cbdc781418f..36303af892c 100644
|
||||
--- a/gcc/config/or1k/linux.h
|
||||
+++ b/gcc/config/or1k/linux.h
|
||||
@@ -32,6 +32,8 @@
|
||||
@ -27,5 +27,5 @@ index 4b2f7b6e1fd..b00d23ddfa0 100644
|
||||
#define LINK_SPEC "%{h*} \
|
||||
%{static:-Bstatic} \
|
||||
--
|
||||
2.21.0
|
||||
2.31.1
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 0d7fe4806d9dce76367c193d5199df6a2b98009f Mon Sep 17 00:00:00 2001
|
||||
From 1107ecc3e8af31adc7bbd4e08c0614836bd1cebd Mon Sep 17 00:00:00 2001
|
||||
From: Romain Naour <romain.naour@gmail.com>
|
||||
Date: Wed, 20 Jan 2021 23:22:16 +0100
|
||||
Subject: [PATCH] Revert "re PR target/92095 (internal error with -O1
|
||||
@ -30,7 +30,7 @@ Cc: Eric Botcazou <ebotcazou@gcc.gnu.org>
|
||||
delete mode 100644 gcc/testsuite/gcc.c-torture/compile/20191108-1.c
|
||||
|
||||
diff --git a/gcc/config/sparc/sparc-protos.h b/gcc/config/sparc/sparc-protos.h
|
||||
index ef1adb69ede..9bdae7b9faa 100644
|
||||
index f1c120c4860..f4b6f00a7b1 100644
|
||||
--- a/gcc/config/sparc/sparc-protos.h
|
||||
+++ b/gcc/config/sparc/sparc-protos.h
|
||||
@@ -69,7 +69,6 @@ extern void sparc_split_reg_mem (rtx, rtx, machine_mode);
|
||||
@ -42,10 +42,10 @@ index ef1adb69ede..9bdae7b9faa 100644
|
||||
extern const char *output_cbranch (rtx, rtx, int, int, int, rtx_insn *);
|
||||
extern const char *output_return (rtx_insn *);
|
||||
diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
|
||||
index a993aab7639..2974d174e93 100644
|
||||
index 0553dc501e6..516dcf96d7b 100644
|
||||
--- a/gcc/config/sparc/sparc.c
|
||||
+++ b/gcc/config/sparc/sparc.c
|
||||
@@ -4205,6 +4205,13 @@ eligible_for_sibcall_delay (rtx_insn *trial)
|
||||
@@ -4170,6 +4170,13 @@ eligible_for_sibcall_delay (rtx_insn *trial)
|
||||
static bool
|
||||
sparc_cannot_force_const_mem (machine_mode mode, rtx x)
|
||||
{
|
||||
@ -59,7 +59,7 @@ index a993aab7639..2974d174e93 100644
|
||||
switch (GET_CODE (x))
|
||||
{
|
||||
case CONST_INT:
|
||||
@@ -4240,11 +4247,9 @@ sparc_cannot_force_const_mem (machine_mode mode, rtx x)
|
||||
@@ -4205,11 +4212,9 @@ sparc_cannot_force_const_mem (machine_mode mode, rtx x)
|
||||
}
|
||||
|
||||
/* Global Offset Table support. */
|
||||
@ -73,7 +73,7 @@ index a993aab7639..2974d174e93 100644
|
||||
|
||||
/* Return the SYMBOL_REF for the Global Offset Table. */
|
||||
|
||||
@@ -4257,6 +4262,27 @@ sparc_got (void)
|
||||
@@ -4222,6 +4227,27 @@ sparc_got (void)
|
||||
return got_symbol_rtx;
|
||||
}
|
||||
|
||||
@ -101,7 +101,7 @@ index a993aab7639..2974d174e93 100644
|
||||
/* Wrapper around the load_pcrel_sym{si,di} patterns. */
|
||||
|
||||
static rtx
|
||||
@@ -4276,78 +4302,30 @@ gen_load_pcrel_sym (rtx op0, rtx op1, rtx op2)
|
||||
@@ -4241,78 +4267,30 @@ gen_load_pcrel_sym (rtx op0, rtx op1, rtx op2)
|
||||
return insn;
|
||||
}
|
||||
|
||||
@ -186,7 +186,7 @@ index a993aab7639..2974d174e93 100644
|
||||
}
|
||||
|
||||
/* Ensure that we are not using patterns that are not OK with PIC. */
|
||||
@@ -5512,7 +5490,7 @@ save_local_or_in_reg_p (unsigned int regno, int leaf_function)
|
||||
@@ -5477,7 +5455,7 @@ save_local_or_in_reg_p (unsigned int regno, int leaf_function)
|
||||
return true;
|
||||
|
||||
/* GOT register (%l7) if needed. */
|
||||
@ -195,7 +195,7 @@ index a993aab7639..2974d174e93 100644
|
||||
return true;
|
||||
|
||||
/* If the function accesses prior frames, the frame pointer and the return
|
||||
@@ -12555,9 +12533,10 @@ static void
|
||||
@@ -12520,9 +12498,10 @@ static void
|
||||
sparc_file_end (void)
|
||||
{
|
||||
/* If we need to emit the special GOT helper function, do so now. */
|
||||
@ -207,7 +207,7 @@ index a993aab7639..2974d174e93 100644
|
||||
#ifdef DWARF2_UNWIND_INFO
|
||||
bool do_cfi;
|
||||
#endif
|
||||
@@ -12594,22 +12573,17 @@ sparc_file_end (void)
|
||||
@@ -12559,22 +12538,17 @@ sparc_file_end (void)
|
||||
#ifdef DWARF2_UNWIND_INFO
|
||||
do_cfi = dwarf2out_do_cfi_asm ();
|
||||
if (do_cfi)
|
||||
@ -236,7 +236,7 @@ index a993aab7639..2974d174e93 100644
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -13115,10 +13089,7 @@ sparc_init_pic_reg (void)
|
||||
@@ -13080,10 +13054,7 @@ sparc_init_pic_reg (void)
|
||||
edge entry_edge;
|
||||
rtx_insn *seq;
|
||||
|
||||
@ -249,10 +249,10 @@ index a993aab7639..2974d174e93 100644
|
||||
|
||||
start_sequence ();
|
||||
diff --git a/gcc/config/sparc/sparc.md b/gcc/config/sparc/sparc.md
|
||||
index 0a6e27ffa83..7af62d599b9 100644
|
||||
index d9ef79c13cc..6dbd054f1c7 100644
|
||||
--- a/gcc/config/sparc/sparc.md
|
||||
+++ b/gcc/config/sparc/sparc.md
|
||||
@@ -1604,7 +1604,10 @@
|
||||
@@ -1601,7 +1601,10 @@
|
||||
(clobber (reg:P O7_REG))]
|
||||
"REGNO (operands[0]) == INTVAL (operands[3])"
|
||||
{
|
||||
@ -321,5 +321,5 @@ index f00283f6e7b..67d4ac38095 100644
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
--
|
||||
2.25.4
|
||||
2.31.1
|
||||
|
@ -73,7 +73,7 @@ config BR2_GCC_SUPPORTS_DLANG
|
||||
config BR2_GCC_VERSION
|
||||
string
|
||||
default "8.4.0" if BR2_GCC_VERSION_8_X
|
||||
default "9.3.0" if BR2_GCC_VERSION_9_X
|
||||
default "9.4.0" if BR2_GCC_VERSION_9_X
|
||||
default "10.3.0" if BR2_GCC_VERSION_10_X
|
||||
default "arc-2020.09-release" if BR2_GCC_VERSION_ARC
|
||||
default "48152afb96c59733d5bc79e3399bb7b3d4b44266" if BR2_GCC_VERSION_CSKY
|
||||
|
@ -1,7 +1,7 @@
|
||||
# From ftp://gcc.gnu.org/pub/gcc/releases/gcc-8.4.0/sha512.sum
|
||||
sha512 6de904f552a02de33b11ef52312bb664396efd7e1ce3bbe37bfad5ef617f133095b3767b4804bc7fe78df335cb53bc83f1ac055baed40979ce4c2c3e46b70280 gcc-8.4.0.tar.xz
|
||||
# From ftp://gcc.gnu.org/pub/gcc/releases/gcc-9.3.0/sha512.sum
|
||||
sha512 4b9e3639eef6e623747a22c37a904b4750c93b6da77cf3958d5047e9b5ebddb7eebe091cc16ca0a227c0ecbd2bf3b984b221130f269a97ee4cc18f9cf6c444de gcc-9.3.0.tar.xz
|
||||
# From ftp://gcc.gnu.org/pub/gcc/releases/gcc-9.4.0/sha512.sum
|
||||
sha512 dfd3500bf21784b8351a522d53463cf362ede66b0bc302edf350bb44e94418497a8b4b797b6af8ca9b2eeb746b3b115d9c3698381b989546e9151b4496415624 gcc-9.4.0.tar.xz
|
||||
# From ftp://gcc.gnu.org/pub/gcc/releases/gcc-10.3.0/sha512.sum
|
||||
sha512 2b2dd7453d48a398c29eaebd1422b70341001b8c90a62aee51e83344e7fdd8a8e45f82a4a9165bd7edc76dada912c932f4b6632c5636760fec4c5d7e402b3f86 gcc-10.3.0.tar.xz
|
||||
|
||||
|
@ -25,9 +25,9 @@ GCR_LICENSE_FILES = COPYING
|
||||
|
||||
ifeq ($(BR2_PACKAGE_GOBJECT_INTROSPECTION),y)
|
||||
GCR_DEPENDENCIES += gobject-introspection host-libxslt
|
||||
GCR_CONF_OPTS += --with-introspection
|
||||
GCR_CONF_OPTS += --enable-introspection
|
||||
else
|
||||
GCR_CONF_OPTS += --without-introspection
|
||||
GCR_CONF_OPTS += --disable-introspection
|
||||
endif
|
||||
|
||||
# Only the X11 backend is supported for the simple GUI
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user