On Fri, Aug 18, 2017 at 7:27 PM, Emil Velikov <emil.l.veli...@gmail.com> wrote: > On 18 August 2017 at 20:46, Rob Herring <r...@kernel.org> wrote: >> Both statically linking libLLVMCore and dynamically linking libLLVM causes >> duplicated symbols in gallium_dri.so and it fails to dlopen. We don't >> really need to link libLLVMCore, but just need generated headers to be >> built first. Dynamically linking to libLLVM instead is enough to do >> that. Thanks to Qiang Yu for finding the root cause. >> > Nice find indeed, thanks. > > This reminds me - a small task for a rainy day. > - Wire the version script files into the Android build - see the > autoconf snippet below. > It will hide the hundreds of symbols when static linking LLVM (aka > sidestep the current issue) and make the binary noticeably smaller. > > gallium_dri_la_LDFLAGS += \ > -Wl,--version-script=$(top_srcdir)/src/gallium/targets/dri/dri.sym
About 60K smaller out of 12MB. Is that inline with what you'd expect? before: text data bss dec hex filename 12164054 420384 352476 12936914 c566d2 out/target/product/linaro_x86_64/system/lib64/dri/gallium_dri.so after: text data bss dec hex filename 12104616 419816 352476 12876908 c47c6c out/target/product/linaro_x86_64/system/lib64/dri/gallium_dri.so The change is trivial, though I'm not sure if there's any downside to setting --undefined-version (The Android build system turns this off). diff --git a/src/gallium/targets/dri/Android.mk b/src/gallium/targets/dri/Android.mk index 150b2e368e51..440dded0cebe 100644 --- a/src/gallium/targets/dri/Android.mk +++ b/src/gallium/targets/dri/Android.mk @@ -32,6 +32,8 @@ LOCAL_SRC_FILES := target.c LOCAL_CFLAGS := +LOCAL_LDFLAGS := -Wl,--version-script=$(LOCAL_PATH)/dri.sym -Wl,--undefined-version + LOCAL_SHARED_LIBRARIES := \ libdl \ liblog \ _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev