Compare commits

..

23 Commits
6.2 ... 6.5

Author SHA1 Message Date
Stefan Agner
a3567cd462 Bump version to 6.5 2021-10-05 00:15:28 +02:00
Stefan Agner
c5c5b6bcbe Update buildroot to 2021.02.5 (#1566)
Signed-off-by: Stefan Agner <stefan@agner.ch>
2021-10-04 22:00:47 +02:00
Stefan Agner
bd6562edf6 Linux: Update kernel 5.10.70 (#1564) 2021-10-04 10:17:28 +02:00
Stefan Agner
2d526a3d8f Make sure Intel BT gets built as a module (#1558)
CONFIG_BT_HCIBTUSB selects CONFIG_BT_INTEL. That causes CONFIG_BT_INTEL
to be built-in instead of being built as a kernel module.

When the driver is built-in, loading firmware fails during early boot
with the following error message:
[ 1.058941] bluetooth hci0: Direct firmware load for intel/ibt-17-16-1.sfi failed with error -2

Make sure the driver is built as a module which should fix firmware
loading.
2021-10-04 10:17:00 +02:00
Stefan Agner
3dc6801bc2 Bump OS Agent to 1.2.1 (#1559)
This should make the D-Bus method ReloadDevice working and show the
current data disk correctly.
2021-10-04 10:16:40 +02:00
Pascal Vizeli
cbbecc355b Update OS-Agent 1.2.0 & adjust datadisk support (#1554)
* Update OS-Agent & adjust datadisk support

* Update Documentation/partition.md

Co-authored-by: Stefan Agner <stefan@agner.ch>
2021-10-04 10:16:29 +02:00
Stefan Agner
fe1d3fc29a Add USB stall handling for U-Boot (#1011, #1544) (#1553)
Some USB devices cause the USB stack to get stuck with a stall error.
This adds a patch which recovers from this situation.

This avoids an U-Boot crash when Arduino Mega R3 devices are connected,
which cause an USB stall when trying to read the product string.
2021-10-04 10:13:50 +02:00
Stefan Agner
1b639f2248 Bump version to 6.4 2021-09-09 02:04:38 +02:00
Stefan Agner
08e9eee2c5 Fix buffer overflow when initialize USB keyboard in U-Boot (#1538) (#1541)
When a USB keyboard is connected to Raspberry Pi 32-bit versions of
U-Boot crashed in certain situations just before booting Linux. This
seems to be cause by a buffer overflow when removing the USB keyboard
before hand-over to Linux.
2021-09-09 02:04:00 +02:00
Stefan Agner
72d4656b1f Linux: Update kernel 5.10.62 (#1536) 2021-09-09 02:03:45 +02:00
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
509 changed files with 11317 additions and 1921 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.70 |
| 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.70 |
| Odroid-C2 | 5.10.70 |
| Odroid-C4 | 5.10.70 |
| Odroid-N2 | 5.10.70 |
| Odroid-XU4 | 5.10.70 |
| Generic x86-64 | 5.10.70 |

View File

@@ -41,40 +41,27 @@ Sometime the bootloader part can look different because there can be firmware or
The data partition is the only partition with real I/O. It will be expanded automatically at boot to the full size of the disk.
## Using datactl to move the data partition.
## Using CLI to move the data partition.
In a Home Assistant OS installation, the data is stored on the `/mnt/data` partition of the SD card. This is the only read+write partition on the SD drive. Using the `datactl` move command, this partition can be moved off of the SD card onto an externally connected drive, leaving the rest of the read-only system on the SD.
In a Home Assistant OS installation, the data is stored on the `/mnt/data` partition of the boot storage (typically the SD card). This is the only read/write partition on the boot storage. Using the `datadisk` move command, this partition can be moved to an externally connected drive, leaving the rest of the read-only system on the boot storage.
The storage capacity of the external drive must be larger than the storage capacity of the existing SD card.
The command needs to be run from the host console by either connecting a keyboard and monitor or making use of the [debug ssh access](https://developers.home-assistant.io/docs/operating-system/debugging/) over port 22222. The command will not work from within an SSH add-on container.
Log in as `root` to get to the Home Assistant CLI and then enter `login` to continue to the host.
Confirm your USB SSD/HD is connected and recognized using `fdisk -l`.
With the drive connected, use the following command (replacing sdx with your drive, without a partition number):
The storage capacity of the external drive must be larger than the storage capacity of the existing disk.
```sh
$ datactl move /dev/sdx
$ ha os datadisk move /dev/sdx
```
Enter "yes" to confirm the operation. This will prepare the disk, however, the
actual move will be running on next reboot. This will make the first boot significantly longer than usual; please be patient. Reboot with the following command:
This will make a reboot which going significantly longer than usual; please be patient!
For getting a list of supported detected devices which can be used by `datadisk`:
```sh
$ ha host reboot
$ ha os datadisk list
```
Once complete, the external drive
will contain the data and will need to be plugged in to successfully boot Home
Assistant.
## Using UI to move the data partition.
## Check if the move was succesful.
Within the Home Assistant interface you won't see if the move was succesful. To check this, go to your host console again (as described above) and enter:
```sh
$ systemctl status mnt-data.mount
```
If the data partition was moved to your USB drive you should see ```sh Active: active (mounted) ``` in the output. Also, it will show, which drive got mounted as /mnt/data (```sh Where ``` and ```sh what ``` section of the output)
__follow__
## Check Power Supply Rating

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.1632740631.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/5] 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.1632740631.git.stefan@agner.ch>
In-Reply-To: <9cb97076d98f7f68534abb3d1f596644ae730841.1632740631.git.stefan@agner.ch>
References: <9cb97076d98f7f68534abb3d1f596644ae730841.1632740631.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/5] 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.1632740631.git.stefan@agner.ch>
In-Reply-To: <9cb97076d98f7f68534abb3d1f596644ae730841.1632740631.git.stefan@agner.ch>
References: <9cb97076d98f7f68534abb3d1f596644ae730841.1632740631.git.stefan@agner.ch>
From: Marek Szyprowski <m.szyprowski@samsung.com>
Date: Thu, 17 Jun 2021 11:22:03 +0200
Subject: [PATCH 3/5] 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,44 @@
From 0a33e4e03b9266818d6f0a6d566bf12be55c657c Mon Sep 17 00:00:00 2001
Message-Id: <0a33e4e03b9266818d6f0a6d566bf12be55c657c.1632740631.git.stefan@agner.ch>
In-Reply-To: <9cb97076d98f7f68534abb3d1f596644ae730841.1632740631.git.stefan@agner.ch>
References: <9cb97076d98f7f68534abb3d1f596644ae730841.1632740631.git.stefan@agner.ch>
From: Yuichiro Goto <goto@k-tech.co.jp>
Date: Mon, 26 Apr 2021 08:08:03 +0900
Subject: [PATCH 4/5] IOMUX: Fix buffer overflow in iomux_replace_device()
Use of strcat() against an uninitialized buffer would lead
to buffer overflow. This patch fixes it.
Fixes: 694cd5618c ("IOMUX: Introduce iomux_replace_device()")
Signed-off-by: Yuichiro Goto <goto@k-tech.co.jp>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Tested-by: Peter Robinson <pbrobinson@gmail.com>
---
common/iomux.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/common/iomux.c b/common/iomux.c
index b9088aa3b5..c428f7110a 100644
--- a/common/iomux.c
+++ b/common/iomux.c
@@ -158,8 +158,12 @@ int iomux_replace_device(const int console, const char *old, const char *new)
return -ENOMEM;
}
- strcat(tmp, ",");
- strcat(tmp, name);
+ if (arg) {
+ strcat(tmp, ",");
+ strcat(tmp, name);
+ }
+ else
+ strcpy(tmp, name);
arg = tmp;
size = strlen(tmp) + 1;
--
2.33.0

View File

@@ -0,0 +1,87 @@
From 194a2cb0e38c8684e9c98aa66ba3d3a838fce9d6 Mon Sep 17 00:00:00 2001
Message-Id: <194a2cb0e38c8684e9c98aa66ba3d3a838fce9d6.1632740631.git.stefan@agner.ch>
In-Reply-To: <9cb97076d98f7f68534abb3d1f596644ae730841.1632740631.git.stefan@agner.ch>
References: <9cb97076d98f7f68534abb3d1f596644ae730841.1632740631.git.stefan@agner.ch>
From: Stefan Agner <stefan@agner.ch>
Date: Mon, 27 Sep 2021 12:28:04 +0200
Subject: [PATCH 5/5] usb: xhci: reset endpoint on USB stall
There are devices which cause a USB stall when trying to read strings.
Specifically Arduino Mega R3 stalls when trying to read the product
string.
The stall currently remains unhandled, and subsequent retries submit new
transfers on a stopped endpoint which ultimately cause a crash in
abort_td():
WARN halted endpoint, queueing URB anyway.
XHCI control transfer timed out, aborting...
Unexpected XHCI event TRB, skipping... (3affe040 00000000 13000000 02008401)
BUG at drivers/usb/host/xhci-ring.c:505/abort_td()!
BUG!
resetting ...
Linux seems to be able to recover from the stall by issuing a
TRB_RESET_EP command.
Introduce reset_ep() which issues a TRB_RESET_EP followed by setting the
transfer ring dequeue pointer via TRB_SET_DEQ. This allows to properly
recover from a USB stall error and continue communicating with the USB
device.
Signed-off-by: Stefan Agner <stefan@agner.ch>
---
drivers/usb/host/xhci-ring.c | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 46c137f857..667e9fbf5e 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -481,6 +481,33 @@ union xhci_trb *xhci_wait_for_event(struct xhci_ctrl *ctrl, trb_type expected)
BUG();
}
+/*
+ * Issue reset endpoint command for an endpoint. This is required to recover
+ * a halted endpoint (e.g. due to a stall error).
+ */
+static void reset_ep(struct usb_device *udev, int ep_index)
+{
+ struct xhci_ctrl *ctrl = xhci_get_ctrl(udev);
+ struct xhci_ring *ring = ctrl->devs[udev->slot_id]->eps[ep_index].ring;
+ union xhci_trb *event;
+ u32 field;
+
+ printf("Resetting EP...\n");
+ xhci_queue_command(ctrl, NULL, udev->slot_id, ep_index, TRB_RESET_EP);
+ event = xhci_wait_for_event(ctrl, TRB_COMPLETION);
+ field = le32_to_cpu(event->trans_event.flags);
+ BUG_ON(TRB_TO_SLOT_ID(field) != udev->slot_id);
+ xhci_acknowledge_event(ctrl);
+
+ xhci_queue_command(ctrl, (void *)((uintptr_t)ring->enqueue |
+ ring->cycle_state), udev->slot_id, ep_index, TRB_SET_DEQ);
+ event = xhci_wait_for_event(ctrl, TRB_COMPLETION);
+ BUG_ON(TRB_TO_SLOT_ID(le32_to_cpu(event->event_cmd.flags))
+ != udev->slot_id || GET_COMP_CODE(le32_to_cpu(
+ event->event_cmd.status)) != COMP_SUCCESS);
+ xhci_acknowledge_event(ctrl);
+}
+
/*
* Stops transfer processing for an endpoint and throws away all unprocessed
* TRBs by setting the xHC's dequeue pointer to our enqueue pointer. The next
@@ -931,6 +958,10 @@ int xhci_ctrl_tx(struct usb_device *udev, unsigned long pipe,
record_transfer_result(udev, event, length);
xhci_acknowledge_event(ctrl);
+ if (udev->status == USB_ST_STALLED) {
+ reset_ep(udev, ep_index);
+ return -EPIPE;
+ }
/* Invalidate buffer to make it available to usb-core */
if (length > 0)
--
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.70"
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.70"
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.70"
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.70"
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.70"
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.70"
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.70"
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
@@ -20,7 +21,7 @@ CONFIG_BT_LE=y
CONFIG_BT_INTEL=m
CONFIG_BT_BCM=m
CONFIG_BT_RTL=m
CONFIG_BT_HCIBTUSB=y
CONFIG_BT_HCIBTUSB=m
CONFIG_BT_HCIBTUSB_BCM=y
CONFIG_BT_HCIBTUSB_RTL=y
@@ -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=5
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

@@ -4,7 +4,7 @@
#
################################################################################
OS_AGENT_VERSION = 1.1.0
OS_AGENT_VERSION = 1.2.1
OS_AGENT_SITE = $(call github,home-assistant,os-agent,$(OS_AGENT_VERSION))
OS_AGENT_LICENSE = Apache License 2.0
OS_AGENT_LICENSE_FILES = LICENSE

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,76 +0,0 @@
#!/bin/sh
# ==============================================================================
# Home Assistant OS data partition handling
# ==============================================================================
set -e
# Use current mount point. This avoids "Can't be the same disk!" error
# when using a drive which has been used as a data drive previously.
DATA_DEVICE_CHILD="$(findmnt --noheadings --output=source /mnt/data)"
DATA_DEVICE_ROOT="/dev/$(lsblk -no pkname "${DATA_DEVICE_CHILD}")"
if [ "${DATA_DEVICE_ROOT}" = "" ]; then
echo "[ERROR] Data disk device not found!"
exit 1
fi
# Move command
if [ "${1}" = "move" ] && [ -e "${2}" ]; then
NEW_DEVICE_ROOT="${2}"
# Check device
if ! lsblk "${NEW_DEVICE_ROOT}" | grep disk > /dev/null 2>&1; then
echo "[ERROR] Is not disk!"
exit 1
elif [ "${NEW_DEVICE_ROOT}" = "${DATA_DEVICE_ROOT}" ]; then
echo "[ERROR] Can't be the same disk!"
exit 1
fi
# Flag device
if [ -z "${DATACTL_NOCONFIRM}" ]; then
echo "WARNING: All partitions on ${NEW_DEVICE_ROOT} will be deleted!"
printf "Enter \"yes\" to confirm: "
read -r confirm
if [ "${confirm}" != "yes" ]; then
echo "Aborting."
exit 1
fi
fi
# Create GPT partition table with a single data partition
cat << EOF | sfdisk --wipe-partitions=always --wipe=always "${NEW_DEVICE_ROOT}"
label: gpt
uuid=a52a4597-fa3a-4851-aefd-2fbe9f849079, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, name=hassos-data-external
EOF
# Since we create a new partition table etc. we are guaranteed the target
# partition is partition 1
NEW_DEVICE_PART_SIZE=$(cat "/sys/class/block/$(basename "${NEW_DEVICE_ROOT}")1/size")
OLD_DEVICE_PART_SIZE=$(cat "/sys/class/block/$(basename "${DATA_DEVICE_CHILD}")/size")
if [ "${NEW_DEVICE_PART_SIZE}" -lt "${OLD_DEVICE_PART_SIZE}" ]; then
echo "[INFO] Target device too small!"
echo "label: gpt" | sfdisk "${NEW_DEVICE_ROOT}"
exit 1
fi
touch "/mnt/overlay/move-data"
cat << EOF
Disk ${NEW_DEVICE_ROOT} has been prepared to be used as data drive and the data
move has been scheduled for the next reboot. Please reboot the device now and
make sure to leave the disk connected to the system from now on.
EOF
else
cat << EOF
Usage: datactl move <device>
Moves data partition to external device provided by <device> (without partition
number). A new partition table and a partition for the complete device will be
created by datactl.
EOF
fi

View File

@@ -1,3 +1,76 @@
2021.02.5, released September 15th, 2021
Important / security related fixes.
Toolchain: Disable fortify support for Microblaze as it is not
currently working.
Updated/fixed packages: alsa-utils, arm-trusted-firmware,
bayer2rgb-neon, belle-sip, busybox, c-ares, cjson, coreutils,
cpio, eigen, environt-setup, fetchmail, fluidsynth,
fontconfig, gd, gdb, gnuradio, gnutls, go, haproxy, ipmiutil,
iputils, jszip, kvm-unit-tests, libarchive, libexif,
libgcrypt, libmodsecurity, libopenssl, librsvg, libshout,
libssh, linux, localedef, mc, mesa3d, mosquitto, netsniff-ng,
nginx, nodejs, ogre, openmpi, openvmtools, php, postgresql,
prelink-cross, prosody, protobuf, python-keyring,
python-matplotlib, python-pillow, python-pyudev,
python-secretstorage, python3, qt5base, samba4, sdl2, sox,
swupdate, sylpheed, tor, uboot-tools, uhd, unbound, vim,
wlroots, xapp_xrdb, xapp_xwd, xen, xenomai, xlib_libXfont2,
xlib_libXft, zip
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
@@ -828,8 +835,15 @@ endchoice
comment "RELocation Read Only (RELRO) needs shared libraries"
depends on !BR2_SHARED_LIBS
config BR2_FORTIFY_SOURCE_ARCH_SUPPORTS
bool
default y
# Microblaze glibc toolchains don't work with Fortify Source enabled
depends on !BR2_microblaze
choice
bool "Buffer-overflow Detection (FORTIFY_SOURCE)"
depends on BR2_FORTIFY_SOURCE_ARCH_SUPPORTS
depends on BR2_TOOLCHAIN_USES_GLIBC
depends on !BR2_OPTIMIZE_0
help
@@ -870,6 +884,7 @@ config BR2_FORTIFY_SOURCE_2
endchoice
comment "Fortify Source needs a glibc toolchain and optimization"
depends on BR2_FORTIFY_SOURCE_ARCH_SUPPORTS
depends on (!BR2_TOOLCHAIN_USES_GLIBC || BR2_OPTIMIZE_0)
endmenu

View File

@@ -146,6 +146,12 @@ endif
comment "Legacy options removed in 2021.02"
config BR2_PACKAGE_GNURADIO_PAGER
bool "gnuradio gr-flex support removed"
select BR2_LEGACY
help
gr-flex has been removed from gnuradio since version 3.8.0.0.
config BR2_PACKAGE_SCONESERVER_HTTP_SCONESITE_IMAGE
bool "sconeserver http::sconesite::image removed"
select BR2_LEGACY

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,18 @@ F: package/xapian/
N: Giulio Benetti <giulio.benetti@benettiengineering.com>
F: package/at/
F: package/binutils/
F: package/gcc/
F: package/harfbuzz/
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/
F: toolchain/
N: Gregory Dymarek <gregd72002@gmail.com>
F: package/ding-libs/
@@ -1238,11 +1244,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/
@@ -1824,36 +1825,6 @@ F: arch/Config.in.xtensa
N: Maxim Kochetkov <fido_max@inbox.ru>
F: package/timescaledb/
N: Maxime Hadjinlian <maxime.hadjinlian@gmail.com>
F: package/babeld/
F: package/dante/
F: package/faifa/
F: package/initscripts/
F: package/intel-microcode/
F: package/iucode-tool/
F: package/jasper/
F: package/kodi/
F: package/libass/
F: package/libbluray/
F: package/libcdio/
F: package/libcofi/
F: package/libenca/
F: package/libmodplug/
F: package/libnfs/
F: package/libplist/
F: package/libshairplay/
F: package/linux-zigbee/
F: package/netcat-openbsd/
F: package/open-plc-utils/
F: package/rpi-firmware/
F: package/rpi-userland/
F: package/rtmpdump/
F: package/skeleton/
F: package/systemd/
F: package/systemd-bootchart/
F: package/tinyalsa/
F: package/tinyxml/
N: Michael Durrant <mdurrant@arcturusnetworks.com>
F: board/arcturus/
F: configs/arcturus_ucp1020_defconfig
@@ -2134,6 +2105,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 +2183,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/
@@ -2502,9 +2474,6 @@ F: configs/rock_pi_n10_defconfig
F: configs/rockpro64_defconfig
F: package/arm-gnu-a-toolchain/
N: Sven Fischer <sven@leiderfischer.de>
F: package/qt5/qt5remoteobjects/
N: Sven Haardiek <sven.haardiek@iotec-gmbh.de>
F: package/lcdproc/
F: package/python-influxdb/
@@ -2726,9 +2695,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.5
# Actual time the release is cut (for reproducible builds)
BR2_VERSION_EPOCH = 1623509900
BR2_VERSION_EPOCH = 1631718000
# 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,28 @@ 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
# While newer versions of TF-A support "none" as
# ENABLE_STACK_PROTECTOR value, older versions (e.g 2.0) only
# supported "0" to disable SSP.
default "0" 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

@@ -53,6 +53,10 @@ ARM_TRUSTED_FIRMWARE_MAKE_OPTS += \
$(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_ADDITIONAL_VARIABLES)) \
PLAT=$(ARM_TRUSTED_FIRMWARE_PLATFORM)
ARM_TRUSTED_FIRMWARE_MAKE_ENV += \
$(TARGET_MAKE_ENV) \
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
else ifeq ($(BR2_ARM_CPU_ARMV8A),y)
@@ -100,14 +104,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)
@@ -162,7 +158,8 @@ ARM_TRUSTED_FIRMWARE_MAKE_TARGETS += \
define ARM_TRUSTED_FIRMWARE_BUILD_CMDS
$(ARM_TRUSTED_FIRMWARE_BUILD_FIPTOOL)
$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) $(ARM_TRUSTED_FIRMWARE_MAKE_OPTS) \
$(ARM_TRUSTED_FIRMWARE_MAKE_ENV) $(MAKE) -C $(@D) \
$(ARM_TRUSTED_FIRMWARE_MAKE_OPTS) \
$(ARM_TRUSTED_FIRMWARE_MAKE_TARGETS)
$(ARM_TRUSTED_FIRMWARE_BL31_UBOOT_BUILD)
endef

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

@@ -23,13 +23,13 @@ BR2_ROOTFS_POST_BUILD_SCRIPT="board/pc/post-build.sh"
BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh"
BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/pc/genimage-bios.cfg"
# Linux headers same as kernel, a 4.18 series
BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_18=y
# Linux headers same as kernel, a 4.19 series
BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
# Kernel
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="4.18.10"
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="4.19.204"
BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/pc/linux.config"
BR2_LINUX_KERNEL_INSTALL_TARGET=y

View File

@@ -25,13 +25,13 @@ BR2_TARGET_ROOTFS_EXT2_SIZE="120M"
BR2_ROOTFS_POST_BUILD_SCRIPT="board/pc/post-build.sh"
BR2_ROOTFS_POST_IMAGE_SCRIPT="board/pc/post-image-efi.sh"
# Linux headers same as kernel, a 4.18 series
BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_18=y
# Linux headers same as kernel, a 4.19 series
BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
# Kernel
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="4.18.10"
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="4.19.204"
BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/pc/linux.config"
BR2_LINUX_KERNEL_INSTALL_TARGET=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

View File

@@ -80,6 +80,6 @@ also be defined.
to the +make+ command during the target installation step. By default,
+install+.
* +LIBFOO_SYNC_HEADERS+, to run syncqt.pl before qmake. Some packages
* +LIBFOO_SYNC_QT_HEADERS+, to run syncqt.pl before qmake. Some packages
need this to have a properly populated include directory before
running the build.

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.5 manual generated on 2021-09-15 15:21:07 UTC from
git revision 767a2da72f
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
767a2da72fc1690fde33b665851f20492ba5cd75] 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
@@ -6520,9 +6517,9 @@ also be defined.
* LIBFOO_INSTALL_TARGET_OPTS, to specify additional targets to pass
to the make command during the target installation step. By
default, install.
* LIBFOO_SYNC_HEADERS, to run syncqt.pl before qmake. Some packages
need this to have a properly populated include directory before
running the build.
* LIBFOO_SYNC_QT_HEADERS, to run syncqt.pl before qmake. Some
packages need this to have a properly populated include directory
before running the build.
18.19. Infrastructure for packages building kernel modules

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

@@ -31,7 +31,7 @@ config BR2_LINUX_KERNEL_LATEST_VERSION
bool "Latest version (5.10)"
config BR2_LINUX_KERNEL_LATEST_CIP_VERSION
bool "Latest CIP SLTS version (4.19.182-cip45)"
bool "Latest CIP SLTS version (4.19.198-cip54)"
help
CIP launched in the spring of 2016 to address the needs of
organizations in industries such as power generation and
@@ -50,7 +50,7 @@ config BR2_LINUX_KERNEL_LATEST_CIP_VERSION
https://www.cip-project.org
config BR2_LINUX_KERNEL_LATEST_CIP_RT_VERSION
bool "Latest CIP RT SLTS version (4.19.165-cip41-rt18)"
bool "Latest CIP RT SLTS version (4.19.198-cip54-rt21)"
help
Same as the CIP version, but this is the PREEMPT_RT realtime
variant.
@@ -125,9 +125,9 @@ endif
config BR2_LINUX_KERNEL_VERSION
string
default "5.10.43" 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 "5.10.64" if BR2_LINUX_KERNEL_LATEST_VERSION
default "4.19.198-cip54" if BR2_LINUX_KERNEL_LATEST_CIP_VERSION
default "4.19.198-cip54-rt21" if BR2_LINUX_KERNEL_LATEST_CIP_RT_VERSION
default BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE \
if BR2_LINUX_KERNEL_CUSTOM_VERSION
default "custom" if BR2_LINUX_KERNEL_CUSTOM_TARBALL

View File

@@ -1,14 +1,14 @@
# 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 3eb84bd24a2de2b4749314e34597c02401c5d6831b055ed5224adb405c35e30a linux-5.10.64.tar.xz
sha256 5cf7782ec2e91417edf0d5e6555da6d556962c8985e33ba9e7dadba5cbdc68f9 linux-5.4.145.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 02252f0002e65306f6765089e8bb51f621f4eaea974348c31991b0c508243bb5 linux-4.4.283.tar.xz
sha256 67727389771a858406f773b4db62d7d3248209e26120df47507ea4a8898d2e15 linux-4.9.282.tar.xz
sha256 9c5612ef428441b7c85cf211a455c06ce695b81a9a40c064d0ea424dd08bef3a linux-4.14.246.tar.xz
sha256 b7eb776f408b3ea71c97dde4888cc4549edf925a18cd158e7c9681d6ffa684c0 linux-4.19.206.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
sha256 e6fc0a999a180ad272b08ff71cbc67f2d3fdc6773d4a8069aefb8781b8e07821 linux-cip-4.19.198-cip54.tar.gz
sha256 449668d678e458ddaf30f944b7ca7f5ce6ea6664f57d43ea4eb90b176e03b9cb linux-cip-4.19.198-cip54-rt21.tar.gz
# Licenses hashes
sha256 fb5a425bd3b3cd6071a3a9aff9909a859e7c1158d54d32e07658398cd67eb6a0 COPYING

View File

@@ -77,7 +77,6 @@ define ALSA_UTILS_INSTALL_TARGET_CMDS
fi
if [ -x "$(TARGET_DIR)/usr/sbin/alsactl" ]; then \
mkdir -p $(TARGET_DIR)/usr/share/; \
rm -rf $(TARGET_DIR)/usr/share/alsa/; \
cp -rdpf $(STAGING_DIR)/usr/share/alsa/ $(TARGET_DIR)/usr/share/alsa/; \
fi
endef

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

@@ -9,7 +9,7 @@ config BR2_PACKAGE_BAYER2RGB_NEON
to decode raw camera bayer to RGB using
NEON hardware acceleration.
https://git.phytec.de/bayer2rgb-neon/
https://gitlab-ext.sigma-chemnitz.de/ensc/bayer2rgb
comment "bayer2rgb-neon needs a toolchain w/ C++, dynamic library, gcc >= 4.9"
depends on BR2_arm && BR2_ARM_CPU_HAS_NEON

View File

@@ -9,6 +9,7 @@ BELLE_SIP_SITE = \
https://gitlab.linphone.org/BC/public/belle-sip/-/archive/$(BELLE_SIP_VERSION)
BELLE_SIP_LICENSE = GPL-3.0+
BELLE_SIP_LICENSE_FILES = LICENSE.txt
BELLE_SIP_CPE_ID_VENDOR = linphone
BELLE_SIP_INSTALL_STAGING = YES
BELLE_SIP_DEPENDENCIES = \
bctoolbox \

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

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