www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.ldc - Pass parameter to gcc linker

reply Oleg B <code.viator gmail.com> writes:
Hello

I need to pass parameter to gcc then cross build D code for ARM.
In my case I have some missversions (I think) in cross compile 
tool stack: sysroot builded with unknown (for me) compiler, I use 
compiler with exact glibc version but with other build flags, and 
may be something else.

Problem: then I try to build my D code I get this kinds of errors:

/arm-gcc/bin/../lib/gcc/arm-linux-gnueabihf/8.2.1/../../../../arm-linux-gn
eabihf/bin/ld.gold: error:
/arm-gcc/bin/../libexec/gcc/arm-linux-gnueabihf/8.2.1/liblto_plugin.so: not
configured to support 64-bit little-endian object
/arm-gcc/bin/../lib/gcc/arm-linux-gnueabihf/8.2.1/../../../../arm-linux-gn
eabihf/bin/ld.gold: error: cannot find -lugin
/arm-gcc/bin/../lib/gcc/arm-linux-gnueabihf/8.2.1/../../../../arm-linux-gn
eabihf/bin/ld.gold: error: cannot find
-lugin-opt=/arm-gcc/bin/../libexec/gcc/arm-linux-gnueabihf/8.2.1/lto-wrapper
/arm-gcc/bin/../lib/gcc/arm-linux-gnueabihf/8.2.1/../../../../arm-linux-gn
eabihf/bin/ld.gold: error: cannot find -lugin-opt=-fresolution=/tmp/cc89QFF3.res
...

I found only one resolution of problem: in ldc2.conf I select 
custom script for `-gcc` switch instead of direct compiler name

custom script disable lto for gcc call:


arm-linux-gnueabihf-gcc -fno-lto $ 

how to pass `-fno-lto` to gcc without "custom-script-hacking"?
As I know ldc used gcc only for linkage, but `-L-fno-lto` don't 
has effect.

gcc from 
https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-a/downloads

ldc 1.22.0 from github
Oct 05 2020
parent reply kinke <noone nowhere.com> writes:
Use -Xcc for linker driver flags (cc), not -L (for the actual 
linker, ld).
Oct 05 2020
parent Oleg B <code.viator gmail.com> writes:
On Monday, 5 October 2020 at 19:12:14 UTC, kinke wrote:
 Use -Xcc for linker driver flags (cc), not -L (for the actual 
 linker, ld).
Thanks!
Oct 05 2020