Android: gallium_dri: pass dri.sym to linker

Submitted by Rob Herring on Aug. 21, 2017, 7:33 p.m.

Details

Message ID 20170821193307.16532-1-robh@kernel.org
State New
Headers show
Series "Android: gallium_dri: pass dri.sym to linker" ( rev: 1 ) in Mesa

Not browsing as part of any series.

Commit Message

Rob Herring Aug. 21, 2017, 7:33 p.m.
Pass the dri.sym version script to the linker. This ensures only
explicitly exported symbols are exported and shrinks the library by up
to 60KB.

We need to pass "--undefined-version" because the Android build system
sets --no-undefined-version by default and we get an error on
__driDriverExtensions without the option.

Suggested-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Rob Herring <robh@kernel.org>
---
 src/gallium/targets/dri/Android.mk | 4 ++++
 1 file changed, 4 insertions(+)

Patch hide | download patch | download mbox

diff --git a/src/gallium/targets/dri/Android.mk b/src/gallium/targets/dri/Android.mk
index 150b2e368e51..313930b76274 100644
--- a/src/gallium/targets/dri/Android.mk
+++ b/src/gallium/targets/dri/Android.mk
@@ -32,6 +32,10 @@  LOCAL_SRC_FILES := target.c
 
 LOCAL_CFLAGS :=
 
+LOCAL_LDFLAGS := \
+	-Wl,--version-script=$(LOCAL_PATH)/dri.sym \
+	-Wl,--undefined-version
+
 LOCAL_SHARED_LIBRARIES := \
 	libdl \
 	liblog \

Comments

On 21 August 2017 at 20:33, Rob Herring <robh@kernel.org> wrote:
> Pass the dri.sym version script to the linker. This ensures only
> explicitly exported symbols are exported and shrinks the library by up
> to 60KB.
>
> We need to pass "--undefined-version" because the Android build system
> sets --no-undefined-version by default and we get an error on
> __driDriverExtensions without the option.
>
> Suggested-by: Emil Velikov <emil.l.velikov@gmail.com>
> Signed-off-by: Rob Herring <robh@kernel.org>
> ---
>  src/gallium/targets/dri/Android.mk | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/src/gallium/targets/dri/Android.mk b/src/gallium/targets/dri/Android.mk
> index 150b2e368e51..313930b76274 100644
> --- a/src/gallium/targets/dri/Android.mk
> +++ b/src/gallium/targets/dri/Android.mk
> @@ -32,6 +32,10 @@ LOCAL_SRC_FILES := target.c
>
>  LOCAL_CFLAGS :=
>
> +LOCAL_LDFLAGS := \
> +       -Wl,--version-script=$(LOCAL_PATH)/dri.sym \
> +       -Wl,--undefined-version
> +
Can you please add an inline comment about undefined-version. I'm thinking of:

"Depending on the build permutation, some of a function or two
mentioned in the sym file may be missing.
Which will lead to errors like the following unless --undefined-version is set.

   version script assignment of  to symbol FOO failed: symbol not defined
"

With a bit of comment (regardless if you use my example or not)
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>

Thanks
Emil