Re: Compiling gcc fails while trying to link libgcc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>:
>On Thu, Jul 9, 2020 at 1:51 AM Peter Lamby via Gcc-help
><gcc-help@xxxxxxxxxxx> 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.




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux