[PATCH] Generalize -fuse-ld= to support absolute path or arbitrary ld.linker

Jakub Jelinek jakub@redhat.com
Mon Jun 28 13:46:48 GMT 2021


On Mon, Jun 28, 2021 at 03:26:21PM +0200, Martin Liška wrote:
> > There are 2 options:
> > 1. Add mold to -fuse-ld option
> > 2. Implement --ld-path
> > 
> > The 2nd option is much more future-proof: you won't need to add new
> > -fuse-ld variant each time new linker comes up. To provide some
> > context: clang had been supporting passing path to -fuse-ld, but since
> > clang 12 this is deprecated in favor of new --ld-path option. I think
> > we should take an example from clang and implement this useful feature
> > in gcc as well.
> 
> Can you please provide a pointer for the deprecation.
> I'm adding Jakub who recommended using the -B argument.

-B will work with any gcc version, at least from the past 3+ decades,
just mkdir /whatever/dir/ and put the linker or symlink (with ld basename)
to it there, then -B /whatever/dir/

--ld-path= is a bad idea, it doesn't follow use any usual option naming
conventions.

Note, all these extra linkers (lld, mold) will not really work properly,
gcc during configuration detects various assembler and linker properties
on which it then relies on and I'm sure neither lld nor mold supports
those features.

HAVE_LD_ALIGNED_SHF_MERGE
HAVE_LD_AS_NEEDED
HAVE_LD_AVR_AVRXMEGA3_RODATA_IN_FLASH
HAVE_LD_BNDPLT_SUPPORT
HAVE_LD_BROKEN_PE_DWARF5
HAVE_LD_BUILDID
HAVE_LD_CLEARCAP
HAVE_LD_COMPRESS_DEBUG
HAVE_LD_DEMANGLE
HAVE_LD_EH_FRAME_CIEV3
HAVE_LD_EH_FRAME_HDR
HAVE_LD_EH_GC_SECTIONS
HAVE_LD_EH_GC_SECTIONS_BUG
HAVE_LD_LARGE_TOC
HAVE_LD_NO_DOT_SYMS
HAVE_LD_PERSONALITY_RELAXATION
HAVE_LD_PIE
HAVE_LD_PIE_COPYRELOC
HAVE_LD_PPC_GNU_ATTR_LONG_DOUBLE
HAVE_LD_PUSHPOPSTATE_SUPPORT
HAVE_LD_RO_RW_SECTION_MIXING
HAVE_LD_SOL2_EMULATION
HAVE_LD_STATIC_DYNAMIC
HAVE_LD_SYSROOT

is what is currently tested (not all of these for all targets).

	Jakub



More information about the Gcc-patches mailing list