Package: gcc-4.5
Version: 4.5-20100227-1
Severity: normal
Tags: experimental

gcc-4.5 with -flto doesn't work with -fPIC properly.

Simple testcase:
int entry(int a)
{
    return bar(a)+1;
}

int bar(int a)
{
    return a+4;
}

$ gcc-4.5 foo1.c -flto -fPIC -DPIC -c
$ gcc-4.5 foo2.c -flto -fPIC -DPIC -c
$ gcc-4.5 foo1.o foo2.o -flto -shared
/usr/bin/ld: /tmp/ccmA7RCK.lto.o: relocation R_X86_64_PC32 against symbol `bar' 
can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
collect2: ld returned 1 exit status

This works however:
$ gcc-4.5 foo1.o foo2.o -flto -shared -fPIC

Now -fPIC is something libtool automatically adds, and I it doesn't add it at
linktime (perhaps other build systems don't either).
Could gcc's -flto see that all .o files involved in the link are -fPIC... and
make the resulting file -fPIC too?
Or at least it should see the -shared in the linker line, and automatically use
-fPIC when -flto is used.


-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (990, 'unstable'), (500, 'testing'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.33-00175-g2d1299a0 (SMP w/4 CPU cores; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages gcc-4.5 depends on:
ii  binutils                2.20.1-3         The GNU assembler, linker and bina
ii  cpp-4.5                 4.5-20100227-1   The GNU C preprocessor
ii  gcc-4.5-base            4.5-20100227-1   The GNU Compiler Collection (base 
ii  libc6                   2.10.2-6         Embedded GNU C Library: Shared lib
ii  libcloog-ppl0           0.15.8-1         the Chunky Loop Generator (runtime
ii  libelfg0                0.8.12-0.1       an ELF object file access library
ii  libgcc1                 1:4.5-20100227-1 GCC support library
ii  libgmp3c2               2:4.3.2+dfsg-1   Multiprecision arithmetic library
ii  libgmpxx4ldbl           2:4.3.2+dfsg-1   Multiprecision arithmetic library 
ii  libgomp1                4.5-20100227-1   GCC OpenMP (GOMP) support library
ii  libmpc2                 0.8.1-1          multiple precision complex floatin
ii  libmpfr1ldbl            2.4.2-3          multiple precision floating-point 
ii  libppl-c2               0.10.2-6         Parma Polyhedra Library (C interfa
ii  libppl7                 0.10.2-6         Parma Polyhedra Library (runtime l
ii  zlib1g                  1:1.2.3.4.dfsg-3 compression library - runtime

Versions of packages gcc-4.5 recommends:
ii  libc6-dev                     2.10.2-6   Embedded GNU C Library: Developmen

Versions of packages gcc-4.5 suggests:
pn  gcc-4.5-doc                   <none>     (no description available)
pn  gcc-4.5-locales               <none>     (no description available)
pn  gcc-4.5-multilib              <none>     (no description available)
pn  libgcc1-dbg                   <none>     (no description available)
pn  libgomp1-dbg                  <none>     (no description available)
pn  libmudflap0-4.5-dev           <none>     (no description available)
pn  libmudflap0-dbg               <none>     (no description available)

-- no debconf information



-- 
To UNSUBSCRIBE, email to debian-gcc-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/20100325213843.7735.41797.report...@debian

Reply via email to