From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by sourceware.org (Postfix) with ESMTPS id D3C873840C18 for ; Tue, 2 Mar 2021 11:41:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org D3C873840C18 Received: by mail-wr1-x42d.google.com with SMTP id u14so19519529wri.3 for ; Tue, 02 Mar 2021 03:41:23 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=hUgpcuQe+/PwJe0bAKjbN1kyeSUfddZveos2PDl0os0=; b=eOyrmeWF+u7Bxp2feAMsLfyNSWgI0DX6GGAPmyKd3NYoS6eYqk/m/flSbcfQlF68jq e+81b3tlF4CcTMr4Y3+DScYutOFc0Wns8uuKMx0y2NSHOgYXVDHGwCLqGpF5JSx/FXH1 mCOm5LMBq/hlv4XwFNyot2zr83F2Rt4A6uJRrWQ9hsK6GBJ07fLkYh9qnjAXZprLASfz PaK9ov8Zf1CJyVYKFl/cJP5v+9upgcCbYaLklqRPjpVPzh1r1rmBSEO4X0rSyBJtDD6R W1bt9ZLZiGvYAJubUKCWiyHquNDwU+5B4BHurokiLnlgWa5ttgROTV6ycXS0ZK+ICGma 5c+w== X-Gm-Message-State: AOAM5327sW7wdfDXsFmlLjvF+p3lKA+6YuRRttk+tERdbmLR5890Lytn TzVTrhaVY1wyxLUhq4zWGSGdy5yqYNI7BDTJev4= X-Google-Smtp-Source: ABdhPJxhMwjrZnOWLrlHNtKf9LlTqECTmD0mI2JbFd9tV7ddP9SCKbllngi3dFJaJWfimHk9GCrN+N18LimzhDLv2Wc= X-Received: by 2002:adf:ee4f:: with SMTP id w15mr21195392wro.199.1614685283002; Tue, 02 Mar 2021 03:41:23 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Yeting Kuo Date: Tue, 2 Mar 2021 19:41:11 +0800 Message-ID: Subject: Re: G++ driver missing option when sending to collect2 To: Jim Wilson Cc: gcc-help X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00, BODY_8BITS, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, HTML_MESSAGE, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: gcc-help@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-help mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Mar 2021 11:41:25 -0000 Hi Jim, Thanks your advice. It helps me a lot. Best Regard, Yeting Kuo Jim Wilson =E6=96=BC 2021=E5=B9=B42=E6=9C=8827=E6=97=A5 = =E9=80=B1=E5=85=AD =E4=B8=8A=E5=8D=883:16=E5=AF=AB=E9=81=93=EF=BC=9A > On Wed, Feb 24, 2021 at 6:13 PM Yeting Kuo via Gcc-help < > gcc-help@gcc.gnu.org> wrote: > >> $ riscv32-unknown-elf-g++ test.o -Wl,--start-group x.o -lc -Wl,--end-gro= up >> -v >> > > If you make all of the options linker options instead of compiler options= , > then the compiler won't re-sort them. E.g. this works > riscv32-unknown-elf-g++ test.o -Wl,--start-group -Wl,x.o -Wl,-lc > -Wl,--end-group -v > > However, if you have some special library that requires special treatment= , > it is probably better to encode that in the specs. If this is for a > special target triplet, then you can modify the LINK_SPEC for the target = in > the gcc sources. Otherwise, you can try using a modified specs file. Yo= u > can use > riscv32-unknown-elf-gcc -dumpspecs > specs > to see the default specs file. You can provide an incremental specs file > to modify lib or link_command or whatever is appropriate for your target. > You can then specify the specs file when linking with -specs=3Dyourspecfi= le. > Or you can modify the default specs file and then copy it into the same d= ir > where cc1 lives if you want it used for all compilers. You can find an > example of how to do this incrementally in libgloss. > > https://sourceware.org/git/?p=3Dnewlib-cygwin.git;a=3Dblob;f=3Dlibgloss/r= iscv/nano.specs;h=3De12e31384241c58a5a07341a0f7cebc4fac9ed20;hb=3DHEAD > When using riscv-gnu-toolchain and adding -specs=3Dnano.specs we link wit= h > -lc_nano instead of -lc. A simpler example might just be appending an > extra library to lib. > > Jim > >