Compare commits

..

13 Commits
6.2 ... 6.3

Author SHA1 Message Date
Stefan Agner
88da93d0d5 Bump version to 6.3 2021-09-03 16:35:26 +02:00
Stefan Agner
4642552b2f Fix U-Boot USB initialization failure (#1203, #1490) (#1529)
Add a patch to fix a U-Boot issue causing troubles when enumerating USB
devices (required when booting from USB devices).
2021-09-03 16:35:26 +02:00
Stefan Agner
c3c48556ae Linux: Update kernel 5.10.61 for ODROID-N2 (#1512) (#1528)
* Linux: Update kernel 5.10.61 for ODROID-N2 (#1512)

Update the kernel to 5.10.61 for ODROID-N2 and fix the update script
to update kernel for ODROID-N2 next time too.

* Move ODROID kernel patches to non-kernel version specific directory
2021-09-03 13:45:17 +02:00
Stefan Agner
31e6aa07c9 Add Mediatek MT7601U support (#1526) 2021-09-03 13:45:17 +02:00
Stefan Agner
d76d08efa2 Increase minimal free memory for Raspberry Pis (#1525)
The minimal memory reserved parameter vm.min_free_kbytes should be
between 1-3% according to RedHat.

However, the kernel by default reserves around 3MB (e.g. only 3285 on a
32-bit Raspberry Pi 4 2GB installation). This seems to be too low for
network intensive applications such as ours: Under memory pressure
"page allocation failure" on various orders have been observed.

Raspberry Pi OS uses a fixed value of 16MB. Follow this setting for now.

Note: We cannot set this globally for Home Assistant: x86-64 machines
can have quite a bit more memory, which also requires increased
min_free_kbytes parameter. ODROID-N2 on the other hand uses transparent
huge pages: If enabled, the kernel requires higher min_free_kbytes
values, and sets those also by default (e.g. on ODROID-N2+ with 4GB
memory its set to 22528 by default).
2021-09-03 00:28:48 +02:00
Jens Maus
95910387ca Update eq3_char_loop and rpi-rf-mod package to latest (#1517)
Update eq3_char_loop and rpi-rf-mod package to latest versions. Add proper hash files accordingly.
2021-09-03 00:28:12 +02:00
Jens Maus
7b644d87b7 updated generic_raw_uart to latest 1.20 version. (#1516) 2021-09-03 00:28:04 +02:00
Stefan Agner
4bfb3cf10d Linux: Update kernel 5.10.61 (#1512) 2021-09-03 00:27:50 +02:00
Rob VDM
5a8b0ac1a2 Add support for Keyspan USB-Serial adapters (#1509) 2021-09-03 00:27:20 +02:00
Stefan Agner
cbc3e5fa27 Add Intel WiFi firmwares (#1505) (#1506)
Add all available Intel WiFi firmwares.
2021-09-03 00:26:34 +02:00
Stefan Agner
50392b5b86 Enable HDMI CEC drivers for ODROID-N2 (#1216) (#1497) 2021-09-03 00:24:55 +02:00
Stefan Agner
b21b821ddf Fix Ralink RT73 package selection (#1496) 2021-09-03 00:24:05 +02:00
Stefan Agner
82764e7822 Update buildroot to 2021.02.4 (#1522)
Signed-off-by: Stefan Agner <stefan@agner.ch>
2021-09-03 00:20:44 +02:00
376 changed files with 7684 additions and 1440 deletions

View File

@@ -5,15 +5,15 @@ Default Kernel tree: 5.10
| Board | Version |
|-------|---------|
| Open Virtual Appliance | 5.10.53 |
| Open Virtual Appliance | 5.10.61 |
| Raspberry Pi | 5.10.17 |
| Raspberry Pi 0-W | 5.10.17 |
| Raspberry Pi 2 | 5.10.17 |
| Raspberry Pi 3 | 5.10.17 |
| Raspberry Pi 4 | 5.10.17 |
| Tinker Board | 5.10.53 |
| Odroid-C2 | 5.10.53 |
| Odroid-C4 | 5.10.53 |
| Odroid-N2 | 5.10.53 |
| Odroid-XU4 | 5.10.53 |
| Generic x86-64 | 5.10.53 |
| Tinker Board | 5.10.61 |
| Odroid-C2 | 5.10.61 |
| Odroid-C4 | 5.10.61 |
| Odroid-N2 | 5.10.61 |
| Odroid-XU4 | 5.10.61 |
| Generic x86-64 | 5.10.61 |

View File

@@ -3818,10 +3818,10 @@ CONFIG_CEC_NOTIFIER=y
CONFIG_MEDIA_CEC_SUPPORT=y
# CONFIG_CEC_CH7322 is not set
# CONFIG_CEC_CROS_EC is not set
# CONFIG_CEC_MESON_AO is not set
# CONFIG_CEC_MESON_G12A_AO is not set
# CONFIG_CEC_GPIO is not set
# CONFIG_USB_PULSE8_CEC is not set
CONFIG_CEC_MESON_AO=m
CONFIG_CEC_MESON_G12A_AO=m
CONFIG_CEC_GPIO=m
CONFIG_USB_PULSE8_CEC=m
# CONFIG_USB_RAINSHADOW_CEC is not set
CONFIG_MEDIA_SUPPORT=y
CONFIG_MEDIA_SUPPORT_FILTER=y

View File

@@ -1,8 +1,8 @@
From 76cd0b31510f2019e411593e1a177ca8280b56b3 Mon Sep 17 00:00:00 2001
Message-Id: <76cd0b31510f2019e411593e1a177ca8280b56b3.1619686343.git.stefan@agner.ch>
From 9cb97076d98f7f68534abb3d1f596644ae730841 Mon Sep 17 00:00:00 2001
Message-Id: <9cb97076d98f7f68534abb3d1f596644ae730841.1630679018.git.stefan@agner.ch>
From: Pascal Vizeli <pvizeli@syshack.ch>
Date: Tue, 10 Dec 2019 09:48:46 +0000
Subject: [PATCH 1/2] rpi: Use CONFIG_OF_BOARD instead of CONFIG_EMBED
Subject: [PATCH 1/3] rpi: Use CONFIG_OF_BOARD instead of CONFIG_EMBED
Signed-off-by: Pascal Vizeli <pvizeli@syshack.ch>
---
@@ -79,5 +79,5 @@ index 78638105f7..06b390d907 100644
CONFIG_SYS_RELOC_GD_ENV_ADDR=y
CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
--
2.31.1
2.33.0

View File

@@ -1,10 +1,10 @@
From 8c11937b388dfafcdff27914d361532dc805245f Mon Sep 17 00:00:00 2001
Message-Id: <8c11937b388dfafcdff27914d361532dc805245f.1619686343.git.stefan@agner.ch>
In-Reply-To: <76cd0b31510f2019e411593e1a177ca8280b56b3.1619686343.git.stefan@agner.ch>
References: <76cd0b31510f2019e411593e1a177ca8280b56b3.1619686343.git.stefan@agner.ch>
From 69ac2930e69ca876f8da95d80f4a1cb8cc23bb6a Mon Sep 17 00:00:00 2001
Message-Id: <69ac2930e69ca876f8da95d80f4a1cb8cc23bb6a.1630679018.git.stefan@agner.ch>
In-Reply-To: <9cb97076d98f7f68534abb3d1f596644ae730841.1630679018.git.stefan@agner.ch>
References: <9cb97076d98f7f68534abb3d1f596644ae730841.1630679018.git.stefan@agner.ch>
From: Florin Sarbu <florin@balena.io>
Date: Thu, 12 Sep 2019 12:31:31 +0200
Subject: [PATCH 2/2] raspberrypi: Disable simple framebuffer support
Subject: [PATCH 2/3] raspberrypi: Disable simple framebuffer support
On 4.19 kernels this u-boot driver clashes with bcm2708_fb.
So let's disable it from here so that we have bcm2708_fb
@@ -61,5 +61,5 @@ index 834f1cd236..19a0d611c4 100644
#ifdef CONFIG_CMD_USB
#define CONFIG_TFTP_TSIZE
--
2.31.1
2.33.0

View File

@@ -0,0 +1,49 @@
From 72619dd5d0be59e702fd7b7090916ee688c34180 Mon Sep 17 00:00:00 2001
Message-Id: <72619dd5d0be59e702fd7b7090916ee688c34180.1630679018.git.stefan@agner.ch>
In-Reply-To: <9cb97076d98f7f68534abb3d1f596644ae730841.1630679018.git.stefan@agner.ch>
References: <9cb97076d98f7f68534abb3d1f596644ae730841.1630679018.git.stefan@agner.ch>
From: Marek Szyprowski <m.szyprowski@samsung.com>
Date: Thu, 17 Jun 2021 11:22:03 +0200
Subject: [PATCH 3/3] ARM: bcm283x: change the virtual address of the XHCI PCI
device base
Move the XHCI PCI device base up in the virtual address space. This fixes
initialization failure observed with newer Raspberry Pi firmware, later
than 63b1922311 ("firmware: arm_loader: Update armstubs with those from
PR 117). It looks that chosing 0xff800000 as the XHCI PCI device base
conflicts with the updated ARM/VideoCore firmware.
This also requires to reduce the size of the mapped PCI device region
from 8MiB to 4MiB to fit into 32bit address space. This is still enough
for the XHCI PCI device.
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
arch/arm/mach-bcm283x/init.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-bcm283x/init.c b/arch/arm/mach-bcm283x/init.c
index 49027ce0a2..9803499985 100644
--- a/arch/arm/mach-bcm283x/init.c
+++ b/arch/arm/mach-bcm283x/init.c
@@ -14,7 +14,7 @@
#include <asm/global_data.h>
#define BCM2711_RPI4_PCIE_XHCI_MMIO_PHYS 0x600000000UL
-#define BCM2711_RPI4_PCIE_XHCI_MMIO_SIZE 0x800000UL
+#define BCM2711_RPI4_PCIE_XHCI_MMIO_SIZE 0x400000UL
#ifdef CONFIG_ARM64
#include <asm/armv8/mmu.h>
@@ -148,7 +148,7 @@ int mach_cpu_init(void)
#ifdef CONFIG_ARMV7_LPAE
#ifdef CONFIG_TARGET_RPI_4_32B
-#define BCM2711_RPI4_PCIE_XHCI_MMIO_VIRT 0xff800000UL
+#define BCM2711_RPI4_PCIE_XHCI_MMIO_VIRT 0xffc00000UL
#include <addr_map.h>
#include <asm/system.h>
--
2.33.0

View File

@@ -0,0 +1 @@
vm.min_free_kbytes = 16384

View File

@@ -21,7 +21,7 @@ BR2_ROOTFS_POST_IMAGE_SCRIPT="$(BR2_EXTERNAL_HASSOS_PATH)/scripts/post-image.sh"
BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_EXTERNAL_HASSOS_PATH)/board/pc/generic-x86-64 $(BR2_EXTERNAL_HASSOS_PATH)/board/pc/generic-x86-64/hassos-hook.sh"
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.10.53"
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.10.61"
BR2_LINUX_KERNEL_DEFCONFIG="x86_64"
BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="$(BR2_EXTERNAL_HASSOS_PATH)/kernel/hassos.config $(BR2_EXTERNAL_HASSOS_PATH)/kernel/docker.config $(BR2_EXTERNAL_HASSOS_PATH)/kernel/device-support.config $(BR2_EXTERNAL_HASSOS_PATH)/board/pc/generic-x86-64/kernel.config"
BR2_LINUX_KERNEL_LZ4=y
@@ -40,17 +40,22 @@ BR2_PACKAGE_UDISKS2=y
# BR2_PACKAGE_LVM2_STANDARD_INSTALL is not set
BR2_PACKAGE_LINUX_FIRMWARE=y
BR2_PACKAGE_LINUX_FIRMWARE_IBT=y
BR2_PACKAGE_LINUX_FIRMWARE_IWLWIFI_22260=y
BR2_PACKAGE_LINUX_FIRMWARE_IWLWIFI_3160=y
BR2_PACKAGE_LINUX_FIRMWARE_IWLWIFI_3168=y
BR2_PACKAGE_LINUX_FIRMWARE_IWLWIFI_5000=y
BR2_PACKAGE_LINUX_FIRMWARE_IWLWIFI_6000G2A=y
BR2_PACKAGE_LINUX_FIRMWARE_IWLWIFI_6000G2B=y
BR2_PACKAGE_LINUX_FIRMWARE_IWLWIFI_7260=y
BR2_PACKAGE_LINUX_FIRMWARE_IWLWIFI_7265=y
BR2_PACKAGE_LINUX_FIRMWARE_IWLWIFI_7265D=y
BR2_PACKAGE_LINUX_FIRMWARE_IWLWIFI_8000=y
BR2_PACKAGE_LINUX_FIRMWARE_IWLWIFI_8000C=y
BR2_PACKAGE_LINUX_FIRMWARE_IWLWIFI_8265=y
BR2_PACKAGE_LINUX_FIRMWARE_IWLWIFI_9XXX=y
BR2_PACKAGE_LINUX_FIRMWARE_I915=y
BR2_PACKAGE_LINUX_FIRMWARE_MEDIATEK_MT7601U=y
BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT2XX=y
BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT73
BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT73=y
BR2_PACKAGE_LINUX_FIRMWARE_RTL_8169=y
BR2_PACKAGE_LINUX_FIRMWARE_RTL_87XX_BT=y
BR2_PACKAGE_LINUX_FIRMWARE_RTL_88XX_BT=y

View File

@@ -21,7 +21,7 @@ BR2_ROOTFS_POST_IMAGE_SCRIPT="$(BR2_EXTERNAL_HASSOS_PATH)/scripts/post-image.sh"
BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_EXTERNAL_HASSOS_PATH)/board/hardkernel/odroid-c2 $(BR2_EXTERNAL_HASSOS_PATH)/board/hardkernel/odroid-c2/hassos-hook.sh"
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.10.53"
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.10.61"
BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="$(BR2_EXTERNAL_HASSOS_PATH)/board/hardkernel/kernel-amlogic.config"
BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="$(BR2_EXTERNAL_HASSOS_PATH)/kernel/hassos.config $(BR2_EXTERNAL_HASSOS_PATH)/kernel/docker.config $(BR2_EXTERNAL_HASSOS_PATH)/kernel/device-support.config"
@@ -42,8 +42,9 @@ BR2_PACKAGE_OS_AGENT=y
BR2_PACKAGE_UDISKS2=y
# BR2_PACKAGE_LVM2_STANDARD_INSTALL is not set
BR2_PACKAGE_LINUX_FIRMWARE=y
BR2_PACKAGE_LINUX_FIRMWARE_MEDIATEK_MT7601U=y
BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT2XX=y
BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT73
BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT73=y
BR2_PACKAGE_LINUX_FIRMWARE_RTL_87XX_BT=y
BR2_PACKAGE_LINUX_FIRMWARE_RTL_88XX_BT=y
BR2_PACKAGE_LINUX_FIRMWARE_RTL_81XX=y

View File

@@ -21,7 +21,7 @@ BR2_ROOTFS_POST_IMAGE_SCRIPT="$(BR2_EXTERNAL_HASSOS_PATH)/scripts/post-image.sh"
BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_EXTERNAL_HASSOS_PATH)/board/hardkernel/odroid-c4 $(BR2_EXTERNAL_HASSOS_PATH)/board/hardkernel/odroid-c4/hassos-hook.sh"
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.10.53"
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.10.61"
BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="$(BR2_EXTERNAL_HASSOS_PATH)/board/hardkernel/kernel-amlogic.config"
BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="$(BR2_EXTERNAL_HASSOS_PATH)/kernel/hassos.config $(BR2_EXTERNAL_HASSOS_PATH)/kernel/docker.config $(BR2_EXTERNAL_HASSOS_PATH)/kernel/device-support.config"
@@ -42,8 +42,9 @@ BR2_PACKAGE_OS_AGENT=y
BR2_PACKAGE_UDISKS2=y
# BR2_PACKAGE_LVM2_STANDARD_INSTALL is not set
BR2_PACKAGE_LINUX_FIRMWARE=y
BR2_PACKAGE_LINUX_FIRMWARE_MEDIATEK_MT7601U=y
BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT2XX=y
BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT73
BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT73=y
BR2_PACKAGE_LINUX_FIRMWARE_RTL_87XX_BT=y
BR2_PACKAGE_LINUX_FIRMWARE_RTL_88XX_BT=y
BR2_PACKAGE_LINUX_FIRMWARE_RTL_81XX=y

View File

@@ -21,7 +21,7 @@ BR2_ROOTFS_POST_IMAGE_SCRIPT="$(BR2_EXTERNAL_HASSOS_PATH)/scripts/post-image.sh"
BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_EXTERNAL_HASSOS_PATH)/board/hardkernel/odroid-n2 $(BR2_EXTERNAL_HASSOS_PATH)/board/hardkernel/odroid-n2/hassos-hook.sh"
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.10.53"
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.10.61"
BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="$(BR2_EXTERNAL_HASSOS_PATH)/board/hardkernel/kernel-amlogic.config"
BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="$(BR2_EXTERNAL_HASSOS_PATH)/kernel/hassos.config $(BR2_EXTERNAL_HASSOS_PATH)/kernel/docker.config $(BR2_EXTERNAL_HASSOS_PATH)/kernel/device-support.config $(BR2_EXTERNAL_HASSOS_PATH)/board/hardkernel/odroid-n2/kernel.config"
@@ -42,8 +42,9 @@ BR2_PACKAGE_OS_AGENT=y
BR2_PACKAGE_UDISKS2=y
# BR2_PACKAGE_LVM2_STANDARD_INSTALL is not set
BR2_PACKAGE_LINUX_FIRMWARE=y
BR2_PACKAGE_LINUX_FIRMWARE_MEDIATEK_MT7601U=y
BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT2XX=y
BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT73
BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT73=y
BR2_PACKAGE_LINUX_FIRMWARE_RTL_87XX_BT=y
BR2_PACKAGE_LINUX_FIRMWARE_RTL_88XX_BT=y
BR2_PACKAGE_LINUX_FIRMWARE_RTL_81XX=y

View File

@@ -22,7 +22,7 @@ BR2_ROOTFS_POST_IMAGE_SCRIPT="$(BR2_EXTERNAL_HASSOS_PATH)/scripts/post-image.sh"
BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_EXTERNAL_HASSOS_PATH)/board/hardkernel/odroid-xu4 $(BR2_EXTERNAL_HASSOS_PATH)/board/hardkernel/odroid-xu4/hassos-hook.sh"
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.10.53"
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.10.61"
BR2_LINUX_KERNEL_DEFCONFIG="exynos"
BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="$(BR2_EXTERNAL_HASSOS_PATH)/kernel/hassos.config $(BR2_EXTERNAL_HASSOS_PATH)/kernel/docker.config $(BR2_EXTERNAL_HASSOS_PATH)/kernel/device-support.config"
BR2_LINUX_KERNEL_LZ4=y
@@ -42,8 +42,9 @@ BR2_PACKAGE_UDISKS2=y
# BR2_PACKAGE_LVM2_STANDARD_INSTALL is not set
BR2_PACKAGE_LINUX_FIRMWARE=y
BR2_PACKAGE_LINUX_FIRMWARE_MFC_V8=y
BR2_PACKAGE_LINUX_FIRMWARE_MEDIATEK_MT7601U=y
BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT2XX=y
BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT73
BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT73=y
BR2_PACKAGE_LINUX_FIRMWARE_RTL_87XX_BT=y
BR2_PACKAGE_LINUX_FIRMWARE_RTL_88XX_BT=y
BR2_PACKAGE_LINUX_FIRMWARE_RTL_81XX=y

View File

@@ -22,7 +22,7 @@ BR2_ROOTFS_POST_IMAGE_SCRIPT="$(BR2_EXTERNAL_HASSOS_PATH)/scripts/post-image.sh"
BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_EXTERNAL_HASSOS_PATH)/board/pc/ova $(BR2_EXTERNAL_HASSOS_PATH)/board/pc/ova/hassos-hook.sh"
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.10.53"
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.10.61"
BR2_LINUX_KERNEL_DEFCONFIG="x86_64"
BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="$(BR2_EXTERNAL_HASSOS_PATH)/kernel/hassos.config $(BR2_EXTERNAL_HASSOS_PATH)/kernel/docker.config $(BR2_EXTERNAL_HASSOS_PATH)/kernel/device-support.config $(BR2_EXTERNAL_HASSOS_PATH)/board/pc/ova/kernel.config"
BR2_LINUX_KERNEL_LZ4=y
@@ -41,17 +41,22 @@ BR2_PACKAGE_UDISKS2=y
# BR2_PACKAGE_LVM2_STANDARD_INSTALL is not set
BR2_PACKAGE_LINUX_FIRMWARE=y
BR2_PACKAGE_LINUX_FIRMWARE_IBT=y
BR2_PACKAGE_LINUX_FIRMWARE_IWLWIFI_22260=y
BR2_PACKAGE_LINUX_FIRMWARE_IWLWIFI_3160=y
BR2_PACKAGE_LINUX_FIRMWARE_IWLWIFI_3168=y
BR2_PACKAGE_LINUX_FIRMWARE_IWLWIFI_5000=y
BR2_PACKAGE_LINUX_FIRMWARE_IWLWIFI_6000G2A=y
BR2_PACKAGE_LINUX_FIRMWARE_IWLWIFI_6000G2B=y
BR2_PACKAGE_LINUX_FIRMWARE_IWLWIFI_7260=y
BR2_PACKAGE_LINUX_FIRMWARE_IWLWIFI_7265=y
BR2_PACKAGE_LINUX_FIRMWARE_IWLWIFI_7265D=y
BR2_PACKAGE_LINUX_FIRMWARE_IWLWIFI_8000=y
BR2_PACKAGE_LINUX_FIRMWARE_IWLWIFI_8000C=y
BR2_PACKAGE_LINUX_FIRMWARE_IWLWIFI_8265=y
BR2_PACKAGE_LINUX_FIRMWARE_IWLWIFI_9XXX=y
BR2_PACKAGE_LINUX_FIRMWARE_I915=y
BR2_PACKAGE_LINUX_FIRMWARE_MEDIATEK_MT7601U=y
BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT2XX=y
BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT73
BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT73=y
BR2_PACKAGE_LINUX_FIRMWARE_RTL_8169=y
BR2_PACKAGE_LINUX_FIRMWARE_RTL_87XX_BT=y
BR2_PACKAGE_LINUX_FIRMWARE_RTL_88XX_BT=y

View File

@@ -42,8 +42,9 @@ BR2_PACKAGE_OS_AGENT=y
BR2_PACKAGE_UDISKS2=y
# BR2_PACKAGE_LVM2_STANDARD_INSTALL is not set
BR2_PACKAGE_LINUX_FIRMWARE=y
BR2_PACKAGE_LINUX_FIRMWARE_MEDIATEK_MT7601U=y
BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT2XX=y
BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT73
BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT73=y
BR2_PACKAGE_LINUX_FIRMWARE_RTL_87XX_BT=y
BR2_PACKAGE_LINUX_FIRMWARE_RTL_88XX_BT=y
BR2_PACKAGE_LINUX_FIRMWARE_USB_SERIAL_TI=y

View File

@@ -42,8 +42,9 @@ BR2_PACKAGE_OS_AGENT=y
BR2_PACKAGE_UDISKS2=y
# BR2_PACKAGE_LVM2_STANDARD_INSTALL is not set
BR2_PACKAGE_LINUX_FIRMWARE=y
BR2_PACKAGE_LINUX_FIRMWARE_MEDIATEK_MT7601U=y
BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT2XX=y
BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT73
BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT73=y
BR2_PACKAGE_LINUX_FIRMWARE_RTL_87XX_BT=y
BR2_PACKAGE_LINUX_FIRMWARE_RTL_88XX_BT=y
BR2_PACKAGE_LINUX_FIRMWARE_USB_SERIAL_TI=y

View File

@@ -42,8 +42,9 @@ BR2_PACKAGE_OS_AGENT=y
BR2_PACKAGE_UDISKS2=y
# BR2_PACKAGE_LVM2_STANDARD_INSTALL is not set
BR2_PACKAGE_LINUX_FIRMWARE=y
BR2_PACKAGE_LINUX_FIRMWARE_MEDIATEK_MT7601U=y
BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT2XX=y
BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT73
BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT73=y
BR2_PACKAGE_LINUX_FIRMWARE_RTL_87XX_BT=y
BR2_PACKAGE_LINUX_FIRMWARE_RTL_88XX_BT=y
BR2_PACKAGE_LINUX_FIRMWARE_USB_SERIAL_TI=y

View File

@@ -42,8 +42,9 @@ BR2_PACKAGE_OS_AGENT=y
BR2_PACKAGE_UDISKS2=y
# BR2_PACKAGE_LVM2_STANDARD_INSTALL is not set
BR2_PACKAGE_LINUX_FIRMWARE=y
BR2_PACKAGE_LINUX_FIRMWARE_MEDIATEK_MT7601U=y
BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT2XX=y
BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT73
BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT73=y
BR2_PACKAGE_LINUX_FIRMWARE_RTL_87XX_BT=y
BR2_PACKAGE_LINUX_FIRMWARE_RTL_88XX_BT=y
BR2_PACKAGE_LINUX_FIRMWARE_USB_SERIAL_TI=y

View File

@@ -42,8 +42,9 @@ BR2_PACKAGE_OS_AGENT=y
BR2_PACKAGE_UDISKS2=y
# BR2_PACKAGE_LVM2_STANDARD_INSTALL is not set
BR2_PACKAGE_LINUX_FIRMWARE=y
BR2_PACKAGE_LINUX_FIRMWARE_MEDIATEK_MT7601U=y
BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT2XX=y
BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT73
BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT73=y
BR2_PACKAGE_LINUX_FIRMWARE_RTL_87XX_BT=y
BR2_PACKAGE_LINUX_FIRMWARE_RTL_88XX_BT=y
BR2_PACKAGE_LINUX_FIRMWARE_USB_SERIAL_TI=y

View File

@@ -42,8 +42,9 @@ BR2_PACKAGE_OS_AGENT=y
BR2_PACKAGE_UDISKS2=y
# BR2_PACKAGE_LVM2_STANDARD_INSTALL is not set
BR2_PACKAGE_LINUX_FIRMWARE=y
BR2_PACKAGE_LINUX_FIRMWARE_MEDIATEK_MT7601U=y
BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT2XX=y
BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT73
BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT73=y
BR2_PACKAGE_LINUX_FIRMWARE_RTL_87XX_BT=y
BR2_PACKAGE_LINUX_FIRMWARE_RTL_88XX_BT=y
BR2_PACKAGE_LINUX_FIRMWARE_USB_SERIAL_TI=y

View File

@@ -42,8 +42,9 @@ BR2_PACKAGE_OS_AGENT=y
BR2_PACKAGE_UDISKS2=y
# BR2_PACKAGE_LVM2_STANDARD_INSTALL is not set
BR2_PACKAGE_LINUX_FIRMWARE=y
BR2_PACKAGE_LINUX_FIRMWARE_MEDIATEK_MT7601U=y
BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT2XX=y
BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT73
BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT73=y
BR2_PACKAGE_LINUX_FIRMWARE_RTL_87XX_BT=y
BR2_PACKAGE_LINUX_FIRMWARE_RTL_88XX_BT=y
BR2_PACKAGE_LINUX_FIRMWARE_USB_SERIAL_TI=y

View File

@@ -23,7 +23,7 @@ BR2_ROOTFS_POST_IMAGE_SCRIPT="$(BR2_EXTERNAL_HASSOS_PATH)/scripts/post-image.sh"
BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_EXTERNAL_HASSOS_PATH)/board/asus/tinker $(BR2_EXTERNAL_HASSOS_PATH)/board/asus/hassos-hook.sh"
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.10.53"
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.10.61"
BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="$(BR2_EXTERNAL_HASSOS_PATH)/board/asus/tinker/kernel.config"
BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="$(BR2_EXTERNAL_HASSOS_PATH)/kernel/hassos.config $(BR2_EXTERNAL_HASSOS_PATH)/kernel/docker.config $(BR2_EXTERNAL_HASSOS_PATH)/kernel/device-support.config"
@@ -44,8 +44,9 @@ BR2_PACKAGE_OS_AGENT=y
BR2_PACKAGE_UDISKS2=y
# BR2_PACKAGE_LVM2_STANDARD_INSTALL is not set
BR2_PACKAGE_LINUX_FIRMWARE=y
BR2_PACKAGE_LINUX_FIRMWARE_MEDIATEK_MT7601U=y
BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT2XX=y
BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT73
BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT73=y
BR2_PACKAGE_LINUX_FIRMWARE_RTL_87XX_BT=y
BR2_PACKAGE_LINUX_FIRMWARE_RTL_88XX_BT=y
BR2_PACKAGE_LINUX_FIRMWARE_RTL_87XX=y

View File

@@ -8,6 +8,7 @@ CONFIG_USB_SERIAL_FTDI_SIO=m
CONFIG_USB_SERIAL_PL2303=m
CONFIG_USB_SERIAL_CH341=m
CONFIG_USB_SERIAL_TI=m
CONFIG_USB_SERIAL_KEYSPAN=m
CONFIG_USB_ACM=m
CONFIG_USB_USBNET=m
@@ -28,6 +29,9 @@ CONFIG_BT_HCIBTUSB_RTL=y
CONFIG_RTL_CARDS=y
CONFIG_RTL8192CU=m
CONFIG_WLAN_VENDOR_MEDIATEK=y
CONFIG_MT7601U=m
CONFIG_WLAN_VENDOR_RALINK=y
CONFIG_RT2X00=m
CONFIG_RT2500USB=m

View File

@@ -1,5 +1,5 @@
VERSION_MAJOR=6
VERSION_BUILD=2
VERSION_BUILD=3
HASSOS_NAME="Home Assistant OS"
HASSOS_ID="haos"

View File

@@ -0,0 +1,3 @@
# Locally computed
sha256 2cc35060f1667a71184fd191e72bd96793f0a9709f14262adb7279ace38ba960 eq3_char_loop-e60183fc5b8375d9eea185c716f716c07657fa00.tar.gz
sha256 e600b8a501a17600d01bd7a4646508f94f3cd3b9df03661babd9f1801e579b36 LicenseDE.txt

View File

@@ -8,7 +8,7 @@
#
#############################################################
EQ3_CHAR_LOOP_VERSION = 8cb51174c2bc8c4b33df50a96b82c90e8092f79c
EQ3_CHAR_LOOP_VERSION = e60183fc5b8375d9eea185c716f716c07657fa00
EQ3_CHAR_LOOP_SITE = $(call github,eq-3,occu,$(EQ3_CHAR_LOOP_VERSION))
EQ3_CHAR_LOOP_LICENSE = GPL2
#EQ3_CHAR_LOOP_LICENSE_FILES = LICENSE

View File

@@ -0,0 +1,3 @@
# Locally computed
sha256 45077e1b2ce89f8ea41c9039153a4e00f398fef80078e968f2861c43d475de45 generic_raw_uart-9510818fa12e52baf40fe5ac84e58fd62db4f70e.tar.gz
sha256 b40930bbcf80744c86c46a12bc9da056641d722716c378f5659b9e555ef833e1 LICENSE

View File

@@ -13,10 +13,10 @@
#
#############################################################
GENERIC_RAW_UART_VERSION = 2b2ae687f5ea9d6cb940a44bed66ad872ecd7a4d
GENERIC_RAW_UART_VERSION = 9510818fa12e52baf40fe5ac84e58fd62db4f70e
GENERIC_RAW_UART_SITE = $(call github,alexreinert,piVCCU,$(GENERIC_RAW_UART_VERSION))
GENERIC_RAW_UART_LICENSE = GPL2
#GENERIC_RAW_UART_LICENSE_FILES = LICENSE
GENERIC_RAW_UART_LICENSE_FILES = LICENSE
GENERIC_RAW_UART_MODULE_SUBDIRS = kernel
$(eval $(kernel-module))

View File

@@ -0,0 +1,3 @@
# Locally computed
sha256 115e5c0e0174f21005e6e1d8a616dd86ad5ad61df5929b06e6f7b7b20a8c9e48 rpi-rf-mod-7f5d50c8ac72e114a6b11a4ae0e92e316260fb0d.tar.gz
sha256 b40930bbcf80744c86c46a12bc9da056641d722716c378f5659b9e555ef833e1 LICENSE

View File

@@ -11,15 +11,16 @@
#
#############################################################
RPI_RF_MOD_VERSION = 3b0311063973669d0b5310a3d3e4b6280ac4f438
RPI_RF_MOD_VERSION = 7f5d50c8ac72e114a6b11a4ae0e92e316260fb0d
RPI_RF_MOD_SITE = $(call github,jens-maus,RaspberryMatic,$(RPI_RF_MOD_VERSION))
RPI_RF_MOD_LICENSE = Apache-2.0
RPI_RF_MOD_DEPENDENCIES = host-dtc
#RPI_RF_MOD_LICENSE_FILES = LICENSE
RPI_RF_MOD_LICENSE_FILES = LICENSE
ifeq ($(BR2_PACKAGE_RPI_RF_MOD_DTS_RPI),y)
# RaspberryPi DTS file
RPI_RF_MOD_DTS_FILE = rpi-rf-mod
RPI_RF_MOD_DTS_FILE_ALT = rpi-rf-mod-rpi1
else ifeq ($(BR2_PACKAGE_RPI_RF_MOD_DTS_TINKER),y)
# ASUS Tinkerboard DTS file
RPI_RF_MOD_DTS_FILE = rpi-rf-mod-tinker
@@ -38,12 +39,18 @@ define RPI_RF_MOD_BUILD_CMDS
if [[ -n "$(RPI_RF_MOD_DTS_FILE)" ]]; then \
$(HOST_DIR)/bin/dtc -@ -I dts -O dtb -W no-unit_address_vs_reg -o $(@D)/buildroot-external/package/rpi-rf-mod/dts/rpi-rf-mod.dtbo $(@D)/buildroot-external/package/rpi-rf-mod/dts/$(RPI_RF_MOD_DTS_FILE).dts; \
fi
if [[ -n "$(RPI_RF_MOD_DTS_FILE_ALT)" ]]; then \
$(HOST_DIR)/bin/dtc -@ -I dts -O dtb -W no-unit_address_vs_reg -o $(@D)/buildroot-external/package/rpi-rf-mod/dts/$(RPI_RF_MOD_DTS_FILE_ALT).dtbo $(@D)/buildroot-external/package/rpi-rf-mod/dts/$(RPI_RF_MOD_DTS_FILE_ALT).dts; \
fi
endef
define RPI_RF_MOD_INSTALL_TARGET_CMDS
if [[ -n "$(RPI_RF_MOD_DTS_FILE)" ]]; then \
$(INSTALL) -D -m 0644 $(@D)/buildroot-external/package/rpi-rf-mod/dts/rpi-rf-mod.dtbo $(BINARIES_DIR)/; \
fi
if [[ -n "$(RPI_RF_MOD_DTS_FILE_ALT)" ]]; then \
$(INSTALL) -D -m 0644 $(@D)/buildroot-external/package/rpi-rf-mod/dts/$(RPI_RF_MOD_DTS_FILE_ALT).dtbo $(BINARIES_DIR)/; \
fi
endef
$(eval $(generic-package))

View File

@@ -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.

View File

@@ -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

View File

@@ -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

View File

@@ -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) \

View File

@@ -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

View File

@@ -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"

View File

@@ -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
}
}

View File

@@ -0,0 +1 @@
# CONFIG_XIP_KERNEL is not set

View File

@@ -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

View File

@@ -0,0 +1,4 @@
#!/bin/sh
BOARD_DIR="$(dirname $0)"
install -m 0644 -D $BOARD_DIR/extlinux.conf $BINARIES_DIR/extlinux/extlinux.conf

View File

@@ -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.

View File

@@ -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

View File

@@ -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)

View File

@@ -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"

View File

@@ -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),

View File

@@ -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

View File

@@ -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.

View File

@@ -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

View File

@@ -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.

View File

@@ -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 \

View File

@@ -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

View File

@@ -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,

View File

@@ -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

View File

@@ -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
+}

View 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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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)

View File

@@ -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

View File

@@ -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

Some files were not shown because too many files have changed in this diff Show More