Re: [PATCH] powerpc: vmlinux.lds: Drop Binutils 2.18 workarounds

2019-03-28 Thread Segher Boessenkool
On Thu, Mar 28, 2019 at 07:19:57AM +0100, Christophe Leroy wrote:
> Le 27/03/2019 à 19:21, Segher Boessenkool a écrit :
> >Yeah, okay, we should have some PHDRS statement here still.  You can drop
> >the dummy segment, and the notes segment as well, or you can keep the notes
> >section in both the notes and kernel segments.
> 
> Is the note segment useful at all ? I guess if we decide to keep it, we 
> should have a reason.

I don't know if it is.

$ readelf -x17 powerpc64/kernel/vmlinux

Hex dump of section '.notes':
  0xc10d4128 0004 0014 0003 474e5500 GNU.
  0xc10d4138 ba254e47 396b1745 176695d8 6b54c9e3 .%NG9k.E.f..kT..
  0xc10d4148 959cedd7 0006 0001 0100 
  0xc10d4158 4c696e75 7800   Linux...

Does that look useful?  There's a build-id in there it seems.  I don't know
if any tools look at that, or how they find it.

> >(You patch doesn't apply btw, whitespace damage I think; will you send a
> >new one?)
> 
> Originally the patch is by Joel Stanley 
> 
> I guess he will send a v2 taking into account the discussion ?

Please do Joel :-)  Thanks in advance, etc.

> Or maybe you can send it yourself as you are probably the best person to 
> explain in details the change in the commit message.

I have no way of testing things properly.


Segher


Re: [PATCH] powerpc: vmlinux.lds: Drop Binutils 2.18 workarounds

2019-03-28 Thread Christophe Leroy




Le 27/03/2019 à 19:21, Segher Boessenkool a écrit :

On Wed, Mar 27, 2019 at 07:47:55AM -0500, Segher Boessenkool wrote:

On Wed, Mar 27, 2019 at 07:40:32AM +0100, Christophe Leroy wrote:

Le 26/03/2019 à 23:29, Segher Boessenkool a écrit :

I tried to reproduce this.  It does not fail with a ppc6xx_defconfig
build, and mpc885_ads_defconfig fails with


So far, the only defconfig which fails for me is ppc64_defconfig, like
Michael.


Oh, I misunderstood then.  Let me try that :-)


Yeah, okay, we should have some PHDRS statement here still.  You can drop
the dummy segment, and the notes segment as well, or you can keep the notes
section in both the notes and kernel segments.


Is the note segment useful at all ? I guess if we decide to keep it, we 
should have a reason.




(You patch doesn't apply btw, whitespace damage I think; will you send a
new one?)


Originally the patch is by Joel Stanley 

I guess he will send a v2 taking into account the discussion ?

Or maybe you can send it yourself as you are probably the best person to 
explain in details the change in the commit message.


Christophe


Re: [PATCH] powerpc: vmlinux.lds: Drop Binutils 2.18 workarounds

2019-03-27 Thread Segher Boessenkool
On Wed, Mar 27, 2019 at 07:47:55AM -0500, Segher Boessenkool wrote:
> On Wed, Mar 27, 2019 at 07:40:32AM +0100, Christophe Leroy wrote:
> > Le 26/03/2019 à 23:29, Segher Boessenkool a écrit :
> > >I tried to reproduce this.  It does not fail with a ppc6xx_defconfig
> > >build, and mpc885_ads_defconfig fails with
> > 
> > So far, the only defconfig which fails for me is ppc64_defconfig, like 
> > Michael.
> 
> Oh, I misunderstood then.  Let me try that :-)

Yeah, okay, we should have some PHDRS statement here still.  You can drop
the dummy segment, and the notes segment as well, or you can keep the notes
section in both the notes and kernel segments.

(You patch doesn't apply btw, whitespace damage I think; will you send a
new one?)


Segher


Re: [PATCH] powerpc: vmlinux.lds: Drop Binutils 2.18 workarounds

2019-03-27 Thread Segher Boessenkool
On Wed, Mar 27, 2019 at 07:40:32AM +0100, Christophe Leroy wrote:
> Le 26/03/2019 à 23:29, Segher Boessenkool a écrit :
> >I tried to reproduce this.  It does not fail with a ppc6xx_defconfig
> >build, and mpc885_ads_defconfig fails with
> 
> So far, the only defconfig which fails for me is ppc64_defconfig, like 
> Michael.

Oh, I misunderstood then.  Let me try that :-)

> 885_ads is ok, I just noticed the STACK header in vmlinux that is not 
> there when the patch is not applies.

Right...  The linker generates that by default, it's nothing to worry
about.

> >What is your GCC?
> 
> [root@localhost linux-powerpc]# powerpc64-linux-gcc -v
> Using built-in specs.
> COLLECT_GCC=powerpc64-linux-gcc
> COLLECT_LTO_WRAPPER=/opt/gcc-8.1.0-nolibc/powerpc64-linux/bin/../libexec/gcc/powerpc64-linux/8.1.0/lto-wrapper
> Target: powerpc64-linux
> Configured with: /home/arnd/git/gcc/configure --target=powerpc64-linux 
> --enable-targets=all 
> --prefix=/home/arnd/cross/x86_64/gcc-8.1.0-nolibc/powerpc64-linux 
> --enable-languages=c --without-headers --disable-bootstrap --disable-nls 
> --disable-threads --disable-shared --disable-libmudflap --disable-libssp 
> --disable-libgomp --disable-decimal-float --disable-libquadmath 
> --disable-libatomic --disable-libcc1 --disable-libmpx 
> --enable-checking=release
> Thread model: single
> gcc version 8.1.0 (GCC)

Okay cool, a plain GCC build, importantly not a vendor compiler.  Built
with my scripts no less ;-)

> [root@localhost linux-powerpc]# powerpc64-linux-ld -v
> GNU ld (GNU Binutils) 2.30


Segher


Re: [PATCH] powerpc: vmlinux.lds: Drop Binutils 2.18 workarounds

2019-03-27 Thread Christophe Leroy




Le 27/03/2019 à 09:56, Christophe Leroy a écrit :



Le 26/03/2019 à 21:12, Segher Boessenkool a écrit :

On Tue, Mar 26, 2019 at 08:28:58PM +0100, Christophe Leroy wrote:



Le 26/03/2019 à 19:19, Segher Boessenkool a écrit :

On Tue, Mar 26, 2019 at 07:55:33AM +, Christophe Leroy wrote:
    STACK off    0x vaddr 0x paddr 0x align 
2**4

  filesz 0x memsz 0x flags rwx


You need to prevent this one somehow.  What object file forces this?


mpc885_ads_defconfig


No, which object file, ".o file".  Not defconfig :-)



Ok, how to I know that ? Is it based on some file flags or some headers ?

Here is the list of headers in vmlinux.o, is there one that shouldn't 
exist ?



vmlinux.o: file format elf32-powerpc

Sections:
Idx Name  Size  VMA   LMA   File off  Algn
   0 .text 003320c0      1000  2**12
   CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
   1 .head.text    2340      003330c0  2**0
   CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
   2 .init.text    00017cb8      00335400  2**2
   CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
   3 .text.unlikely 4154      0034d0b8  2**2
   CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
   4 .ref.text 13f0      0035120c  2**2
   CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
   5 .softirqentry.text 0258      003525fc  2**2
   CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
   6 .sched.text   3930      00352854  2**2
   CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
   7 .cpuidle.text 007c      00356184  2**2
   CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
   8 .meminit.text 0584      00356200  2**2
   CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
   9 .exit.text    0800      00356784  2**2
   CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
  10 .rodata   0001d7a7      00356f90  2**4
   CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA
  11 .init.rodata  0790      00374738  2**2
   CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA
  12 .rodata.str1.4 00022329      00374ec8  2**2
   CONTENTS, ALLOC, LOAD, READONLY, DATA
  13 __param   03c0      003971f4  2**2
   CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA
  14 .note.Linux   0018      003975b4  2**2
   CONTENTS, ALLOC, LOAD, READONLY, DATA
  15 __ex_table    0ca8      003975cc  2**2
   CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA
  16 __ftr_alt_97  0008      00398274  2**2
   CONTENTS, ALLOC, LOAD, READONLY, DATA
  17 __ftr_fixup   0198      00398280  2**3
   CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA
  18 __reservedmem_of_table 00c4      00398418  2**2
   CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA
  19 __irqchip_of_table_end 00c4      003984dc  2**2
   CONTENTS, ALLOC, LOAD, READONLY, DATA
  20 __modver  0008      003985a0  2**2
   CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA
  21 __reservedmem_of_table_end 00c4      003985a8  
2**2

   CONTENTS, ALLOC, LOAD, READONLY, DATA
  22 .eh_frame 00134eb8      0039866c  2**2
   CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA
  23 .fixup    0cc8      004cd524  2**0
   CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
  24 .data 00013668      004cf000  2**12
   CONTENTS, ALLOC, LOAD, RELOC, DATA
  25 __bug_table   6ce4      004e2668  2**0
   CONTENTS, ALLOC, LOAD, RELOC, DATA
  26 .data..read_mostly 1ce8      004e9350  2**3
   CONTENTS, ALLOC, LOAD, RELOC, DATA
  27 .init.data    244c      004eb038  2**2
   CONTENTS, ALLOC, LOAD, RELOC, DATA
  28 .init.setup   039c      004ed484  2**2
   CONTENTS, ALLOC, LOAD, RELOC, DATA
  29 .initcallrootfs.init 0004      004ed820  2**2
   CONTENTS, ALLOC, LOAD, RELOC, DATA
  30 .data..page_aligned 3000      004ee000  2**12
   CONTENTS, ALLOC, LOAD, DATA
  31 .initcall3.init 0008      004f1000  2**2
   CONTENTS, ALLOC, LOAD, RELOC, DATA
  32 .initcallearly.init 0010      004f1008  2**2
   CONTENTS, ALLOC, 

Re: [PATCH] powerpc: vmlinux.lds: Drop Binutils 2.18 workarounds

2019-03-27 Thread Christophe Leroy




Le 26/03/2019 à 21:12, Segher Boessenkool a écrit :

On Tue, Mar 26, 2019 at 08:28:58PM +0100, Christophe Leroy wrote:



Le 26/03/2019 à 19:19, Segher Boessenkool a écrit :

On Tue, Mar 26, 2019 at 07:55:33AM +, Christophe Leroy wrote:

STACK off0x vaddr 0x paddr 0x align 2**4
  filesz 0x memsz 0x flags rwx


You need to prevent this one somehow.  What object file forces this?


mpc885_ads_defconfig


No, which object file, ".o file".  Not defconfig :-)



Ok, how to I know that ? Is it based on some file flags or some headers ?

Here is the list of headers in vmlinux.o, is there one that shouldn't 
exist ?



vmlinux.o: file format elf32-powerpc

Sections:
Idx Name  Size  VMA   LMA   File off  Algn
  0 .text 003320c0      1000  2**12
  CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
  1 .head.text2340      003330c0  2**0
  CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
  2 .init.text00017cb8      00335400  2**2
  CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
  3 .text.unlikely 4154      0034d0b8  2**2
  CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
  4 .ref.text 13f0      0035120c  2**2
  CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
  5 .softirqentry.text 0258      003525fc  2**2
  CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
  6 .sched.text   3930      00352854  2**2
  CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
  7 .cpuidle.text 007c      00356184  2**2
  CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
  8 .meminit.text 0584      00356200  2**2
  CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
  9 .exit.text0800      00356784  2**2
  CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
 10 .rodata   0001d7a7      00356f90  2**4
  CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA
 11 .init.rodata  0790      00374738  2**2
  CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA
 12 .rodata.str1.4 00022329      00374ec8  2**2
  CONTENTS, ALLOC, LOAD, READONLY, DATA
 13 __param   03c0      003971f4  2**2
  CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA
 14 .note.Linux   0018      003975b4  2**2
  CONTENTS, ALLOC, LOAD, READONLY, DATA
 15 __ex_table0ca8      003975cc  2**2
  CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA
 16 __ftr_alt_97  0008      00398274  2**2
  CONTENTS, ALLOC, LOAD, READONLY, DATA
 17 __ftr_fixup   0198      00398280  2**3
  CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA
 18 __reservedmem_of_table 00c4      00398418  2**2
  CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA
 19 __irqchip_of_table_end 00c4      003984dc  2**2
  CONTENTS, ALLOC, LOAD, READONLY, DATA
 20 __modver  0008      003985a0  2**2
  CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA
 21 __reservedmem_of_table_end 00c4      003985a8  2**2
  CONTENTS, ALLOC, LOAD, READONLY, DATA
 22 .eh_frame 00134eb8      0039866c  2**2
  CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA
 23 .fixup0cc8      004cd524  2**0
  CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
 24 .data 00013668      004cf000  2**12
  CONTENTS, ALLOC, LOAD, RELOC, DATA
 25 __bug_table   6ce4      004e2668  2**0
  CONTENTS, ALLOC, LOAD, RELOC, DATA
 26 .data..read_mostly 1ce8      004e9350  2**3
  CONTENTS, ALLOC, LOAD, RELOC, DATA
 27 .init.data244c      004eb038  2**2
  CONTENTS, ALLOC, LOAD, RELOC, DATA
 28 .init.setup   039c      004ed484  2**2
  CONTENTS, ALLOC, LOAD, RELOC, DATA
 29 .initcallrootfs.init 0004      004ed820  2**2
  CONTENTS, ALLOC, LOAD, RELOC, DATA
 30 .data..page_aligned 3000      004ee000  2**12
  CONTENTS, ALLOC, LOAD, DATA
 31 .initcall3.init 0008      004f1000  2**2
  CONTENTS, ALLOC, LOAD, RELOC, DATA
 32 .initcallearly.init 0010      004f1008  2**2
  CONTENTS, ALLOC, LOAD, RELOC, DATA
 33 .initcall6.init 0120      004f1018  2**2
  CONTENTS, ALLOC, LOAD, 

Re: [PATCH] powerpc: vmlinux.lds: Drop Binutils 2.18 workarounds

2019-03-27 Thread Christophe Leroy




Le 26/03/2019 à 23:29, Segher Boessenkool a écrit :

On Tue, Mar 26, 2019 at 03:12:31PM -0500, Segher Boessenkool wrote:

On Tue, Mar 26, 2019 at 08:28:58PM +0100, Christophe Leroy wrote:



Le 26/03/2019 à 19:19, Segher Boessenkool a écrit :

On Tue, Mar 26, 2019 at 07:55:33AM +, Christophe Leroy wrote:

STACK off0x vaddr 0x paddr 0x align 2**4
  filesz 0x memsz 0x flags rwx


You need to prevent this one somehow.  What object file forces this?


mpc885_ads_defconfig


No, which object file, ".o file".  Not defconfig :-)


I tried to reproduce this.  It does not fail with a ppc6xx_defconfig
build, and mpc885_ads_defconfig fails with


So far, the only defconfig which fails for me is ppc64_defconfig, like 
Michael.


885_ads is ok, I just noticed the STACK header in vmlinux that is not 
there when the patch is not applies.




INFO: Uncompressed kernel (size 0x435178) overlaps the address of the 
wrapper(0x40)
INFO: Fixing the link_address of wrapper to (0x50)
ln: failed to access 'arch/powerpc/boot/cuImage.mpc885ads': No such file or 
directory

What is your GCC?


[root@localhost linux-powerpc]# powerpc64-linux-gcc -v
Using built-in specs.
COLLECT_GCC=powerpc64-linux-gcc
COLLECT_LTO_WRAPPER=/opt/gcc-8.1.0-nolibc/powerpc64-linux/bin/../libexec/gcc/powerpc64-linux/8.1.0/lto-wrapper
Target: powerpc64-linux
Configured with: /home/arnd/git/gcc/configure --target=powerpc64-linux 
--enable-targets=all 
--prefix=/home/arnd/cross/x86_64/gcc-8.1.0-nolibc/powerpc64-linux 
--enable-languages=c --without-headers --disable-bootstrap --disable-nls 
--disable-threads --disable-shared --disable-libmudflap --disable-libssp 
--disable-libgomp --disable-decimal-float --disable-libquadmath 
--disable-libatomic --disable-libcc1 --disable-libmpx 
--enable-checking=release

Thread model: single
gcc version 8.1.0 (GCC)

[root@localhost linux-powerpc]# powerpc64-linux-ld -v
GNU ld (GNU Binutils) 2.30

Christophe


Re: [PATCH] powerpc: vmlinux.lds: Drop Binutils 2.18 workarounds

2019-03-26 Thread Segher Boessenkool
On Tue, Mar 26, 2019 at 05:29:43PM -0500, Segher Boessenkool wrote:
> On Tue, Mar 26, 2019 at 03:12:31PM -0500, Segher Boessenkool wrote:
> > On Tue, Mar 26, 2019 at 08:28:58PM +0100, Christophe Leroy wrote:
> > > 
> > > 
> > > Le 26/03/2019 à 19:19, Segher Boessenkool a écrit :
> > > >On Tue, Mar 26, 2019 at 07:55:33AM +, Christophe Leroy wrote:
> > > >>STACK off0x vaddr 0x paddr 0x align 2**4
> > > >>  filesz 0x memsz 0x flags rwx
> > > >
> > > >You need to prevent this one somehow.  What object file forces this?
> > > 
> > > mpc885_ads_defconfig
> > 
> > No, which object file, ".o file".  Not defconfig :-)
> 
> I tried to reproduce this.  It does not fail with a ppc6xx_defconfig
> build, and mpc885_ads_defconfig fails with
> 
> INFO: Uncompressed kernel (size 0x435178) overlaps the address of the 
> wrapper(0x40)
> INFO: Fixing the link_address of wrapper to (0x50)
> ln: failed to access 'arch/powerpc/boot/cuImage.mpc885ads': No such file or 
> directory

(Fixed this by getting a working mkimage)

> What is your GCC?

That question remains -- all my powerpc kernel builds work just fine with
that patch applied (recent GCC, recent binutils).


Segher


Re: [PATCH] powerpc: vmlinux.lds: Drop Binutils 2.18 workarounds

2019-03-26 Thread Segher Boessenkool
On Tue, Mar 26, 2019 at 03:12:31PM -0500, Segher Boessenkool wrote:
> On Tue, Mar 26, 2019 at 08:28:58PM +0100, Christophe Leroy wrote:
> > 
> > 
> > Le 26/03/2019 à 19:19, Segher Boessenkool a écrit :
> > >On Tue, Mar 26, 2019 at 07:55:33AM +, Christophe Leroy wrote:
> > >>STACK off0x vaddr 0x paddr 0x align 2**4
> > >>  filesz 0x memsz 0x flags rwx
> > >
> > >You need to prevent this one somehow.  What object file forces this?
> > 
> > mpc885_ads_defconfig
> 
> No, which object file, ".o file".  Not defconfig :-)

I tried to reproduce this.  It does not fail with a ppc6xx_defconfig
build, and mpc885_ads_defconfig fails with

INFO: Uncompressed kernel (size 0x435178) overlaps the address of the 
wrapper(0x40)
INFO: Fixing the link_address of wrapper to (0x50)
ln: failed to access 'arch/powerpc/boot/cuImage.mpc885ads': No such file or 
directory

What is your GCC?


Segher


Re: [PATCH] powerpc: vmlinux.lds: Drop Binutils 2.18 workarounds

2019-03-26 Thread Segher Boessenkool
On Tue, Mar 26, 2019 at 08:28:58PM +0100, Christophe Leroy wrote:
> 
> 
> Le 26/03/2019 à 19:19, Segher Boessenkool a écrit :
> >On Tue, Mar 26, 2019 at 07:55:33AM +, Christophe Leroy wrote:
> >>STACK off0x vaddr 0x paddr 0x align 2**4
> >>  filesz 0x memsz 0x flags rwx
> >
> >You need to prevent this one somehow.  What object file forces this?
> 
> mpc885_ads_defconfig

No, which object file, ".o file".  Not defconfig :-)


Segher


Re: [PATCH] powerpc: vmlinux.lds: Drop Binutils 2.18 workarounds

2019-03-26 Thread Christophe Leroy




Le 26/03/2019 à 19:19, Segher Boessenkool a écrit :

On Tue, Mar 26, 2019 at 07:55:33AM +, Christophe Leroy wrote:

STACK off0x vaddr 0x paddr 0x align 2**4
  filesz 0x memsz 0x flags rwx


You need to prevent this one somehow.  What object file forces this?


mpc885_ads_defconfig

Christophe



Setting the program headers manually works of course, but that also hides
other problems.


Segher



Re: [PATCH] powerpc: vmlinux.lds: Drop Binutils 2.18 workarounds

2019-03-26 Thread Segher Boessenkool
On Tue, Mar 26, 2019 at 07:55:33AM +, Christophe Leroy wrote:
>STACK off0x vaddr 0x paddr 0x align 2**4
>  filesz 0x memsz 0x flags rwx

You need to prevent this one somehow.  What object file forces this?

Setting the program headers manually works of course, but that also hides
other problems.


Segher


Re: [PATCH] powerpc: vmlinux.lds: Drop Binutils 2.18 workarounds

2019-03-26 Thread Christophe Leroy




Le 26/03/2019 à 01:55, Michael Ellerman a écrit :

Joel Stanley  writes:

Segher added some workarounds for GCC 4.2 and bintuils 2.18. We now set
4.6 and 2.20 as the minimum, so they can be dropped.

This is mostly a revert of c6995fe4 ("powerpc: Fix build bug with
binutils < 2.18 and GCC < 4.2").

Signed-off-by: Joel Stanley 
---
  arch/powerpc/kernel/vmlinux.lds.S | 35 ---
  1 file changed, 4 insertions(+), 31 deletions(-)


Seems this breaks some toolchains, at least the one from kernel.org:

   
/opt/cross/kisskb/korg/gcc-8.1.0-nolibc/powerpc64-linux/bin/powerpc64-linux-ld: 
.tmp_vmlinux1: Not enough room for program headers, try linking with -N
   
/opt/cross/kisskb/korg/gcc-8.1.0-nolibc/powerpc64-linux/bin/powerpc64-linux-ld: 
final link failed: Bad value
   make[1]: *** [/kisskb/src/Makefile:1024: vmlinux] Error 1

http://kisskb.ellerman.id.au/kisskb/buildresult/13743374/

Not sure why.

That's binutils 2.30.



ld doc says:

6586 @cindex not enough room for program headers
6587 @cindex program headers, not enough room
6588 When producing an ELF output file, if the linker script uses the
6589 @code{SIZEOF_HEADERS} builtin function, the linker must compute the
6590 number of program headers before it has determined all the section
6591 addresses and sizes.  If the linker later discovers that it needs
6592 additional program headers, it will report an error @samp{not enough
6593 room for program headers}.  To avoid this error, you must avoid using
6594 the @code{SIZEOF_HEADERS} function, or you must rework your linker
6595 script to avoid forcing the linker to use additional program 
headers, or

6596 you must define the program headers yourself using the @code{PHDRS}
6597 command (@pxref{PHDRS}).
6598 @end table


What about just removing the dummy section, and keeping everything else ? :

diff --git a/arch/powerpc/kernel/vmlinux.lds.S 
b/arch/powerpc/kernel/vmlinux.lds.S

index 060a1acd7c6d..511bff8e4a8f 100644
--- a/arch/powerpc/kernel/vmlinux.lds.S
+++ b/arch/powerpc/kernel/vmlinux.lds.S
@@ -20,20 +20,6 @@ ENTRY(_stext)
 PHDRS {
kernel PT_LOAD FLAGS(7); /* RWX */
notes PT_NOTE FLAGS(0);
-   dummy PT_NOTE FLAGS(0);
-
-   /* binutils < 2.18 has a bug that makes it misbehave when taking an
-  ELF file with all segments at load address 0 as input.  This
-  happens when running "strip" on vmlinux, because of the AT() magic
-  in this linker script.  People using GCC >= 4.2 won't run into
-  this problem, because the "build-id" support will put some data
-  into the "notes" segment (at a non-zero load address).
-
-  To work around this, we force some data into both the "dummy"
-  segment and the kernel segment, so the dummy segment will get a
-  non-zero load address.  It's not enough to always create the
-  "notes" segment, since if nothing gets assigned to it, its load
-  address will be zero.  */
 }

 #ifdef CONFIG_PPC64
@@ -179,14 +165,6 @@ SECTIONS

NOTES :kernel :notes

-   /* The dummy segment contents for the bug workaround mentioned above
-  near PHDRS.  */
-   .dummy : AT(ADDR(.dummy) - LOAD_OFFSET) {
-   LONG(0)
-   LONG(0)
-   LONG(0)
-   } :kernel :dummy
-
 /*
  * Init sections discarded at runtime
  */


Christophe


Re: [PATCH] powerpc: vmlinux.lds: Drop Binutils 2.18 workarounds

2019-03-26 Thread Christophe Leroy




On 03/26/2019 12:55 AM, Michael Ellerman wrote:

Joel Stanley  writes:

Segher added some workarounds for GCC 4.2 and bintuils 2.18. We now set
4.6 and 2.20 as the minimum, so they can be dropped.

This is mostly a revert of c6995fe4 ("powerpc: Fix build bug with
binutils < 2.18 and GCC < 4.2").

Signed-off-by: Joel Stanley 
---
  arch/powerpc/kernel/vmlinux.lds.S | 35 ---
  1 file changed, 4 insertions(+), 31 deletions(-)


Seems this breaks some toolchains, at least the one from kernel.org:

   
/opt/cross/kisskb/korg/gcc-8.1.0-nolibc/powerpc64-linux/bin/powerpc64-linux-ld: 
.tmp_vmlinux1: Not enough room for program headers, try linking with -N
   
/opt/cross/kisskb/korg/gcc-8.1.0-nolibc/powerpc64-linux/bin/powerpc64-linux-ld: 
final link failed: Bad value
   make[1]: *** [/kisskb/src/Makefile:1024: vmlinux] Error 1

http://kisskb.ellerman.id.au/kisskb/buildresult/13743374/

Not sure why.

That's binutils 2.30.

cheers



Without the patch on PPC32:

Program Header:
LOAD off0x0001 vaddr 0xc000 paddr 0x align 2**16
 filesz 0x003c2ce4 memsz 0x003e1a08 flags rwx
NOTE off0x0038dca8 vaddr 0xc037dca8 paddr 0x0037dca8 align 2**2
 filesz 0x003c memsz 0x003c flags ---
NOTE off0x0038dce4 vaddr 0xc037dce4 paddr 0x0037dce4 align 2**0
 filesz 0x000c memsz 0x000c flags ---

With the patch:

Program Header:
LOAD off0x0001 vaddr 0xc000 paddr 0x align 2**16
 filesz 0x003c2ce4 memsz 0x003e1a08 flags rwx
NOTE off0x0038dca8 vaddr 0xc037dca8 paddr 0x0037dca8 align 2**2
 filesz 0x003c memsz 0x003c flags r--
   STACK off0x vaddr 0x paddr 0x align 2**4
 filesz 0x memsz 0x flags rwx



Christophe


Re: [PATCH] powerpc: vmlinux.lds: Drop Binutils 2.18 workarounds

2019-03-25 Thread Michael Ellerman
Joel Stanley  writes:
> Segher added some workarounds for GCC 4.2 and bintuils 2.18. We now set
> 4.6 and 2.20 as the minimum, so they can be dropped.
>
> This is mostly a revert of c6995fe4 ("powerpc: Fix build bug with
> binutils < 2.18 and GCC < 4.2").
>
> Signed-off-by: Joel Stanley 
> ---
>  arch/powerpc/kernel/vmlinux.lds.S | 35 ---
>  1 file changed, 4 insertions(+), 31 deletions(-)

Seems this breaks some toolchains, at least the one from kernel.org:

  
/opt/cross/kisskb/korg/gcc-8.1.0-nolibc/powerpc64-linux/bin/powerpc64-linux-ld: 
.tmp_vmlinux1: Not enough room for program headers, try linking with -N
  
/opt/cross/kisskb/korg/gcc-8.1.0-nolibc/powerpc64-linux/bin/powerpc64-linux-ld: 
final link failed: Bad value
  make[1]: *** [/kisskb/src/Makefile:1024: vmlinux] Error 1

http://kisskb.ellerman.id.au/kisskb/buildresult/13743374/

Not sure why.

That's binutils 2.30.

cheers


Re: [PATCH] powerpc: vmlinux.lds: Drop Binutils 2.18 workarounds

2019-03-21 Thread Michael Ellerman
Segher Boessenkool  writes:

> On Thu, Mar 21, 2019 at 11:02:53AM +1030, Joel Stanley wrote:
>> Segher added some workarounds for GCC 4.2 and bintuils 2.18. We now set
>> 4.6 and 2.20 as the minimum, so they can be dropped.
>
> It was a bug in binutils _before_ 2.18, only seen by people using GCC
> _before_ 4.2.
>
> It's all ancient history by now, and good riddance :-)
>
>> Signed-off-by: Joel Stanley 
>
> Acked-by: Segher Boessenkool 

Thanks.

I updated the change log slightly:

  powerpc/vmlinux.lds: Drop binutils < 2.18 workarounds
  
  Segher added some workarounds for binutils < 2.18 and GCC < 4.2. We
  now set GCC 4.6 and binutils 2.20 as the minimum, so the workarounds
  can be dropped.
  
  This is mostly a revert of c6995fe4 ("powerpc: Fix build bug with
  binutils < 2.18 and GCC < 4.2").

cheers


Re: [PATCH] powerpc: vmlinux.lds: Drop Binutils 2.18 workarounds

2019-03-21 Thread Segher Boessenkool
On Thu, Mar 21, 2019 at 11:02:53AM +1030, Joel Stanley wrote:
> Segher added some workarounds for GCC 4.2 and bintuils 2.18. We now set
> 4.6 and 2.20 as the minimum, so they can be dropped.

It was a bug in binutils _before_ 2.18, only seen by people using GCC
_before_ 4.2.

It's all ancient history by now, and good riddance :-)

> Signed-off-by: Joel Stanley 

Acked-by: Segher Boessenkool 


Segher