[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 3/6] xen/efi: Make efi-boot.h compile with -Wwrite-strings
- To: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
- Date: Mon, 20 Nov 2023 22:49:09 +0000
- Authentication-results: esa3.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
- Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Jan Beulich <JBeulich@xxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Roberto Bagnara <roberto.bagnara@xxxxxxxxxxx>, Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>
- Delivery-date: Mon, 20 Nov 2023 22:49:30 +0000
- Ironport-data: A9a23:Ddb7WKvnI+hiN0IbEWF3bfPExOfnVKpeMUV32f8akzHdYApBsoF/q tZmKWmFOanYYDOkcth+YIm2oUMA7MXQnd41HVRvqHtkEykV+JbJXdiXEBz9bniYRiHhoOCLz O1FM4Wdc5pkJpP4jk3wWlQ0hSAkjclkfpKlVaicfHg3HFc4IMsYoUoLs/YjhYJ1isSODQqIu Nfjy+XSI1bg0DNvWo4uw/vrRChH4rKq5Fv0gnRkPaoQ5QaEzyFPZH4iDfrZw0XQE9E88tGSH 44v/JnhlkvF8hEkDM+Sk7qTWiXmlZaLYGBiIlIPM0STqkAqSh4ai87XB9JFAatjsB2bnsgZ9 Tl4ncfYpTHFnEH7sL91vxFwS0mSNEDdkVPNCSDXXce7lyUqf5ZwqhnH4Y5f0YAwo45K7W9yG fMwGQIgTzKvq+2M2LOhZfZHithkK+y7I9ZK0p1g5Wmx4fcORJnCR+PB5MNC3Sd2jcdLdRrcT 5NHM3w1Nk2GOkAefAhPYH49tL7Aan3XWjtUsl+K44Ew5HDe1ldZ27nxKtvFPNeNQK25m27B/ DKcpjSiWEpy2Nq36GXd0U2KnNTzgQjCXagzMJaF0NtgjwjGroAUIEJPDgbqyRWjsWauVtQaJ 0EK9y4Gqakp6FftXtT7Rwe/onOPolgbQdU4O88Q5RyJy6HUyx2EHWVCRTlEAPQ9r9M/TzEu0 l6PnvvqCCZpvbnTTmiSnp+LqRuiNC5TKnUNDQcGUA8E7t/LsIw1yBXVQb5LLqmxidHkHCDq9 BqDpiM+mrY7gNYC0uOw+lWvqzihvITTRwg5oADeRHu47xhRbZSgIYev7DDz6PdLLI+dCF6br nUAs8Gb4KYFCpTlvDaKSugXALbv7f+KNjTGiHZlApY6+jKivXWkeOh45jB1I0NgdNgJZSXoZ k77sx5e/5JVMz2haqofXm6qI510l+66T42jD62FKIUWCnRsSOOZ1BBcSG+y80ziqlAti44gE puHNsGJXWlPXMyL0wGKq/chPa4Dn39mnT+CG8qikXyaPayiiGl5oIrp0WdijchjtctoWC2Pr 75i2zKikn2zqtHWbCjN6pI0JlsXN3U9Dp2eg5UILrbeelc8RDh4VKG5LVYdl2pNxfw9egDgp CnVZ6Ol4ACn2S2vxfuiNhiPl48Drb4g9ClmbETAzH6j2mQ5YJbH0UvsX8JfQFXTz8Q6laQcZ 6BcK6297gFnFmyvF8I1McOs8+SPtX2D2WqzAsZSSGFuI8c9H1WRpY6Mk8mG3HBmMxdbfPAW+ 9WIvj43i7JaL+i+JK46sM6S8m4=
- Ironport-hdrordr: A9a23:Qg0TUKwbsyisPe6XsK9jKrPwFL1zdoMgy1knxilNoRw8SKKlfq eV7Y0mPH7P+VAssR4b+exoVJPtfZqYz+8R3WBzB8bEYOCFghrKEGgK1+KLqFeMJ8S9zJ846U 4JSdkHNDSaNzlHZKjBjzVQa+xQouW6zA==
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
GCC complains:
In file included from arch/arm/efi/boot.c:700:
arch/arm/efi/efi-boot.h: In function 'efi_arch_handle_cmdline':
arch/arm/efi/efi-boot.h:482:16: error: assignment discards 'const' qualifier
from pointer target type [-Werror=discarded-qualifiers]
482 | name.s = "xen";
| ^
There's no easy option. .rodata is really read-only, so the fact Xen doesn't
crash means these strings aren't written to.
Lie to the compiler using a union.
Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
CC: Jan Beulich <JBeulich@xxxxxxxx>
CC: Roger Pau Monné <roger.pau@xxxxxxxxxx>
CC: Wei Liu <wl@xxxxxxx>
CC: Stefano Stabellini <sstabellini@xxxxxxxxxx>
CC: Julien Grall <julien@xxxxxxx>
CC: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
CC: Bertrand Marquis <bertrand.marquis@xxxxxxx>
CC: Michal Orzel <michal.orzel@xxxxxxx>
CC: Roberto Bagnara <roberto.bagnara@xxxxxxxxxxx>
CC: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>
I *really* don't like this, but it's the only suggestion given.
---
xen/arch/arm/efi/efi-boot.h | 2 +-
xen/arch/x86/efi/efi-boot.h | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/xen/arch/arm/efi/efi-boot.h b/xen/arch/arm/efi/efi-boot.h
index 1c3640bb65fd..c26bf18b68b9 100644
--- a/xen/arch/arm/efi/efi-boot.h
+++ b/xen/arch/arm/efi/efi-boot.h
@@ -479,7 +479,7 @@ static void __init efi_arch_handle_cmdline(CHAR16
*image_name,
w2s(&name);
}
else
- name.s = "xen";
+ name.cs = "xen"; /* TODO, find a better way of doing this. */
prop_len = 0;
prop_len += snprintf(buf + prop_len,
diff --git a/xen/arch/x86/efi/efi-boot.h b/xen/arch/x86/efi/efi-boot.h
index eebc54180bf7..e2d256e0517b 100644
--- a/xen/arch/x86/efi/efi-boot.h
+++ b/xen/arch/x86/efi/efi-boot.h
@@ -324,7 +324,8 @@ static void __init efi_arch_handle_cmdline(CHAR16
*image_name,
w2s(&name);
}
else
- name.s = "xen";
+ name.cs = "xen"; /* TODO, find a better way of doing this. */
+
place_string(&mbi.cmdline, name.s);
if ( mbi.cmdline )
--
2.30.2
|