www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Shared lib support for Linux

reply Long Chang <changlong jkys.info> writes:
Hello ,

The DMD will support shared lib for linux in future,  But I wan't to
know when this can be completed .

I am try use GDC build libgdruntime.a with -fPIC,  and catch some
error I can't fix it .

for example:
../../../../libphobos/rt/arraybyte.d
../../../../libphobos/rt/arraybyte.d: In function
=E2=80=98_arraySliceExpAddSliceAssign_g=E2=80=99:
../../../../libphobos/rt/arraybyte.d:220: error: PIC register =E2=80=98ebx=
=E2=80=99
clobbered in =E2=80=98asm=E2=80=99

If Druntime team can help GDC team fix this issue will be great .


Kind Regards / Long Chang
Mar 21 2011
next sibling parent Kagamin <spam here.lot> writes:
Long Chang Wrote:

 Hello ,
 
 The DMD will support shared lib for linux in future,  But I wan't to
 know when this can be completed .
 
 I am try use GDC build libgdruntime.a with -fPIC,  and catch some
 error I can't fix it .
 
 for example:
 ../../../../libphobos/rt/arraybyte.d
 ../../../../libphobos/rt/arraybyte.d: In function
 ‘_arraySliceExpAddSliceAssign_g’:
 ../../../../libphobos/rt/arraybyte.d:220: error: PIC register ‘ebx’
 clobbered in ‘asm’
 
 If Druntime team can help GDC team fix this issue will be great .
 
 
 Kind Regards / Long Chang

mov ESI, aptr; mov EDI, bptr; mov CL, value; align 4; startadd386: add ESI, 4; mov DX, [EDI]; mov AX, [EDI+2]; add EDI, 4; add AL, CL; add AH, CL; add DL, CL; add DH, CL; mov [ESI -4], DX; mov [ESI+2 -4], AX; cmp ESI, n; jb startadd386; mov aptr, ESI; mov bptr, EDI; though the function looks buggy.
Mar 22 2011
prev sibling next sibling parent Iain Buclaw <ibuclaw ubuntu.com> writes:
== Quote from Long Chang (changlong jkys.info)'s article
 Hello ,
 The DMD will support shared lib for linux in future,  But I wan't to
 know when this can be completed .
 I am try use GDC build libgdruntime.a with -fPIC,  and catch some
 error I can't fix it .
 for example:
 ../../../../libphobos/rt/arraybyte.d
 ../../../../libphobos/rt/arraybyte.d: In function
 ‘_arraySliceExpAddSliceAssign_g’:
 ../../../../libphobos/rt/arraybyte.d:220: error: PIC register ‘ebx
 ’
 clobbered in ‘asm’
 If Druntime team can help GDC team fix this issue will be great .
 Kind Regards / Long Chang

Ignoring any bugs in Druntime and DMD regarding PIC code generation; GDC puts all used registers in any given asm statement in the clobbered list. Without this, GCC will not know of their usage, and so assumes the register(s) are free, therefore it may decide to use them for storing other data. Regards
Mar 22 2011
prev sibling next sibling parent Long Chang <changlong jkys.info> writes:
On Tue, Mar 22, 2011 at 8:57 PM, Iain Buclaw <ibuclaw ubuntu.com> wrote:
 =3D=3D Quote from Long Chang (changlong jkys.info)'s article
 Hello ,
 The DMD will support shared lib for linux in future, =A0But I wan't to
 know when this can be completed .
 I am try use GDC build libgdruntime.a with -fPIC, =A0and catch some
 error I can't fix it .
 for example:
 ../../../../libphobos/rt/arraybyte.d
 ../../../../libphobos/rt/arraybyte.d: In function
 =91_arraySliceExpAddSliceAssign_g=92:
 ../../../../libphobos/rt/arraybyte.d:220: error: PIC register =91ebx
 =92
 clobbered in =91asm=92
 If Druntime team can help GDC team fix this issue will be great .
 Kind Regards / Long Chang

Ignoring any bugs in Druntime and DMD regarding PIC code generation; GDC =

 used registers in any given asm statement in the clobbered list. Without =

 will not know of their usage, and so assumes the register(s) are free, th=

 it may decide to use them for storing other data.

 Regards

The GDC default build script report this error and stop building, I don't know to to ignore it. If the next GDC can release with shared lib support will be great news .
Mar 22 2011
prev sibling next sibling parent Long Chang <changlong jkys.info> writes:
On Tue, Mar 22, 2011 at 8:57 PM, Iain Buclaw <ibuclaw ubuntu.com> wrote:
 =3D=3D Quote from Long Chang (changlong jkys.info)'s article
 Hello ,
 The DMD will support shared lib for linux in future, =A0But I wan't to
 know when this can be completed .
 I am try use GDC build libgdruntime.a with -fPIC, =A0and catch some
 error I can't fix it .
 for example:
 ../../../../libphobos/rt/arraybyte.d
 ../../../../libphobos/rt/arraybyte.d: In function
 =91_arraySliceExpAddSliceAssign_g=92:
 ../../../../libphobos/rt/arraybyte.d:220: error: PIC register =91ebx
 =92
 clobbered in =91asm=92
 If Druntime team can help GDC team fix this issue will be great .
 Kind Regards / Long Chang

Ignoring any bugs in Druntime and DMD regarding PIC code generation; GDC =

 used registers in any given asm statement in the clobbered list. Without =

 will not know of their usage, and so assumes the register(s) are free, th=

 it may decide to use them for storing other data.

 Regards

I delete all error asm code line, it building success . But when I build my project, got this error : gcc -shared -o dmd_xtpl.so dmd_xtpl.o -L/home/opt/usr/local/lib64/ -lgphobos2 -lgdruntime -fPIC /usr/bin/ld: /home/opt/usr/local/lib64//libgphobos2.a(errno_.o): relocation R_X86_64_PC32 against undefined symbol `__errno_location GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: final link failed: Bad value collect2: ld returned 1 exit status
Mar 22 2011
prev sibling parent Long Chang <changlong jkys.info> writes:
I install libc_pic ,  and got this error :

gcc -shared -o dmd_xtpl.so dmd_xtpl.o -fPIC -m64
-L/home/opt/usr/local/lib64 -lgdruntime
-lc_pic/usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../../lib/libc_pic.a(init-=
first.os):
In function `_init':
(.text+0x20): multiple definition of `_init'
/usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../../lib/crti.o:(.init+0x0):
first defined here
/usr/bin/ld: dmd_xtpl.so: version node not found for symbol
pthread_cond_destroy  GLIBC_2.3.2
/usr/bin/ld: failed to set dynamic section sizes: Bad value
collect2: ld returned 1 exit status


On Tue, Mar 22, 2011 at 8:57 PM, Iain Buclaw <ibuclaw ubuntu.com> wrote:
 =3D=3D Quote from Long Chang (changlong jkys.info)'s article
 Hello ,
 The DMD will support shared lib for linux in future, =A0But I wan't to
 know when this can be completed .
 I am try use GDC build libgdruntime.a with -fPIC, =A0and catch some
 error I can't fix it .
 for example:
 ../../../../libphobos/rt/arraybyte.d
 ../../../../libphobos/rt/arraybyte.d: In function
 =91_arraySliceExpAddSliceAssign_g=92:
 ../../../../libphobos/rt/arraybyte.d:220: error: PIC register =91ebx
 =92
 clobbered in =91asm=92
 If Druntime team can help GDC team fix this issue will be great .
 Kind Regards / Long Chang

Ignoring any bugs in Druntime and DMD regarding PIC code generation; GDC =

 used registers in any given asm statement in the clobbered list. Without =

 will not know of their usage, and so assumes the register(s) are free, th=

 it may decide to use them for storing other data.

 Regards

--=20 .
Mar 22 2011