Preliminary shared runtime support in build system #32

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants
@jpf91
Contributor

jpf91 commented Sep 28, 2012

This only adjusts the build system, no changes to the compiler or runtime are included. This allows specifying a PIC_FLAGS environment available to enable -fPIC when compiling and adds two new targets to the Makefiles: libgdruntime.so and libgphobos2.so

This is meant to make the development of a shared runtime easier, but not for production use. The shared libraries are not built by default and they are not installed into the target system.

(The libraries are also not correctly versioned, but as shared library versioning depends on stable ABIs we can't decide anything here without phobos upstream)

When the shared runtime support is finished, we probably want to ship both static and shared libraries. But we probably wouldn't want the static library to be built with -fPIC so we'd have to make some changes in the Makefile to compile all files twice.

See also: http://gdcproject.org/wiki/SharedRuntime

@ibuclaw

This comment has been minimized.

Show comment
Hide comment
@ibuclaw

ibuclaw Sep 28, 2012

Member

LTGM.

I think initially though, will want only libgphobos to be compiled as a shared library by default. A possible scenario for the mid-term future would be splitting libgdruntime into two libgdruntime-core and libgdruntime-rt libraries (-rt being static as contains C main).

Member

ibuclaw commented Sep 28, 2012

LTGM.

I think initially though, will want only libgphobos to be compiled as a shared library by default. A possible scenario for the mid-term future would be splitting libgdruntime into two libgdruntime-core and libgdruntime-rt libraries (-rt being static as contains C main).

Preliminary shared runtime support in build system
This only adjusts the build system, no changes to the compiler
or runtime are included. This allows specifying a PIC_FLAGS
environment available to enable -fPIC when compiling and
adds two new targets to the Makefiles: libgdruntime.so and
libgphobos2.so

See also: http://gdcproject.org/wiki/SharedRuntime
@jpf91

This comment has been minimized.

Show comment
Hide comment
@jpf91

jpf91 Sep 30, 2012

Contributor

Two small updates:

  • We should link shared libraries with -nophoboslib, we should never use -nostdlib as it breaks something in the C library (When linking the final application it tried to link to hidden symbols (fstat64) in libc_noshared.a if nostdlib was used, using nophoboslib instead works).
  • std/c/linux/linux.o was part of LINUX_OBJS, but on unix it's always appended to D_EXTRA_OBJS as well. So it was linked in twice on linux, causing duplicate symbol errors. Fixed by removing std/c/linux/linux.o from LINUX_OBJS.

I'll try to run the test suite against the shared libraries now, I'm curious how well it's working ;-)

Contributor

jpf91 commented Sep 30, 2012

Two small updates:

  • We should link shared libraries with -nophoboslib, we should never use -nostdlib as it breaks something in the C library (When linking the final application it tried to link to hidden symbols (fstat64) in libc_noshared.a if nostdlib was used, using nophoboslib instead works).
  • std/c/linux/linux.o was part of LINUX_OBJS, but on unix it's always appended to D_EXTRA_OBJS as well. So it was linked in twice on linux, causing duplicate symbol errors. Fixed by removing std/c/linux/linux.o from LINUX_OBJS.

I'll try to run the test suite against the shared libraries now, I'm curious how well it's working ;-)

@jpf91

This comment has been minimized.

Show comment
Hide comment
@jpf91

jpf91 Dec 9, 2012

Contributor

Closed till we have a proper solution.

Contributor

jpf91 commented Dec 9, 2012

Closed till we have a proper solution.

@jpf91 jpf91 closed this Dec 9, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment