Bug 60530 - openssh-6.5p1 can't be built with lto - revision 208516
Summary: openssh-6.5p1 can't be built with lto - revision 208516
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: lto (show other bugs)
Version: 4.9.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-14 18:16 UTC by David Kredba
Modified: 2014-03-16 07:30 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
Un-reduced preprocessed source file gzipped (74.18 KB, application/octet-stream)
2014-03-14 18:16 UTC, David Kredba
Details

Note You need to log in before you can comment on or make changes to this bug.
Description David Kredba 2014-03-14 18:16:27 UTC
Created attachment 32351 [details]
Un-reduced preprocessed source file gzipped

The only one object file causing the erro from -o ssh ssh.o readconf.o clientloop.o sshtty.o sshconnect.o sshconnect1.o sshconnect2.o mux.o roaming_common.o roaming_client.o is ssh.o.

x86_64-pc-linux-gnu-gcc -o ssh ssh.i -L. -Lopenbsd-compat/ -flto=4 -fuse-linker-plugin -Wl,--as-needed -Wl,-O2 -Wl,-flto -O2 -ggdb -pipe -march=native -mtune=native -mno-3dnow -mno-sse4.2 -mno-avx -Wl,-z,relro -Wl,-z,now -Wl,-z,noexecstack -fstack-protector-strong -flto=4 -fuse-linker-plugin -Wl,--as-needed -Wl,-O2 -Wl,-flto -O2 -ggdb -pipe -march=native -mtune=native -mno-3dnow -mno-sse4.2 -mno-avx -pie -lssh -lopenbsd-compat  -lssl -lcrypto  -ldl -lutil -lz -lnsl  -lcrypt -lresolv -lpthread 
umac.c:1193:3: warning: type of 'umac_ctx' does not match original declaration
 } umac_ctx;
   ^
./umac.c:1193:3: note: previously declared here
 } umac_ctx;
   ^
/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.0-alpha20140311/../../../../x86_64-pc-linux-gnu/bin/ld: /tmp/ccKc90pS.ltrans0.ltrans.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/tmp/ccKc90pS.ltrans0.ltrans.o: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
Comment 1 David Kredba 2014-03-14 18:21:46 UTC
When system libraries are removed, ssh.i file links to ssh file:

x86_64-pc-linux-gnu-gcc -o ssh ssh.i -L. -Lopenbsd-compat/ -flto=4 -fuse-linker-plugin -Wl,--as-needed -Wl,-O2 -Wl,-flto -O2 -ggdb -pipe -march=native -mtune=native -mno-3dnow -mno-sse4.2 -mno-avx -Wl,-z,relro -Wl,-z,now -Wl,-z,noexecstack -fstack-protector-strong -flto=4 -fuse-linker-plugin -Wl,--as-needed -Wl,-O2 -Wl,-flto -O2 -ggdb -pipe -march=native -mtune=native -mno-3dnow -mno-sse4.2 -mno-avx -r -nostdlib

ls -l ssh
-rw-r--r-- 1 root root 129751 Mar 14 19:21 ssh
Comment 2 H.J. Lu 2014-03-14 18:43:11 UTC
(In reply to David Kredba from comment #0)
> Created attachment 32351 [details]
> Un-reduced preprocessed source file gzipped
> 
> The only one object file causing the erro from -o ssh ssh.o readconf.o
> clientloop.o sshtty.o sshconnect.o sshconnect1.o sshconnect2.o mux.o
> roaming_common.o roaming_client.o is ssh.o.
> 
> x86_64-pc-linux-gnu-gcc -o ssh ssh.i -L. -Lopenbsd-compat/ -flto=4
> -fuse-linker-plugin -Wl,--as-needed -Wl,-O2 -Wl,-flto -O2 -ggdb -pipe
> -march=native -mtune=native -mno-3dnow -mno-sse4.2 -mno-avx -Wl,-z,relro
> -Wl,-z,now -Wl,-z,noexecstack -fstack-protector-strong -flto=4
> -fuse-linker-plugin -Wl,--as-needed -Wl,-O2 -Wl,-flto -O2 -ggdb -pipe
> -march=native -mtune=native -mno-3dnow -mno-sse4.2 -mno-avx -pie -lssh
> -lopenbsd-compat  -lssl -lcrypto  -ldl -lutil -lz -lnsl  -lcrypt -lresolv
> -lpthread 
> umac.c:1193:3: warning: type of 'umac_ctx' does not match original
> declaration
>  } umac_ctx;
>    ^
> ./umac.c:1193:3: note: previously declared here
>  } umac_ctx;
>    ^
> /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.0-alpha20140311/../../../../x86_64-pc-
> linux-gnu/bin/ld: /tmp/ccKc90pS.ltrans0.ltrans.o: relocation R_X86_64_32
> against `.rodata.str1.1' can not be used when making a shared object;
> recompile with -fPIC
> /tmp/ccKc90pS.ltrans0.ltrans.o: error adding symbols: Bad value
> collect2: error: ld returned 1 exit status

When -pie is used, you need to add -fpie.
Comment 3 David Kredba 2014-03-15 16:10:15 UTC
Thank you.

So it is Openssh bug?

-fpie should come from configure processing, should not?
Comment 4 David Kredba 2014-03-16 07:30:37 UTC
-fpie in LDFLAGS fixed it, thank you!

(Going to open a Gentoo report.)