Re: link time optimization issue

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

 



On 2014.05.13 at 13:02 +0200, Henrik Juul Pedersen wrote:
> Hi,
> 
> I've been experimenting with link time optimization with GCC, and have
> run into an issue with some existing code:
> 
> == Test scenario ==
> - foo.c:
> int foo ( void ) {
>     return 3;
> }
> 
> - bar.c:
> #include <stdio.h>
> 
> int foo( void );
> 
> int main ( void ) {
>     printf("Foo returns: %d\n", foo());
>     return 0;
> }
> 
> == Compilation ==
> gcc -flto -O2 -c foo.c
> ar rcs libfoo.a foo.o
> gcc -flto -O2 -L. bar.c -lfoo -o myprog
> /tmp/ccGcDjka.ltrans0.ltrans.o: In function `main':
> ccGcDjka.ltrans0.o:(.text+0x5): undefined reference to `foo'
> collect2: error: ld returned 1 exit status

See: https://gcc.gnu.org/wiki/LinkTimeOptimizationFAQ

-- 
Markus




[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