[Bug binutils/19145] New: [regression] arm-none-eabi big-endian LTO broken

2015-10-16 Thread jonathan at codesourcery dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=19145

Bug ID: 19145
   Summary: [regression] arm-none-eabi big-endian LTO broken
   Product: binutils
   Version: unspecified
Status: NEW
  Severity: normal
  Priority: P2
 Component: binutils
  Assignee: unassigned at sourceware dot org
  Reporter: jonathan at codesourcery dot com
  Target Milestone: ---

This is a continuation of: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67871

$ touch empty.c
$ arm-none-eabi-gcc -mbig-endian -flto empty.c
/tmp/ccUtMyOv.o: file not recognized: File format is ambiguous
/tmp/ccUtMyOv.o: matching formats: elf32-bigarm elf32-big
collect2: error: ld returned 1 exit status


I've git-bisected, keeping the gcc revision fixed to ToT, and following commit
seems to be the culprit:

commit 5ae0078cd2b6b69e6119864e20987c8724916b29
Author: H.J. Lu 
Date:   Wed Feb 11 05:01:03 2015 -0800

Merge linker plugin handling into BFD plugin support

Linker plugin_maybe_claim is the interface of linker plugin support.
This patch extracts linker plugin_maybe_claim into plugin_object_p and
makes it available to BFD via a new function:

void register_ld_plugin_object_p (const bfd_target *(*) (bfd *));

bfd_plugin_object_p calls plugin_object_p registered by linker first.  It
adds an enum bfd_plugin_format field and a pointer to plugin dummy BFD so
that plugin_object_p stores plugin dummy BFD to allow plugin_maybe_claim
to retrieve it later.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug binutils/19145] [regression] arm-none-eabi big-endian LTO broken

2015-10-16 Thread jonathan at codesourcery dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=19145

Jonathan Roelofs  changed:

   What|Removed |Added

 CC||hjl.tools at gmail dot com

-- 
You are receiving this mail because:
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug binutils/19145] [regression] arm-none-eabi big-endian LTO broken

2015-10-16 Thread jonathan at codesourcery dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=19145

--- Comment #2 from Jonathan Roelofs  ---
Created attachment 8727
  --> https://sourceware.org/bugzilla/attachment.cgi?id=8727&action=edit
object file compiled from empty source file

$ rm empty.c
$ touch empty.c
$ ./install/bin/arm-none-eabi-gcc -mbig-endian -flto empty.c -save-temps
empty.o: file not recognized: File format is ambiguous
empty.o: matching formats: elf32-bigarm elf32-big
collect2: error: ld returned 1 exit status
$ ./install/bin/arm-none-eabi-readelf -h empty.o
ELF Header:
  Magic:   7f 45 4c 46 01 02 01 00 00 00 00 00 00 00 00 00 
  Class: ELF32
  Data:  2's complement, big endian
  Version:   1 (current)
  OS/ABI:UNIX - System V
  ABI Version:   0
  Type:  REL (Relocatable file)
  Machine:   ARM
  Version:   0x1
  Entry point address:   0x0
  Start of program headers:  0 (bytes into file)
  Start of section headers:  888 (bytes into file)
  Flags: 0x500, Version5 EABI
  Size of this header:   52 (bytes)
  Size of program headers:   0 (bytes)
  Number of program headers: 0
  Size of section headers:   40 (bytes)
  Number of section headers: 15
  Section header string table index: 12
$ ./install/bin/arm-none-eabi-objdump -f empty.o

empty.o: file format elf32-bigarm
architecture: armv4t, flags 0x0010:
HAS_SYMS
start address 0x

-- 
You are receiving this mail because:
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug binutils/19145] [regression] arm-none-eabi big-endian LTO broken

2015-10-16 Thread jonathan at codesourcery dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=19145

--- Comment #3 from Jonathan Roelofs  ---
Unfortunately, that doesn't fix it.

My gcc and binutils configurations are described here:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67871#c3

I've attached the object file that I get from compiling an empty source file
(in case that reduces the number of things you need to build in order to
reproduce this). With that, you should see:

$ ./install/bin/arm-none-eabi-ld -EB -flto empty.o -plugin
./install/libexec/gcc/arm-none-eabi/6.0.0/liblto_plugin.so
empty.o: file not recognized: File format is ambiguous
empty.o: matching formats: elf32-bigarm elf32-big

-- 
You are receiving this mail because:
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug binutils/19145] [regression] arm-none-eabi big-endian LTO broken

2015-10-18 Thread jonathan at codesourcery dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=19145

--- Comment #5 from Jonathan Roelofs  ---
(In reply to H.J. Lu from comment #4)
> There are 2 issues:
> 
> 1. arm-none-eabi binutils only supports litte-endian.
> 2. arm-none-eabi GCC only supports little-endian.
> 
> To support big-endian, you should configure binutils and GCC for
> armeb-none-eabi.  Or you fix ARM EABI binutils and GCC to support
> both little-endian and big-endian.

I'm not convinced that's actually true. We've shipped working
arm-none-eabi-{gcc,binutils} toolchains with both the `be;@mbig-endian`
multilib and the `.;` (little-endian) multilib (among others) before.

>From the gcc testsuite results, it very much looks like the only difference in
failures between the little-endian multilib and the big-endian one is that any
testcase that uses -flto fails for the big-endian multilib.

This is definitely a regression.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug binutils/19145] [regression] arm-none-eabi big-endian LTO broken

2015-10-18 Thread jonathan at codesourcery dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=19145

--- Comment #7 from Jonathan Roelofs  ---
$ arm-none-eabi-ld -V
GNU ld (GNU Binutils) 2.25.51.20150929
  Supported emulations:
   armelf

-- 
You are receiving this mail because:
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug binutils/19145] [regression] arm-none-eabi big-endian LTO broken

2015-10-21 Thread jonathan at codesourcery dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=19145

--- Comment #9 from Jonathan Roelofs  ---
Created attachment 8735
  --> https://sourceware.org/bugzilla/attachment.cgi?id=8735&action=edit
fix implementation (binutils)

Ah, thanks. That will work.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug binutils/19145] [regression] arm-none-eabi big-endian LTO broken

2015-10-21 Thread jonathan at codesourcery dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=19145

--- Comment #10 from Jonathan Roelofs  ---
Created attachment 8736
  --> https://sourceware.org/bugzilla/attachment.cgi?id=8736&action=edit
fix implementation (gcc)

-- 
You are receiving this mail because:
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug binutils/19145] [regression] arm-none-eabi big-endian LTO broken

2015-10-21 Thread jonathan at codesourcery dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=19145

--- Comment #11 from Jonathan Roelofs  ---
One of my coworkers reminds me that we've done the same thing for linux before:

https://sourceware.org/ml/binutils/2006-10/msg00181.html

-- 
You are receiving this mail because:
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug binutils/19145] [regression] arm-none-eabi big-endian LTO broken

2015-10-21 Thread jonathan at codesourcery dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=19145

--- Comment #12 from Jonathan Roelofs  ---
https://sourceware.org/ml/binutils/2015-10/msg00181.html

-- 
You are receiving this mail because:
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils