Issue Details (XML | Word | Printable)

Key: PCC-254
Type: Bug Bug
Status: Resolved Resolved
Resolution: Won't Fix
Priority: Major Major
Assignee: Anders Magnusson
Reporter: Detlef Riekenberg
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
pcc

broken code: libs/wpp/libwpp.a build with pcc is missing __divdi3 and __udivdi3

Created: 23/Feb/11 08:25 PM   Updated: 01/May/14 03:15 PM
Component/s: None
Affects Version/s: None
Fix Version/s: None

Environment: i686/linux


 Description  « Hide
pcc can build libs/wpp/libwpp.a in Wine,
but when the lib is used, building the dependant app failed:
../../tools/winegcc/winegcc -B../../tools/winebuild --sysroot=../.. -fasynchronous-unwind-tables -shared ../../../src/dlls/d3dcompiler_43/d3dcompiler_43.spec asmparser.o blob.o bytecodewriter.o compiler.o d3dcompiler_43_main.o reflection.o utils.o asmshader.tab.o asmshader.yy.o version.res -o d3dcompiler_43.dll.so -ldxguid -luuid ../../libs/port/libwine_port.a ../../libs/wpp/libwpp.a
../../libs/wpp/libwpp.a(ppy.tab.o): In function `ppy_parse':
ppy.tab.c:2262: undefined reference to `__divdi3'
ppy.tab.c:2262: undefined reference to `__divdi3'
ppy.tab.c:2262: undefined reference to `__udivdi3'
ppy.tab.c:2262: undefined reference to `__udivdi3'
winegcc: pcc failed


--
By by ... Detlef


 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Anders Magnusson added a comment - 23/Feb/11 09:09 PM
You must tell it to link with libpcc to get those routines.

Detlef Riekenberg added a comment - 23/Feb/11 11:26 PM - edited
The Wine build system and the source works with gcc, but it fails with
CC="pcc" CFLAGS="-g -v"


callchain before the failure:

flex -oasmshader.yy.c ../../../src/dlls/d3dcompiler_43/asmshader.l

pcc -c -I../../../src/dlls/d3dcompiler_43 -I. -I../../../src/include -I../../include -D__WINESRC__ -D_REENTRANT -fPIC -Wall -pipe -fno-strict-aliasing -Wdeclaration-after-statement -Wstrict-prototypes -Wtype-limits -Wwrite-strings -Wpointer-arith -g -v -o asmshader.yy.o asmshader.yy.c

/usr/local/libexec/cpp -v -D__PCC__=1 -D__PCC_MINOR__=1 -D__PCC_MINORMINOR__=0 -D__GNUC__=4 -D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=1 -D__GNUC_STDC_INLINE__=1 -D__VERSION__="pcc 1.1.0.DEVEL 20110221 for i686-pc-linux-gnu, xxx@yyy" -D__SCHAR_MAX__=127 -D__SHRT_MAX__=32767 -D__INT_MAX__=0x7fffffff -D__LONG_MAX__=0x7fffffff -D__LONG_LONG_MAX__=0x7fffffffffffffffLL -D__REGISTER_PREFIX__= -D__USER_LABEL_PREFIX__= -D__linux__ -D__ELF__ -D__STDC_ISO_10646__=200009L -D__WCHAR_TYPE__=int -D__SIZEOF_WCHAR_T__=4 -D__WCHAR_MAX__=2147483647 -D__WINT_TYPE__=unsigned int -D__SIZE_TYPE__=unsigned long -D__PTRDIFF_TYPE__=long int -D__SIZEOF_WINT_T__=4 -D__i386__ -I../../../src/dlls/d3dcompiler_43 -I. -I../../../src/include -I../../include -D__WINESRC__ -D_REENTRANT -S /usr/local/include/pcc/ -S /usr/include/ -S /usr/local/lib/pcc/i686-pc-linux-gnu/1.1.0.DEVEL/include/ asmshader.yy.c /tmp/ctm.probt9

sbf used: 582202

cpp: pcc 1.1.0.DEVEL 20110221 for i686-pc-linux-gnu, xxx@yyy
/usr/local/libexec/ccom -Wpointer-sign -Wunknown-pragmas -g -k /tmp/ctm.probt9 /tmp/ctm.9wqZCc

as -v -k -o asmshader.yy.o /tmp/ctm.9wqZCc
GNU assembler version 2.20.51 (i686-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.20.51-system.20100908
pcc 1.1.0.DEVEL 20110221 for i686-pc-linux-gnu, xxx@yyy
LD_LIBRARY_PATH="../../libs/wine:$LD_LIBRARY_PATH" ../../tools/wrc/wrc --nostdinc --po-dir=../../../src/po -I../../../src/dlls/d3dcompiler_43 -I. -I../../../src/include -I../../include -D__WINESRC__ -o version.res ../../../src/dlls/d3dcompiler_43/version.rc

../../tools/winegcc/winegcc -B../../tools/winebuild --sysroot=../.. -fasynchronous-unwind-tables -shared ../../../src/dlls/d3dcompiler_43/d3dcompiler_43.spec asmparser.o blob.o bytecodewriter.o compiler.o d3dcompiler_43_main.o reflection.o utils.o asmshader.tab.o asmshader.yy.o version.res -o d3dcompiler_43.dll.so -ldxguid -luuid ../../libs/port/libwine_port.a ../../libs/wpp/libwpp.a

../../libs/wpp/libwpp.a(ppy.tab.o): In function `ppy_parse':
ppy.tab.c:2262: undefined reference to `__divdi3'


--
By by ... Detlef

Anders Magnusson added a comment - 26/Feb/11 03:39 PM
By some reason the linker you are using does not seem to link with libpcc, where __divdi3 is. It is included by default when pcc is used for linking, but it looks in the above that gcc is used for linking...?

Detlef Riekenberg added a comment - 04/Mar/11 05:51 PM
ld is used for linking.

winegcc is only a wrapper:
winegcc tries to provide a MinGW compatible compiler under Linux. This is most useful to Win32 developers who can simply take their MinGW code from Windows, and recompile it without modifications under Winelib on Linux.

The goal of winegcc is to be able to simply replace gcc/g++/windres
with winegcc/wineg++/wrc in a MinGW Makefile, and just recompile
the application using Winelib under Wine. While typically there are
small adjustments that must be made to the application source code
and/or Makefile, it is quite easy to do them in a fashion that is
compatible between the MinGW and Wine environments.


--
By by ... Detlef

Anders Magnusson added a comment - 12/Mar/11 10:00 PM
I assume winegcc do not include libpcc, which is needed for pcc-compiled code to work. It must be taught to do that.

Detlef Riekenberg added a comment - 14/Mar/11 10:44 PM
There is no code in winegcc to include libgcc either.

The only left location for such a magic is ld.

A patch, which add an -lgcc / -lpcc when linking is difficult,
as such a patch is not needed for gcc and requires the full compiler specific path for the static library.

--
By by ... Detlef

Anders Magnusson added a comment - 01/May/14 03:15 PM
The correct fix is to include libpcc.