Skip to contentSkip to conversation

uml: make CONFIG_STATIC_LINK actually static

PATCH Superseded Brendan Higgins 4 participants 6 messages Dec 10, 2019 – Jan 23, 2020 User-mode Linux (UML)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 uml: make CONFIG_STATIC_LINK actually static

Currently, CONFIG_STATIC_LINK can be enabled with options which cannot be statically linked, namely UML_NET_VECTOR, UML_NET_VDE, and UML_NET_PCAP; this is because glibc tries to load NSS which does not support being statically linked. So make CONFIG_STATIC_LINK depend on !UML_NET_VECTOR && !UML_NET_VDE && !UML_NET_PCAP.

---
 arch/um/Kconfig | 4 ++++
 1 file changed, 4 insertions(+)
arch/um/Kconfig +4 -0
index 2a6d04fcb3e91..1ddc8745123f2 100644
@@ -63,6 +63,7 @@ source "arch/$(HEADER_ARCH)/um/Kconfig"
 
 config STATIC_LINK
 	bool "Force a static link"
+	depends on !UML_NET_VECTOR && !UML_NET_VDE && !UML_NET_PCAP
 	default n
 	help
 	  This option gives you the ability to force a static link of UML.
@@ -72,6 +73,9 @@ config STATIC_LINK
 	  Additionally, this option enables using higher memory spaces (up to
 	  2.75G) for UML.
 
+	  NOTE: This option is incompatible with some networking features which
+	  depend on features that require being dynamically loaded (like NSS).
+
 config LD_SCRIPT_STATIC
 	bool
 	default y
Signature · 7 lines
2.24.0.525.g8f36a354ae-goog


_______________________________________________
linux-um mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-um
#1 lore raw

Hi Brendan,

Quoted 17 lines · Brendan Higgins

Currently, CONFIG_STATIC_LINK can be enabled with options which cannot be statically linked, namely UML_NET_VECTOR, UML_NET_VDE, and UML_NET_PCAP; this is because glibc tries to load NSS which does not support being statically linked. So make CONFIG_STATIC_LINK depend on !UML_NET_VECTOR && !UML_NET_VDE && !UML_NET_PCAP.

---
 arch/um/Kconfig | 4 ++++
 1 file changed, 4 insertions(+)
arch/um/Kconfig +0 -0
index 2a6d04fcb3e91..1ddc8745123f2 100644

arch/um/Kconfig source "arch/$(HEADER_ARCH)/um/Kconfig" · line 66

Quoted 4 lines
arch/um/Kconfig +1 -0
@@ -63,6 +63,7 @@ source "arch/$(HEADER_ARCH)/um/Kconfig"
 
 config STATIC_LINK
        bool "Force a static link"
+       depends on !UML_NET_VECTOR && !UML_NET_VDE && !UML_NET_PCAP

"depends on !FORBID_STATIC_LINK"?

Then all the drivers that are incompatible with static linking can just select FORBID_STATIC_LINK in their own Kconfig block.

Quoted 14 lines
arch/um/Kconfig +3 -1
        default n
        help
          This option gives you the ability to force a static link of UML.
@@ -72,6 +73,9 @@ config STATIC_LINK
          Additionally, this option enables using higher memory spaces (up to
          2.75G) for UML.
 
+         NOTE: This option is incompatible with some networking features which
+         depend on features that require being dynamically loaded (like NSS).
+
 config LD_SCRIPT_STATIC
        bool
        default y
--
Quoted 1 line

2.24.0.525.g8f36a354ae-goog

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
#2 lore raw
Quoted 23 lines · Geert Uytterhoeven

Hi Brendan,

Quoted 18 lines · Brendan Higgins

Currently, CONFIG_STATIC_LINK can be enabled with options which cannot be statically linked, namely UML_NET_VECTOR, UML_NET_VDE, and UML_NET_PCAP; this is because glibc tries to load NSS which does not support being statically linked. So make CONFIG_STATIC_LINK depend on !UML_NET_VECTOR && !UML_NET_VDE && !UML_NET_PCAP.

---
 arch/um/Kconfig | 4 ++++
 1 file changed, 4 insertions(+)
arch/um/Kconfig +0 -0
index 2a6d04fcb3e91..1ddc8745123f2 100644
@@ -63,6 +63,7 @@ source "arch/$(HEADER_ARCH)/um/Kconfig"
 
Quoted 8 lines

arch/um/Kconfig source "arch/$(HEADER_ARCH)/um/Kconfig" · line 66

Quoted 3 lines
arch/um/Kconfig +1 -0
 config STATIC_LINK
        bool "Force a static link"
+       depends on !UML_NET_VECTOR && !UML_NET_VDE && !UML_NET_PCAP

"depends on !FORBID_STATIC_LINK"?

Then all the drivers that are incompatible with static linking can just select FORBID_STATIC_LINK in their own Kconfig block.

Makes sense!

Signature · 2 lines
Thanks,
//richard
#3 lore raw

I agree that at least the UML_NET_VECTOR is not compatible with static linking at the moment, but I was running a statically linked UML with PCAP back in December.
I was having no problems, but I don't remember if I was using PCAP itself...
I seem to remember a minor patch I did to fix a symbol conflict but nothing of note. I have not played around with UML_NET_VECTOR since I run the normal networking. I did not find any config info when googling the vector version so I just ignored it.

Enjoy.

Jim McMechan
________________________________
From: linux-um <[email protected]> on behalf of Richard Weinberger <[email protected]>
Sent: Sunday, January 19, 2020 1:40 PM
To: Geert Uytterhoeven <[email protected]>
Cc: Johannes Berg <[email protected]>; Richard Weinberger <[email protected]>; Jeff Dike <[email protected]>; linux-um <[email protected]>; Linux Kernel Mailing List <[email protected]>; [email protected] <[email protected]>; Brendan Higgins <[email protected]>; Anton Ivanov <[email protected]>
Subject: Re: [PATCH v1] uml: make CONFIG_STATIC_LINK actually static

Quoted 23 lines · Geert Uytterhoeven

Hi Brendan,

Quoted 18 lines · Brendan Higgins

Currently, CONFIG_STATIC_LINK can be enabled with options which cannot be statically linked, namely UML_NET_VECTOR, UML_NET_VDE, and UML_NET_PCAP; this is because glibc tries to load NSS which does not support being statically linked. So make CONFIG_STATIC_LINK depend on !UML_NET_VECTOR && !UML_NET_VDE && !UML_NET_PCAP.

---
 arch/um/Kconfig | 4 ++++
 1 file changed, 4 insertions(+)
arch/um/Kconfig +0 -0
index 2a6d04fcb3e91..1ddc8745123f2 100644
@@ -63,6 +63,7 @@ source "arch/$(HEADER_ARCH)/um/Kconfig"
 
Quoted 8 lines

arch/um/Kconfig source "arch/$(HEADER_ARCH)/um/Kconfig" · line 66

Quoted 3 lines
arch/um/Kconfig +1 -0
 config STATIC_LINK
        bool "Force a static link"
+       depends on !UML_NET_VECTOR && !UML_NET_VDE && !UML_NET_PCAP

"depends on !FORBID_STATIC_LINK"?

Then all the drivers that are incompatible with static linking can just select FORBID_STATIC_LINK in their own Kconfig block.

Makes sense!

--
Thanks,
//richard

_______________________________________________
linux-um mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-um

#4 lore raw
In reply to Richard Weinberger

Resent for the mailing list since my webmail decided to try to send html...

I agree that at least the UML_NET_VECTOR is not compatible with static linking at the moment, but I was running a statically linked UML with PCAP back in December.
I was having no problems, but I don't remember if I was using PCAP itself...
I seem to remember a minor patch I did to fix a symbol conflict but nothing of note. I have not played around with UML_NET_VECTOR since I run the normal networking. And I did not find any config info with a quick googling the vector version so I just ignored it.

Enjoy.

Jim McMechan

_______________________________________________
linux-um mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-um

#5 lore raw
Quoted 6 lines · James McMechan

Resent for the mailing list since my webmail decided to try to send html...

I agree that at least the UML_NET_VECTOR is not compatible with static linking at the moment, but I was running a statically linked UML with PCAP back in December.
I was having no problems, but I don't remember if I was using PCAP itself...

I was just going off of what Anton and Johannes said in regard to PCAP; it seems to have deviated from the libpcap library, so I have been unable to test it:

http://lists.infradead.org/pipermail/linux-um/2019-December/002548.html

Anton, do you have the fix for PCAP out yet?

Quoted 3 lines

I seem to remember a minor patch I did to fix a symbol conflict but nothing of note. I have not played around with UML_NET_VECTOR since I run the normal networking. And I did not find any config info with a quick googling the vector version so I just ignored it.

Nevertheless, VDE still causes the linker to complain.

Cheers