Skip to content

Conversation

dbankov-broadcom
Copy link

Add -Xcc and -gcc options to better support bootstrapping of LDC.
Having -Xcc and -gcc options is also useful in general when having to
link D and C/C++ object files.

@dbankov-broadcom
Copy link
Author

dbankov-broadcom commented Aug 21, 2021

BTW this PR is the result of the discussion in ldc-developers/ldc#3810 PR. This change will allow bootstrapping LDC with statically linked GDRuntime and GPhobos by using:

cmake -G Ninja <ldc-src-dir> -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PWD/../install -DD_COMPILER=gdmd-11 -DD_COMPILER_ID=GDMD -DD_COMPILER_FE_VERSION=2076 -DD_COMPILER_FLAGS=-gcc=g++-11 -DCMAKE_C_COMPILER=gcc-11 -DCMAKE_CXX_COMPILER=g++-11 -DLDC_LINK_MANUALLY=OFF

The above will unfortunately result in the symbol conflicts mentioned in ldc-developers/ldc#3810 unless a version of GCC which has the corresponding symbols marked as weak is used (I'll post a PR with this change shortly). Passing -q,-shared-libphobos (see below) could be used as a workaround until GDRuntime and GPhobos are updated to have the corresponding symbols marked as weak in the upstream GCC repository.

cmake -G Ninja <ldc-src-dir> -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PWD/../install -DD_COMPILER=gdmd-11 -DD_COMPILER_ID=GDMD -DD_COMPILER_FE_VERSION=2076 -DD_COMPILER_FLAGS="-gcc=g++-11 -q,-shared-libphobos" -DCMAKE_C_COMPILER=gcc-11 -DCMAKE_CXX_COMPILER=g++-11 -DLDC_LINK_MANUALLY=OFF

Add -Xcc and -gcc options to better support bootstrapping of LDC.
Having -Xcc and -gcc options is also useful in general when having to
link D and C/C++ object files.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant