Index: root/xen-unstable.hg/tools/firmware/hvmloader/acpi/build.c =================================================================== --- root.orig/xen-unstable.hg/tools/firmware/hvmloader/acpi/build.c +++ root/xen-unstable.hg/tools/firmware/hvmloader/acpi/build.c @@ -57,8 +57,8 @@ int construct_madt(struct acpi_20_madt * memset(madt, 0, sizeof(*madt)); madt->header.signature = ACPI_2_0_MADT_SIGNATURE; madt->header.revision = ACPI_2_0_MADT_REVISION; - strncpy(madt->header.oem_id, ACPI_OEM_ID, 6); - strncpy(madt->header.oem_table_id, ACPI_OEM_TABLE_ID, 8); + strncpy((char *)madt->header.oem_id, ACPI_OEM_ID, 6); + strncpy((char *)madt->header.oem_table_id, ACPI_OEM_TABLE_ID, 8); madt->header.oem_revision = ACPI_OEM_REVISION; madt->header.creator_id = ACPI_CREATOR_ID; madt->header.creator_revision = ACPI_CREATOR_REVISION; @@ -131,8 +131,8 @@ int construct_hpet(struct acpi_20_hpet * memset(hpet, 0, sizeof(*hpet)); hpet->header.signature = ACPI_2_0_HPET_SIGNATURE; hpet->header.revision = ACPI_2_0_HPET_REVISION; - strncpy(hpet->header.oem_id, ACPI_OEM_ID, 6); - strncpy(hpet->header.oem_table_id, ACPI_OEM_TABLE_ID, 8); + strncpy((char *)hpet->header.oem_id, ACPI_OEM_ID, 6); + strncpy((char *)hpet->header.oem_table_id, ACPI_OEM_TABLE_ID, 8); hpet->header.oem_revision = ACPI_OEM_REVISION; hpet->header.creator_id = ACPI_CREATOR_ID; hpet->header.creator_revision = ACPI_CREATOR_REVISION; @@ -161,8 +161,8 @@ int construct_processor_objects(uint8_t hdr = (struct acpi_header *)p; hdr->signature = ASCII32('S','S','D','T'); hdr->revision = 2; - strncpy(hdr->oem_id, ACPI_OEM_ID, 6); - strncpy(hdr->oem_table_id, ACPI_OEM_TABLE_ID, 8); + strncpy((char *)hdr->oem_id, ACPI_OEM_ID, 6); + strncpy((char *)hdr->oem_table_id, ACPI_OEM_TABLE_ID, 8); hdr->oem_revision = ACPI_OEM_REVISION; hdr->creator_id = ACPI_CREATOR_ID; hdr->creator_revision = ACPI_CREATOR_REVISION; @@ -195,7 +195,7 @@ int construct_processor_objects(uint8_t } /* NameString */ - strncpy(p, "\\_PR_", 5); + strncpy((char *)p, "\\_PR_", 5); p += 5; /* @@ -263,8 +263,8 @@ int construct_secondary_tables(uint8_t * tcpa->header.signature = ACPI_2_0_TCPA_SIGNATURE; tcpa->header.length = sizeof(*tcpa); tcpa->header.revision = ACPI_2_0_TCPA_REVISION; - strncpy(tcpa->header.oem_id, ACPI_OEM_ID, 6); - strncpy(tcpa->header.oem_table_id, ACPI_OEM_TABLE_ID, 8); + strncpy((char *)tcpa->header.oem_id, ACPI_OEM_ID, 6); + strncpy((char *)tcpa->header.oem_table_id, ACPI_OEM_TABLE_ID, 8); tcpa->header.oem_revision = ACPI_OEM_REVISION; tcpa->header.creator_id = ACPI_CREATOR_ID; tcpa->header.creator_revision = ACPI_CREATOR_REVISION; Index: root/xen-unstable.hg/tools/firmware/hvmloader/32bitbios_support.c =================================================================== --- root.orig/xen-unstable.hg/tools/firmware/hvmloader/32bitbios_support.c +++ root/xen-unstable.hg/tools/firmware/hvmloader/32bitbios_support.c @@ -45,16 +45,11 @@ static int relocate_elf(unsigned char *e return -1; } - for (i = 0; i < ehdr->e_shnum; i++) { - if (!(shdr[i]).sh_flags & SHF_ALLOC) { - shdr[i].sh_addr = 0; - continue; - } + for (i = 0; i < ehdr->e_shnum; i++) shdr[i].sh_addr = (Elf32_Addr)&elfarray[shdr[i].sh_offset]; - } for (i = 0; i < ehdr->e_shnum; i++) { - if (shdr[i].sh_type == SHT_REL && shdr[i].sh_addr != 0) { + if (shdr[i].sh_type == SHT_REL) { Elf32_Shdr *targetsec = (Elf32_Shdr *)&(shdr[shdr[i].sh_info]); Elf32_Shdr *symtabsec = (Elf32_Shdr *)&(shdr[shdr[i].sh_link]); Elf32_Sym *syms = (Elf32_Sym *)symtabsec->sh_addr; @@ -62,6 +57,10 @@ static int relocate_elf(unsigned char *e unsigned char *code = (unsigned char *)targetsec->sh_addr; int j; + /* must not have been stripped */ + if (shdr[i].sh_size == 0) + return -6; + for (j = 0; j < shdr[i].sh_size / sizeof(Elf32_Rel); j++) { int idx = ELF32_R_SYM(rels[j].r_info); Elf32_Sym *symbol = &syms[idx];