um: allow static linking for non-glibc libc implementations
Subsystems (2)
v2 cover um: allow static linking for non-glibc libc implementations
This is a continuation of [1]. Since I was able to produce a working UML binary with UML_NET_VECTOR linked with musl with the changes included in the patches here. I was compiling on Arch Linux, so hopefully all the latest versions of the compiler, libraries and binutils.
I also tested allyesconfig with both musl and glibc. The compilation succeeds with both, however both binaries (glibc one being dynamically linked) segfault on start. This is probably of some incompatible config option/module being included and not related to musl/glibc.
[1]: https://patchwork.ozlabs.org/project/linux-um/patch/[email protected]/
Ignat Korchagin (3):
um/kconfig: introduce CC_CAN_LINK_STATIC_NO_RUNTIME_DEPS
um: some fixes to build UML with musl
um: allow static linking for non-glibc implementations
arch/um/Kconfig | 2 +- arch/um/drivers/Kconfig | 3 --- arch/um/drivers/daemon_user.c | 1 + arch/um/drivers/pcap_user.c | 12 ++++++------ arch/um/drivers/slip_user.c | 2 +- arch/um/drivers/vector_user.c | 4 +--- arch/um/os-Linux/util.c | 2 +- arch/x86/um/user-offsets.c | 2 +- init/Kconfig | 6 ++++++ scripts/cc-can-link.sh | 5 +++-- 10 files changed, 21 insertions(+), 18 deletions(-)
Signature · 7 lines
2.20.1 _______________________________________________ linux-um mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-um
PATCH v2 1/3 um/kconfig: introduce CC_CAN_LINK_STATIC_NO_RUNTIME_DEPS
For statically linked UML build it is important to take into account the standard C-library implementation. Some implementations, notably glibc have
caveats: even when linked statically, the final program might require some runtime dependencies, if certain functions are used within the code.
Consider the following program:
int main(void)
{
getpwent();
return 0;
}Compiling this program and linking statically with glibc produces the following warning from the linker:/usr/sbin/ld: /tmp/ccuthw1o.o: in function `main':
test.c:(.text+0x5): warning: Using 'getpwent' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
We will use the flag to detect such C-library implementation build time and possibly disable static linking for UML to avoid producing a binary with unexpected behaviour and dependencies.
--- init/Kconfig | 6 ++++++ scripts/cc-can-link.sh | 5 +++-- 2 files changed, 9 insertions(+), 2 deletions(-)
init/Kconfig +6 -0
@@ -57,6 +57,12 @@ config CC_CAN_LINK_STATIC default $(success,$(srctree)/scripts/cc-can-link.sh $(CC) -static $(m64-flag)) if 64BIT default $(success,$(srctree)/scripts/cc-can-link.sh $(CC) -static $(m32-flag)) +config CC_CAN_LINK_STATIC_NO_RUNTIME_DEPS + bool + depends on UML && CC_CAN_LINK_STATIC + default $(success,$(srctree)/scripts/cc-can-link.sh $(CC) -static -Xlinker --fatal-warnings $(m64-flag)) if 64BIT + default $(success,$(srctree)/scripts/cc-can-link.sh $(CC) -static -Xlinker --fatal-warnings $(m32-flag)) + config CC_HAS_ASM_GOTO def_bool $(success,$(srctree)/scripts/gcc-goto.sh $(CC))
scripts/cc-can-link.sh +3 -2
@@ -2,10 +2,11 @@ # SPDX-License-Identifier: GPL-2.0 cat << "END" | $@ -x c - -o /dev/null >/dev/null 2>&1 -#include <stdio.h> +#include <sys/types.h> +#include <pwd.h> int main(void) { - printf(""); + getpwent(); return 0; } END
Signature · 7 lines
2.20.1 _______________________________________________ linux-um mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-um
Re: [PATCH v2 1/3] um/kconfig: introduce CC_CAN_LINK_STATIC_NO_RUNTIME_DEPS
Quoted 20 lines · Ignat Korchagin
For statically linked UML build it is important to take into account the standard C-library implementation. Some implementations, notably glibc have
caveats: even when linked statically, the final program might require some runtime dependencies, if certain functions are used within the code.Consider the following program:
int main(void){ getpwent(); return 0; }Compiling this program and linking statically with glibc produces the following warning from the linker:
/usr/sbin/ld:/tmp/ccuthw1o.o: in function `main':
test.c:(.text+0x5): warning: Using 'getpwent' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
Quoted 5 lines
We will use the flag to detect such C-library implementation build time and possibly disable static linking for UML to avoid producing a binary with unexpected behaviour and dependencies.
Signed-off-by Ignat Korchagin <[email protected]>
Nice.
_______________________________________________
linux-um mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-um
PATCH v2 2/3 um: some fixes to build UML with musl
In reply to Ignat Korchaginmusl toolchain and headers are a bit more strict. These fixes enable building UML with musl as well as seem not to break on glibc.
--- arch/um/drivers/daemon_user.c | 1 + arch/um/drivers/pcap_user.c | 12 ++++++------ arch/um/drivers/slip_user.c | 2 +- arch/um/drivers/vector_user.c | 4 +--- arch/um/os-Linux/util.c | 2 +- arch/x86/um/user-offsets.c | 2 +- 6 files changed, 11 insertions(+), 12 deletions(-)
arch/um/drivers/daemon_user.c +1 -0
@@ -7,6 +7,7 @@*/ #include <stdint.h> +#include <string.h> #include <unistd.h> #include <errno.h> #include <sys/types.h>
arch/um/drivers/pcap_user.c +6 -6
@@ -32,7 +32,7 @@ static int pcap_user_init(void *data, void *dev)return 0 ; } -static int pcap_open (void *data) +static int pcap_user_open (void *data) {struct pcap_data *pri = data;__u32 netmask;
@@ -44,14 +44,14 @@ static int pcap_open(void *data)if (pri->filter !=NULL ) { err =dev_netmask (pri->dev, &netmask);if (err <0 ) { -printk (UM_KERN_ERR "pcap_open : dev_netmask failed\n" ); +printk (UM_KERN_ERR "pcap_user_open : dev_netmask failed\n" );return -EIO ; } pri->compiled =uml_kmalloc (sizeof (struct bpf_program ),UM_GFP_KERNEL );if (pri->compiled ==NULL ) { -printk (UM_KERN_ERR "pcap_open : kmalloc failed\n" ); +printk (UM_KERN_ERR "pcap_user_open : kmalloc failed\n" );return -ENOMEM ; }
@@ -59,14 +59,14 @@ static int pcap_open(void *data) (struct bpf_program *) pri->compiled, pri->filter, pri->optimize, netmask);if (err <0 ) { -printk (UM_KERN_ERR "pcap_open : pcap_compile failed - " +printk (UM_KERN_ERR "pcap_user_open : pcap_compile failed - " "'%s'\n" ,pcap_geterr (pri->pcap)); goto out; } err =pcap_setfilter (pri->pcap, pri->compiled);if (err <0 ) { -printk (UM_KERN_ERR "pcap_open : pcap_setfilter " +printk (UM_KERN_ERR "pcap_user_open : pcap_setfilter " "failed - '%s'\n" ,pcap_geterr (pri->pcap)); goto out; }
@@ -127,7 +127,7 @@ int pcap_user_read(int fd, void *buffer, int len, struct pcap_data *pri)const struct net_user_info pcap_user_info = { .init = pcap_user_init, - .open = pcap_open, + .open = pcap_user_open, .close =NULL , .remove = pcap_remove, .add_address =NULL ,
arch/um/drivers/slip_user.c +1 -1
@@ -9,7 +9,7 @@#include <errno.h> #include <fcntl.h> #include <string.h> -#include <sys/termios.h> +#include <termios.h> #include <sys/wait.h> #include <net_user.h> #include <os.h>
arch/um/drivers/vector_user.c +1 -3
@@ -18,9 +18,7 @@#include <fcntl.h> #include <sys/socket.h> #include <sys/un.h> -#include <net/ethernet.h> #include <netinet/ip.h> -#include <netinet/ether.h> #include <linux/if_ether.h> #include <linux/if_packet.h> #include <sys/wait.h>
@@ -332,7 +330,7 @@ static struct vector_fds *user_init_unix_fds(struct arglist *ifspec, int id) }switch (id) {case ID_BESS : -if (connect (fd, remote_addr,sizeof (struct sockaddr_un )) <0 ) { +if (connect (fd, (const struct sockaddr *) remote_addr,sizeof (struct sockaddr_un )) <0 ) {printk (UM_KERN_ERR "bess open:cannot connect to %s %i" , remote_addr->sun_path, -errno); goto unix_cleanup; }
arch/um/os-Linux/util.c +1 -1
@@ -10,7 +10,7 @@#include <signal.h> #include <string.h> #include <termios.h> -#include <wait.h> +#include <sys/wait.h> #include <sys/mman.h> #include <sys/utsname.h> #include <init.h>
arch/x86/um/user-offsets.c +1 -1
@@ -2,7 +2,7 @@#include <stdio.h> #include <stddef.h> #include <signal.h> -#include <sys/poll.h> +#include <poll.h> #include <sys/mman.h> #include <sys/user.h> #define __FRAME_OFFSETS
Signature · 7 lines
2.20.1 _______________________________________________ linux-um mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-um
Anton Ivanov
maintainerRe: [PATCH v2 2/3] um: some fixes to build UML with musl
Quoted 30 lines · Ignat Korchagin
musl toolchain and headers are a bit more strict. These fixes enable building UML with musl as well as seem not to break on glibc.
Signed-off-by Ignat Korchagin <[email protected]>--- arch/um/drivers/daemon_user.c | 1 + arch/um/drivers/pcap_user.c | 12 ++++++------ arch/um/drivers/slip_user.c | 2 +- arch/um/drivers/vector_user.c | 4 +--- arch/um/os-Linux/util.c | 2 +- arch/x86/um/user-offsets.c | 2 +- 6 files changed, 11 insertions(+), 12 deletions(-)arch/um/drivers/daemon_user.c +1
-0@@ -7,6 +7,7 @@*/ #include <stdint.h> +#include <string.h> #include <unistd.h> #include <errno.h> #include <sys/types.h> arch/um/drivers/pcap_user.c +0
-0
arch/um/drivers/pcap_user.c static int pcap_user_init(void *data, void *dev) · line 35
Quoted 5 lines
arch/um/drivers/pcap_user.c +1
-1@@ -32,7 +32,7 @@ static int pcap_user_init(void *data, void *dev)return 0 ; } -static int pcap_open (void *data) +static int pcap_user_open (void *data)
This change in the function name was introduced on purpose to avoid name clash in some version of libpcap which export pcap_open
Quoted 101 lines
arch/um/drivers/pcap_user.c +5
-5{struct pcap_data *pri = data;__u32 netmask;@@ -44,14 +44,14 @@ static int pcap_open(void *data)if (pri->filter !=NULL ) { err =dev_netmask (pri->dev, &netmask);if (err <0 ) { -printk (UM_KERN_ERR "pcap_open : dev_netmask failed\n" ); +printk (UM_KERN_ERR "pcap_user_open : dev_netmask failed\n" );return -EIO ; } pri->compiled =uml_kmalloc (sizeof (struct bpf_program ),UM_GFP_KERNEL );if (pri->compiled ==NULL ) { -printk (UM_KERN_ERR "pcap_open : kmalloc failed\n" ); +printk (UM_KERN_ERR "pcap_user_open : kmalloc failed\n" );return -ENOMEM ; }@@ -59,14 +59,14 @@ static int pcap_open(void *data) (struct bpf_program *) pri->compiled, pri->filter, pri->optimize, netmask);if (err <0 ) { -printk (UM_KERN_ERR "pcap_open : pcap_compile failed - " +printk (UM_KERN_ERR "pcap_user_open : pcap_compile failed - " "'%s'\n" ,pcap_geterr (pri->pcap)); goto out; } err =pcap_setfilter (pri->pcap, pri->compiled);if (err <0 ) { -printk (UM_KERN_ERR "pcap_open : pcap_setfilter " +printk (UM_KERN_ERR "pcap_user_open : pcap_setfilter " "failed - '%s'\n" ,pcap_geterr (pri->pcap)); goto out; }@@ -127,7 +127,7 @@ int pcap_user_read(int fd, void *buffer, int len, struct pcap_data *pri)const struct net_user_info pcap_user_info = { .init = pcap_user_init, - .open = pcap_open, + .open = pcap_user_open, .close =NULL , .remove = pcap_remove, .add_address =NULL ,arch/um/drivers/slip_user.c +1
-1@@ -9,7 +9,7 @@#include <errno.h> #include <fcntl.h> #include <string.h> -#include <sys/termios.h> +#include <termios.h> #include <sys/wait.h> #include <net_user.h> #include <os.h> arch/um/drivers/vector_user.c +1
-3@@ -18,9 +18,7 @@#include <fcntl.h> #include <sys/socket.h> #include <sys/un.h> -#include <net/ethernet.h> #include <netinet/ip.h> -#include <netinet/ether.h> #include <linux/if_ether.h> #include <linux/if_packet.h> #include <sys/wait.h> @@ -332,7 +330,7 @@ static struct vector_fds *user_init_unix_fds(struct arglist *ifspec, int id) }switch (id) {case ID_BESS : -if (connect (fd, remote_addr,sizeof (struct sockaddr_un )) <0 ) { +if (connect (fd, (const struct sockaddr *) remote_addr,sizeof (struct sockaddr_un )) <0 ) {printk (UM_KERN_ERR "bess open:cannot connect to %s %i" , remote_addr->sun_path, -errno); goto unix_cleanup; }arch/um/os-Linux/util.c +1
-1@@ -10,7 +10,7 @@#include <signal.h> #include <string.h> #include <termios.h> -#include <wait.h> +#include <sys/wait.h> #include <sys/mman.h> #include <sys/utsname.h> #include <init.h> arch/x86/um/user-offsets.c +0
-0
arch/x86/um/user-offsets.c line 8
Quoted 8 lines
arch/x86/um/user-offsets.c +1
-1@@ -2,7 +2,7 @@#include <stdio.h> #include <stddef.h> #include <signal.h> -#include <sys/poll.h> +#include <poll.h> #include <sys/mman.h> #include <sys/user.h> #define __FRAME_OFFSETS
Apologies for the delay in answering, I was buried under OVS for the last month or so.
With the exception of this patch the rest of the series looks OK. Can you please resumbit and if Johannes and Richard are OK with it I will +1 it.
Best regards,
Signature · 3 lines
Anton R. Ivanov Cambridgegreys Limited. Registered in England. Company Number 10273661 https://www.cambridgegreys.com/
Re: [PATCH v2 2/3] um: some fixes to build UML with musl
Quoted 36 lines · Anton Ivanov
Quoted 33 lines · Ignat Korchagin
musl toolchain and headers are a bit more strict. These fixes enable building UML with musl as well as seem not to break on glibc.
Signed-off-by Ignat Korchagin <[email protected]>--- arch/um/drivers/daemon_user.c | 1 + arch/um/drivers/pcap_user.c | 12 ++++++------ arch/um/drivers/slip_user.c | 2 +- arch/um/drivers/vector_user.c | 4 +--- arch/um/os-Linux/util.c | 2 +- arch/x86/um/user-offsets.c | 2 +- 6 files changed, 11 insertions(+), 12 deletions(-)arch/um/drivers/daemon_user.c +1
-0@@ -7,6 +7,7 @@*/ #include <stdint.h> +#include <string.h> #include <unistd.h> #include <errno.h> #include <sys/types.h> arch/um/drivers/pcap_user.c +0
-0@@ -32,7 +32,7 @@ static int pcap_user_init(void *data, void *dev)return 0 ; }
Quoted 4 lines
arch/um/drivers/pcap_user.c static int pcap_user_init(void *data, void *dev) · line 35
Quoted 2 lines
arch/um/drivers/pcap_user.c +1
-1-static int pcap_open (void *data) +static int pcap_user_open (void *data)This change in the function name was introduced on purpose to avoid name clash in some version of libpcap which export
pcap_open
Yes
Quoted 114 lines
Quoted 103 lines
arch/um/drivers/pcap_user.c +5
-5{struct pcap_data *pri = data;__u32 netmask;@@ -44,14 +44,14 @@ static int pcap_open(void *data)if (pri->filter !=NULL ) { err =dev_netmask (pri->dev, &netmask);if (err <0 ) { -printk (UM_KERN_ERR "pcap_open : dev_netmask failed\n" ); +printk (UM_KERN_ERR "pcap_user_open : dev_netmask failed\n" );return -EIO ; } pri->compiled =uml_kmalloc (sizeof (struct bpf_program ),UM_GFP_KERNEL );if (pri->compiled ==NULL ) { -printk (UM_KERN_ERR "pcap_open : kmalloc failed\n" ); +printk (UM_KERN_ERR "pcap_user_open : kmalloc failed\n" );return -ENOMEM ; }@@ -59,14 +59,14 @@ static int pcap_open(void *data) (struct bpf_program *) pri->compiled, pri->filter, pri->optimize, netmask);if (err <0 ) { -printk (UM_KERN_ERR "pcap_open : pcap_compile failed - " +printk (UM_KERN_ERR "pcap_user_open : pcap_compile failed - " "'%s'\n" ,pcap_geterr (pri->pcap)); goto out; } err =pcap_setfilter (pri->pcap, pri->compiled);if (err <0 ) { -printk (UM_KERN_ERR "pcap_open : pcap_setfilter " +printk (UM_KERN_ERR "pcap_user_open : pcap_setfilter " "failed - '%s'\n" ,pcap_geterr (pri->pcap)); goto out; }@@ -127,7 +127,7 @@ int pcap_user_read(int fd, void *buffer, int len, struct pcap_data *pri)const struct net_user_info pcap_user_info = { .init = pcap_user_init, - .open = pcap_open, + .open = pcap_user_open, .close =NULL , .remove = pcap_remove, .add_address =NULL ,arch/um/drivers/slip_user.c +1
-1@@ -9,7 +9,7 @@#include <errno.h> #include <fcntl.h> #include <string.h> -#include <sys/termios.h> +#include <termios.h> #include <sys/wait.h> #include <net_user.h> #include <os.h> arch/um/drivers/vector_user.c +1
-3@@ -18,9 +18,7 @@#include <fcntl.h> #include <sys/socket.h> #include <sys/un.h> -#include <net/ethernet.h> #include <netinet/ip.h> -#include <netinet/ether.h> #include <linux/if_ether.h> #include <linux/if_packet.h> #include <sys/wait.h> @@ -332,7 +330,7 @@ static struct vector_fds *user_init_unix_fds(struct arglist *ifspec, int id) }switch (id) {case ID_BESS : -if (connect (fd, remote_addr,sizeof (struct sockaddr_un )) <0 ) { +if (connect (fd, (const struct sockaddr *) remote_addr,sizeof (struct sockaddr_un )) <0 ) {printk (UM_KERN_ERR "bess open:cannot connect to %s %i" , remote_addr->sun_path, -errno); goto unix_cleanup; }arch/um/os-Linux/util.c +1
-1@@ -10,7 +10,7 @@#include <signal.h> #include <string.h> #include <termios.h> -#include <wait.h> +#include <sys/wait.h> #include <sys/mman.h> #include <sys/utsname.h> #include <init.h> arch/x86/um/user-offsets.c +0
-0arch/x86/um/user-offsets.c line 8
Quoted 8 lines
arch/x86/um/user-offsets.c +1
-1@@ -2,7 +2,7 @@#include <stdio.h> #include <stddef.h> #include <signal.h> -#include <sys/poll.h> +#include <poll.h> #include <sys/mman.h> #include <sys/user.h> #define __FRAME_OFFSETSApologies for the delay in answering, I was buried under OVS for the last month or so.
Quoted 1 line
With the exception of this patch the rest of the series looks OK. Can you please resumbit and if Johannes and Richard are OK with it I will +1 it.
I didn't quite understand how I should improve this patch. Could you, please, clarify?
Quoted 6 lines
Best regards,
--
Anton R. Ivanov
Cambridgegreys Limited. Registered in England. Company Number 10273661
https://www.cambridgegreys.com/
Anton Ivanov
maintainerRe: [PATCH v2 2/3] um: some fixes to build UML with musl
Quoted 159 lines · Ignat Korchagin
Quoted 36 lines · Anton Ivanov
Quoted 33 lines · Ignat Korchagin
musl toolchain and headers are a bit more strict. These fixes enable building UML with musl as well as seem not to break on glibc.
Signed-off-by Ignat Korchagin <[email protected]>--- arch/um/drivers/daemon_user.c | 1 + arch/um/drivers/pcap_user.c | 12 ++++++------ arch/um/drivers/slip_user.c | 2 +- arch/um/drivers/vector_user.c | 4 +--- arch/um/os-Linux/util.c | 2 +- arch/x86/um/user-offsets.c | 2 +- 6 files changed, 11 insertions(+), 12 deletions(-)arch/um/drivers/daemon_user.c +1
-0@@ -7,6 +7,7 @@*/ #include <stdint.h> +#include <string.h> #include <unistd.h> #include <errno.h> #include <sys/types.h> arch/um/drivers/pcap_user.c +0
-0@@ -32,7 +32,7 @@ static int pcap_user_init(void *data, void *dev)return 0 ; }Quoted 4 lines
arch/um/drivers/pcap_user.c static int pcap_user_init(void *data, void *dev) · line 35
Quoted 2 lines
arch/um/drivers/pcap_user.c +1
-1-static int pcap_open (void *data) +static int pcap_user_open (void *data)This change in the function name was introduced on purpose to avoid name clash in some version of libpcap which export
pcap_openYes
Quoted 114 lines
Quoted 103 lines
arch/um/drivers/pcap_user.c +5
-5{struct pcap_data *pri = data;__u32 netmask;@@ -44,14 +44,14 @@ static int pcap_open(void *data)if (pri->filter !=NULL ) { err =dev_netmask (pri->dev, &netmask);if (err <0 ) { -printk (UM_KERN_ERR "pcap_open : dev_netmask failed\n" ); +printk (UM_KERN_ERR "pcap_user_open : dev_netmask failed\n" );return -EIO ; } pri->compiled =uml_kmalloc (sizeof (struct bpf_program ),UM_GFP_KERNEL );if (pri->compiled ==NULL ) { -printk (UM_KERN_ERR "pcap_open : kmalloc failed\n" ); +printk (UM_KERN_ERR "pcap_user_open : kmalloc failed\n" );return -ENOMEM ; }@@ -59,14 +59,14 @@ static int pcap_open(void *data) (struct bpf_program *) pri->compiled, pri->filter, pri->optimize, netmask);if (err <0 ) { -printk (UM_KERN_ERR "pcap_open : pcap_compile failed - " +printk (UM_KERN_ERR "pcap_user_open : pcap_compile failed - " "'%s'\n" ,pcap_geterr (pri->pcap)); goto out; } err =pcap_setfilter (pri->pcap, pri->compiled);if (err <0 ) { -printk (UM_KERN_ERR "pcap_open : pcap_setfilter " +printk (UM_KERN_ERR "pcap_user_open : pcap_setfilter " "failed - '%s'\n" ,pcap_geterr (pri->pcap)); goto out; }@@ -127,7 +127,7 @@ int pcap_user_read(int fd, void *buffer, int len, struct pcap_data *pri)const struct net_user_info pcap_user_info = { .init = pcap_user_init, - .open = pcap_open, + .open = pcap_user_open, .close =NULL , .remove = pcap_remove, .add_address =NULL ,arch/um/drivers/slip_user.c +1
-1@@ -9,7 +9,7 @@#include <errno.h> #include <fcntl.h> #include <string.h> -#include <sys/termios.h> +#include <termios.h> #include <sys/wait.h> #include <net_user.h> #include <os.h> arch/um/drivers/vector_user.c +1
-3@@ -18,9 +18,7 @@#include <fcntl.h> #include <sys/socket.h> #include <sys/un.h> -#include <net/ethernet.h> #include <netinet/ip.h> -#include <netinet/ether.h> #include <linux/if_ether.h> #include <linux/if_packet.h> #include <sys/wait.h> @@ -332,7 +330,7 @@ static struct vector_fds *user_init_unix_fds(struct arglist *ifspec, int id) }switch (id) {case ID_BESS : -if (connect (fd, remote_addr,sizeof (struct sockaddr_un )) <0 ) { +if (connect (fd, (const struct sockaddr *) remote_addr,sizeof (struct sockaddr_un )) <0 ) {printk (UM_KERN_ERR "bess open:cannot connect to %s %i" , remote_addr->sun_path, -errno); goto unix_cleanup; }arch/um/os-Linux/util.c +1
-1@@ -10,7 +10,7 @@#include <signal.h> #include <string.h> #include <termios.h> -#include <wait.h> +#include <sys/wait.h> #include <sys/mman.h> #include <sys/utsname.h> #include <init.h> arch/x86/um/user-offsets.c +0
-0arch/x86/um/user-offsets.c line 8
Quoted 8 lines
arch/x86/um/user-offsets.c +1
-1@@ -2,7 +2,7 @@#include <stdio.h> #include <stddef.h> #include <signal.h> -#include <sys/poll.h> +#include <poll.h> #include <sys/mman.h> #include <sys/user.h> #define __FRAME_OFFSETSApologies for the delay in answering, I was buried under OVS for the last month or so.
Quoted 4 lines
Quoted 1 line
With the exception of this patch the rest of the series looks OK. Can you please resumbit and if Johannes and Richard are OK with it I will +1 it.
I didn't quite understand how I should improve this patch. Could you, please, clarify?
Sorry, not reading it correctly :)
My fault. You actually did exactly what has been in the queue for a while after Brendan noticed it: https://lkml.org/lkml/2019/12/5/868
Patch is OK with me, should not read patches before the 3rd double espresso next time.
I will +1 it, Richard, Johannes, what do you think?
Thanks,
Quoted 8 lines
Quoted 7 lines
Best regards,
--
Anton R. Ivanov
Cambridgegreys Limited. Registered in England. Company Number 10273661
https://www.cambridgegreys.com/
Signature · 3 lines
Anton R. Ivanov Cambridgegreys Limited. Registered in England. Company Number 10273661 https://www.cambridgegreys.com/
Johannes Berg
maintainerRe: [PATCH v2 2/3] um: some fixes to build UML with musl
Quoted 3 lines · Anton Ivanov
Patch is OK with me, should not read patches before the 3rd double espresso next time.
I will +1 it, Richard, Johannes, what do you think?
I got dropped off the list in "The Great Infradead Purge" but I see it in patchwork ;)
Not sure we should modify cc-can-link.sh without at least CC'ing Masahiro Yamada?
But yeah, looks fine to me. Not that I have any interest in static linking.
johannes
_______________________________________________
linux-um mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-um
Re: [PATCH v2 2/3] um: some fixes to build UML with musl
Quoted 7 lines · Johannes Berg
Quoted 3 lines · Anton Ivanov
Patch is OK with me, should not read patches before the 3rd double espresso next time.
I will +1 it, Richard, Johannes, what do you think?
Quoted 8 lines
I got dropped off the list in "The Great Infradead Purge" but I see it in patchwork ;)
Not sure we should modify
cc-can-link.shwithout at least CC'ing Masahiro Yamada?But yeah, looks fine to me. Not that I have any interest in static linking.
Yeah, looks good to me as well, but I think the others here know the drivers here better than I.
_______________________________________________
linux-um mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-um
PATCH v2 3/3 um: allow static linking for non-glibc implementations
In reply to Ignat KorchaginIt is possible to produce a statically linked UML binary with UML_NET_VECTOR, UML_NET_VDE and UML_NET_PCAP options enabled using alternative libc implementations, which do not rely on NSS, such as musl.
Allow static linking in this case.
--- arch/um/Kconfig | 2 +- arch/um/drivers/Kconfig | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-)
arch/um/Kconfig +1 -1
@@ -67,7 +67,7 @@ config FORBID_STATIC_LINK config STATIC_LINK bool "Force a static link" - depends on !FORBID_STATIC_LINK + depends on CC_CAN_LINK_STATIC_NO_RUNTIME_DEPS || (!UML_NET_VECTOR && !UML_NET_VDE && !UML_NET_PCAP) help This option gives you the ability to force a static link of UML. Normally, UML is linked as a shared binary. This is inconvenient for
arch/um/drivers/Kconfig +0 -3
@@ -234,7 +234,6 @@ config UML_NET_DAEMON config UML_NET_VECTOR bool "Vector I/O high performance network devices" depends on UML_NET - select FORBID_STATIC_LINK help This User-Mode Linux network driver uses multi-message send and receive functions. The host running the UML guest must have
@@ -246,7 +245,6 @@ config UML_NET_VECTOR config UML_NET_VDE bool "VDE transport (obsolete)" depends on UML_NET - select FORBID_STATIC_LINK help This User-Mode Linux network transport allows one or more running UMLs on a single host to communicate with each other and also
@@ -294,7 +292,6 @@ config UML_NET_MCAST config UML_NET_PCAP bool "pcap transport (obsolete)" depends on UML_NET - select FORBID_STATIC_LINK help The pcap transport makes a pcap packet stream on the host look like an ethernet device inside UML. This is useful for making
Signature · 7 lines
2.20.1 _______________________________________________ linux-um mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-um
Re: [PATCH v2 3/3] um: allow static linking for non-glibc implementations
Quoted 8 lines · Ignat Korchagin
It is possible to produce a statically linked UML binary with
UML_NET_VECTOR,UML_NET_VDEandUML_NET_PCAPoptions enabled using alternative libc implementations, which do not rely on NSS, such as musl.Allow static linking in this case.
Signed-off-by Ignat Korchagin <[email protected]>
One minor issue below. Other than that:
arch/um/Kconfig config FORBID_STATIC_LINK
Quoted 10 lines
--- arch/um/Kconfig | 2 +- arch/um/drivers/Kconfig | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-)arch/um/Kconfig +0
-0@@ -67,7 +67,7 @@ config FORBID_STATIC_LINK
Doesn't look like FORBID_STATIC_LINK is used anymore, so you should probably drop it as well.
With the preceding changes, in this patchset, you can revert my patch like you did in the RFC - or not, your choice. I am not offended by people reverting my commits. I just don't like it when people break allyesconfig. :-)
Quoted 36 lines
arch/um/Kconfig +1
-1config STATIC_LINK bool "Force a static link" - depends on !FORBID_STATIC_LINK + depends on CC_CAN_LINK_STATIC_NO_RUNTIME_DEPS || (!UML_NET_VECTOR && !UML_NET_VDE && !UML_NET_PCAP) help This option gives you the ability to force a static link of UML. Normally, UML is linked as a shared binary. This is inconvenient forarch/um/drivers/Kconfig +0
-4@@ -234,7 +234,6 @@ config UML_NET_DAEMON config UML_NET_VECTOR bool "Vector I/O high performance network devices" depends on UML_NET - select FORBID_STATIC_LINK help This User-Mode Linux network driver uses multi-message send and receive functions. The host running the UML guest must have@@ -246,7 +245,6 @@ config UML_NET_VECTOR config UML_NET_VDE bool "VDE transport (obsolete)" depends on UML_NET - select FORBID_STATIC_LINK help This User-Mode Linux network transport allows one or more running UMLs on a single host to communicate with each other and also@@ -294,7 +292,6 @@ config UML_NET_MCAST config UML_NET_PCAP bool "pcap transport (obsolete)" depends on UML_NET - select FORBID_STATIC_LINK help The pcap transport makes a pcap packet stream on the host look like an ethernet device inside UML. This is useful for making --
Quoted 2 lines
2.20.1
_______________________________________________
linux-um mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-um
Re: [PATCH v2 3/3] um: allow static linking for non-glibc implementations
Quoted 20 lines · Brendan Higgins
Quoted 8 lines · Ignat Korchagin
It is possible to produce a statically linked UML binary with
UML_NET_VECTOR,UML_NET_VDEandUML_NET_PCAPoptions enabled using alternative libc implementations, which do not rely on NSS, such as musl.Allow static linking in this case.
Signed-off-by Ignat Korchagin <[email protected]>One minor issue below. Other than that:
Reviewed-by Brendan Higgins <[email protected]>Quoted 5 lines
--- arch/um/Kconfig | 2 +- arch/um/drivers/Kconfig | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-)
Quoted 8 lines
arch/um/Kconfig config FORBID_STATIC_LINK
Quoted 5 lines
arch/um/Kconfig +0
-0@@ -67,7 +67,7 @@ config FORBID_STATIC_LINKDoesn't look like
FORBID_STATIC_LINKis used anymore, so you should probably drop it as well.
Right, good catch! I will repost the series with this adjusted as well cc Masahiro Yamada as mentioned for +1 on the changes to can-link.sh script.
Seems I also need to rebase now to accommodate changes in b816b3db15f68690ee72a4a414624f8e82942b25 ("kbuild: fix CONFIG_CC_CAN_LINK(_STATIC) for cross-compilation with Clang")
Quoted 35 lines
With the preceding changes, in this patchset, you can revert my patch like you did in the RFC - or not, your choice. I am not offended by people reverting my commits. I just don't like it when people break allyesconfig. :-)
Quoted 30 lines
arch/um/Kconfig +1
-1config STATIC_LINK bool "Force a static link" - depends on !FORBID_STATIC_LINK + depends on CC_CAN_LINK_STATIC_NO_RUNTIME_DEPS || (!UML_NET_VECTOR && !UML_NET_VDE && !UML_NET_PCAP) help This option gives you the ability to force a static link of UML. Normally, UML is linked as a shared binary. This is inconvenient forarch/um/drivers/Kconfig +0
-2@@ -234,7 +234,6 @@ config UML_NET_DAEMON config UML_NET_VECTOR bool "Vector I/O high performance network devices" depends on UML_NET - select FORBID_STATIC_LINK help This User-Mode Linux network driver uses multi-message send and receive functions. The host running the UML guest must have@@ -246,7 +245,6 @@ config UML_NET_VECTOR config UML_NET_VDE bool "VDE transport (obsolete)" depends on UML_NET - select FORBID_STATIC_LINK help This User-Mode Linux network transport allows one or more running UMLs on a single host to communicate with each other and also@@ -294,7 +292,6 @@ config UML_NET_MCAST config UML_NET_PCAP bool "pcap transport (obsolete)"
Quoted 8 lines
Quoted 8 lines
arch/um/drivers/Kconfig +0
-2depends on UML_NET - select FORBID_STATIC_LINK help The pcap transport makes a pcap packet stream on the host look like an ethernet device inside UML. This is useful for making --2.20.1
_______________________________________________
linux-um mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-um
Quoted 18 lines · Ignat Korchagin
This is a continuation of [1]. Since I was able to produce a working UML binary with
UML_NET_VECTORlinked with musl with the changes included in the patches here. I was compiling on Arch Linux, so hopefully all the latest versions of the compiler, libraries and binutils.I also tested allyesconfig with both musl and glibc. The compilation succeeds with both, however both binaries (glibc one being dynamically linked) segfault on start. This is probably of some incompatible config option/module being included and not related to musl/glibc.
[1]: https://patchwork.ozlabs.org/project/linux-um/patch/[email protected]/
Ignat Korchagin (3):
um/kconfig: introduceCC_CAN_LINK_STATIC_NO_RUNTIME_DEPS
um: some fixes to build UML with musl
um: allow static linking for non-glibc implementations
Quoted 11 lines
arch/um/Kconfig | 2 +- arch/um/drivers/Kconfig | 3 --- arch/um/drivers/daemon_user.c | 1 + arch/um/drivers/pcap_user.c | 12 ++++++------ arch/um/drivers/slip_user.c | 2 +- arch/um/drivers/vector_user.c | 4 +--- arch/um/os-Linux/util.c | 2 +- arch/x86/um/user-offsets.c | 2 +- init/Kconfig | 6 ++++++ scripts/cc-can-link.sh | 5 +++-- 10 files changed, 21 insertions(+), 18 deletions(-)
Sorry for taking so long to get to this. I saw this last week or whenever and then forgot, saw the comments yesterday and remembered.
Looks pretty good overall. I will put my reviewed-by on each individual patch. Nevertheless, I tested them all together, so being lazy: