All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] package/btrfs-progs: fix build with kernel < 5.11
@ 2022-01-13 18:05 Fabrice Fontaine
  2022-01-13 19:37 ` Thomas Petazzoni
  0 siblings, 1 reply; 2+ messages in thread
From: Fabrice Fontaine @ 2022-01-13 18:05 UTC (permalink / raw)
  To: buildroot; +Cc: Fabrice Fontaine

Fix the following build failure with kernel < 5.11 raised since commit
f363bc2958812539cf248f6cf44fe519445adf7a:

/tmp/instance-1/output-1/host/opt/ext-toolchain/bin/../lib/gcc/powerpc64-buildroot-linux-gnu/9.3.0/../../../../powerpc64-buildroot-linux-gnu/bin/ld: kernel-shared/volumes.o: in function `create_chunk':
volumes.c:(.text+0x17f8): undefined reference to `__ALIGN_KERNEL'

Fixes:
 - http://autobuild.buildroot.org/results/b630dbd078656a974c6ac9645b2e87279ef2adc0

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
 ...ocal-definition-for-alignment-macros.patch | 46 +++++++++++++++++++
 1 file changed, 46 insertions(+)
 create mode 100644 package/btrfs-progs/0003-btrfs-progs-kerncompat-add-local-definition-for-alignment-macros.patch

diff --git a/package/btrfs-progs/0003-btrfs-progs-kerncompat-add-local-definition-for-alignment-macros.patch b/package/btrfs-progs/0003-btrfs-progs-kerncompat-add-local-definition-for-alignment-macros.patch
new file mode 100644
index 0000000000..86c63edc30
--- /dev/null
+++ b/package/btrfs-progs/0003-btrfs-progs-kerncompat-add-local-definition-for-alignment-macros.patch
@@ -0,0 +1,46 @@
+From b0cfe12c4d4b8b4ef335cdf4ddefcbdcd1b70d58 Mon Sep 17 00:00:00 2001
+From: David Sterba <dsterba@suse.com>
+Date: Thu, 13 Jan 2022 14:47:08 +0100
+Subject: [PATCH] btrfs-progs: kerncompat: add local definition for alignment
+ macros
+
+There's still problem left with compilation on musl and kernel < 5.11,
+because __ALIGN_KERNEL is not defined anymore:
+
+../bin/ld: kernel-shared/volumes.o: in function `create_chunk':
+volumes.c:(.text+0x17f8): undefined reference to `__ALIGN_KERNEL'
+
+Due to the entangled includes and unconditional definition of
+__ALIGN_KERNEL, we can't use #ifdef in kerncompat.h to define it
+eventually (as kerncompat.h is the first include). Instead add local
+definitions of the macros and rename them to avoid name clashes.
+
+Pull-request: #433
+Signed-off-by: David Sterba <dsterba@suse.com>
+[Retrieved from:
+https://github.com/kdave/btrfs-progs/commit/b0cfe12c4d4b8b4ef335cdf4ddefcbdcd1b70d58]
+Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+---
+ kerncompat.h | 9 ++++++++-
+ 1 file changed, 8 insertions(+), 1 deletion(-)
+
+diff --git a/kerncompat.h b/kerncompat.h
+index 6ca1526e2..f0a6e196e 100644
+--- a/kerncompat.h
++++ b/kerncompat.h
+@@ -359,7 +359,14 @@ do {					\
+ 
+ /* Alignment check */
+ #define IS_ALIGNED(x, a)                (((x) & ((typeof(x))(a) - 1)) == 0)
+-#define ALIGN(x, a)		__ALIGN_KERNEL((x), (a))
++
++/*
++ * Alignment, copied and renamed from /usr/include/linux/const.h to work around
++ * issues caused by moving the definition in 5.12
++ */
++#define __ALIGN_KERNEL__(x, a)		__ALIGN_KERNEL_MASK__(x, (typeof(x))(a) - 1)
++#define __ALIGN_KERNEL_MASK__(x, mask)	(((x) + (mask)) & ~(mask))
++#define ALIGN(x, a)		__ALIGN_KERNEL__((x), (a))
+ 
+ static inline int is_power_of_2(unsigned long n)
+ {
-- 
2.34.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Buildroot] [PATCH 1/1] package/btrfs-progs: fix build with kernel < 5.11
  2022-01-13 18:05 [Buildroot] [PATCH 1/1] package/btrfs-progs: fix build with kernel < 5.11 Fabrice Fontaine
@ 2022-01-13 19:37 ` Thomas Petazzoni
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Petazzoni @ 2022-01-13 19:37 UTC (permalink / raw)
  To: Fabrice Fontaine; +Cc: buildroot

On Thu, 13 Jan 2022 19:05:18 +0100
Fabrice Fontaine <fontaine.fabrice@gmail.com> wrote:

> Fix the following build failure with kernel < 5.11 raised since commit
> f363bc2958812539cf248f6cf44fe519445adf7a:
> 
> /tmp/instance-1/output-1/host/opt/ext-toolchain/bin/../lib/gcc/powerpc64-buildroot-linux-gnu/9.3.0/../../../../powerpc64-buildroot-linux-gnu/bin/ld: kernel-shared/volumes.o: in function `create_chunk':
> volumes.c:(.text+0x17f8): undefined reference to `__ALIGN_KERNEL'
> 
> Fixes:
>  - http://autobuild.buildroot.org/results/b630dbd078656a974c6ac9645b2e87279ef2adc0
> 
> Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> ---
>  ...ocal-definition-for-alignment-macros.patch | 46 +++++++++++++++++++
>  1 file changed, 46 insertions(+)
>  create mode 100644 package/btrfs-progs/0003-btrfs-progs-kerncompat-add-local-definition-for-alignment-macros.patch

Applied to master, thanks.

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-01-13 19:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-13 18:05 [Buildroot] [PATCH 1/1] package/btrfs-progs: fix build with kernel < 5.11 Fabrice Fontaine
2022-01-13 19:37 ` Thomas Petazzoni

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.