Patchwork build: list libraries after objects, for proper linkage

login
register
mail settings
Submitter Diego Elio Pettenò
Date Aug. 14, 2011, 1:31 p.m.
Message ID <1313328684-25619-1-git-send-email-flameeyes@flameeyes.eu>
Download mbox | patch
Permalink /patch/109958/
State New
Headers show

Comments

Alon Levy - Aug. 13, 2011, 2:07 p.m.
On Sun, Aug 14, 2011 at 03:31:24PM +0200, Diego Elio Pettenò wrote:
> Without this change, when using -Wl,--as-needed with GNU linker, the
> libraries would be discarded.
> 

Thanks, my bad, didn't know about this switch, makes perfect sense, will add
to the pull request (I should send one by the end of the week).

> Signed-off-by: Diego Elio Pettenò <flameeyes@flameeyes.eu>
> ---
>  libcacard/Makefile |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libcacard/Makefile b/libcacard/Makefile
> index 5cd7594..3ea845f 100644
> --- a/libcacard/Makefile
> +++ b/libcacard/Makefile
> @@ -18,7 +18,7 @@ QEMU_CFLAGS+=-I../
>  libcacard.lib-y=$(addsuffix .lo,$(basename $(libcacard-y)))
>  
>  vscclient: $(libcacard-y) $(QEMU_OBJS) vscclient.o
> -	$(call quiet-command,$(CC) $(libcacard_libs) -lrt -o $@ $^,"  LINK  $@")
> +	$(call quiet-command,$(CC) -o $@ $^ $(libcacard_libs) -lrt,"  LINK  $@")
>  
>  clean:
>  	rm -f *.o */*.o *.d */*.d *.a */*.a *~ */*~ vscclient *.lo .libs/* *.la *.pc
> @@ -37,7 +37,7 @@ install-libcacard:
>  	@echo "libtool is missing, please install and rerun configure"; exit 1
>  else
>  libcacard.la: $(libcacard.lib-y) $(QEMU_OBJS_LIB)
> -	$(call quiet-command,libtool --mode=link --quiet --tag=CC $(CC) $(libcacard_libs) -lrt -rpath $(libdir) -o $@ $^,"  lt LINK $@")
> +	$(call quiet-command,libtool --mode=link --quiet --tag=CC $(CC) -rpath $(libdir) -o $@ $^ $(libcacard_libs) -lrt,"  lt LINK $@")
>  
>  libcacard.pc: $(libcacard_srcpath)/libcacard.pc.in
>  	sed -e 's|@LIBDIR@|$(libdir)|' \
> -- 
> 1.7.6
> 
>
Diego Elio Pettenò - Aug. 14, 2011, 1:31 p.m.
Without this change, when using -Wl,--as-needed with GNU linker, the
libraries would be discarded.

Signed-off-by: Diego Elio Pettenò <flameeyes@flameeyes.eu>
---
 libcacard/Makefile |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
Anthony Liguori - Aug. 22, 2011, 4:30 p.m.
On 08/14/2011 08:31 AM, Diego Elio Pettenò wrote:
> Without this change, when using -Wl,--as-needed with GNU linker, the
> libraries would be discarded.
>
> Signed-off-by: Diego Elio Pettenò<flameeyes@flameeyes.eu>

Applied.  Thanks.

Regards,

Anthony Liguori

> ---
>   libcacard/Makefile |    4 ++--
>   1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/libcacard/Makefile b/libcacard/Makefile
> index 5cd7594..3ea845f 100644
> --- a/libcacard/Makefile
> +++ b/libcacard/Makefile
> @@ -18,7 +18,7 @@ QEMU_CFLAGS+=-I../
>   libcacard.lib-y=$(addsuffix .lo,$(basename $(libcacard-y)))
>
>   vscclient: $(libcacard-y) $(QEMU_OBJS) vscclient.o
> -	$(call quiet-command,$(CC) $(libcacard_libs) -lrt -o $@ $^,"  LINK  $@")
> +	$(call quiet-command,$(CC) -o $@ $^ $(libcacard_libs) -lrt,"  LINK  $@")
>
>   clean:
>   	rm -f *.o */*.o *.d */*.d *.a */*.a *~ */*~ vscclient *.lo .libs/* *.la *.pc
> @@ -37,7 +37,7 @@ install-libcacard:
>   	@echo "libtool is missing, please install and rerun configure"; exit 1
>   else
>   libcacard.la: $(libcacard.lib-y) $(QEMU_OBJS_LIB)
> -	$(call quiet-command,libtool --mode=link --quiet --tag=CC $(CC) $(libcacard_libs) -lrt -rpath $(libdir) -o $@ $^,"  lt LINK $@")
> +	$(call quiet-command,libtool --mode=link --quiet --tag=CC $(CC) -rpath $(libdir) -o $@ $^ $(libcacard_libs) -lrt,"  lt LINK $@")
>
>   libcacard.pc: $(libcacard_srcpath)/libcacard.pc.in
>   	sed -e 's|@LIBDIR@|$(libdir)|' \

Patch

diff --git a/libcacard/Makefile b/libcacard/Makefile
index 5cd7594..3ea845f 100644
--- a/libcacard/Makefile
+++ b/libcacard/Makefile
@@ -18,7 +18,7 @@  QEMU_CFLAGS+=-I../
 libcacard.lib-y=$(addsuffix .lo,$(basename $(libcacard-y)))
 
 vscclient: $(libcacard-y) $(QEMU_OBJS) vscclient.o
-	$(call quiet-command,$(CC) $(libcacard_libs) -lrt -o $@ $^,"  LINK  $@")
+	$(call quiet-command,$(CC) -o $@ $^ $(libcacard_libs) -lrt,"  LINK  $@")
 
 clean:
 	rm -f *.o */*.o *.d */*.d *.a */*.a *~ */*~ vscclient *.lo .libs/* *.la *.pc
@@ -37,7 +37,7 @@  install-libcacard:
 	@echo "libtool is missing, please install and rerun configure"; exit 1
 else
 libcacard.la: $(libcacard.lib-y) $(QEMU_OBJS_LIB)
-	$(call quiet-command,libtool --mode=link --quiet --tag=CC $(CC) $(libcacard_libs) -lrt -rpath $(libdir) -o $@ $^,"  lt LINK $@")
+	$(call quiet-command,libtool --mode=link --quiet --tag=CC $(CC) -rpath $(libdir) -o $@ $^ $(libcacard_libs) -lrt,"  lt LINK $@")
 
 libcacard.pc: $(libcacard_srcpath)/libcacard.pc.in
 	sed -e 's|@LIBDIR@|$(libdir)|' \