[Bug ld/19807] New: [2.26 regression] R_386_GOT32X optimization breaks linux kernel

2016-03-11 Thread fvogt at suse dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=19807

Bug ID: 19807
   Summary: [2.26 regression] R_386_GOT32X optimization breaks
linux kernel
   Product: binutils
   Version: 2.27 (HEAD)
Status: NEW
  Severity: critical
  Priority: P2
 Component: ld
  Assignee: unassigned at sourceware dot org
  Reporter: fvogt at suse dot com
  Target Milestone: ---

Building the i386 linux kernel (tried the latest 4.5 rc7, but all are broken)
with compression causes booting to fail during the decompression stage:
"Failed to allocate space for phdrs".

The kernel decompressor stage is linked to a fixed address, but running at a
different location.
This isn't a problem as it relocates itself by adding the difference to the GOT
entries,
but the optimization "mov $GOTOFF(%ecx), %eax" (R_386_GOT32X) -> "lea $address,
%eax" (R_386_32) breaks this,
as the GOT is no longer referenced in the final ELF.
Result is that some global variables, like free_mem_ptr_end, are overwritten
during decompression, causing weird errors like
malloc returing NULL.

Workaround: specify "--disable-x86-relax-relocations" configure option or
"-mrelax-relocations=no" to as.

See also:
https://bugzilla.opensuse.org/show_bug.cgi?id=970239
https://bugzilla.redhat.com/show_bug.cgi?id=1302071

-- 
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 ld/19807] [2.26 regression] R_386_GOT32X optimization breaks linux kernel

2016-03-11 Thread fvogt at suse dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=19807

--- Comment #2 from Fabian Vogt  ---
I tried that but it crashed even before the decompressor.
I'll have a closer look at that and report back.

-- 
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 ld/19807] [2.26 regression] R_386_GOT32X optimization breaks linux kernel

2016-03-11 Thread fvogt at suse dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=19807

Fabian Vogt  changed:

   What|Removed |Added

 Status|WAITING |ASSIGNED

--- Comment #6 from Fabian Vogt  ---
(In reply to H.J. Lu from comment #5)
> Created attachment 9089 [details]
> An updated patch to pass --no-dynamic-linker to linker

Applied and tested with 4.5rc7. Result: Boots fine!

-- 
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 ld/19807] [2.26 regression] R_386_GOT32X optimization breaks linux kernel

2016-03-14 Thread fvogt at suse dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=19807

--- Comment #9 from Fabian Vogt  ---
I just tested your patch again on a clean kernel tree, it seems that my
previous test was somehow wrong.

Using "-pie" as flag to LD causes

 leal(_bss-4)(%ebp), %esi
 leal(_bss-4)(%ebx), %edi

in arch/x86/boot/compressed/head_32.S to be

 leal-0x4(%ebp), %esi
 leal-0x4(%ebx), %edi

instead of the expected

 leal0x59a27c(%ebp),%esi
 leal0x59a27c(%ebx),%edi

so the kernel does not copy itself correctly.

-- 
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 ld/19807] [2.26 regression] R_386_GOT32X optimization breaks linux kernel

2016-03-14 Thread fvogt at suse dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=19807

--- Comment #10 from Fabian Vogt  ---
(In reply to Fabian Vogt from comment #9)
> I just tested your patch again on a clean kernel tree, it seems that my
> previous test was somehow wrong.

Actually, I just tried with binutils master instead of 2.26 again and it works.
Is there anything that can be used to get this working with 2.26?

-- 
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 ld/19807] [2.26 regression] R_386_GOT32X optimization breaks linux kernel

2016-03-14 Thread fvogt at suse dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=19807

--- Comment #12 from Fabian Vogt  ---
(In reply to H.J. Lu from comment #11)
> (In reply to Fabian Vogt from comment #10)
> > (In reply to Fabian Vogt from comment #9)
> > > I just tested your patch again on a clean kernel tree, it seems that my
> > > previous test was somehow wrong.
> > 
> > Actually, I just tried with binutils master instead of 2.26 again and it
> > works.
> > Is there anything that can be used to get this working with 2.26?
> 
> Did you mean binutils 2.26 branch or 2.26 release?

> ld -v
GNU ld (GNU Binutils; openSUSE Factory) 2.26.0.20160229-1

which is the 2.26 branch up to 4eb4e2ad76eb4bf5a2a2c20b2a2ec382fdbb3e2f.

-- 
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 ld/19807] [2.26 regression] R_386_GOT32X optimization breaks linux kernel

2016-03-14 Thread fvogt at suse dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=19807

--- Comment #14 from Fabian Vogt  ---
I could reproduce the issue with

GNU ld (GNU Binutils) 2.26.0.20160314

as well. For the difference, see comment 9.

-- 
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 ld/19807] [2.26 regression] R_386_GOT32X optimization breaks linux kernel

2016-03-15 Thread fvogt at suse dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=19807

--- Comment #16 from Fabian Vogt  ---
(In reply to H.J. Lu from comment #15)
> (In reply to Fabian Vogt from comment #14)
> > I could reproduce the issue with
> > 
> > GNU ld (GNU Binutils) 2.26.0.20160314
> > 
> > as well. For the difference, see comment 9.
> 
> Please try users/hjl/dynamic/binutils-2_26-branch branch.

Works fine.

-- 
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 ld/19807] [2.26 regression] R_386_GOT32X optimization breaks linux kernel

2016-03-16 Thread fvogt at suse dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=19807

Fabian Vogt  changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Resolution|FIXED   |---

--- Comment #21 from Fabian Vogt  ---
(In reply to Richard Guenther from comment #20)
> Hum, so we leave 2.26 broken?

The 2.26 release is not broken, "only" the binutils-2_26-branch.

Reopening to request clarification whether and how that can be solved.

-- 
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 ld/19807] [2.26 regression] R_386_GOT32X optimization breaks linux kernel

2016-03-19 Thread fvogt at suse dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=19807

--- Comment #24 from Fabian Vogt  ---
(In reply to H.J. Lu from comment #23)
> (In reply to Richard Guenther from comment #20)
> > Hum, so we leave 2.26 broken?
> 
> Please try users/hjl/pr19827/binutils-2_26-branch branch.

Tested and boots.

-- 
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