Open Bug 624385 Opened 9 years ago Updated 9 years ago

libmozgnome implementation use gfxAsurface but does not link with its implementation

Categories

(Core :: General, defect)

x86_64
Linux
defect
Not set

Tracking

()

UNCONFIRMED

People

(Reporter: jh, Unassigned)

Details

User-Agent:       Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101203 SUSE/3.6.13-0.2.1 Firefox/3.6.13
Build Identifier: 

While buildling libmozgnome with mainline GCC and link time optimization and profile generation, we get:
/abuild/jh/trunk-install/bin/g++ -fpermissive -O3 -flto=24 -fuse-linker-plugin
-fprofile-generate  -fno-rtti -fno-exceptions -Wall -Wpointer-arith
-Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor
-Wcast-align -Wno-invalid-offsetof -Wno-variadic-macros -Werror=return-type
-pedantic -Wno-long-long -fno-strict-aliasing -fshort-wchar -pthread -pipe 
-DNDEBUG -DTRIMMED -g   -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include  
-I/usr/include/gtk-2.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include
-I/usr/include/dbus-1.0 -I/usr/lib64/dbus-1.0/include
-I/usr/lib64/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo
-I/usr/include/pango-1.0 -I/usr/include/pixman-1 -I/usr/include/freetype2
-I/usr/include/libpng12   -I/usr/include/gtk-2.0 -I/usr/lib64/gtk-2.0/include
-I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0
-I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1
-I/usr/include/freetype2 -I/usr/include/libpng12
-I/usr/include/gtk-unix-print-2.0    -fPIC -shared -Wl,-z,defs
-Wl,-h,libmozgnome.so -o libmozgnome.so  nsGnomeModule.o nsAlertsService.o
nsAlertsIconListener.o     -lpthread   
-Wl,-rpath-link,/abuild/jh/build-mozilla-new8-prof/dist/bin
-Wl,-rpath-link,/usr/local/lib
/abuild/jh/build-mozilla-new8-prof/dist/lib/libxpcomglue_s.a
-L/abuild/jh/build-mozilla-new8-prof/dist/bin -lxpcom -lmozalloc
-L/abuild/jh/build-mozilla-new8-prof/dist/bin -lxpcom -lmozalloc
-L/abuild/jh/build-mozilla-new8-prof/dist/lib -lplds4 -lplc4 -lnspr4 -lpthread
-ldl   -lgobject-2.0 -lglib-2.0   -L/lib64 -lnotify -lgtk-x11-2.0 -ldbus-glib-1
-lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lgdk_pixbuf-2.0
-lpangocairo-1.0 -lcairo -lpango-1.0 -lfreetype -lz -lfontconfig -lgmodule-2.0
-ldbus-1 -lgobject-2.0 -lglib-2.0     -Wl,--version-script
-Wl,/abuild/jh/mozilla-central2/mozilla-central/build/unix/gnu-ld-scripts/components-version-script
-Wl,-Bsymbolic -ldl    
/abuild/jh/trunk-install/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/../../../../x86_64-unknown-linux-gnu/bin/ld:
/abuild/jh/tmp//cc0wLUAb.ltrans0.ltrans.o: in function
gfxUnknownSurface::~gfxUnknownSurface():../../../dist/include/gfxASurface.h:247:
error: undefined reference to 'vtable for gfxASurface'
/abuild/jh/trunk-install/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/../../../../x86_64-unknown-linux-gnu/bin/ld:
/abuild/jh/tmp//cc0wLUAb.ltrans0.ltrans.o: in function
gfxUnknownSurface::~gfxUnknownSurface():../../../dist/include/gfxASurface.h:248:
error: undefined reference to 'gfxASurface::RecordMemoryFreed()'
/abuild/jh/trunk-install/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/../../../../x86_64-unknown-linux-gnu/bin/ld:
/abuild/jh/tmp//cc0wLUAb.ltrans0.ltrans.o: in function
gfxUnknownSurface::~gfxUnknownSurface():../../../dist/include/gfxASurface.h:247:
error: undefined reference to 'vtable for gfxASurface'
/abuild/jh/trunk-install/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/../../../../x86_64-unknown-linux-gnu/bin/ld:
/abuild/jh/tmp//cc0wLUAb.ltrans0.ltrans.o: in function
gfxUnknownSurface::~gfxUnknownSurface():../../../dist/include/gfxASurface.h:248:
error: undefined reference to 'gfxASurface::RecordMemoryFreed()'
/abuild/jh/trunk-install/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/../../../../x86_64-unknown-linux-gnu/bin/ld:
/abuild/jh/tmp//cc0wLUAb.ltrans0.ltrans.o: in function
gfxASurface::~gfxASurface():../../../dist/include/gfxASurface.h:247: error:
undefined reference to 'vtable for gfxASurface'
/abuild/jh/trunk-install/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/../../../../x86_64-unknown-linux-gnu/bin/ld:
/abuild/jh/tmp//cc0wLUAb.ltrans0.ltrans.o: in function
gfxASurface::~gfxASurface():../../../dist/include/gfxASurface.h:248: error:
undefined reference to 'gfxASurface::RecordMemoryFreed()'
/abuild/jh/trunk-install/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/../../../../x86_64-unknown-linux-gnu/bin/ld:
/abuild/jh/tmp//cc0wLUAb.ltrans0.ltrans.o: in function
gfxASurface::~gfxASurface():../../../dist/include/gfxASurface.h:247: error:
undefined reference to 'vtable for gfxASurface'
/abuild/jh/trunk-install/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/../../../../x86_64-unknown-linux-gnu/bin/ld:
/abuild/jh/tmp//cc0wLUAb.ltrans0.ltrans.o: in function
gfxASurface::~gfxASurface():../../../dist/include/gfxASurface.h:248: error:
undefined reference to 'gfxASurface::RecordMemoryFreed()'
/abuild/jh/trunk-install/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/../../../../x86_64-unknown-linux-gnu/bin/ld:
/abuild/jh/tmp//cc0wLUAb.ltrans0.ltrans.o: in function
_ZTV17gfxUnknownSurface.local.39.3126:cc0wLUAb.ltrans0.o(.data.rel.ro+0x10):
error: undefined reference to 'gfxASurface::BeginPrinting(nsAString const&,
nsAString const&)'
/abuild/jh/trunk-install/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/../../../../x86_64-unknown-linux-gnu/bin/ld:
/abuild/jh/tmp//cc0wLUAb.ltrans0.ltrans.o: in function
_ZTV17gfxUnknownSurface.local.39.3126:cc0wLUAb.ltrans0.o(.data.rel.ro+0x18):
error: undefined reference to 'gfxASurface::EndPrinting()'
/abuild/jh/trunk-install/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/../../../../x86_64-unknown-linux-gnu/bin/ld:
/abuild/jh/tmp//cc0wLUAb.ltrans0.ltrans.o: in function
_ZTV17gfxUnknownSurface.local.39.3126:cc0wLUAb.ltrans0.o(.data.rel.ro+0x20):
error: undefined reference to 'gfxASurface::AbortPrinting()'
/abuild/jh/trunk-install/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/../../../../x86_64-unknown-linux-gnu/bin/ld:
/abuild/jh/tmp//cc0wLUAb.ltrans0.ltrans.o: in function
_ZTV17gfxUnknownSurface.local.39.3126:cc0wLUAb.ltrans0.o(.data.rel.ro+0x28):
error: undefined reference to 'gfxASurface::BeginPage()'
/abuild/jh/trunk-install/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/../../../../x86_64-unknown-linux-gnu/bin/ld:
/abuild/jh/tmp//cc0wLUAb.ltrans0.ltrans.o: in function
_ZTV17gfxUnknownSurface.local.39.3126:cc0wLUAb.ltrans0.o(.data.rel.ro+0x30):
error: undefined reference to 'gfxASurface::EndPage()'
/abuild/jh/trunk-install/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/../../../../x86_64-unknown-linux-gnu/bin/ld:
/abuild/jh/tmp//cc0wLUAb.ltrans0.ltrans.o: in function
_ZTV17gfxUnknownSurface.local.39.3126:cc0wLUAb.ltrans0.o(.data.rel.ro+0x38):
error: undefined reference to 'gfxASurface::Finish()'
/abuild/jh/trunk-install/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/../../../../x86_64-unknown-linux-gnu/bin/ld:
/abuild/jh/tmp//cc0wLUAb.ltrans0.ltrans.o: in function
_ZTV17gfxUnknownSurface.local.39.3126:cc0wLUAb.ltrans0.o(.data.rel.ro+0x40):
error: undefined reference to
'gfxASurface::CreateSimilarSurface(gfxASurface::gfxContentType, gfxIntSize
const&)'


the reason is that libmozgnome implemenetaiton include gfxAsurface, uses it in C++ standard sense but rely on fact that it is fully optimized out since it is not linked with its implementation.
For complex reasons this fails in this configuration: GCC keeps virtual functions for possible devirutalization around and there is difficult iteraction in between COMDAT, linker plugin and profiling instrumentation that renders the function neccesary.

While this is also missed optimization problem in GCC, I think this code is not strictly valid.

Reproducible: Always
This comes from toolkit/system/gnome/nsAlertsIconListener.cpp including imgIContainer.h, in turn including gfxImageSurface.h, in turn including gfxASurface.h.
You need to log in before you can comment on or make changes to this bug.