Remove uncessary link form libva.so by adding flag RTLD_NODELETE into 93/393/1
authorAustin Yuan <shengquan.yuan@intel.com>
Wed, 3 Jun 2009 15:14:46 +0000 (11:14 -0400)
committerAustin Yuan <shengquan.yuan@intel.com>
Wed, 3 Jun 2009 15:14:46 +0000 (11:14 -0400)
dlopen

Here is the background of this fix
Investigation indicates MRST Moblin Alpha1 0529 and 0520 uses the same libva source package
(which is from graphics Alpha1.4 pakcage
\\mid-depot.amr.corp.intel.com\Exchange\Moblin2\PackageSubmit\1.0.7_05142009-4_Alpha1.4),
and the rootcause is that the linkage of libva dependence libraries is
chaned in 0529 build. I am not sure why 0529 build has this change, and this
change indeed causes libva application segment fault issue.

See the detailed investigation and explanation in the attached
libva-0520-vs-0529.PNG picture.

Reproduce Steps(steps,current result, reproduce possibility)
===========================================================
(1) boot 0529 build
(2) Install libva testsuits into 0529 build
(3) run "mpeg4vld -x -i /var/clips/demo.m4v"

Expected result:
===========================================================
libVA application should exit cleanly

Possible root cause:
================================
There was a global change which helps reduce unnecessary linking
utilizing a
feature in binutils. We could opt liva out of this easily, however I
would
recommend fixing the package to do the right linking instead of relying
on the
tools to do so, Arjan, any suggestions?

Anas
=============================
summary of the picture:

the "new" libva does no longer link to

* libXv

* libdrm

* librt

* libpthread

HOWEVER; libva doesn't USE any of these! I don't see how not linking to
these could lead to a crash, since they truely are not used.

================================
Basically it is a known issue. If we remove these library link from
libVA, we will always get a segment fault when XCloseDisplay is called in
application.
Libva doesn't use these liXv/libdrm libraries, but libVA will dlopen HW
specific driver, and the driver links with these libXv/libdrm libraries.
We found the issue can be worked around by adding the link into libVA.
Using binutil to remove unnecessary link makes sense for most of libraries,
but for libva, it disables our workaround.

Austin

Signed-off-by: Austin Yuan <shengquan.yuan@intel.com>
src/Makefile.am
src/va.c

index fbcdeda..6767bfc 100644 (file)
@@ -27,7 +27,7 @@ INCLUDES = \
 libva_la_LTLIBRARIES = libva.la
 libva_ladir = $(libdir)
 libva_la_LDFLAGS = -version-number 0:30:0 -no-undefined
-libva_la_LIBADD = $(LIBVA_LIBS) -ldl -ldrm -lX11 -lXext -lXv X11/libva_X11.la
+libva_la_LIBADD = $(LIBVA_LIBS) -ldl -lX11 -lXext X11/libva_X11.la
 CFLAGS = -ansi -O2 
 
 nodist_libva_la_SOURCES = va_version.h
index 3169b1d..70dd90c 100644 (file)
--- a/src/va.c
+++ b/src/va.c
@@ -150,7 +150,7 @@ static VAStatus va_openDriver(VADisplay dpy, char *driver_name)
         
         va_infoMessage("Trying to open %s\n", driver_path);
 
-        handle = dlopen( driver_path, RTLD_NOW | RTLD_GLOBAL );
+        handle = dlopen( driver_path, RTLD_NOW | RTLD_GLOBAL | RTLD_NODELETE );
         if (!handle)
         {
             /* Don't give errors for non-existing files */