boot/efi: use a wildcard section copy for final EFI generation
authorYiFei Zhu <zhuyifei1999@gmail.com>
Sat, 26 Jan 2019 16:51:27 +0000 (10:51 -0600)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 9 Feb 2019 16:51:23 +0000 (17:51 +0100)
The GNU gold linker uses the section name `.rela.dyn` instead of
`.rela` for containing the relocation information. If this section
is not copied systemd-boot can crash.

Efitools started using wildcard section copies in their commit
b98d381b, and these wildcard sections are the only difference between
systemd-boot's section copy list and theirs. This patch add the
wildcard section `.rel*` to our objcopy, as it should include all
other wildcards assuming a recent GNU objcopy. Redundant arguments
for sections that would be matched by this wildcard are removed.

This patch has been tested on EDK II UEFI v2.70 Firmware on QEMU, and
Lenovo 0.5120 UEFI 2.40 Firmware on bare metal.

Fixes: #11541

src/boot/efi/meson.build

index 9c0ae5a..2140151 100644 (file)
@@ -194,9 +194,7 @@ if have_gnu_efi
                                    '-j', '.data',
                                    '-j', '.dynamic',
                                    '-j', '.dynsym',
-                                   '-j', '.rel',
-                                   '-j', '.rela',
-                                   '-j', '.reloc']
+                                   '-j', '.rel*']
                                   + efi_format +
                                   ['@INPUT@', '@OUTPUT@'],
                         install : true,