linux-um.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] um: Make the definition of cpu_data more compatible
  2023-01-13  4:49 [PATCH 0/4] um: Various build fixes for allyesconfig Peter Foley
@ 2023-01-13  4:49 ` Peter Foley
  2023-01-13  4:49 ` [PATCH 2/4] um: Avoid pcap multiple definition errors Peter Foley
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Peter Foley @ 2023-01-13  4:49 UTC (permalink / raw)
  To: Richard Weinberger, Anton Ivanov, Johannes Berg
  Cc: linux-um, linux-kernel, Peter Foley

Match the x86 implementation to improve build errors.
Noticed when building allyesconfig.

e.g.
../arch/um/include/asm/processor-generic.h:94:19: error: called object is not a function or function pointer
   94 | #define cpu_data (&boot_cpu_data)
      |                  ~^~~~~~~~~~~~~~~
../drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_topology.c:2157:16: note: in expansion of macro ‘cpu_data’
 2157 |         return cpu_data(first_cpu_of_numa_node).apicid;

Signed-off-by: Peter Foley <pefoley2@pefoley.com>
---
 arch/um/include/asm/processor-generic.h | 2 +-
 arch/um/kernel/um_arch.c                | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/um/include/asm/processor-generic.h b/arch/um/include/asm/processor-generic.h
index bb5f06480da9..7414154b8e9a 100644
--- a/arch/um/include/asm/processor-generic.h
+++ b/arch/um/include/asm/processor-generic.h
@@ -91,7 +91,7 @@ struct cpuinfo_um {
 
 extern struct cpuinfo_um boot_cpu_data;
 
-#define cpu_data (&boot_cpu_data)
+#define cpu_data(cpu)    boot_cpu_data
 #define current_cpu_data boot_cpu_data
 #define cache_line_size()	(boot_cpu_data.cache_alignment)
 
diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c
index 786b44dc20c9..8dcda617b8bf 100644
--- a/arch/um/kernel/um_arch.c
+++ b/arch/um/kernel/um_arch.c
@@ -96,7 +96,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
 
 static void *c_start(struct seq_file *m, loff_t *pos)
 {
-	return *pos < nr_cpu_ids ? cpu_data + *pos : NULL;
+	return *pos < nr_cpu_ids ? &boot_cpu_data + *pos : NULL;
 }
 
 static void *c_next(struct seq_file *m, void *v, loff_t *pos)

-- 
2.39.0

_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um

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

* [PATCH 0/4] um: Various build fixes for allyesconfig
@ 2023-01-13  4:49 Peter Foley
  2023-01-13  4:49 ` [PATCH 1/4] um: Make the definition of cpu_data more compatible Peter Foley
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Peter Foley @ 2023-01-13  4:49 UTC (permalink / raw)
  To: Richard Weinberger, Anton Ivanov, Johannes Berg
  Cc: linux-um, linux-kernel, Peter Foley

Fix some build failures I ran across when trying to build an allyesconfig
kernel for ARCH=um.

To: Richard Weinberger <richard@nod.at>
To: Anton Ivanov <anton.ivanov@cambridgegreys.com>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: linux-um@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Peter Foley <pefoley2@pefoley.com>

---
Peter Foley (4):
      um: Make the definition of cpu_data more compatible
      um: Avoid pcap multiple definition errors
      um: Prevent building modules incompatible with MODVERSIONS
      um: Use CFLAGS_vmlinux

 arch/um/Makefile                        | 3 +--
 arch/um/drivers/Kconfig                 | 2 ++
 arch/um/drivers/pcap_kern.c             | 4 ++--
 arch/um/include/asm/processor-generic.h | 2 +-
 arch/um/kernel/um_arch.c                | 2 +-
 5 files changed, 7 insertions(+), 6 deletions(-)
---
base-commit: d9fc1511728c15df49ff18e49a494d00f78b7cd4
change-id: 20230112-um-3f06b1bbbbb0

Best regards,
-- 
Peter Foley <pefoley2@pefoley.com>

_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um

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

* [PATCH 2/4] um: Avoid pcap multiple definition errors
  2023-01-13  4:49 [PATCH 0/4] um: Various build fixes for allyesconfig Peter Foley
  2023-01-13  4:49 ` [PATCH 1/4] um: Make the definition of cpu_data more compatible Peter Foley
@ 2023-01-13  4:49 ` Peter Foley
  2023-01-13  4:49 ` [PATCH 3/4] um: Prevent building modules incompatible with MODVERSIONS Peter Foley
  2023-01-13  4:49 ` [PATCH 4/4] um: Use CFLAGS_vmlinux Peter Foley
  3 siblings, 0 replies; 6+ messages in thread
From: Peter Foley @ 2023-01-13  4:49 UTC (permalink / raw)
  To: Richard Weinberger, Anton Ivanov, Johannes Berg
  Cc: linux-um, linux-kernel, Peter Foley

Change the function name in pcap_kern to avoid conflicting with
libpcap.a.

e.g.
ld: /usr/lib/gcc/x86_64-pc-linux-gnu/12/../../../../lib64/libpcap.a(pcap.o): in function `pcap_init':
(.text+0x7f0): multiple definition of `pcap_init'; arch/um/drivers/pcap_kern.o:pcap_kern.c:(.text.unlikely+0x0): first defined here
---
 arch/um/drivers/pcap_kern.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/um/drivers/pcap_kern.c b/arch/um/drivers/pcap_kern.c
index cfe4cb17694c..25ee2c97ca21 100644
--- a/arch/um/drivers/pcap_kern.c
+++ b/arch/um/drivers/pcap_kern.c
@@ -15,7 +15,7 @@ struct pcap_init {
 	char *filter;
 };
 
-void pcap_init(struct net_device *dev, void *data)
+void pcap_init_kern(struct net_device *dev, void *data)
 {
 	struct uml_net_private *pri;
 	struct pcap_data *ppri;
@@ -44,7 +44,7 @@ static int pcap_write(int fd, struct sk_buff *skb, struct uml_net_private *lp)
 }
 
 static const struct net_kern_info pcap_kern_info = {
-	.init			= pcap_init,
+	.init			= pcap_init_kern,
 	.protocol		= eth_protocol,
 	.read			= pcap_read,
 	.write			= pcap_write,

-- 
2.39.0

_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um

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

* [PATCH 3/4] um: Prevent building modules incompatible with MODVERSIONS
  2023-01-13  4:49 [PATCH 0/4] um: Various build fixes for allyesconfig Peter Foley
  2023-01-13  4:49 ` [PATCH 1/4] um: Make the definition of cpu_data more compatible Peter Foley
  2023-01-13  4:49 ` [PATCH 2/4] um: Avoid pcap multiple definition errors Peter Foley
@ 2023-01-13  4:49 ` Peter Foley
  2023-01-13  4:49 ` [PATCH 4/4] um: Use CFLAGS_vmlinux Peter Foley
  3 siblings, 0 replies; 6+ messages in thread
From: Peter Foley @ 2023-01-13  4:49 UTC (permalink / raw)
  To: Richard Weinberger, Anton Ivanov, Johannes Berg
  Cc: linux-um, linux-kernel, Peter Foley

The manual ld invocation in arch/um/drivers doesn't play nicely with
genksyms. Given the problematic modules are deprecated anyway, just
prevent building them when using MODVERSIONS.

e.g.
MODPOST Module.symvers
arch/um/drivers/.pcap.o.cmd: No such file or directory
---
 arch/um/drivers/Kconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/um/drivers/Kconfig b/arch/um/drivers/Kconfig
index a4f0a19fbe14..36911b1fddcf 100644
--- a/arch/um/drivers/Kconfig
+++ b/arch/um/drivers/Kconfig
@@ -261,6 +261,7 @@ config UML_NET_VECTOR
 config UML_NET_VDE
 	bool "VDE transport (obsolete)"
 	depends on UML_NET
+	depends on !MODVERSIONS
 	select MAY_HAVE_RUNTIME_DEPS
 	help
 	  This User-Mode Linux network transport allows one or more running
@@ -309,6 +310,7 @@ config UML_NET_MCAST
 config UML_NET_PCAP
 	bool "pcap transport (obsolete)"
 	depends on UML_NET
+	depends on !MODVERSIONS
 	select MAY_HAVE_RUNTIME_DEPS
 	help
 	  The pcap transport makes a pcap packet stream on the host look

-- 
2.39.0

_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um

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

* [PATCH 4/4] um: Use CFLAGS_vmlinux
  2023-01-13  4:49 [PATCH 0/4] um: Various build fixes for allyesconfig Peter Foley
                   ` (2 preceding siblings ...)
  2023-01-13  4:49 ` [PATCH 3/4] um: Prevent building modules incompatible with MODVERSIONS Peter Foley
@ 2023-01-13  4:49 ` Peter Foley
  2023-01-13  6:43   ` David Gow
  3 siblings, 1 reply; 6+ messages in thread
From: Peter Foley @ 2023-01-13  4:49 UTC (permalink / raw)
  To: Richard Weinberger, Anton Ivanov, Johannes Berg
  Cc: linux-um, linux-kernel, Peter Foley

link-vmlinux.sh doesn't use LDFLAGS_vmlinux when linking the kernel for
UML. Move the LDFLAGS_EXESTACK options into CFLAGS_vmlinux so they're
actually respected.

e.g.
/usr/lib/gcc/x86_64-pc-linux-gnu/12/../../../../x86_64-pc-linux-gnu/bin/ld: warning: .tmp_vmlinux.kallsyms3.o: missing .note.GNU-stack section implies executable stack
/usr/lib/gcc/x86_64-pc-linux-gnu/12/../../../../x86_64-pc-linux-gnu/bin/ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
/usr/lib/gcc/x86_64-pc-linux-gnu/12/../../../../x86_64-pc-linux-gnu/bin/ld: warning: vmlinux has a LOAD segment with RWX permissions
---
 arch/um/Makefile | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/um/Makefile b/arch/um/Makefile
index f1d4d67157be..93dfb23bd263 100644
--- a/arch/um/Makefile
+++ b/arch/um/Makefile
@@ -139,11 +139,10 @@ ifeq ($(CONFIG_LD_IS_BFD),y)
 LDFLAGS_EXECSTACK += $(call ld-option,--no-warn-rwx-segments)
 endif
 
-LD_FLAGS_CMDLINE = $(foreach opt,$(KBUILD_LDFLAGS),-Wl,$(opt))
+LD_FLAGS_CMDLINE = $(foreach opt,$(KBUILD_LDFLAGS) $(LDFLAGS_EXECSTACK),-Wl,$(opt))
 
 # Used by link-vmlinux.sh which has special support for um link
 export CFLAGS_vmlinux := $(LINK-y) $(LINK_WRAPS) $(LD_FLAGS_CMDLINE)
-export LDFLAGS_vmlinux := $(LDFLAGS_EXECSTACK)
 
 # When cleaning we don't include .config, so we don't include
 # TT or skas makefiles and don't clean skas_ptregs.h.

-- 
2.39.0

_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um

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

* Re: [PATCH 4/4] um: Use CFLAGS_vmlinux
  2023-01-13  4:49 ` [PATCH 4/4] um: Use CFLAGS_vmlinux Peter Foley
@ 2023-01-13  6:43   ` David Gow
  0 siblings, 0 replies; 6+ messages in thread
From: David Gow @ 2023-01-13  6:43 UTC (permalink / raw)
  To: Peter Foley
  Cc: Richard Weinberger, Anton Ivanov, Johannes Berg, linux-um, linux-kernel


[-- Attachment #1.1: Type: text/plain, Size: 1878 bytes --]

On Fri, 13 Jan 2023 at 12:49, Peter Foley <pefoley2@pefoley.com> wrote:
>
> link-vmlinux.sh doesn't use LDFLAGS_vmlinux when linking the kernel for
> UML. Move the LDFLAGS_EXESTACK options into CFLAGS_vmlinux so they're
> actually respected.
>
> e.g.
> /usr/lib/gcc/x86_64-pc-linux-gnu/12/../../../../x86_64-pc-linux-gnu/bin/ld: warning: .tmp_vmlinux.kallsyms3.o: missing .note.GNU-stack section implies executable stack
> /usr/lib/gcc/x86_64-pc-linux-gnu/12/../../../../x86_64-pc-linux-gnu/bin/ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
> /usr/lib/gcc/x86_64-pc-linux-gnu/12/../../../../x86_64-pc-linux-gnu/bin/ld: warning: vmlinux has a LOAD segment with RWX permissions
> ---

Thanks very much for fixing this -- the LDFLAGS/CFLAGS fun here always
trips me up!

Reviewed-by: David Gow <davidgow@google.com>

Cheers,
-- David


>  arch/um/Makefile | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/arch/um/Makefile b/arch/um/Makefile
> index f1d4d67157be..93dfb23bd263 100644
> --- a/arch/um/Makefile
> +++ b/arch/um/Makefile
> @@ -139,11 +139,10 @@ ifeq ($(CONFIG_LD_IS_BFD),y)
>  LDFLAGS_EXECSTACK += $(call ld-option,--no-warn-rwx-segments)
>  endif
>
> -LD_FLAGS_CMDLINE = $(foreach opt,$(KBUILD_LDFLAGS),-Wl,$(opt))
> +LD_FLAGS_CMDLINE = $(foreach opt,$(KBUILD_LDFLAGS) $(LDFLAGS_EXECSTACK),-Wl,$(opt))
>
>  # Used by link-vmlinux.sh which has special support for um link
>  export CFLAGS_vmlinux := $(LINK-y) $(LINK_WRAPS) $(LD_FLAGS_CMDLINE)
> -export LDFLAGS_vmlinux := $(LDFLAGS_EXECSTACK)
>
>  # When cleaning we don't include .config, so we don't include
>  # TT or skas makefiles and don't clean skas_ptregs.h.
>
> --
> 2.39.0
>
> _______________________________________________
> linux-um mailing list
> linux-um@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-um

[-- Attachment #1.2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4003 bytes --]

[-- Attachment #2: Type: text/plain, Size: 152 bytes --]

_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um

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

end of thread, other threads:[~2023-01-13  6:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-13  4:49 [PATCH 0/4] um: Various build fixes for allyesconfig Peter Foley
2023-01-13  4:49 ` [PATCH 1/4] um: Make the definition of cpu_data more compatible Peter Foley
2023-01-13  4:49 ` [PATCH 2/4] um: Avoid pcap multiple definition errors Peter Foley
2023-01-13  4:49 ` [PATCH 3/4] um: Prevent building modules incompatible with MODVERSIONS Peter Foley
2023-01-13  4:49 ` [PATCH 4/4] um: Use CFLAGS_vmlinux Peter Foley
2023-01-13  6:43   ` David Gow

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).