Red Hat Bugzilla – Bug 1279172
When linking ppc64le objects on ppc64 host, gcc produces a ppc32le binary.
Last modified: 2016-12-20 10:31:22 EST
Description of problem:
I was trying to build a ppc64le kernel on a ppc64 host, all the kernel builds well, except the VDSO64 part. The difference here is the VDSO64 part is linked using gcc instead of ld.
The folloxing command is used to link:
gcc -mlittle-endian -m64 -Wl,-T -Wl,elf64lppc ...
and it fails:
file class ELFCLASS64 incompatible with ELFCLASS32
/usr/bin/powerpc64-linux-gnu-ld: final link failed: File in wrong format
This is because gcc calls collect2 with:
/usr/libexec/gcc/ppc64-redhat-linux/5.1.1/collect2", [ ... "--oformat",
"elf32-powerpcle", "-m", "elf64lppc",...
Version-Release number of selected component (if applicable):
Steps to Reproduce:
a.c -- 8< ---------------
b.c -- 8< ---------------
-- 8< -------------------
1- gcc -nostdlib -mlittle-endian -m64 -c -o a.o a.c
2- gcc -nostdlib -mlittle-endian -m64 -c -o b.o b.c
3- gcc -nostdlib -mlittle-endian -m64 -o c a.o b.o
1- file a.o
a.o: ELF 64-bit LSB relocatable, 64-bit PowerPC or cisco 7500, version 1 (SYSV), not stripped
2- file b.o
b.o: ELF 64-bit LSB relocatable, 64-bit PowerPC or cisco 7500, version 1 (SYSV), not stripped
3- file c
c: ELF 32-bit LSB executable, PowerPC or cisco 4500, version 1 (SYSV), statically linked, BuildID[sha1]=b1f7ec48c66453b7877818d9c6cfc153c2a0159e, not stripped
3- file c
c: ELF 64-bit LSB executable, 64-bit PowerPC or cisco 7500, version 1 (SYSV), statically linked, BuildID[sha1]=cd2c31117165176abec8e66300775cb4ac2286c7, not stripped
This has been fixed upstream in gcc-6
and backported to gcc-5:
Created attachment 1091247 [details]
backport of r228089 to fedora gcc RPM package
I've built and tested a gcc RPM with this patch and it works fine now.
This message is a reminder that Fedora 23 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 23. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora 'version'
Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.
Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 23 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.
Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.
Fedora 23 changed to end-of-life (EOL) status on 2016-12-20. Fedora 23 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.
If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
Thank you for reporting this bug and we are sorry it could not be fixed.