From: Peter Lamby <dev@peterlamby.de>
To: Jim Wilson <jimw@sifive.com>
Cc: gcc-help <gcc-help@gcc.gnu.org>
Subject: Re: Compiling gcc fails while trying to link libgcc
Date: Sat, 11 Jul 2020 09:50:10 +0200 [thread overview]
Message-ID: <2DC9FA62-4556-48A5-A97D-0FF67A268489@peterlamby.de> (raw)
In-Reply-To: <CAFyWVabpkVREEK4P2WOGEayvum6CBOEabt8iSTo6VfjsBA_sJQ@mail.gmail.com>
Hi Jim,
removing both pie flags did the trick. I removed the
fno-plt too. Thanks for your help.
I like the default flag for pie. This way I don't have to set them
via CFLAGS and have them break my library builds :)
Best
Peter
Am 11. Juli 2020 03:35:38 MESZ schrieb Jim Wilson <jimw@sifive.com>:
>On Thu, Jul 9, 2020 at 1:51 AM Peter Lamby via Gcc-help
><gcc-help@gcc.gnu.org> wrote:
>> export CFLAGS=-pipe -march=native -fstack-protector-strong -fno-plt \
>> -pie -fpie
>
>You can't use -pie when linking a shared library. So this isn't going
>to work. Also the -fno-plt is suspicious. Can you compile a shared
>library without plts? The -fpie is clearly wrong too. You need to do
>this a different way. Note that gcc has a configure option
>--enable-default-pie which will produce pie output by default, but
>won't pass -pie to the linker with -static, -shared, or -r. And won't
>add -fpie if -fpic was specified.
>
>rohan:2242$ gcc -shared -fpic -o tmp.so tmp.c
>rohan:2243$ gcc -shared -fpic -o tmp.so tmp.c -pie
>/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o: In
>function `_start':
>(.text+0x20): undefined reference to `main'
>collect2: error: ld returned 1 exit status
>rohan:2244$
>
>Jim
--
Diese Nachricht wurde von meinem Android-Gerät mit K-9 Mail gesendet.
prev parent reply other threads:[~2020-07-11 7:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-09 8:49 Peter Lamby
2020-07-11 1:35 ` Jim Wilson
2020-07-11 7:50 ` Peter Lamby [this message]
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=2DC9FA62-4556-48A5-A97D-0FF67A268489@peterlamby.de \
--to=dev@peterlamby.de \
--cc=gcc-help@gcc.gnu.org \
--cc=jimw@sifive.com \
/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).