mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-15 09:55:36 +00:00
Kbuild fixes for v6.13 (3rd)
- Fix escaping of '$' in scripts/mksysmap - Fix a modpost crash observed with the latest binutils - Fix 'provides' in the linux-api-headers pacman package -----BEGIN PGP SIGNATURE----- iQJJBAABCgAzFiEEbmPs18K1szRHjPqEPYsBB53g2wYFAmd6lzsVHG1hc2FoaXJv eUBrZXJuZWwub3JnAAoJED2LAQed4NsGkXoQAJCH0b0gfzuRMtgKI+HKj/eow4ZI +uArtK/cu2fJ6Vxe71GTBJGEca8DNslOOlyMvWf6jhRcBdd5jOlTciUojk389jRb 6JR9fvEfS3RevkbkzVe0Uq6jSL02eLrF/z/Q3xmVMi68npBlCg40G2EDIIS8iWpu jRxnhSUBKU+ooKahA2KwRVexUdkE8BbdsNLUf5NaTSOACI0A4sn6Om4uYdCQdrRC oNptpzJdVoG40cKlzSyzNoCVxxY77b9PKdkuR28SMpj55ZjcAQRV3ZuHphegH1JQ fpg6JNu0sNHrM4OkKzrpA6f8d3s1yooILgrCMQhFo0gUHLFVLIuos1t8uT4urDr+ RJ7bUWnLCyqu6wEtzGRaiRPXDolKJrXYYTO+XwLkz5iLkNLO1uGXvm7Hbl4GG2iX PKKZ5gT02kQmijvDRc496Q7z4LYJqAqUIUu0NSR1lP+qK0qKCIHJyi3kAAvvLZ/Y Eia8LtUXcjjbbMSSk3vCXC8qvRj4NE1HxqmbBDVTpdnzxNfxeQisHiD0Rz9RzTyo FhvWGrDNx2vTcShrBiZvww5wfUkSSueXqG89d95U3AxlhJ58dk4w08whu03fkhNB P/NM1e6ShOo682LVrBgFHmhgxc+2iYb81ZqzfSJVHLOV8cpShC0KjONFRgdCW4K4 O8iD6fUXYDlLIJjg =v0Mh -----END PGP SIGNATURE----- Merge tag 'kbuild-fixes-v6.13-3' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild Pull Kbuild fixes from Masahiro Yamada: - Fix escaping of '$' in scripts/mksysmap - Fix a modpost crash observed with the latest binutils - Fix 'provides' in the linux-api-headers pacman package * tag 'kbuild-fixes-v6.13-3' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: kbuild: pacman-pkg: provide versioned linux-api-headers package modpost: work around unaligned data access error modpost: refactor do_vmbus_entry() modpost: fix the missed iteration for the max bit in do_input() scripts/mksysmap: Fix escape chars '$'
This commit is contained in:
commit
9244696b34
@ -26,7 +26,7 @@
|
||||
# (do not forget a space before each pattern)
|
||||
|
||||
# local symbols for ARM, MIPS, etc.
|
||||
/ \\$/d
|
||||
/ \$/d
|
||||
|
||||
# local labels, .LBB, .Ltmpxxx, .L__unnamed_xx, .LASANPC, etc.
|
||||
/ \.L/d
|
||||
@ -39,7 +39,7 @@
|
||||
/ __pi_\.L/d
|
||||
|
||||
# arm64 local symbols in non-VHE KVM namespace
|
||||
/ __kvm_nvhe_\\$/d
|
||||
/ __kvm_nvhe_\$/d
|
||||
/ __kvm_nvhe_\.L/d
|
||||
|
||||
# lld arm/aarch64/mips thunks
|
||||
|
@ -132,7 +132,8 @@ struct devtable {
|
||||
* based at address m.
|
||||
*/
|
||||
#define DEF_FIELD(m, devid, f) \
|
||||
typeof(((struct devid *)0)->f) f = TO_NATIVE(*(typeof(f) *)((m) + OFF_##devid##_##f))
|
||||
typeof(((struct devid *)0)->f) f = \
|
||||
get_unaligned_native((typeof(f) *)((m) + OFF_##devid##_##f))
|
||||
|
||||
/* Define a variable f that holds the address of field f of struct devid
|
||||
* based at address m. Due to the way typeof works, for a field of type
|
||||
@ -600,7 +601,7 @@ static void do_pnp_card_entry(struct module *mod, void *symval)
|
||||
static void do_pcmcia_entry(struct module *mod, void *symval)
|
||||
{
|
||||
char alias[256] = {};
|
||||
unsigned int i;
|
||||
|
||||
DEF_FIELD(symval, pcmcia_device_id, match_flags);
|
||||
DEF_FIELD(symval, pcmcia_device_id, manf_id);
|
||||
DEF_FIELD(symval, pcmcia_device_id, card_id);
|
||||
@ -609,10 +610,6 @@ static void do_pcmcia_entry(struct module *mod, void *symval)
|
||||
DEF_FIELD(symval, pcmcia_device_id, device_no);
|
||||
DEF_FIELD_ADDR(symval, pcmcia_device_id, prod_id_hash);
|
||||
|
||||
for (i=0; i<4; i++) {
|
||||
(*prod_id_hash)[i] = TO_NATIVE((*prod_id_hash)[i]);
|
||||
}
|
||||
|
||||
ADD(alias, "m", match_flags & PCMCIA_DEV_ID_MATCH_MANF_ID,
|
||||
manf_id);
|
||||
ADD(alias, "c", match_flags & PCMCIA_DEV_ID_MATCH_CARD_ID,
|
||||
@ -623,10 +620,14 @@ static void do_pcmcia_entry(struct module *mod, void *symval)
|
||||
function);
|
||||
ADD(alias, "pfn", match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO,
|
||||
device_no);
|
||||
ADD(alias, "pa", match_flags & PCMCIA_DEV_ID_MATCH_PROD_ID1, (*prod_id_hash)[0]);
|
||||
ADD(alias, "pb", match_flags & PCMCIA_DEV_ID_MATCH_PROD_ID2, (*prod_id_hash)[1]);
|
||||
ADD(alias, "pc", match_flags & PCMCIA_DEV_ID_MATCH_PROD_ID3, (*prod_id_hash)[2]);
|
||||
ADD(alias, "pd", match_flags & PCMCIA_DEV_ID_MATCH_PROD_ID4, (*prod_id_hash)[3]);
|
||||
ADD(alias, "pa", match_flags & PCMCIA_DEV_ID_MATCH_PROD_ID1,
|
||||
get_unaligned_native(*prod_id_hash + 0));
|
||||
ADD(alias, "pb", match_flags & PCMCIA_DEV_ID_MATCH_PROD_ID2,
|
||||
get_unaligned_native(*prod_id_hash + 1));
|
||||
ADD(alias, "pc", match_flags & PCMCIA_DEV_ID_MATCH_PROD_ID3,
|
||||
get_unaligned_native(*prod_id_hash + 2));
|
||||
ADD(alias, "pd", match_flags & PCMCIA_DEV_ID_MATCH_PROD_ID4,
|
||||
get_unaligned_native(*prod_id_hash + 3));
|
||||
|
||||
module_alias_printf(mod, true, "pcmcia:%s", alias);
|
||||
}
|
||||
@ -654,10 +655,9 @@ static void do_input(char *alias,
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = min / BITS_PER_LONG; i < max / BITS_PER_LONG + 1; i++)
|
||||
arr[i] = TO_NATIVE(arr[i]);
|
||||
for (i = min; i < max; i++)
|
||||
if (arr[i / BITS_PER_LONG] & (1ULL << (i%BITS_PER_LONG)))
|
||||
for (i = min; i <= max; i++)
|
||||
if (get_unaligned_native(arr + i / BITS_PER_LONG) &
|
||||
(1ULL << (i % BITS_PER_LONG)))
|
||||
sprintf(alias + strlen(alias), "%X,*", i);
|
||||
}
|
||||
|
||||
@ -812,15 +812,13 @@ static void do_virtio_entry(struct module *mod, void *symval)
|
||||
* Each byte of the guid will be represented by two hex characters
|
||||
* in the name.
|
||||
*/
|
||||
|
||||
static void do_vmbus_entry(struct module *mod, void *symval)
|
||||
{
|
||||
int i;
|
||||
DEF_FIELD_ADDR(symval, hv_vmbus_device_id, guid);
|
||||
char guid_name[(sizeof(*guid) + 1) * 2];
|
||||
char guid_name[sizeof(*guid) * 2 + 1];
|
||||
|
||||
for (i = 0; i < (sizeof(*guid) * 2); i += 2)
|
||||
sprintf(&guid_name[i], "%02x", TO_NATIVE((guid->b)[i/2]));
|
||||
for (int i = 0; i < sizeof(*guid); i++)
|
||||
sprintf(&guid_name[i * 2], "%02x", guid->b[i]);
|
||||
|
||||
module_alias_printf(mod, false, "vmbus:%s", guid_name);
|
||||
}
|
||||
|
@ -1138,9 +1138,9 @@ static Elf_Addr addend_386_rel(uint32_t *location, unsigned int r_type)
|
||||
{
|
||||
switch (r_type) {
|
||||
case R_386_32:
|
||||
return TO_NATIVE(*location);
|
||||
return get_unaligned_native(location);
|
||||
case R_386_PC32:
|
||||
return TO_NATIVE(*location) + 4;
|
||||
return get_unaligned_native(location) + 4;
|
||||
}
|
||||
|
||||
return (Elf_Addr)(-1);
|
||||
@ -1161,24 +1161,24 @@ static Elf_Addr addend_arm_rel(void *loc, Elf_Sym *sym, unsigned int r_type)
|
||||
switch (r_type) {
|
||||
case R_ARM_ABS32:
|
||||
case R_ARM_REL32:
|
||||
inst = TO_NATIVE(*(uint32_t *)loc);
|
||||
inst = get_unaligned_native((uint32_t *)loc);
|
||||
return inst + sym->st_value;
|
||||
case R_ARM_MOVW_ABS_NC:
|
||||
case R_ARM_MOVT_ABS:
|
||||
inst = TO_NATIVE(*(uint32_t *)loc);
|
||||
inst = get_unaligned_native((uint32_t *)loc);
|
||||
offset = sign_extend32(((inst & 0xf0000) >> 4) | (inst & 0xfff),
|
||||
15);
|
||||
return offset + sym->st_value;
|
||||
case R_ARM_PC24:
|
||||
case R_ARM_CALL:
|
||||
case R_ARM_JUMP24:
|
||||
inst = TO_NATIVE(*(uint32_t *)loc);
|
||||
inst = get_unaligned_native((uint32_t *)loc);
|
||||
offset = sign_extend32((inst & 0x00ffffff) << 2, 25);
|
||||
return offset + sym->st_value + 8;
|
||||
case R_ARM_THM_MOVW_ABS_NC:
|
||||
case R_ARM_THM_MOVT_ABS:
|
||||
upper = TO_NATIVE(*(uint16_t *)loc);
|
||||
lower = TO_NATIVE(*((uint16_t *)loc + 1));
|
||||
upper = get_unaligned_native((uint16_t *)loc);
|
||||
lower = get_unaligned_native((uint16_t *)loc + 1);
|
||||
offset = sign_extend32(((upper & 0x000f) << 12) |
|
||||
((upper & 0x0400) << 1) |
|
||||
((lower & 0x7000) >> 4) |
|
||||
@ -1195,8 +1195,8 @@ static Elf_Addr addend_arm_rel(void *loc, Elf_Sym *sym, unsigned int r_type)
|
||||
* imm11 = lower[10:0]
|
||||
* imm32 = SignExtend(S:J2:J1:imm6:imm11:'0')
|
||||
*/
|
||||
upper = TO_NATIVE(*(uint16_t *)loc);
|
||||
lower = TO_NATIVE(*((uint16_t *)loc + 1));
|
||||
upper = get_unaligned_native((uint16_t *)loc);
|
||||
lower = get_unaligned_native((uint16_t *)loc + 1);
|
||||
|
||||
sign = (upper >> 10) & 1;
|
||||
j1 = (lower >> 13) & 1;
|
||||
@ -1219,8 +1219,8 @@ static Elf_Addr addend_arm_rel(void *loc, Elf_Sym *sym, unsigned int r_type)
|
||||
* I2 = NOT(J2 XOR S)
|
||||
* imm32 = SignExtend(S:I1:I2:imm10:imm11:'0')
|
||||
*/
|
||||
upper = TO_NATIVE(*(uint16_t *)loc);
|
||||
lower = TO_NATIVE(*((uint16_t *)loc + 1));
|
||||
upper = get_unaligned_native((uint16_t *)loc);
|
||||
lower = get_unaligned_native((uint16_t *)loc + 1);
|
||||
|
||||
sign = (upper >> 10) & 1;
|
||||
j1 = (lower >> 13) & 1;
|
||||
@ -1241,7 +1241,7 @@ static Elf_Addr addend_mips_rel(uint32_t *location, unsigned int r_type)
|
||||
{
|
||||
uint32_t inst;
|
||||
|
||||
inst = TO_NATIVE(*location);
|
||||
inst = get_unaligned_native(location);
|
||||
switch (r_type) {
|
||||
case R_MIPS_LO16:
|
||||
return inst & 0xffff;
|
||||
|
@ -65,6 +65,20 @@
|
||||
#define TO_NATIVE(x) \
|
||||
(target_is_big_endian == host_is_big_endian ? x : bswap(x))
|
||||
|
||||
#define __get_unaligned_t(type, ptr) ({ \
|
||||
const struct { type x; } __attribute__((__packed__)) *__pptr = \
|
||||
(typeof(__pptr))(ptr); \
|
||||
__pptr->x; \
|
||||
})
|
||||
|
||||
#define get_unaligned(ptr) __get_unaligned_t(typeof(*(ptr)), (ptr))
|
||||
|
||||
#define get_unaligned_native(ptr) \
|
||||
({ \
|
||||
typeof(*(ptr)) _val = get_unaligned(ptr); \
|
||||
TO_NATIVE(_val); \
|
||||
})
|
||||
|
||||
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
|
||||
|
||||
#define strstarts(str, prefix) (strncmp(str, prefix, strlen(prefix)) == 0)
|
||||
|
@ -103,7 +103,7 @@ _package-headers() {
|
||||
|
||||
_package-api-headers() {
|
||||
pkgdesc="Kernel headers sanitized for use in userspace"
|
||||
provides=(linux-api-headers)
|
||||
provides=(linux-api-headers="${pkgver}")
|
||||
conflicts=(linux-api-headers)
|
||||
|
||||
_prologue
|
||||
|
Loading…
x
Reference in New Issue
Block a user