[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 1/4] xz: use initconst for hypervisor build



Or else clang adds a .init.rodata.cst8 section to the resulting object
file, which is not handled by the Xen linker script and can end up
before the text section which contains the headers, thus resulting in
a not usable binary.

Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Cc: George Dunlap <George.Dunlap@xxxxxxxxxxxxx>
Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Cc: Jan Beulich <jbeulich@xxxxxxxx>
Cc: Julien Grall <julien.grall@xxxxxxx>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>
Cc: Tim Deegan <tim@xxxxxxx>
Cc: Wei Liu <wl@xxxxxxx>
---
 xen/common/decompress.h    | 2 ++
 xen/common/xz/dec_bcj.c    | 6 +++---
 xen/common/xz/dec_stream.c | 2 +-
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/xen/common/decompress.h b/xen/common/decompress.h
index 647b7b1e83..4a429bca12 100644
--- a/xen/common/decompress.h
+++ b/xen/common/decompress.h
@@ -10,6 +10,7 @@
 #define STATIC
 #define INIT __init
 #define INITDATA __initdata
+#define INITCONST __initconst
 
 #define malloc xmalloc_bytes
 #define free xfree
@@ -22,6 +23,7 @@
 #define STATIC static
 #define INIT
 #define INITDATA
+#define INITCONST
 
 #define large_malloc malloc
 #define large_free free
diff --git a/xen/common/xz/dec_bcj.c b/xen/common/xz/dec_bcj.c
index 86c1192199..0a9a45de2b 100644
--- a/xen/common/xz/dec_bcj.c
+++ b/xen/common/xz/dec_bcj.c
@@ -87,10 +87,10 @@ static inline int INIT bcj_x86_test_msbyte(uint8_t b)
 
 static size_t INIT bcj_x86(struct xz_dec_bcj *s, uint8_t *buf, size_t size)
 {
-       static const bool_t mask_to_allowed_status[8]
+       static const bool_t INITCONST mask_to_allowed_status[8]
                = { true, true, true, false, true, false, false, false };
 
-       static const uint8_t mask_to_bit_num[8] = { 0, 1, 2, 2, 3, 3, 3, 3 };
+       static const uint8_t INITCONST mask_to_bit_num[8] = { 0, 1, 2, 2, 3, 3, 
3, 3 };
 
        size_t i;
        size_t prev_pos = (size_t)-1;
@@ -180,7 +180,7 @@ static size_t INIT bcj_powerpc(struct xz_dec_bcj *s, 
uint8_t *buf, size_t size)
 #ifdef XZ_DEC_IA64
 static size_t INIT bcj_ia64(struct xz_dec_bcj *s, uint8_t *buf, size_t size)
 {
-       static const uint8_t branch_table[32] = {
+       static const uint8_t INITCONST branch_table[32] = {
                0, 0, 0, 0, 0, 0, 0, 0,
                0, 0, 0, 0, 0, 0, 0, 0,
                4, 4, 6, 6, 0, 0, 7, 7,
diff --git a/xen/common/xz/dec_stream.c b/xen/common/xz/dec_stream.c
index b8b566307c..61eb2ffb55 100644
--- a/xen/common/xz/dec_stream.c
+++ b/xen/common/xz/dec_stream.c
@@ -138,7 +138,7 @@ struct xz_dec {
 
 #ifdef XZ_DEC_ANY_CHECK
 /* Sizes of the Check field with different Check IDs */
-static const uint8_t check_sizes[16] = {
+static const uint8_t INITCONST check_sizes[16] = {
        0,
        4, 4, 4,
        8, 8, 8,
-- 
2.20.1 (Apple Git-117)


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.