diff mbox series

um: Fix pcap and vde driver builds

Message ID 20191016075343.28564-2-anton.ivanov@cambridgegreys.com
State Superseded
Headers show
Series um: Fix pcap and vde driver builds | expand

Commit Message

Anton Ivanov Oct. 16, 2019, 7:53 a.m. UTC
Signed-off-by: Anton Ivanov <anton.ivanov@cambridgegreys.com>
---
 arch/um/drivers/Makefile | 8 ++++++++
 scripts/link-vmlinux.sh  | 2 +-
 2 files changed, 9 insertions(+), 1 deletion(-)

Comments

Anton Ivanov Oct. 16, 2019, 9:12 a.m. UTC | #1
On 16/10/2019 08:53, Anton Ivanov wrote:
> Signed-off-by: Anton Ivanov <anton.ivanov@cambridgegreys.com>
> ---
>   arch/um/drivers/Makefile | 8 ++++++++
>   scripts/link-vmlinux.sh  | 2 +-
>   2 files changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/arch/um/drivers/Makefile b/arch/um/drivers/Makefile
> index 693319839f69..34355057ec85 100644
> --- a/arch/um/drivers/Makefile
> +++ b/arch/um/drivers/Makefile
> @@ -24,6 +24,14 @@ LDFLAGS_vde.o := -r $(shell $(CC) $(CFLAGS) -print-file-name=libvdeplug.a)
>   
>   targets := pcap_kern.o pcap_user.o vde_kern.o vde_user.o
>   
> +ifeq ($(CONFIG_UML_NET_PCAP),y)
> +	export UML_EXTRA_LIBS += -lpcap
> +endif
> +ifeq ($(CONFIG_UML_NET_VDE),y)
> +	export UML_EXTRA_LIBS += -lvde -lvdeplug
> +endif
> +
> +
>   $(obj)/pcap.o: $(obj)/pcap_kern.o $(obj)/pcap_user.o
>   	$(LD) -r -dp -o $@ $^ $(ld_flags)
>   
> diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
> index 915775eb2921..d3e6a6cdfc13 100755
> --- a/scripts/link-vmlinux.sh
> +++ b/scripts/link-vmlinux.sh
> @@ -86,7 +86,7 @@ vmlinux_link()
>   		${CC} ${CFLAGS_vmlinux} -o ${2}			\
>   			-Wl,-T,${lds}				\
>   			${objects}				\
> -			-lutil -lrt -lpthread
> +			-lutil -lrt -lpthread ${UML_EXTRA_LIBS}
>   		rm -f linux
>   	fi
>   }


This will not work as advertised unfortunately - I have to write out the 
libs list somewhere and load it again in the link script instead of 
passing it as an environment variable.

A fixed patch will follow shortly.
diff mbox series

Patch

diff --git a/arch/um/drivers/Makefile b/arch/um/drivers/Makefile
index 693319839f69..34355057ec85 100644
--- a/arch/um/drivers/Makefile
+++ b/arch/um/drivers/Makefile
@@ -24,6 +24,14 @@  LDFLAGS_vde.o := -r $(shell $(CC) $(CFLAGS) -print-file-name=libvdeplug.a)
 
 targets := pcap_kern.o pcap_user.o vde_kern.o vde_user.o
 
+ifeq ($(CONFIG_UML_NET_PCAP),y)
+	export UML_EXTRA_LIBS += -lpcap
+endif
+ifeq ($(CONFIG_UML_NET_VDE),y)
+	export UML_EXTRA_LIBS += -lvde -lvdeplug
+endif
+
+
 $(obj)/pcap.o: $(obj)/pcap_kern.o $(obj)/pcap_user.o
 	$(LD) -r -dp -o $@ $^ $(ld_flags)
 
diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
index 915775eb2921..d3e6a6cdfc13 100755
--- a/scripts/link-vmlinux.sh
+++ b/scripts/link-vmlinux.sh
@@ -86,7 +86,7 @@  vmlinux_link()
 		${CC} ${CFLAGS_vmlinux} -o ${2}			\
 			-Wl,-T,${lds}				\
 			${objects}				\
-			-lutil -lrt -lpthread
+			-lutil -lrt -lpthread ${UML_EXTRA_LIBS}
 		rm -f linux
 	fi
 }