public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Yeting Kuo <fakepaper56@gmail.com>
To: gcc-help@gcc.gnu.org
Subject: G++ driver missing option when sending to collect2
Date: Thu, 25 Feb 2021 10:13:05 +0800	[thread overview]
Message-ID: <CAGhUdNi=2KqMBqTQ+jFGviYZzaFXmmBui+0-6LCGM85u6we-Zg@mail.gmail.com> (raw)

Hi all,
I have a compiler driver issue when using g++. I want to check whether it
is a bug.
I send '-Wl,--start-group x.o -lc -Wl,--end-group' to g++, but the command
collect2 received is '--start-group x.o --end-group' like the following
commands:

$ riscv32-unknown-elf-g++ test.o -Wl,--start-group x.o -lc -Wl,--end-group
-v 2>&1 | grep collect2
/home/users/eddiekuo/upstream_toolchain/riscv32-unknown-elf/bin/../libexec/gcc/riscv32-unknown-elf/11.0.0/collect2
-plugin
/home/users/eddiekuo/upstream_toolchain/riscv32-unknown-elf/bin/../libexec/gcc/riscv32-unknown-elf/11.0.0/liblto_plugin.so
-plugin-opt=/home/users/eddiekuo/upstream_toolchain/riscv32-unknown-elf/bin/../libexec/gcc/riscv32-unknown-elf/11.0.0/lto-wrapper
-plugin-opt=-fresolution=/tmp/ccoy0c2c.res -plugin-opt=-pass-through=-lgcc
-plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgloss
-plugin-opt=-pass-through=-lgcc -melf32lriscv
/home/users/eddiekuo/upstream_toolchain/riscv32-unknown-elf/bin/../lib/gcc/riscv32-unknown-elf/11.0.0/../../../../riscv32-unknown-elf/lib/crt0.o
/home/users/eddiekuo/upstream_toolchain/riscv32-unknown-elf/bin/../lib/gcc/riscv32-unknown-elf/11.0.0/crtbegin.o
-L/home/users/eddiekuo/upstream_toolchain/riscv32-unknown-elf/bin/../lib/gcc/riscv32-unknown-elf/11.0.0
-L/home/users/eddiekuo/upstream_toolchain/riscv32-unknown-elf/bin/../lib/gcc
-L/home/users/eddiekuo/upstream_toolchain/riscv32-unknown-elf/bin/../lib/gcc/riscv32-unknown-elf/11.0.0/../../../../riscv32-unknown-elf/lib
test.o --start-group x.o --end-group -lstdc++ -lm -lc -lgcc --start-group
-lc -lgloss --end-group -lgcc
/home/users/eddiekuo/upstream_toolchain/riscv32-unknown-elf/bin/../lib/gcc/riscv32-unknown-elf/11.0.0/crtend.o

Also I don't have the issue when using gcc:
$riscv32-unknown-elf-gcc test.o -Wl,--start-group x.o -lc -Wl,--end-group
-v 2>&1 | grep collect2
 /home/users/eddiekuo/upstream_toolchain/riscv32-unknown-elf/bin/../libexec/gcc/riscv32-unknown-elf/11.0.0/collect2
-plugin
/home/users/eddiekuo/upstream_toolchain/riscv32-unknown-elf/bin/../libexec/gcc/riscv32-unknown-elf/11.0.0/liblto_plugin.so
-plugin-opt=/home/users/eddiekuo/upstream_toolchain/riscv32-unknown-elf/bin/../libexec/gcc/riscv32-unknown-elf/11.0.0/lto-wrapper
-plugin-opt=-fresolution=/tmp/cccekJC0.res -plugin-opt=-pass-through=-lgcc
-plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgloss
-plugin-opt=-pass-through=-lgcc -melf32lriscv
/home/users/eddiekuo/upstream_toolchain/riscv32-unknown-elf/bin/../lib/gcc/riscv32-unknown-elf/11.0.0/../../../../riscv32-unknown-elf/lib/crt0.o
/home/users/eddiekuo/upstream_toolchain/riscv32-unknown-elf/bin/../lib/gcc/riscv32-unknown-elf/11.0.0/crtbegin.o
-L/home/users/eddiekuo/upstream_toolchain/riscv32-unknown-elf/bin/../lib/gcc/riscv32-unknown-elf/11.0.0
-L/home/users/eddiekuo/upstream_toolchain/riscv32-unknown-elf/bin/../lib/gcc
-L/home/users/eddiekuo/upstream_toolchain/riscv32-unknown-elf/bin/../lib/gcc/riscv32-unknown-elf/11.0.0/../../../../riscv32-unknown-elf/lib
test.o --start-group x.o -lc --end-group -lgcc --start-group -lc -lgloss
--end-group -lgcc
/home/users/eddiekuo/upstream_toolchain/riscv32-unknown-elf/bin/../lib/gcc/riscv32-unknown-elf/11.0.0/crtend.o

My g++ configuration:
$riscv32-unknown-elf-g++ -v
Using built-in specs.
COLLECT_GCC=/home/users1/eddiekuo/upstream_toolchain/riscv32-unknown-elf/bin/riscv32-unknown-elf-g++
COLLECT_LTO_WRAPPER=/home/users/eddiekuo/upstream_toolchain/riscv32-unknown-elf/bin/../libexec/gcc/riscv32-unknown-elf/11.0.0/lto-wrapper
Target: riscv32-unknown-elf
Configured with: ../gcc/configure --target=riscv32-unknown-elf
--prefix=/home/users1/eddiekuo/upstream_toolchain/riscv32-unknown-elf
--enable-languages=c,c++ --disable-multilib --without-headers
--disable-shared --disable-threads --disable-libatomic --disable-libmudflap
--disable-libssp --with-newlib
Thread model: single
Supported LTO compression algorithms: zlib
gcc version 11.0.0 20210223 (experimental) (GCC)

Thanks,
Yeting

             reply	other threads:[~2021-02-25  2:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-25  2:13 Yeting Kuo [this message]
2021-02-25  7:23 ` Jonathan Wakely
2021-02-26  1:57   ` Yeting Kuo
2021-02-26 19:15 ` Jim Wilson
2021-03-02 11:41   ` Yeting Kuo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAGhUdNi=2KqMBqTQ+jFGviYZzaFXmmBui+0-6LCGM85u6we-Zg@mail.gmail.com' \
    --to=fakepaper56@gmail.com \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).