Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 1 | From 6643507ce30f775008e093580f0c9499dfb2c485 Mon Sep 17 00:00:00 2001 |
| 2 | From: Simon Hardy <simon.hardy@itdev.co.uk> |
| 3 | Date: Tue, 24 Mar 2020 13:29:12 +0000 |
| 4 | Subject: build: Fix GRUB i386-pc build with Ubuntu gcc |
| 5 | |
| 6 | With recent versions of gcc on Ubuntu a very large lzma_decompress.img file is |
| 7 | output. (e.g. 134479600 bytes instead of 2864.) This causes grub-mkimage to |
| 8 | fail with: "error: Decompressor is too big." |
| 9 | |
| 10 | This seems to be caused by a section .note.gnu.property that is placed at an |
| 11 | offset such that objcopy needs to pad the img file with zeros. |
| 12 | |
| 13 | This issue is present on: |
| 14 | Ubuntu 19.10 with gcc (Ubuntu 8.3.0-26ubuntu1~19.10) 8.3.0 |
| 15 | Ubuntu 19.10 with gcc (Ubuntu 9.2.1-9ubuntu2) 9.2.1 20191008 |
| 16 | |
| 17 | This issue is not present on: |
| 18 | Ubuntu 19.10 with gcc (Ubuntu 7.5.0-3ubuntu1~19.10) 7.5.0 |
| 19 | RHEL 8.0 with gcc 8.3.1 20190507 (Red Hat 8.3.1-4) |
| 20 | |
| 21 | The issue can be fixed by removing the section using objcopy as shown in |
| 22 | this patch. |
| 23 | |
| 24 | Signed-off-by: Simon Hardy <simon.hardy@itdev.co.uk> |
| 25 | Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com> |
| 26 | --- |
| 27 | gentpl.py | 2 +- |
| 28 | 1 file changed, 1 insertion(+), 1 deletion(-) |
| 29 | |
| 30 | Upstream-Status: Backport |
| 31 | |
| 32 | diff --git a/gentpl.py b/gentpl.py |
| 33 | index 387588c05..c86550d4f 100644 |
| 34 | --- a/gentpl.py |
| 35 | +++ b/gentpl.py |
| 36 | @@ -766,7 +766,7 @@ def image(defn, platform): |
| 37 | if test x$(TARGET_APPLE_LINKER) = x1; then \ |
| 38 | $(MACHO2IMG) $< $@; \ |
| 39 | else \ |
| 40 | - $(TARGET_OBJCOPY) $(""" + cname(defn) + """_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .ARM.exidx $< $@; \ |
| 41 | + $(TARGET_OBJCOPY) $(""" + cname(defn) + """_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .note.gnu.property -R .ARM.exidx $< $@; \ |
| 42 | fi |
| 43 | """) |
| 44 | |
| 45 | -- |
| 46 | cgit v1.2.1 |
| 47 | |