All of lore.kernel.org
 help / color / mirror / Atom feed
* FYI: old OCTEON bootloaders and .MIPS.abiflags
@ 2015-10-28 19:54 Aaro Koskinen
  2015-10-28 21:02 ` Matthew Fortune
  0 siblings, 1 reply; 6+ messages in thread
From: Aaro Koskinen @ 2015-10-28 19:54 UTC (permalink / raw)
  To: linux-mips; +Cc: David Daney, Ralf Baechle, Matthew Fortune

Hi,

Current binutils adds .MIPS.abiflags section to the kernel vmlinux.

This seems break the boot on some old (buggy) OCTEON bootloaders:

	ELF file is 64 bit
	Attempting to allocate memory for ELF segment: addr: 0xffffffff816e67f0 (adjusted to: 0x00000000016e67f0), size 0x18
	Allocated memory for ELF segment: addr: 0xffffffff816e67f0, size 0x18
	Attempting to allocate memory for ELF segment: addr: 0xffffffff81100000 (adjusted to: 0x0000000001100000), size 0x1b86360
	Error allocating memory for elf image!
	## ERROR loading File!

The workaround is to remove the .MIPS.abiflags with "strip" - I guess that
is safe for the kernel... Not sure if there is nothing much else to be
done, and already a similar hack needs to be done for the .notes section.

I just wanted to post this in case some else faces the same issue.

A.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: old OCTEON bootloaders and .MIPS.abiflags
  2015-10-28 19:54 FYI: old OCTEON bootloaders and .MIPS.abiflags Aaro Koskinen
@ 2015-10-28 21:02 ` Matthew Fortune
  2015-10-29 21:35   ` Ralf Baechle
  0 siblings, 1 reply; 6+ messages in thread
From: Matthew Fortune @ 2015-10-28 21:02 UTC (permalink / raw)
  To: Aaro Koskinen, linux-mips@linux-mips.org; +Cc: David Daney, Ralf Baechle

Aaro Koskinen <aaro.koskinen@iki.fi> writes:
> Current binutils adds .MIPS.abiflags section to the kernel vmlinux.
> 
> This seems break the boot on some old (buggy) OCTEON bootloaders:
> 
> 	ELF file is 64 bit
> 	Attempting to allocate memory for ELF segment: addr: 0xffffffff816e67f0 (adjusted to:
> 0x00000000016e67f0), size 0x18
> 	Allocated memory for ELF segment: addr: 0xffffffff816e67f0, size 0x18
> 	Attempting to allocate memory for ELF segment: addr: 0xffffffff81100000 (adjusted to:
> 0x0000000001100000), size 0x1b86360
> 	Error allocating memory for elf image!
> 	## ERROR loading File!
> 
> The workaround is to remove the .MIPS.abiflags with "strip" - I guess that
> is safe for the kernel... Not sure if there is nothing much else to be
> done, and already a similar hack needs to be done for the .notes section.
> 
> I just wanted to post this in case some else faces the same issue.

It seems reasonably sensible to /DISCARD/ the .MIPS.abiflags section in the kernel link
scripts as I don't think the kernel needs that information for any purpose. I assume
.reginfo is discarded as well at some point.

Matthew

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: old OCTEON bootloaders and .MIPS.abiflags
  2015-10-28 21:02 ` Matthew Fortune
@ 2015-10-29 21:35   ` Ralf Baechle
  2015-10-29 22:15       ` Matthew Fortune
  0 siblings, 1 reply; 6+ messages in thread
From: Ralf Baechle @ 2015-10-29 21:35 UTC (permalink / raw)
  To: Matthew Fortune; +Cc: Aaro Koskinen, linux-mips@linux-mips.org, David Daney

On Wed, Oct 28, 2015 at 09:02:43PM +0000, Matthew Fortune wrote:

> Aaro Koskinen <aaro.koskinen@iki.fi> writes:
> > Current binutils adds .MIPS.abiflags section to the kernel vmlinux.
> > 
> > This seems break the boot on some old (buggy) OCTEON bootloaders:
> > 
> > 	ELF file is 64 bit
> > 	Attempting to allocate memory for ELF segment: addr: 0xffffffff816e67f0 (adjusted to:
> > 0x00000000016e67f0), size 0x18
> > 	Allocated memory for ELF segment: addr: 0xffffffff816e67f0, size 0x18
> > 	Attempting to allocate memory for ELF segment: addr: 0xffffffff81100000 (adjusted to:
> > 0x0000000001100000), size 0x1b86360
> > 	Error allocating memory for elf image!
> > 	## ERROR loading File!
> > 
> > The workaround is to remove the .MIPS.abiflags with "strip" - I guess that
> > is safe for the kernel... Not sure if there is nothing much else to be
> > done, and already a similar hack needs to be done for the .notes section.
> > 
> > I just wanted to post this in case some else faces the same issue.
> 
> It seems reasonably sensible to /DISCARD/ the .MIPS.abiflags section in the kernel link
> scripts as I don't think the kernel needs that information for any purpose. I assume
> .reginfo is discarded as well at some point.

Historically discarding .reginfo didn't work because it is generated
by ld after it has generated all the output sections according to the
linker script.  So no matter what, one always ended up with a .reginfo.
This has been fixed at some point but I'm concerned the same behaviour
might have existed for .MIPS.abiflags as well and versions that do the
same thing with .MIPS.abiflags might still be around.

  Ralf

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: old OCTEON bootloaders and .MIPS.abiflags
@ 2015-10-29 22:15       ` Matthew Fortune
  0 siblings, 0 replies; 6+ messages in thread
From: Matthew Fortune @ 2015-10-29 22:15 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: Aaro Koskinen, linux-mips@linux-mips.org, David Daney

Ralf Baechle <ralf@linux-mips.org> writes:
> On Wed, Oct 28, 2015 at 09:02:43PM +0000, Matthew Fortune wrote:
> 
> > Aaro Koskinen <aaro.koskinen@iki.fi> writes:
> > > Current binutils adds .MIPS.abiflags section to the kernel vmlinux.
> > >
> > > This seems break the boot on some old (buggy) OCTEON bootloaders:
> > >
> > > 	ELF file is 64 bit
> > > 	Attempting to allocate memory for ELF segment: addr: 0xffffffff816e67f0 (adjusted to:
> > > 0x00000000016e67f0), size 0x18
> > > 	Allocated memory for ELF segment: addr: 0xffffffff816e67f0, size 0x18
> > > 	Attempting to allocate memory for ELF segment: addr: 0xffffffff81100000 (adjusted to:
> > > 0x0000000001100000), size 0x1b86360
> > > 	Error allocating memory for elf image!
> > > 	## ERROR loading File!
> > >
> > > The workaround is to remove the .MIPS.abiflags with "strip" - I guess that
> > > is safe for the kernel... Not sure if there is nothing much else to be
> > > done, and already a similar hack needs to be done for the .notes section.
> > >
> > > I just wanted to post this in case some else faces the same issue.
> >
> > It seems reasonably sensible to /DISCARD/ the .MIPS.abiflags section in the kernel link
> > scripts as I don't think the kernel needs that information for any purpose. I assume
> > .reginfo is discarded as well at some point.
> 
> Historically discarding .reginfo didn't work because it is generated
> by ld after it has generated all the output sections according to the
> linker script.  So no matter what, one always ended up with a .reginfo.
> This has been fixed at some point but I'm concerned the same behaviour
> might have existed for .MIPS.abiflags as well and versions that do the
> same thing with .MIPS.abiflags might still be around.

From the first implementation of .MIPS.abiflags the linker does not invent this section
other than by merging input sections called .MIPS.abiflags so if the input sections
are DISCARD'd then you will never see a .MIPS.abiflags output section nor the associated
program header.

I'm 99% sure of the above.

Matthew

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: old OCTEON bootloaders and .MIPS.abiflags
@ 2015-10-29 22:15       ` Matthew Fortune
  0 siblings, 0 replies; 6+ messages in thread
From: Matthew Fortune @ 2015-10-29 22:15 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: Aaro Koskinen, linux-mips@linux-mips.org, David Daney

Ralf Baechle <ralf@linux-mips.org> writes:
> On Wed, Oct 28, 2015 at 09:02:43PM +0000, Matthew Fortune wrote:
> 
> > Aaro Koskinen <aaro.koskinen@iki.fi> writes:
> > > Current binutils adds .MIPS.abiflags section to the kernel vmlinux.
> > >
> > > This seems break the boot on some old (buggy) OCTEON bootloaders:
> > >
> > > 	ELF file is 64 bit
> > > 	Attempting to allocate memory for ELF segment: addr: 0xffffffff816e67f0 (adjusted to:
> > > 0x00000000016e67f0), size 0x18
> > > 	Allocated memory for ELF segment: addr: 0xffffffff816e67f0, size 0x18
> > > 	Attempting to allocate memory for ELF segment: addr: 0xffffffff81100000 (adjusted to:
> > > 0x0000000001100000), size 0x1b86360
> > > 	Error allocating memory for elf image!
> > > 	## ERROR loading File!
> > >
> > > The workaround is to remove the .MIPS.abiflags with "strip" - I guess that
> > > is safe for the kernel... Not sure if there is nothing much else to be
> > > done, and already a similar hack needs to be done for the .notes section.
> > >
> > > I just wanted to post this in case some else faces the same issue.
> >
> > It seems reasonably sensible to /DISCARD/ the .MIPS.abiflags section in the kernel link
> > scripts as I don't think the kernel needs that information for any purpose. I assume
> > .reginfo is discarded as well at some point.
> 
> Historically discarding .reginfo didn't work because it is generated
> by ld after it has generated all the output sections according to the
> linker script.  So no matter what, one always ended up with a .reginfo.
> This has been fixed at some point but I'm concerned the same behaviour
> might have existed for .MIPS.abiflags as well and versions that do the
> same thing with .MIPS.abiflags might still be around.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: old OCTEON bootloaders and .MIPS.abiflags
  2015-10-29 22:15       ` Matthew Fortune
  (?)
@ 2015-10-29 22:35       ` Ralf Baechle
  -1 siblings, 0 replies; 6+ messages in thread
From: Ralf Baechle @ 2015-10-29 22:35 UTC (permalink / raw)
  To: Matthew Fortune; +Cc: Aaro Koskinen, linux-mips@linux-mips.org, David Daney

On Thu, Oct 29, 2015 at 10:15:01PM +0000, Matthew Fortune wrote:

> >From the first implementation of .MIPS.abiflags the linker does not invent this section
> other than by merging input sections called .MIPS.abiflags so if the input sections
> are DISCARD'd then you will never see a .MIPS.abiflags output section nor the associated
> program header.
> 
> I'm 99% sure of the above.

Great.

Aaro is going to resubmit this patch with some additional changes suggested
by David Daney on IRC so I'm going to drop this patch.

  Ralf

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-10-29 22:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-28 19:54 FYI: old OCTEON bootloaders and .MIPS.abiflags Aaro Koskinen
2015-10-28 21:02 ` Matthew Fortune
2015-10-29 21:35   ` Ralf Baechle
2015-10-29 22:15     ` Matthew Fortune
2015-10-29 22:15       ` Matthew Fortune
2015-10-29 22:35       ` Ralf Baechle

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.