Issue 124086

Summary: bridge test fails when compiling testtools
Product: App Dev Reporter: Apostolos Syropoulos <asyropoulos123>
Component: apiAssignee: hdu <hdu>
Status: CLOSED FIXED QA Contact:
Severity: Critical    
Priority: P3 CC: hdu, issues
Version: 4.1.0-dev   
Target Milestone: 4.1.0   
Hardware: PC   
OS: Solaris   
Issue Type: DEFECT Latest Confirmation in: ---
Developer Difficulty: ---
Issue Depends on:    
Issue Blocks: 123228    
Attachments:
Description Flags
Patch for file bridges/source/cpp_uno/gcc3_solaris_intel/uno2cpp.cxx
none
cpp2uno.cxx patch
none
cpp2uno.cxx patch
none
uno2cpp.cxx patch
none
Patch for gcc_solaris_intel none

Description Apostolos Syropoulos 2014-01-22 19:53:32 UTC
Hello,

I am trying to build OpenOffice on OpenSolaris. I am using gcc 4.8.2, GNU ld 2.24, and the GNU assembler version 2.24. I have no problem compiling everything until compilation reaches testtools. When I use -O2 compilation stops as follows:

     LD_LIBRARY_PATH=/extra/sources/OpenOffice/aoo4/main/solver/410/unxsogi.pro/lib${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} /extra/sources/OpenOffice/aoo4/main/solver/410/unxsogi.pro/bin/xsltproc --nonet --stringparam prefix /extra/sources/OpenOffice/aoo4/main/testtools/source/bridgetest/../../unxsogi.pro/misc/ -o ../../unxsogi.pro/lib/uno_services.rdb \
        /extra/sources/OpenOffice/aoo4/main/solenv/bin/packcomponents.xslt ../../unxsogi.pro/misc/uno_services.input
cd ../../unxsogi.pro/lib && : &&     LD_LIBRARY_PATH=/extra/sources/OpenOffice/aoo4/main/solver/410/unxsogi.pro/lib${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} /extra/sources/OpenOffice/aoo4/main/solver/410/unxsogi.pro/bin/uno \
        -ro uno_services.rdb -ro uno_types.rdb \
        -s com.sun.star.test.bridge.BridgeTest -- \
        com.sun.star.test.bridge.CppTestObject
### unexpected exception content! failed
### unexpected exception content! failed
### unexpected exception content! failed
exception test failed
oneway exception test failed
exception occured: error: test failed!
 
> error: error: test failed!
> dying...
dmake:  Error code 1, while making 'runtest'

But when I use -O1 I get the following (I have enabled some debugging info):

cd ../../unxsogi.pro/lib && : &&     LD_LIBRARY_PATH=/extra/sources/OpenOffice/aoo4/main/solver/410/unxsogi.pro/lib${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} /extra/sources/OpenOffice/aoo4/main/solver/410/unxsogi.pro/bin/uno \
		-ro uno_services.rdb -ro uno_types.rdb \
		-s com.sun.star.test.bridge.BridgeTest -- \
		com.sun.star.test.bridge.CppTestObject
Trace 2971/1: "component path=file:///extra/sources/OpenOffice/aoo4/main/solver/410/unxsogi.pro/lib/bootstrap.uno.so
"
=> no CPLD_ACCESSPATH set.
loadSharedLibComponentFactory envDcp: gcc3          implName: .star.comp.stoc.SimpleRegistry  libName: bootstrap.uno.s
Trace 2971/1: "> inserting new mapping: ;gcc3[80cf2c8];gcc3[80cf2c8]"
Trace 2971/1: "> revoking mapping ;gcc3[80cf2c8];gcc3[80cf2c8]"
Trace 2971/1: "component path=file:///extra/sources/OpenOffice/aoo4/main/solver/410/unxsogi.pro/lib/bootstrap.uno.so
"
loadSharedLibComponentFactory envDcp: gcc3          implName: .star.comp.stoc.SimpleRegistry  libName: bootstrap.uno.s
Trace 2971/1: "> inserting new mapping: ;gcc3[80d4a68];gcc3[80d4a68]"
Trace 2971/1: "> revoking mapping ;gcc3[80d4a68];gcc3[80d4a68]"
Trace 2971/1: "component path=file:///extra/sources/OpenOffice/aoo4/main/solver/410/unxsogi.pro/lib/bootstrap.uno.so
"
loadSharedLibComponentFactory envDcp: gcc3          implName: .star.comp.stoc.NestedRegistry  libName: bootstrap.uno.s
Trace 2971/1: "> inserting new mapping: ;gcc3[80d4b00];gcc3[80d4b00]"
Trace 2971/1: "> revoking mapping ;gcc3[80d4b00];gcc3[80d4b00]"
Trace 2971/1: "component path=file:///extra/sources/OpenOffice/aoo4/main/solver/410/unxsogi.pro/lib/bootstrap.uno.so
"
loadSharedLibComponentFactory envDcp: gcc3          implName: p.stoc.ORegistryServiceManager  libName: bootstrap.uno.s
Trace 2971/1: "> inserting new mapping: ;gcc3[80d49b0];gcc3[80d49b0]"
Trace 2971/1: "> revoking mapping ;gcc3[80d49b0];gcc3[80d49b0]"
Trace 2971/1: "component path=file:///extra/sources/OpenOffice/aoo4/main/solver/410/unxsogi.pro/lib/bootstrap.uno.so
"
loadSharedLibComponentFactory envDcp: gcc3          implName: mp.stoc.OServiceManagerWrapper  libName: bootstrap.uno.s
Trace 2971/1: "> inserting new mapping: ;gcc3[80d7b68];gcc3[80d7b68]"
Trace 2971/1: "> revoking mapping ;gcc3[80d7b68];gcc3[80d7b68]"
> implementation com.sun.star.comp.stoc.OServiceManagerWrapper supports: com.sun.star.lang.MultiServiceFactory
Trace 2971/1: "component path=file:///extra/sources/OpenOffice/aoo4/main/solver/410/unxsogi.pro/lib/bootstrap.uno.so
"
loadSharedLibComponentFactory envDcp: gcc3          implName: r.comp.stoc.DLLComponentLoader  libName: bootstrap.uno.s
Trace 2971/1: "> inserting new mapping: ;gcc3[80d3748];gcc3[80d3748]"
Trace 2971/1: "> revoking mapping ;gcc3[80d3748];gcc3[80d3748]"
> implementation com.sun.star.comp.stoc.DLLComponentLoader supports: com.sun.star.loader.SharedLibrary
Trace 2971/1: "component path=file:///extra/sources/OpenOffice/aoo4/main/solver/410/unxsogi.pro/lib/bootstrap.uno.so
"
loadSharedLibComponentFactory envDcp: gcc3          implName: .star.comp.stoc.SimpleRegistry  libName: bootstrap.uno.s
Trace 2971/1: "> inserting new mapping: ;gcc3[80d7b68];gcc3[80d7b68]"
Trace 2971/1: "> revoking mapping ;gcc3[80d7b68];gcc3[80d7b68]"
> implementation com.sun.star.comp.stoc.SimpleRegistry supports: com.sun.star.registry.SimpleRegistry
Trace 2971/1: "component path=file:///extra/sources/OpenOffice/aoo4/main/solver/410/unxsogi.pro/lib/bootstrap.uno.so
"
loadSharedLibComponentFactory envDcp: gcc3          implName: .star.comp.stoc.NestedRegistry  libName: bootstrap.uno.s
Trace 2971/1: "> inserting new mapping: ;gcc3[80d3748];gcc3[80d3748]"
Trace 2971/1: "> revoking mapping ;gcc3[80d3748];gcc3[80d3748]"
> implementation com.sun.star.comp.stoc.NestedRegistry supports: com.sun.star.registry.NestedRegistry
Trace 2971/1: "component path=file:///extra/sources/OpenOffice/aoo4/main/solver/410/unxsogi.pro/lib/bootstrap.uno.so
"
loadSharedLibComponentFactory envDcp: gcc3          implName: mp.stoc.TypeDescriptionManager  libName: bootstrap.uno.s
Trace 2971/1: "> inserting new mapping: ;gcc3[80d7b68];gcc3[80d7b68]"
Trace 2971/1: "> revoking mapping ;gcc3[80d7b68];gcc3[80d7b68]"
> implementation com.sun.star.comp.stoc.TypeDescriptionManager supports: com.sun.star.reflection.TypeDescriptionManager
Trace 2971/1: "component path=file:///extra/sources/OpenOffice/aoo4/main/solver/410/unxsogi.pro/lib/bootstrap.uno.so
"
loadSharedLibComponentFactory envDcp: gcc3          implName: toc.ImplementationRegistration  libName: bootstrap.uno.s
Trace 2971/1: "> inserting new mapping: ;gcc3[80d3748];gcc3[80d3748]"
Trace 2971/1: "> revoking mapping ;gcc3[80d3748];gcc3[80d3748]"
> implementation com.sun.star.comp.stoc.ImplementationRegistration supports: com.sun.star.registry.ImplementationRegistration
Trace 2971/1: "component path=file:///extra/sources/OpenOffice/aoo4/main/solver/410/unxsogi.pro/lib/bootstrap.uno.so
"
loadSharedLibComponentFactory envDcp: gcc3          implName: ity.comp.stoc.AccessController  libName: bootstrap.uno.s
Trace 2971/1: "> inserting new mapping: ;gcc3[80d7b68];gcc3[80d7b68]"
Trace 2971/1: "> revoking mapping ;gcc3[80d7b68];gcc3[80d7b68]"
> implementation com.sun.star.security.comp.stoc.AccessController supports: com.sun.star.security.AccessController
Trace 2971/1: "component path=file:///extra/sources/OpenOffice/aoo4/main/solver/410/unxsogi.pro/lib/bootstrap.uno.so
"
loadSharedLibComponentFactory envDcp: gcc3          implName: .security.comp.stoc.FilePolicy  libName: bootstrap.uno.s
Trace 2971/1: "> inserting new mapping: ;gcc3[80d3748];gcc3[80d3748]"
Trace 2971/1: "> revoking mapping ;gcc3[80d3748];gcc3[80d3748]"
> implementation com.sun.star.security.comp.stoc.FilePolicy supports: com.sun.star.security.Policy
Trace 2971/1: "> inserting new mapping: ;gcc3[80d7b68];gcc3[80d7b68]"
Trace 2971/1: "> revoking mapping ;gcc3[80d7b68];gcc3[80d7b68]"
Trace 2971/1: "> inserting new mapping: ;gcc3[80d3748];gcc3[80d3748]"
Trace 2971/1: "> revoking mapping ;gcc3[80d3748];gcc3[80d3748]"
Trace 2971/1: "component path=file:///extra/sources/OpenOffice/aoo4/main/solver/410/unxsogi.pro/lib/bootstrap.uno.so
"
loadSharedLibComponentFactory envDcp: gcc3          implName: egistryTypeDescriptionProvider  libName: bootstrap.uno.s
Trace 2971/1: "> inserting new mapping: ;gcc3[80dca40];gcc3[80dca40]"
Trace 2971/1: "> revoking mapping ;gcc3[80dca40];gcc3[80dca40]"
Trace 2971/1: "> inserting new mapping: ;gcc3[80d3748];gcc3[80d3748]"
Trace 2971/1: "> revoking mapping ;gcc3[80d3748];gcc3[80d3748]"
Trace 2971/1: "component path=file:///extra/sources/OpenOffice/aoo4/main/testtools/unxsogi.pro/lib/bridgetest.uno.so
"
loadSharedLibComponentFactory envDcp: gcc3          implName: un.star.comp.bridge.BridgeTest  libName: file:///extra/s
Trace 2971/1: "> inserting new mapping: ;gcc3[80dcbc8];gcc3[80dcbc8]"
Trace 2971/1: "> revoking mapping ;gcc3[80dcbc8];gcc3[80dcbc8]"
Trace 2971/1: "component path=file:///extra/sources/OpenOffice/aoo4/main/testtools/unxsogi.pro/lib/cppobj.uno.so
"
loadSharedLibComponentFactory envDcp: gcc3          implName: star.comp.bridge.CppTestObject  libName: file:///extra/s
Trace 2971/1: "> inserting new mapping: ;gcc3[80dcd00];gcc3[80dcd00]"
Trace 2971/1: "> revoking mapping ;gcc3[80dcd00];gcc3[80dcd00]"
Trace 2971/1: "> inserting new mapping: ;gcc3[80dd318];uno[80dd3b0]"
Trace 2971/1: "> inserting new mapping: ;uno[80dd3b0];gcc3[80dcd00]"
terminate called after throwing an instance of 'com::sun::star::uno::RuntimeException'
/usr/bin/bash: line 1:  2971 Abort                   (core dumped) LD_LIBRARY_PATH=/extra/sources/OpenOffice/aoo4/main/solver/410/unxsogi.pro/lib${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} /extra/sources/OpenOffice/aoo4/main/solver/410/unxsogi.pro/bin/uno -ro uno_services.rdb -ro uno_types.rdb -s com.sun.star.test.bridge.BridgeTest -- com.sun.star.test.bridge.CppTestObject
dmake:  Error code 134, while making 'runtest'
ERROR: error 65280 occurred while making /extra/sources/OpenOffice/aoo4/main/testtools/source/bridgetest

I have no idea what is wrong. And moreover, I don't know what should I do to find what is the problem. Therefore, any help/advice/assistance would be really appreciated!

Kind regards,
A.S.
Comment 1 Apostolos Syropoulos 2014-01-27 16:14:05 UTC
Created attachment 82406 [details]
Patch for file  bridges/source/cpp_uno/gcc3_solaris_intel/uno2cpp.cxx

This patch solves the problem I reported.
Comment 2 SVN Robot 2014-02-13 13:21:51 UTC
"hdu" committed SVN revision 1567914 into trunk:
#i124086# preserve 16byte stack alignment in gcc3-solaris-intel's uno2cpp bridge
Comment 3 hdu@apache.org 2014-02-13 13:26:17 UTC
Thanks for the patch, Apostolos! Applied now for AOO 4.1.
Comment 4 hdu@apache.org 2014-02-18 09:17:12 UTC
Looking at the patch again there is a forward declaration of callVirtualMethod() immediately followed by its actual definition. IMHO the forward declaration is superfluous. I don't have a Solaris dev environment here, so I can't check, but from a C++ perspective only the "noinline" attribute needs to be moved and the forward declaration should be dropped.
Comment 5 Apostolos Syropoulos 2014-02-19 08:20:03 UTC
Thank you very much for pointing this out. However, if you check out http://opengrok.adfinis-sygroup.org/source/xref/aoo-trunk/main/bridges/source/cpp_uno/gcc3_linux_intel/uno2cpp.cxx you will notice the same problem. Thus, I believe it is necessary to modify the code in other files too. After all, I modified the solaris bridge using code from the linux bridge.Now, the correct code
should like

void __attribute__ ((noinline)) callVirtualMethod(
    void * pAdjustedThisPtr,
    sal_Int32 nVtableIndex,
    void * pRegisterReturn,
    typelib_TypeClass eReturnType,
    sal_Int32 * pStackLongs,
    sal_Int32 nStackLongs )
{

Should I submit a patch or is this enough?
Comment 6 hdu@apache.org 2014-02-19 09:03:15 UTC
(In reply to Apostolos Syropoulos from comment #5)
> Thank you very much for pointing this out. However, if you check out
> http://opengrok.adfinis-sygroup.org/source/xref/aoo-trunk/main/bridges/
> source/cpp_uno/gcc3_linux_intel/uno2cpp.cxx you will notice the same
> problem. Thus, I believe it is necessary to modify the code in other files
> too.

Yes, will do.

> After all, I modified the solaris bridge using code from the linux
> bridge.Now, the correct code
> should like
> 
> void __attribute__ ((noinline)) callVirtualMethod(
>     void * pAdjustedThisPtr,
>     sal_Int32 nVtableIndex,
>     void * pRegisterReturn,
>     typelib_TypeClass eReturnType,
>     sal_Int32 * pStackLongs,
>     sal_Int32 nStackLongs )
> {
> 
> Should I submit a patch or is this enough?

If you confirm that it works this is sufficient.
Comment 7 Apostolos Syropoulos 2014-02-19 17:20:03 UTC
Created attachment 82630 [details]
cpp2uno.cxx patch
Comment 8 Apostolos Syropoulos 2014-02-19 17:22:04 UTC
Created attachment 82631 [details]
cpp2uno.cxx patch
Comment 9 Apostolos Syropoulos 2014-02-19 17:24:19 UTC
Created attachment 82632 [details]
uno2cpp.cxx patch
Comment 10 Apostolos Syropoulos 2014-02-19 17:26:10 UTC
The 2 patches I have attached pass the testtools bridge test. However, when they are built with debug=t they cause the testtools to throw an exception.
Comment 11 Apostolos Syropoulos 2014-02-25 16:32:57 UTC
Created attachment 82698 [details]
Patch for gcc_solaris_intel

Patches 82630, 82631, and 82632 should be discarded. This patch should be applied after applying patch 82406.
Comment 12 hdu@apache.org 2014-02-25 16:38:25 UTC
Comment on attachment 82632 [details]
uno2cpp.cxx patch

Obsoleted attachments 82630, 82631 and 82632 per author request.
Comment 13 hdu@apache.org 2014-02-25 16:46:22 UTC
Ah, so the 16byte stack alignment is not needed? The most important difference is the removal of the regparm then. Does it work now also for debug=true with this patch?

Thanks for the patch and for the removal of the forward declaration. Having looked at the code in its cousin bridges (that we discussed above) I became hesitant to remove them there, because of concerns about the extern "C", no-inline, static or namespaces used there. "Never burn a working bridge" ;-)