This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: What is the raw ld command called by gcc?
- From: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- To: Peng Yu <pengyu dot ut at gmail dot com>
- Cc: "gcc-help at gcc dot gnu dot org" <gcc-help at gcc dot gnu dot org>
- Date: Thu, 24 Jan 2019 17:20:42 +0000
- Subject: Re: What is the raw ld command called by gcc?
- References: <CABrM6wk0w2Uc6ogafMiLGWOouynW9+xNf=LbE5zROCcEu61m4Q@mail.gmail.com>
On Thu, 24 Jan 2019 at 17:13, Peng Yu <pengyu.ut@gmail.com> wrote:
>
> Hi
>
> I'd like to know the raw ld command is called by gcc. Is there a way
> to figure it out?
Use gcc's -v option.
> Also, why gcc acts like a front end to ld for which people has to use
> options like -Wl?
>
> Why not keep ld and gcc separated, so that if people want to link they
> just call ld? Thanks.
Because gcc adds several things to the linker command, and knows how
to invoke the linker for your target. Using gcc gives a uniform
interface, and is more convenient than adding all the extra arguments
by hand.
If you want to use ld directly, nothing stops you doing that.