[Mesa-dev] [RFC patch 1/2] gallium: only link static archives between ld start/end group options

Brian Paul brianp at vmware.com
Wed Aug 22 07:25:21 PDT 2012


On 08/22/2012 04:02 AM, Maarten Lankhorst wrote:
> Not my patch, but fixes a build error I encountered on quantal.
>
>  From 7e2e29c67f8fc8ec72c2dc8544428fdd86b21353 Mon Sep 17 00:00:00 2001
> From: Olivier Blin<dev at blino.org>
> Date: Sat, 4 Aug 2012 00:29:45 +0200
> Subject: [PATCH] gallium: only link static archives between ld start/end group options
>
> llvmpipe test programs failed to link with --as-needed ld option,
> since dynamic libraries were mixed with static libraries between the
> ld --start-group and --end-group options.
>
> gd3d1x likely had the same issue.
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=52167
> ---
>   src/gallium/Makefile.template                    | 2 +-
>   src/gallium/drivers/llvmpipe/Makefile            | 3 ++-
>   src/gallium/state_trackers/d3d1x/gd3d1x/Makefile | 3 ++-
>   3 files changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/src/gallium/Makefile.template b/src/gallium/Makefile.template
> index 036c119..c30477a 100644
> --- a/src/gallium/Makefile.template
> +++ b/src/gallium/Makefile.template
> @@ -41,7 +41,7 @@ depend: $(C_SOURCES) $(CPP_SOURCES) $(ASM_SOURCES) $(SYMLINKS) $(GENERATED_SOURC
>   	$(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(C_SOURCES) $(CPP_SOURCES) $(ASM_SOURCES) $(GENERATED_SOURCES) 2>  /dev/null
>
>   $(PROGS): % : %.o $(PROGS_DEPS)
> -	$(LD) $(LDFLAGS) $(filter %.o,$^) -o $@ -Wl,--start-group  $(LIBS) -Wl,--end-group
> +	$(LD) $(LDFLAGS) $(filter %.o,$^) -o $@ -Wl,--start-group  $(LIBS) -Wl,--end-group $(LDADD)
>
>   # Emacs tags
>   tags:
> diff --git a/src/gallium/drivers/llvmpipe/Makefile b/src/gallium/drivers/llvmpipe/Makefile
> index ef16fc7..35f8fe8 100644
> --- a/src/gallium/drivers/llvmpipe/Makefile
> +++ b/src/gallium/drivers/llvmpipe/Makefile
> @@ -68,7 +68,8 @@ lp_tile_soa.c: lp_tile_soa.py ../../auxiliary/util/u_format_parse.py ../../auxil
>   	$(PYTHON2) $(PYTHON_FLAGS) lp_tile_soa.py ../../auxiliary/util/u_format.csv>  $@
>
>   LDFLAGS += $(LLVM_LDFLAGS)
> -LIBS += -L../../auxiliary/ -lgallium libllvmpipe.a $(LLVM_LIBS) $(GL_LIB_DEPS)
> +LIBS += -L../../auxiliary/ -lgallium libllvmpipe.a
> +LDADD += $(LLVM_LIBS) $(GL_LIB_DEPS)
>   LD=$(CXX)
>
>   $(PROGS): lp_test_main.o libllvmpipe.a
> diff --git a/src/gallium/state_trackers/d3d1x/gd3d1x/Makefile b/src/gallium/state_trackers/d3d1x/gd3d1x/Makefile
> index 32d2956..f9cad05 100644
> --- a/src/gallium/state_trackers/d3d1x/gd3d1x/Makefile
> +++ b/src/gallium/state_trackers/d3d1x/gd3d1x/Makefile
> @@ -3,5 +3,6 @@ CPP_SOURCES=$(wildcard *.cpp)
>   LIBRARY_INCLUDES=-Iinclude -I../gd3dapi -I../d3dapi -I../w32api -I../d3d1xstutil/include -I../d3d1xshader/include -I../../../include -I../../../auxiliary -I../../../state_trackers/egl/common
>   PROGS=tools/dxbc2tgsi
>   PROGS_DEPS=libgd3d1x.a ../d3d1xshader/libd3d1xshader.a ../d3d1xstutil/libd3d1xstutil.a ../../../auxiliary/libgallium.a
> -LIBS=$(PROGS_DEPS) -ldl
> +LIBS=$(PROGS_DEPS)
> +LDADD=-ldl
>   include ../Makefile.inc

Looks OK to me.  Did you check the other gallium driver Makefiles for 
this issue?

-Brian


More information about the mesa-dev mailing list