[PATCH] xen/gunzip: Fix build with clang after 33bc2a8495f7

Julien Grall posted 1 patch 1 week ago
Failed in applying to current master (apply log)
xen/common/inflate.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

[PATCH] xen/gunzip: Fix build with clang after 33bc2a8495f7

Posted by Julien Grall 1 week ago
From: Julien Grall <jgrall@amazon.com>

The compilation will fail when building Xen with clang and
CONFIG_DEBUG=y:

make[4]: Leaving directory '/oss/xen/xen/common/libelf'
  INIT_O  gunzip.init.o
Error: size of gunzip.o:.text is 0x00000019

This is because the function init_allocator() will not be inlined
and is not part of the init section.

Fix it by marking init_allocator() with INIT.

Fixes: 33bc2a8495f7 ("xen/gunzip: Allow perform_gunzip() to be called multiple times")
Reported-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/inflate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/common/inflate.c b/xen/common/inflate.c
index d8c28a3e9593..c593b94d481e 100644
--- a/xen/common/inflate.c
+++ b/xen/common/inflate.c
@@ -238,7 +238,7 @@ STATIC const ush mask_bits[] = {
 static unsigned long INITDATA malloc_ptr;
 static int INITDATA malloc_count;
 
-static void init_allocator(void)
+static void INIT init_allocator(void)
 {
     malloc_ptr = free_mem_ptr;
     malloc_count = 0;
-- 
2.17.1


Re: [PATCH] xen/gunzip: Fix build with clang after 33bc2a8495f7

Posted by Jan Beulich 6 days, 16 hours ago
On 07.04.2021 20:27, Julien Grall wrote:
> From: Julien Grall <jgrall@amazon.com>
> 
> The compilation will fail when building Xen with clang and
> CONFIG_DEBUG=y:
> 
> make[4]: Leaving directory '/oss/xen/xen/common/libelf'
>   INIT_O  gunzip.init.o
> Error: size of gunzip.o:.text is 0x00000019
> 
> This is because the function init_allocator() will not be inlined
> and is not part of the init section.
> 
> Fix it by marking init_allocator() with INIT.
> 
> Fixes: 33bc2a8495f7 ("xen/gunzip: Allow perform_gunzip() to be called multiple times")
> Reported-by: Jan Beulich <jbeulich@suse.com>
> Signed-off-by: Julien Grall <jgrall@amazon.com>

Acked-by: Jan Beulich <jbeulich@suse.com>

Re: [PATCH] xen/gunzip: Fix build with clang after 33bc2a8495f7

Posted by Julien Grall 5 days, 13 hours ago
Hi Jan,

On 08/04/2021 07:17, Jan Beulich wrote:
> On 07.04.2021 20:27, Julien Grall wrote:
>> From: Julien Grall <jgrall@amazon.com>
>>
>> The compilation will fail when building Xen with clang and
>> CONFIG_DEBUG=y:
>>
>> make[4]: Leaving directory '/oss/xen/xen/common/libelf'
>>    INIT_O  gunzip.init.o
>> Error: size of gunzip.o:.text is 0x00000019
>>
>> This is because the function init_allocator() will not be inlined
>> and is not part of the init section.
>>
>> Fix it by marking init_allocator() with INIT.
>>
>> Fixes: 33bc2a8495f7 ("xen/gunzip: Allow perform_gunzip() to be called multiple times")
>> Reported-by: Jan Beulich <jbeulich@suse.com>
>> Signed-off-by: Julien Grall <jgrall@amazon.com>
> 
> Acked-by: Jan Beulich <jbeulich@suse.com>

Thanks! I have committed the patch.

Cheers,

-- 
Julien Grall