Bug 1275709

Summary: ppc64 ld cannot link ppc64le objects
Product: [Fedora] Fedora Reporter: Laurent Vivier <laurent>
Component: binutilsAssignee: Nick Clifton <nickc>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: unspecified    
Version: 22CC: jakub, nickc
Target Milestone: ---   
Target Release: ---   
Hardware: ppc64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-19 20:15:10 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Add ppc64le target for ld in .specs none

Description Laurent Vivier 2015-10-27 14:30:13 UTC
Created attachment 1086859 [details]
Add ppc64le target for ld in .specs

Description of problem:

ld cannot manages ppc64le objects.

$ ld -V
GNU ld version 2.25-9.fc22
  Supported emulations:
   elf64ppc
   elf32ppc
   elf32ppclinux
   elf32ppcsim
   elf32_spu

As 'as', 'gdb' and 'gcc' are able to manage little-endian code, ld is the only missing part to build/debug a ppc64le kernel on a ppc64 host.

Version-Release number of selected component (if applicable):

$ ld -v
GNU ld version 2.25-9.fc22

How reproducible:

100%

Steps to Reproduce:
1. vi le.c
static const int a = 0x12345678;

void _start(void)
{
}
2. gcc -g -nostdlib -mlittle-endian -m64 -c -o le.o le.c
3. ld -melf64lppc -o le le.o

Actual results:

ld: unrecognised emulation mode: elf64lppc
Supported emulations: elf64ppc elf32ppc elf32ppclinux elf32ppcsim elf32_spu

Expected results:

$ gcc -g -nostdlib -mlittle-endian -m64 -c -o le.o le.c
$ file le.o
le.o: ELF 64-bit LSB relocatable, 64-bit PowerPC or cisco 7500, version 1 (SYSV), not stripped
$ ld -melf64lppc -o le le.o
$ file le
le: ELF 64-bit LSB executable, 64-bit PowerPC or cisco 7500, version 1 (SYSV), statically linked, not stripped
$ gdb le
GNU gdb (GDB) Fedora 7.9.1-19.fc22
...
(gdb) x/4xb &a
0x10000110 <a>:	0x78	0x56	0x34	0x12

On big endian we have here:

(gdb) x/4xb &a
0x10000110 <a>:	0x12	0x34	0x56	0x78

Additional info:

Comment 1 Nick Clifton 2015-10-28 12:37:08 UTC
Hi Laurent,

  Thanks for the bug report and patch.  I have now applied the patch to the rawhide binutils, so if you try out  binutils-2.25.1-8.fc24  you should find that it works.

Cheers
  Nick

Comment 2 Fedora End Of Life 2016-07-19 20:15:10 UTC
Fedora 22 changed to end-of-life (EOL) status on 2016-07-19. Fedora 22 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
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.