diff --git a/Makefile.util.def b/Makefile.util.def index b80187c8..a9974724 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -157,6 +157,7 @@ program = { ldadd = '$(LIBLZMA)'; ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)'; cppflags = '-DGRUB_PKGLIBDIR=\"$(pkglibdir)\"'; + cflags = '-static'; }; program = { diff --git a/acinclude.m4 b/acinclude.m4 index 0eb2e2a1..38df4f50 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -91,7 +91,7 @@ else fi grub_cv_prog_objcopy_absolute=yes for link_addr in 0x2000 0x8000 0x7C00; do - if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} -nostdlib ${TARGET_IMG_LDFLAGS_AC} ${TARGET_IMG_BASE_LDOPT},$link_addr conftest.o -o conftest.exec]); then : + if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} -nostdlib -static ${TARGET_IMG_LDFLAGS_AC} ${TARGET_IMG_BASE_LDOPT},$link_addr conftest.o -o conftest.exec]); then : else AC_MSG_ERROR([${CC-cc} cannot link at address $link_addr]) fi diff --git a/conf/Makefile.common b/conf/Makefile.common index b5615a14..07e16579 100644 --- a/conf/Makefile.common +++ b/conf/Makefile.common @@ -78,7 +78,7 @@ STRIPFLAGS_KERNEL = -R .rel.dyn -R .reginfo -R .note -R .comment -R .note.gnu.go endif CFLAGS_MODULE = $(CFLAGS_CPU) $(CFLAGS_PLATFORM) -ffreestanding -LDFLAGS_MODULE = $(LDFLAGS_CPU) $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -Wl,-r,-d +LDFLAGS_MODULE = $(LDFLAGS_CPU) $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -r -Wl,-d CPPFLAGS_MODULE = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) CCASFLAGS_MODULE = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM) diff --git a/configure.ac b/configure.ac index 91b36d0a..e5d3d8de 100644 --- a/configure.ac +++ b/configure.ac @@ -393,7 +393,7 @@ LDFLAGS="$TARGET_LDFLAGS" LIBS="" # debug flags. -WARN_FLAGS="-Wall -W -Wshadow -Wold-style-definition -Wpointer-arith -Wundef -Wextra -Waddress -Wattributes -Wcast-align -Wchar-subscripts -Wcomment -Wdeprecated-declarations -Wdisabled-optimization -Wdiv-by-zero -Wempty-body -Wendif-labels -Wfloat-equal -Wformat-extra-args -Wformat-security -Wformat-y2k -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Winit-self -Wint-to-pointer-cast -Winvalid-pch -Wmain -Wmissing-braces -Wmissing-field-initializers -Wmissing-format-attribute -Wmissing-noreturn -Wmultichar -Wnonnull -Woverflow -Wparentheses -Wpointer-arith -Wpointer-to-int-cast -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -Wstrict-aliasing -Wswitch -Wtrigraphs -Wundef -Wunknown-pragmas -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable -Wvariadic-macros -Wvolatile-register-var -Wwrite-strings -Wnested-externs -Wstrict-prototypes -Wpointer-sign" +WARN_FLAGS="-Wall -Wno-address-of-packed-member -W -Wshadow -Wold-style-definition -Wpointer-arith -Wundef -Wextra -Waddress -Wattributes -Wcast-align -Wchar-subscripts -Wcomment -Wdeprecated-declarations -Wdisabled-optimization -Wdiv-by-zero -Wempty-body -Wendif-labels -Wfloat-equal -Wformat-extra-args -Wformat-security -Wformat-y2k -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Winit-self -Wint-to-pointer-cast -Winvalid-pch -Wmain -Wmissing-braces -Wmissing-field-initializers -Wmissing-format-attribute -Wmissing-noreturn -Wmultichar -Wnonnull -Woverflow -Wparentheses -Wpointer-arith -Wpointer-to-int-cast -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -Wstrict-aliasing -Wswitch -Wtrigraphs -Wundef -Wunknown-pragmas -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable -Wvariadic-macros -Wvolatile-register-var -Wwrite-strings -Wnested-externs -Wstrict-prototypes -Wpointer-sign" HOST_CFLAGS="$HOST_CFLAGS $WARN_FLAGS" TARGET_CFLAGS="$TARGET_CFLAGS $WARN_FLAGS -g -Wredundant-decls -Wmissing-prototypes -Wmissing-declarations" TARGET_CCASFLAGS="$TARGET_CCASFLAGS -g" @@ -542,7 +542,7 @@ if test "x$target_m32" = x1; then # Force 32-bit mode. TARGET_CFLAGS="$TARGET_CFLAGS -m32" TARGET_CCASFLAGS="$TARGET_CCASFLAGS -m32" - TARGET_CPPFLAGS="$TARGET_CPPFLAGS -m32" + TARGET_CPPFLAGS="$TARGET_CPPFLAGS -m32 -fno-pic" TARGET_LDFLAGS="$TARGET_LDFLAGS -m32" TARGET_MODULE_FORMAT="elf32" fi diff --git a/gentpl.py b/gentpl.py index 13a60816..1a7bcd2c 100644 --- a/gentpl.py +++ b/gentpl.py @@ -453,7 +453,7 @@ def image(platform): if test x$(USE_APPLE_CC_FIXES) = xyes; then \ $(MACHO2IMG) $< $@; \ else \ - $(OBJCOPY) $(""" + cname() + """_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .reginfo -R .rel.dyn -R .note.gnu.gold-version $< $@; \ + $(OBJCOPY) $(""" + cname() + """_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .note.gnu.property $< $@; \ fi """) return r diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def index 9a9840b3..f57f4c9b 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -36,9 +36,9 @@ kernel = { nostrip = emu; emu_ldflags = '-Wl,-r,-d'; - i386_efi_ldflags = '-Wl,-r,-d'; + i386_efi_ldflags = '-r -Wl,-d'; i386_efi_stripflags = '--strip-unneeded -K start -R .note -R .comment -R .note.gnu.gold-version'; - x86_64_efi_ldflags = '-Wl,-r,-d'; + x86_64_efi_ldflags = '-r -Wl,-d'; x86_64_efi_stripflags = '--strip-unneeded -K start -R .note -R .comment -R .note.gnu.gold-version'; ia64_efi_cflags = '-fno-builtin -fpic -minline-int-divide-max-throughput'; @@ -46,7 +46,7 @@ kernel = { ia64_efi_stripflags = '--strip-unneeded -K start -R .note -R .comment -R .note.gnu.gold-version'; i386_pc_ldflags = '$(TARGET_IMG_LDFLAGS)'; - i386_pc_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x9000'; + i386_pc_ldflags = '-static $(TARGET_IMG_BASE_LDOPT),0x9000'; i386_qemu_ldflags = '$(TARGET_IMG_LDFLAGS)'; i386_qemu_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x8200'; @@ -271,7 +271,7 @@ image = { sparc64_ieee1275 = boot/sparc64/ieee1275/boot.S; i386_pc_ldflags = '$(TARGET_IMG_LDFLAGS)'; - i386_pc_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x7C00'; + i386_pc_ldflags = '-static $(TARGET_IMG_BASE_LDOPT),0x7C00'; i386_qemu_ldflags = '$(TARGET_IMG_LDFLAGS)'; i386_qemu_ldflags = '$(TARGET_IMG_BASE_LDOPT),$(GRUB_BOOT_MACHINE_LINK_ADDR)'; @@ -293,7 +293,7 @@ image = { cppflags = '-DHYBRID_BOOT=1'; i386_pc_ldflags = '$(TARGET_IMG_LDFLAGS)'; - i386_pc_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x7C00'; + i386_pc_ldflags = '-static $(TARGET_IMG_BASE_LDOPT),0x7C00'; objcopyflags = '-O binary'; enable = i386_pc; @@ -304,7 +304,7 @@ image = { i386_pc = boot/i386/pc/cdboot.S; i386_pc_ldflags = '$(TARGET_IMG_LDFLAGS)'; - i386_pc_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x7C00'; + i386_pc_ldflags = '-static $(TARGET_IMG_BASE_LDOPT),0x7C00'; objcopyflags = '-O binary'; enable = i386_pc; }; @@ -314,7 +314,7 @@ image = { i386_pc = boot/i386/pc/pxeboot.S; i386_pc_ldflags = '$(TARGET_IMG_LDFLAGS)'; - i386_pc_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x7C00'; + i386_pc_ldflags = '-static $(TARGET_IMG_BASE_LDOPT),0x7C00'; objcopyflags = '-O binary'; enable = i386_pc; @@ -325,7 +325,7 @@ image = { i386_pc = boot/i386/pc/diskboot.S; i386_pc_ldflags = '$(TARGET_IMG_LDFLAGS)'; - i386_pc_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x8000'; + i386_pc_ldflags = '-static $(TARGET_IMG_BASE_LDOPT),0x8000'; sparc64_ieee1275 = boot/sparc64/ieee1275/diskboot.S; sparc64_ieee1275_ldflags = '-Wl,-Ttext=0x4200'; @@ -341,7 +341,7 @@ image = { i386_pc = boot/i386/pc/lnxboot.S; i386_pc_ldflags = '$(TARGET_IMG_LDFLAGS)'; - i386_pc_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x6000'; + i386_pc_ldflags = '-static $(TARGET_IMG_BASE_LDOPT),0x6000'; objcopyflags = '-O binary'; enable = i386_pc; @@ -388,7 +388,7 @@ image = { i386_pc = boot/i386/pc/startup_raw.S; objcopyflags = '-O binary'; - ldflags = '$(TARGET_IMG_LDFLAGS) $(TARGET_IMG_BASE_LDOPT),0x8200'; + ldflags = '-static $(TARGET_IMG_LDFLAGS) $(TARGET_IMG_BASE_LDOPT),0x8200'; enable = i386_pc; }; diff --git a/grub-core/bus/usb/ehci.c b/grub-core/bus/usb/ehci.c index b7005192..19732fa0 100644 --- a/grub-core/bus/usb/ehci.c +++ b/grub-core/bus/usb/ehci.c @@ -28,6 +28,7 @@ #include #include #include +#include GRUB_MOD_LICENSE ("GPLv3+"); @@ -1259,7 +1260,7 @@ grub_ehci_setup_transfer (grub_usb_controller_t dev, if ((transfer->dev->speed != GRUB_USB_SPEED_HIGH) && !transfer->dev->hubaddr) { - grub_error (GRUB_USB_ERR_BADDEVICE, + grub_error (GRUB_ERR_BAD_DEVICE, "FULL/LOW speed device on EHCI port!?!"); return GRUB_USB_ERR_BADDEVICE; } @@ -1719,7 +1720,7 @@ grub_ehci_portstatus (grub_usb_controller_t dev, /* FULL speed device connected - change port ownership. * It results in disconnected state of this EHCI port. */ grub_ehci_port_setbits (e, port, GRUB_EHCI_PORT_OWNER); - return GRUB_USB_ERR_BADDEVICE; + return GRUB_ERR_BAD_DEVICE; } /* XXX: Fix it! There is possible problem - we can say to calling @@ -1866,7 +1867,7 @@ grub_ehci_restore_hw (void) } } - return GRUB_USB_ERR_NONE; + return GRUB_ERR_NONE; } static grub_err_t @@ -1886,7 +1887,7 @@ grub_ehci_fini_hw (int noreturn __attribute__ ((unused))) grub_error (GRUB_ERR_TIMEOUT, "restore_hw: EHCI reset timeout"); } - return GRUB_USB_ERR_NONE; + return GRUB_ERR_NONE; } static struct grub_usb_controller_dev usb_controller = { diff --git a/grub-core/bus/usb/usbhub.c b/grub-core/bus/usb/usbhub.c index 5fc5eba3..e4829bfc 100644 --- a/grub-core/bus/usb/usbhub.c +++ b/grub-core/bus/usb/usbhub.c @@ -181,7 +181,7 @@ grub_usb_add_hub (grub_usb_device_t dev) rescan = 1; - return GRUB_ERR_NONE; + return GRUB_USB_ERR_NONE; } static void diff --git a/grub-core/commands/efi/acpi.c b/grub-core/commands/efi/acpi.c index 93a560d9..c6976bc4 100644 --- a/grub-core/commands/efi/acpi.c +++ b/grub-core/commands/efi/acpi.c @@ -26,11 +26,11 @@ struct grub_acpi_rsdp_v10 * grub_machine_acpi_get_rsdpv1 (void) { unsigned i; - static grub_efi_guid_t acpi_guid = GRUB_EFI_ACPI_TABLE_GUID; + static grub_efi_packed_guid_t acpi_guid = GRUB_EFI_ACPI_TABLE_GUID; for (i = 0; i < grub_efi_system_table->num_table_entries; i++) { - grub_efi_guid_t *guid = + grub_efi_packed_guid_t *guid = &grub_efi_system_table->configuration_table[i].vendor_guid; if (! grub_memcmp (guid, &acpi_guid, sizeof (grub_efi_guid_t))) @@ -44,11 +44,11 @@ struct grub_acpi_rsdp_v20 * grub_machine_acpi_get_rsdpv2 (void) { unsigned i; - static grub_efi_guid_t acpi20_guid = GRUB_EFI_ACPI_20_TABLE_GUID; + static grub_efi_packed_guid_t acpi20_guid = GRUB_EFI_ACPI_20_TABLE_GUID; for (i = 0; i < grub_efi_system_table->num_table_entries; i++) { - grub_efi_guid_t *guid = + grub_efi_packed_guid_t *guid = &grub_efi_system_table->configuration_table[i].vendor_guid; if (! grub_memcmp (guid, &acpi20_guid, sizeof (grub_efi_guid_t))) diff --git a/grub-core/commands/efi/loadbios.c b/grub-core/commands/efi/loadbios.c index 214adc3d..132cadbc 100644 --- a/grub-core/commands/efi/loadbios.c +++ b/grub-core/commands/efi/loadbios.c @@ -105,7 +105,7 @@ fake_bios_data (int use_rom) smbios = 0; for (i = 0; i < grub_efi_system_table->num_table_entries; i++) { - grub_efi_guid_t *guid = + grub_efi_packed_guid_t *guid = &grub_efi_system_table->configuration_table[i].vendor_guid; if (! grub_memcmp (guid, &acpi2_guid, sizeof (grub_efi_guid_t))) diff --git a/grub-core/commands/hdparm.c b/grub-core/commands/hdparm.c index 3fb08912..208a8320 100644 --- a/grub-core/commands/hdparm.c +++ b/grub-core/commands/hdparm.c @@ -328,6 +328,7 @@ grub_cmd_hdparm (grub_extcmd_context_t ctxt, int argc, char **args) ata = ((struct grub_scsi *) disk->data)->data; break; } + // fall through default: return grub_error (GRUB_ERR_IO, "not an ATA device"); } diff --git a/grub-core/disk/cryptodisk.c b/grub-core/disk/cryptodisk.c index 1ac906d9..e96c5a76 100644 --- a/grub-core/disk/cryptodisk.c +++ b/grub-core/disk/cryptodisk.c @@ -268,6 +268,7 @@ grub_cryptodisk_endecrypt (struct grub_cryptodisk *dev, break; case GRUB_CRYPTODISK_MODE_IV_PLAIN64: iv[1] = grub_cpu_to_le32 (sector >> 32); + // fall through case GRUB_CRYPTODISK_MODE_IV_PLAIN: iv[0] = grub_cpu_to_le32 (sector & 0xFFFFFFFF); break; diff --git a/grub-core/disk/diskfilter.c b/grub-core/disk/diskfilter.c index 6e9745e3..97cdb19b 100644 --- a/grub-core/disk/diskfilter.c +++ b/grub-core/disk/diskfilter.c @@ -71,6 +71,7 @@ is_lv_readable (struct grub_diskfilter_lv *lv, int easily) case GRUB_DISKFILTER_RAID6: if (!easily) need--; + // fall through case GRUB_DISKFILTER_RAID4: case GRUB_DISKFILTER_RAID5: if (!easily) @@ -507,6 +508,7 @@ read_segment (struct grub_diskfilter_segment *seg, grub_disk_addr_t sector, if (seg->node_count == 1) return grub_diskfilter_read_node (&seg->nodes[0], sector, size, buf); + // fall through case GRUB_DISKFILTER_MIRROR: case GRUB_DISKFILTER_RAID10: { diff --git a/grub-core/disk/efi/efidisk.c b/grub-core/disk/efi/efidisk.c index d9d788c4..5e8be72f 100644 --- a/grub-core/disk/efi/efidisk.c +++ b/grub-core/disk/efi/efidisk.c @@ -262,6 +262,9 @@ name_devices (struct grub_efidisk_data *devices) { case GRUB_EFI_HARD_DRIVE_DEVICE_PATH_SUBTYPE: is_hard_drive = 1; +#if defined(__GNUC__) && __GNUC__ >= 7 + __attribute__ ((fallthrough)); +#endif /* Fall through by intention. */ case GRUB_EFI_CDROM_DEVICE_PATH_SUBTYPE: { diff --git a/grub-core/disk/geli.c b/grub-core/disk/geli.c index f9315df0..328b8c67 100644 --- a/grub-core/disk/geli.c +++ b/grub-core/disk/geli.c @@ -153,7 +153,7 @@ geli_rekey (struct grub_cryptodisk *dev, grub_uint64_t zoneno) gcry_err = grub_crypto_hmac_buffer (dev->hash, dev->rekey_key, 64, &tohash, sizeof (tohash), key); if (gcry_err) - return grub_crypto_gcry_error (gcry_err); + return gcry_err; return grub_cryptodisk_setkey (dev, (grub_uint8_t *) key, dev->rekey_derived_size); diff --git a/grub-core/disk/mdraid1x_linux.c b/grub-core/disk/mdraid1x_linux.c index a0e65a8c..4898ad03 100644 --- a/grub-core/disk/mdraid1x_linux.c +++ b/grub-core/disk/mdraid1x_linux.c @@ -178,7 +178,7 @@ grub_mdraid_detect (grub_disk_t disk, return NULL; if (grub_disk_read (disk, sector, - (char *) &sb.dev_roles[grub_le_to_cpu32 (sb.dev_number)] + (char *) (sb.dev_roles + grub_le_to_cpu32 (sb.dev_number)) - (char *) &sb, sizeof (role), &role)) return NULL; diff --git a/grub-core/disk/usbms.c b/grub-core/disk/usbms.c index 52cc33e9..68f30f28 100644 --- a/grub-core/disk/usbms.c +++ b/grub-core/disk/usbms.c @@ -76,7 +76,7 @@ typedef struct grub_usbms_dev *grub_usbms_dev_t; static grub_usbms_dev_t grub_usbms_devices[MAX_USBMS_DEVICES]; static int first_available_slot = 0; -static grub_err_t +static grub_usb_err_t grub_usbms_cbi_cmd (grub_usb_device_t dev, int interface, grub_uint8_t *cbicb) { @@ -86,7 +86,7 @@ grub_usbms_cbi_cmd (grub_usb_device_t dev, int interface, GRUB_USBMS_CBI_CMD_SIZE, (char*)cbicb); } -static grub_err_t +static grub_usb_err_t grub_usbms_cbi_reset (grub_usb_device_t dev, int interface) { /* Prepare array with Command Block Reset (=CBR) */ @@ -108,17 +108,17 @@ grub_usbms_cbi_reset (grub_usb_device_t dev, int interface) return grub_usbms_cbi_cmd (dev, interface, (grub_uint8_t *)&cbicb); } -static grub_err_t +static grub_usb_err_t grub_usbms_bo_reset (grub_usb_device_t dev, int interface) { grub_usb_err_t u; u = grub_usb_control_msg (dev, 0x21, 255, 0, interface, 0, 0); if (u) - return grub_error (GRUB_ERR_IO, "USB error %d", u); - return GRUB_ERR_NONE; + return u; + return GRUB_USB_ERR_NONE; } -static grub_err_t +static grub_usb_err_t grub_usbms_reset (grub_usbms_dev_t dev) { if (dev->protocol == GRUB_USBMS_PROTOCOL_BULK) @@ -149,7 +149,7 @@ grub_usbms_attach (grub_usb_device_t usbdev, int configno, int interfno) int j; grub_uint8_t luns = 0; unsigned curnum; - grub_usb_err_t err = GRUB_ERR_NONE; + grub_usb_err_t err = GRUB_USB_ERR_NONE; if (first_available_slot == ARRAY_SIZE (grub_usbms_devices)) return 0; @@ -567,7 +567,11 @@ grub_usbms_transfer_cbi (struct grub_scsi *scsi, grub_size_t cmdsize, char *cmd, } } - return err; + + if (err) + return grub_error (GRUB_ERR_IO, "USB error %d", err); + + return GRUB_ERR_NONE; } diff --git a/grub-core/efiemu/mm.c b/grub-core/efiemu/mm.c index 10cbc68c..ebd2f9d0 100644 --- a/grub-core/efiemu/mm.c +++ b/grub-core/efiemu/mm.c @@ -410,6 +410,7 @@ grub_efiemu_mmap_fill (void) default: grub_dprintf ("efiemu", "Unknown memory type %d. Assuming unusable\n", type); + // fall through case GRUB_MEMORY_RESERVED: return grub_efiemu_add_to_mmap (addr, size, GRUB_EFI_UNUSABLE_MEMORY); diff --git a/grub-core/font/font.c b/grub-core/font/font.c index fca8c8d0..4c51f433 100644 --- a/grub-core/font/font.c +++ b/grub-core/font/font.c @@ -1297,6 +1297,7 @@ blit_comb (const struct grub_unicode_glyph *glyph_id, - grub_font_get_xheight (combining_glyphs[i]->font) - 1; if (space <= 0) space = 1 + (grub_font_get_xheight (main_glyph->font)) / 8; + // fall through case GRUB_UNICODE_STACK_ATTACHED_ABOVE: do_blit (combining_glyphs[i], targetx, @@ -1338,6 +1339,7 @@ blit_comb (const struct grub_unicode_glyph *glyph_id, + combining_glyphs[i]->height); if (space <= 0) space = 1 + (grub_font_get_xheight (main_glyph->font)) / 8; + // fall through case GRUB_UNICODE_STACK_ATTACHED_BELOW: do_blit (combining_glyphs[i], targetx, -(bounds.y - space)); diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c index a993f074..c6068329 100644 --- a/grub-core/fs/btrfs.c +++ b/grub-core/fs/btrfs.c @@ -28,6 +28,7 @@ #include #include #include +#include GRUB_MOD_LICENSE ("GPLv3+"); @@ -199,7 +200,7 @@ struct grub_btrfs_time { grub_int64_t sec; grub_uint32_t nanosec; -} __attribute__ ((aligned (4))); +} __attribute__ ((packed)); struct grub_btrfs_inode { @@ -252,10 +253,16 @@ static grub_err_t read_sblock (grub_disk_t disk, struct grub_btrfs_superblock *sb) { unsigned i; + struct grub_btrfs_superblock sblock; grub_err_t err = GRUB_ERR_NONE; + /* without this, the comiler will get confused. It will complain that + * on the first iteration of the loop below, we are accessing + * uninitialized sblock + */ + memset(&sblock, 0, sizeof(struct grub_btrfs_superblock)); + for (i = 0; i < ARRAY_SIZE (superblock_sectors); i++) { - struct grub_btrfs_superblock sblock; /* Don't try additional superblocks beyond device size. */ if (i && (grub_le_to_cpu64 (sblock.this_device.size) >> GRUB_DISK_SECTOR_BITS) <= superblock_sectors[i]) diff --git a/grub-core/fs/reiserfs.c b/grub-core/fs/reiserfs.c index 26adf23c..321b6b35 100644 --- a/grub-core/fs/reiserfs.c +++ b/grub-core/fs/reiserfs.c @@ -784,7 +784,7 @@ grub_reiserfs_iterate_dir (grub_fshelp_node_t item, = grub_le_to_cpu16 (directory_header->state); grub_fshelp_node_t entry_item; struct grub_reiserfs_key entry_key; - enum grub_reiserfs_item_type entry_type; + enum grub_fshelp_filetype entry_type; char *entry_name; if (!(entry_state & GRUB_REISERFS_VISIBLE_MASK)) diff --git a/grub-core/fs/udf.c b/grub-core/fs/udf.c index 8e28d41e..04b79728 100644 --- a/grub-core/fs/udf.c +++ b/grub-core/fs/udf.c @@ -970,6 +970,7 @@ grub_udf_read_symlink (grub_fshelp_node_t node) case 1: if (ptr[1]) goto fail; + // fall through case 2: /* in 4 bytes. out: 1 byte. */ optr = out; diff --git a/grub-core/fs/zfs/zfs.c b/grub-core/fs/zfs/zfs.c index ba0554ab..21adb3fb 100644 --- a/grub-core/fs/zfs/zfs.c +++ b/grub-core/fs/zfs/zfs.c @@ -140,7 +140,10 @@ ZAP_LEAF_NUMCHUNKS (int bs) static inline zap_leaf_chunk_t * ZAP_LEAF_CHUNK (zap_leaf_phys_t *l, int bs, int idx) { - return &((zap_leaf_chunk_t *) (l->l_entries + grub_properly_aligned_t *l_entries; + + l_entries = (grub_properly_aligned_t *) ALIGN_UP((grub_addr_t)l->l_hash, sizeof (grub_properly_aligned_t)); + return &((zap_leaf_chunk_t *) (l_entries + (ZAP_LEAF_HASH_NUMENTRIES(bs) * 2) / sizeof (grub_properly_aligned_t)))[idx]; } diff --git a/grub-core/fs/zfs/zfscrypt.c b/grub-core/fs/zfs/zfscrypt.c index 4ea53b86..1b368087 100644 --- a/grub-core/fs/zfs/zfscrypt.c +++ b/grub-core/fs/zfs/zfscrypt.c @@ -143,7 +143,7 @@ grub_ccm_decrypt (grub_crypto_cipher_handle_t cipher, return err; if (mac_out) grub_crypto_xor (mac_out, mac, mul, m); - return GRUB_ERR_NONE; + return GPG_ERR_NO_ERROR; } static void @@ -244,7 +244,7 @@ grub_gcm_decrypt (grub_crypto_cipher_handle_t cipher, if (mac_out) grub_crypto_xor (mac_out, mac, mac_xor, m); - return GRUB_ERR_NONE; + return GPG_ERR_NO_ERROR; } @@ -263,8 +263,7 @@ algo_decrypt (grub_crypto_cipher_handle_t cipher, grub_uint64_t algo, return grub_gcm_decrypt (cipher, out, in, psize, mac_out, nonce, 15 - l, m); default: - return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, "algorithm %" - PRIuGRUB_UINT64_T " is not supported yet", algo); + return GPG_ERR_CIPHER_ALGO; } } @@ -279,7 +278,7 @@ grub_zfs_decrypt_real (grub_crypto_cipher_handle_t cipher, grub_uint32_t mac[4]; unsigned i; grub_uint32_t sw[4]; - grub_err_t err; + gcry_err_code_t err; grub_memcpy (sw, nonce, 16); if (endian != GRUB_ZFS_BIG_ENDIAN) @@ -295,7 +294,7 @@ grub_zfs_decrypt_real (grub_crypto_cipher_handle_t cipher, size, mac, sw + 1, 3, 12); if (err) - return err; + return grub_crypto_gcry_error (err); for (i = 0; i < 3; i++) if (grub_zfs_to_cpu32 (expected_mac[i], endian) diff --git a/grub-core/gdb/cstub.c b/grub-core/gdb/cstub.c index a5c0c431..9cc4c9b7 100644 --- a/grub-core/gdb/cstub.c +++ b/grub-core/gdb/cstub.c @@ -336,6 +336,7 @@ grub_gdb_trap (int trap_no) /* sAA..AA: Step one instruction from AA..AA(optional). */ case 's': stepping = 1; + // fall through /* cAA..AA: Continue at address AA..AA(optional). */ case 'c': diff --git a/grub-core/gnulib/regexec.c b/grub-core/gnulib/regexec.c index dc449ce5..4b56021d 100644 --- a/grub-core/gnulib/regexec.c +++ b/grub-core/gnulib/regexec.c @@ -4104,8 +4104,8 @@ check_node_accept (const re_match_context_t *mctx, const re_token_t *node, case OP_UTF8_PERIOD: if (ch >= ASCII_CHARS) return false; - /* FALLTHROUGH */ #endif + // fall through case OP_PERIOD: if ((ch == '\n' && !(mctx->dfa->syntax & RE_DOT_NEWLINE)) || (ch == '\0' && (mctx->dfa->syntax & RE_DOT_NOT_NULL))) diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c index 0c80cc83..3ce9d373 100644 --- a/grub-core/kern/misc.c +++ b/grub-core/kern/misc.c @@ -1189,7 +1189,7 @@ grub_abort (void) #if ! defined (__APPLE__) && !defined (GRUB_UTIL) /* GCC emits references to abort(). */ -void abort (void) __attribute__ ((alias ("grub_abort"))); +void __attribute__ ((noreturn)) abort (void) __attribute__ ((alias ("grub_abort"))); #endif #if NEED_ENABLE_EXECUTE_STACK && !defined(GRUB_UTIL) && !defined(GRUB_MACHINE_EMU) diff --git a/grub-core/lib/legacy_parse.c b/grub-core/lib/legacy_parse.c index 775eaad1..67c8aafa 100644 --- a/grub-core/lib/legacy_parse.c +++ b/grub-core/lib/legacy_parse.c @@ -626,6 +626,7 @@ grub_legacy_parse (const char *buf, char **entryname, char **suffix) { case TYPE_FILE_NO_CONSUME: hold_arg = 1; + // fall through case TYPE_PARTITION: case TYPE_FILE: args[i] = adjust_file (curarg, curarglen); diff --git a/grub-core/lib/xzembed/xz_dec_lzma2.c b/grub-core/lib/xzembed/xz_dec_lzma2.c index 7899e9e8..a8ed1c4e 100644 --- a/grub-core/lib/xzembed/xz_dec_lzma2.c +++ b/grub-core/lib/xzembed/xz_dec_lzma2.c @@ -1041,6 +1041,7 @@ enum xz_ret xz_dec_lzma2_run( return XZ_DATA_ERROR; s->lzma2.sequence = SEQ_LZMA_PREPARE; + //fall through case SEQ_LZMA_PREPARE: if (s->lzma2.compressed < RC_INIT_BYTES) @@ -1051,6 +1052,7 @@ enum xz_ret xz_dec_lzma2_run( s->lzma2.compressed -= RC_INIT_BYTES; s->lzma2.sequence = SEQ_LZMA_RUN; + // fall through case SEQ_LZMA_RUN: /* diff --git a/grub-core/lib/xzembed/xz_dec_stream.c b/grub-core/lib/xzembed/xz_dec_stream.c index 0d79b1f0..3eac7bc4 100644 --- a/grub-core/lib/xzembed/xz_dec_stream.c +++ b/grub-core/lib/xzembed/xz_dec_stream.c @@ -748,6 +748,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b) return ret; s->sequence = SEQ_BLOCK_START; + // fall through case SEQ_BLOCK_START: /* We need one byte of input to continue. */ @@ -771,6 +772,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b) s->temp.size = s->block_header.size; s->temp.pos = 0; s->sequence = SEQ_BLOCK_HEADER; + // fall through case SEQ_BLOCK_HEADER: if (!fill_temp(s, b)) @@ -781,6 +783,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b) return ret; s->sequence = SEQ_BLOCK_UNCOMPRESS; + // fall through case SEQ_BLOCK_UNCOMPRESS: ret = dec_block(s, b); @@ -788,6 +791,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b) return ret; s->sequence = SEQ_BLOCK_PADDING; + // fall through case SEQ_BLOCK_PADDING: /* @@ -808,6 +812,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b) } s->sequence = SEQ_BLOCK_CHECK; + // fall through case SEQ_BLOCK_CHECK: ret = hash_validate(s, b, 0); @@ -823,6 +828,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b) return ret; s->sequence = SEQ_INDEX_PADDING; + // fall through case SEQ_INDEX_PADDING: while ((s->index.size + (b->in_pos - s->in_start)) @@ -862,6 +868,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b) #endif s->sequence = SEQ_INDEX_CRC32; + // fall through case SEQ_INDEX_CRC32: ret = hash_validate(s, b, 1); @@ -870,6 +877,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b) s->temp.size = STREAM_HEADER_SIZE; s->sequence = SEQ_STREAM_FOOTER; + // fall through case SEQ_STREAM_FOOTER: if (!fill_temp(s, b)) diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c index 62087cfa..5e82a21b 100644 --- a/grub-core/loader/i386/linux.c +++ b/grub-core/loader/i386/linux.c @@ -977,10 +977,13 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), { case 'g': shift += 10; + // fall through case 'm': shift += 10; + // fall through case 'k': shift += 10; + // fall through default: break; } diff --git a/grub-core/loader/i386/pc/linux.c b/grub-core/loader/i386/pc/linux.c index 4eeb1b6c..48162e9a 100644 --- a/grub-core/loader/i386/pc/linux.c +++ b/grub-core/loader/i386/pc/linux.c @@ -252,10 +252,13 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), { case 'g': shift += 10; + // fall through case 'm': shift += 10; + // fall through case 'k': shift += 10; + // fall through default: break; } diff --git a/grub-core/loader/i386/xnu.c b/grub-core/loader/i386/xnu.c index 4e5ce097..04429b5f 100644 --- a/grub-core/loader/i386/xnu.c +++ b/grub-core/loader/i386/xnu.c @@ -724,7 +724,7 @@ grub_cpu_xnu_fill_devicetree (grub_uint64_t *fsbfreq_out) { void *ptr; struct grub_xnu_devtree_key *curkey; - grub_efi_guid_t guid; + grub_efi_packed_guid_t guid; char guidbuf[64]; /* Retrieve current key. */ diff --git a/grub-core/mmap/efi/mmap.c b/grub-core/mmap/efi/mmap.c index 75f82eda..0c734a4d 100644 --- a/grub-core/mmap/efi/mmap.c +++ b/grub-core/mmap/efi/mmap.c @@ -72,6 +72,7 @@ grub_efi_mmap_iterate (grub_memory_hook_t hook, int avoid_efi_boot_services) GRUB_MEMORY_AVAILABLE); break; } + break; case GRUB_EFI_RUNTIME_SERVICES_CODE: hook (desc->physical_start, desc->num_pages * 4096, GRUB_MEMORY_CODE); @@ -85,6 +86,7 @@ grub_efi_mmap_iterate (grub_memory_hook_t hook, int avoid_efi_boot_services) default: grub_printf ("Unknown memory type %d, considering reserved\n", desc->type); + break; case GRUB_EFI_BOOT_SERVICES_DATA: if (!avoid_efi_boot_services) @@ -93,6 +95,7 @@ grub_efi_mmap_iterate (grub_memory_hook_t hook, int avoid_efi_boot_services) GRUB_MEMORY_AVAILABLE); break; } + break; case GRUB_EFI_RESERVED_MEMORY_TYPE: case GRUB_EFI_RUNTIME_SERVICES_DATA: case GRUB_EFI_MEMORY_MAPPED_IO: diff --git a/grub-core/normal/charset.c b/grub-core/normal/charset.c index 25593ce8..2dda288d 100644 --- a/grub-core/normal/charset.c +++ b/grub-core/normal/charset.c @@ -858,6 +858,7 @@ grub_bidi_line_logical_to_visual (const grub_uint32_t *logical, case GRUB_BIDI_TYPE_R: case GRUB_BIDI_TYPE_AL: bidi_needed = 1; + // fall through default: { if (join_state == JOIN_FORCE) diff --git a/grub-core/script/yylex.l b/grub-core/script/yylex.l index 8fdcfef6..5ad5c41c 100644 --- a/grub-core/script/yylex.l +++ b/grub-core/script/yylex.l @@ -31,6 +31,7 @@ #pragma GCC diagnostic ignored "-Wunsafe-loop-optimizations" #pragma GCC diagnostic ignored "-Wunused-function" #pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wunused-value" #define yyfree grub_lexer_yyfree #define yyalloc grub_lexer_yyalloc diff --git a/grub-core/video/bochs.c b/grub-core/video/bochs.c index 79cae654..e279256a 100644 --- a/grub-core/video/bochs.c +++ b/grub-core/video/bochs.c @@ -351,6 +351,7 @@ grub_video_bochs_setup (unsigned int width, unsigned int height, case 32: framebuffer.mode_info.reserved_mask_size = 8; framebuffer.mode_info.reserved_field_pos = 24; + // fall through case 24: framebuffer.mode_info.red_mask_size = 8; diff --git a/grub-core/video/cirrus.c b/grub-core/video/cirrus.c index 7fad50e5..f28c52d8 100644 --- a/grub-core/video/cirrus.c +++ b/grub-core/video/cirrus.c @@ -431,6 +431,7 @@ grub_video_cirrus_setup (unsigned int width, unsigned int height, case 32: framebuffer.mode_info.reserved_mask_size = 8; framebuffer.mode_info.reserved_field_pos = 24; + // fall through case 24: framebuffer.mode_info.red_mask_size = 8; diff --git a/grub-core/video/i386/pc/vbe.c b/grub-core/video/i386/pc/vbe.c index 81e5a8e9..e70ae7df 100644 --- a/grub-core/video/i386/pc/vbe.c +++ b/grub-core/video/i386/pc/vbe.c @@ -880,6 +880,7 @@ vbe2videoinfo (grub_uint32_t mode, /* CGA is basically 4-bit packed pixel. */ case GRUB_VBE_MEMORY_MODEL_CGA: mode_info->mode_type |= GRUB_VIDEO_MODE_TYPE_CGA; + // fall through case GRUB_VBE_MEMORY_MODEL_PACKED_PIXEL: mode_info->mode_type |= GRUB_VIDEO_MODE_TYPE_INDEX_COLOR; break; @@ -892,6 +893,7 @@ vbe2videoinfo (grub_uint32_t mode, /* Non chain 4 is a special case of planar. */ case GRUB_VBE_MEMORY_MODEL_NONCHAIN4_256: mode_info->mode_type |= GRUB_VIDEO_MODE_TYPE_NONCHAIN4; + // fall through case GRUB_VBE_MEMORY_MODEL_PLANAR: mode_info->mode_type |= GRUB_VIDEO_MODE_TYPE_PLANAR | GRUB_VIDEO_MODE_TYPE_INDEX_COLOR; diff --git a/grub-core/video/readers/jpeg.c b/grub-core/video/readers/jpeg.c index f5e63aee..10ef4c8b 100644 --- a/grub-core/video/readers/jpeg.c +++ b/grub-core/video/readers/jpeg.c @@ -701,6 +701,7 @@ grub_jpeg_decode_jpeg (struct grub_jpeg_data *data) case JPEG_MARKER_SOS: /* Start Of Scan. */ if (grub_jpeg_decode_sos (data)) break; + // fall through case JPEG_MARKER_RST0: /* Restart. */ case JPEG_MARKER_RST1: case JPEG_MARKER_RST2: diff --git a/include/grub/acpi.h b/include/grub/acpi.h index ee0a108f..ec2a54d7 100644 --- a/include/grub/acpi.h +++ b/include/grub/acpi.h @@ -84,7 +84,7 @@ struct grub_acpi_madt grub_uint32_t lapic_addr; grub_uint32_t flags; struct grub_acpi_madt_entry_header entries[0]; -}; +} __attribute__ ((packed)); enum { diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h index 26127ded..47a9cb10 100644 --- a/include/grub/efi/api.h +++ b/include/grub/efi/api.h @@ -384,6 +384,15 @@ struct grub_efi_guid } __attribute__ ((aligned(8))); typedef struct grub_efi_guid grub_efi_guid_t; +struct grub_efi_packed_guid +{ + grub_uint32_t data1; + grub_uint16_t data2; + grub_uint16_t data3; + grub_uint8_t data4[8]; +} GRUB_PACKED; +typedef struct grub_efi_packed_guid grub_efi_packed_guid_t; + /* XXX although the spec does not specify the padding, this actually must have the padding! */ struct grub_efi_memory_descriptor @@ -467,7 +476,7 @@ typedef struct grub_efi_memory_mapped_device_path grub_efi_memory_mapped_device_ struct grub_efi_vendor_device_path { grub_efi_device_path_t header; - grub_efi_guid_t vendor_guid; + grub_efi_packed_guid_t vendor_guid; grub_efi_uint8_t vendor_defined_data[0]; } __attribute__ ((packed)); typedef struct grub_efi_vendor_device_path grub_efi_vendor_device_path_t; @@ -661,7 +670,7 @@ typedef struct grub_efi_uart_device_path grub_efi_uart_device_path_t; struct grub_efi_vendor_messaging_device_path { grub_efi_device_path_t header; - grub_efi_guid_t vendor_guid; + grub_efi_packed_guid_t vendor_guid; grub_efi_uint8_t vendor_defined_data[0]; } __attribute__ ((packed)); typedef struct grub_efi_vendor_messaging_device_path grub_efi_vendor_messaging_device_path_t; @@ -699,7 +708,7 @@ typedef struct grub_efi_cdrom_device_path grub_efi_cdrom_device_path_t; struct grub_efi_vendor_media_device_path { grub_efi_device_path_t header; - grub_efi_guid_t vendor_guid; + grub_efi_packed_guid_t vendor_guid; grub_efi_uint8_t vendor_defined_data[0]; } __attribute__ ((packed)); typedef struct grub_efi_vendor_media_device_path grub_efi_vendor_media_device_path_t; @@ -718,7 +727,7 @@ typedef struct grub_efi_file_path_device_path grub_efi_file_path_device_path_t; struct grub_efi_protocol_device_path { grub_efi_device_path_t header; - grub_efi_guid_t guid; + grub_efi_packed_guid_t guid; } __attribute__ ((packed)); typedef struct grub_efi_protocol_device_path grub_efi_protocol_device_path_t; @@ -727,7 +736,7 @@ typedef struct grub_efi_protocol_device_path grub_efi_protocol_device_path_t; struct grub_efi_piwg_device_path { grub_efi_device_path_t header; - grub_efi_guid_t guid __attribute__ ((packed)); + grub_efi_packed_guid_t guid; } __attribute__ ((packed)); typedef struct grub_efi_piwg_device_path grub_efi_piwg_device_path_t; @@ -1084,7 +1093,7 @@ typedef struct grub_efi_runtime_services grub_efi_runtime_services_t; struct grub_efi_configuration_table { - grub_efi_guid_t vendor_guid; + grub_efi_packed_guid_t vendor_guid; void *vendor_table; } __attribute__ ((packed)); typedef struct grub_efi_configuration_table grub_efi_configuration_table_t; diff --git a/include/grub/efiemu/efiemu.h b/include/grub/efiemu/efiemu.h index 4ce3fc92..a592e8a6 100644 --- a/include/grub/efiemu/efiemu.h +++ b/include/grub/efiemu/efiemu.h @@ -183,13 +183,13 @@ struct grub_efiemu_configuration_table }; struct grub_efiemu_configuration_table32 { - grub_efi_guid_t vendor_guid; + grub_efi_packed_guid_t vendor_guid; grub_efi_uint32_t vendor_table; } __attribute__ ((packed)); typedef struct grub_efiemu_configuration_table32 grub_efiemu_configuration_table32_t; struct grub_efiemu_configuration_table64 { - grub_efi_guid_t vendor_guid; + grub_efi_packed_guid_t vendor_guid; grub_efi_uint64_t vendor_table; } __attribute__ ((packed)); typedef struct grub_efiemu_configuration_table64 grub_efiemu_configuration_table64_t; diff --git a/include/grub/efiemu/runtime.h b/include/grub/efiemu/runtime.h index 1eb474a5..18c866ca 100644 --- a/include/grub/efiemu/runtime.h +++ b/include/grub/efiemu/runtime.h @@ -29,7 +29,7 @@ struct grub_efiemu_ptv_rel struct efi_variable { - grub_efi_guid_t guid; + grub_efi_packed_guid_t guid; grub_uint32_t namelen; grub_uint32_t size; grub_efi_uint32_t attributes; diff --git a/include/grub/gpt_partition.h b/include/grub/gpt_partition.h index 83e3b319..7824708c 100644 --- a/include/grub/gpt_partition.h +++ b/include/grub/gpt_partition.h @@ -28,7 +28,7 @@ struct grub_gpt_part_type grub_uint16_t data2; grub_uint16_t data3; grub_uint8_t data4[8]; -} __attribute__ ((aligned(8))); +} __attribute__ ((packed)); typedef struct grub_gpt_part_type grub_gpt_part_type_t; #define GRUB_GPT_PARTITION_TYPE_EMPTY \ diff --git a/include/grub/types.h b/include/grub/types.h index 3e677c69..eb7ea9b3 100644 --- a/include/grub/types.h +++ b/include/grub/types.h @@ -24,6 +24,12 @@ #include #endif +#ifdef __MINGW32__ +#define GRUB_PACKED __attribute__ ((packed,gcc_struct)) +#else +#define GRUB_PACKED __attribute__ ((packed)) +#endif + #ifdef GRUB_UTIL # define GRUB_CPU_SIZEOF_VOID_P SIZEOF_VOID_P # define GRUB_CPU_SIZEOF_LONG SIZEOF_LONG diff --git a/include/grub/zfs/zap_leaf.h b/include/grub/zfs/zap_leaf.h index f2b7cb1d..3a77ff47 100644 --- a/include/grub/zfs/zap_leaf.h +++ b/include/grub/zfs/zap_leaf.h @@ -70,7 +70,6 @@ typedef struct zap_leaf_phys { */ grub_uint16_t l_hash[0]; - grub_properly_aligned_t l_entries[0]; } zap_leaf_phys_t; typedef union zap_leaf_chunk { diff --git a/util/getroot.c b/util/getroot.c index e103fb6c..fc358df4 100644 --- a/util/getroot.c +++ b/util/getroot.c @@ -22,6 +22,7 @@ #include #include +#include #include #include #include diff --git a/util/grub-mkimagexx.c b/util/grub-mkimagexx.c index 476d05ee..a4a7f9cf 100644 --- a/util/grub-mkimagexx.c +++ b/util/grub-mkimagexx.c @@ -427,6 +427,7 @@ SUFFIX (relocate_addresses) (Elf_Ehdr *e, Elf_Shdr *sections, break; case R_X86_64_PC32: + case R_X86_64_PLT32: { grub_uint32_t *t32 = (grub_uint32_t *) target; *t32 = grub_host_to_target64 (grub_target_to_host32 (*t32) @@ -485,6 +486,7 @@ SUFFIX (relocate_addresses) (Elf_Ehdr *e, Elf_Shdr *sections, + sym->st_value - image_target->vaddr_offset)); } + // fall through case R_IA64_LTOFF_FPTR22: *gpptr = grub_host_to_target64 (addend + sym_addr); add_value_to_slot_21 ((grub_addr_t) target, diff --git a/util/raid.c b/util/raid.c index f73ae76c..880ae2c5 100644 --- a/util/raid.c +++ b/util/raid.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include