LinuxPPC-Dev Archive on lore.kernel.org
 help / Atom feed
* [PATCH] powerpc/32: Include .branch_lt in data section
@ 2018-11-14  3:02 Joel Stanley
  2018-11-14  4:00 ` Alan Modra
  2019-02-08 13:02 ` Michael Ellerman
  0 siblings, 2 replies; 6+ messages in thread
From: Joel Stanley @ 2018-11-14  3:02 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Alan Modra

When building a 32 bit powerpc kernel with Binutils 2.31.1 this warning
is emitted:

 powerpc-linux-gnu-ld: warning: orphan section `.branch_lt' from
 `arch/powerpc/kernel/head_44x.o' being placed in section `.branch_lt'

As of binutils commit 2d7ad24e8726 ("Support PLT16 relocs against local
symbols")[1], 32 bit targets can produce .branch_lt sections in their
output.

Include these symbols in the .data section as the ppc64 kernel does.

[1] https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commitdiff;h=2d7ad24e8726ba4c45c9e67be08223a146a837ce
Signed-off-by: Joel Stanley <joel@jms.id.au>
---
I wasn't sure where this should go or if the ordering matters.
---
 arch/powerpc/kernel/vmlinux.lds.S | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S
index 434581bcd5b4..6d5fd1b95311 100644
--- a/arch/powerpc/kernel/vmlinux.lds.S
+++ b/arch/powerpc/kernel/vmlinux.lds.S
@@ -313,6 +313,7 @@ SECTIONS
 		*(.sdata2)
 		*(.got.plt) *(.got)
 		*(.plt)
+		*(.branch_lt)
 	}
 #else
 	.data : AT(ADDR(.data) - LOAD_OFFSET) {
-- 
2.19.1


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

* Re: [PATCH] powerpc/32: Include .branch_lt in data section
  2018-11-14  3:02 [PATCH] powerpc/32: Include .branch_lt in data section Joel Stanley
@ 2018-11-14  4:00 ` Alan Modra
  2018-11-15 12:47   ` Michael Ellerman
  2019-02-08 13:02 ` Michael Ellerman
  1 sibling, 1 reply; 6+ messages in thread
From: Alan Modra @ 2018-11-14  4:00 UTC (permalink / raw)
  To: Joel Stanley; +Cc: linuxppc-dev

On Wed, Nov 14, 2018 at 01:32:18PM +1030, Joel Stanley wrote:
> When building a 32 bit powerpc kernel with Binutils 2.31.1 this warning
> is emitted:
> 
>  powerpc-linux-gnu-ld: warning: orphan section `.branch_lt' from
>  `arch/powerpc/kernel/head_44x.o' being placed in section `.branch_lt'
> 
> As of binutils commit 2d7ad24e8726 ("Support PLT16 relocs against local
> symbols")[1], 32 bit targets can produce .branch_lt sections in their
> output.
> 
> Include these symbols in the .data section as the ppc64 kernel does.
> 
> [1] https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commitdiff;h=2d7ad24e8726ba4c45c9e67be08223a146a837ce
> Signed-off-by: Joel Stanley <joel@jms.id.au>
Reviewed-by: Alan Modra <amodra@gmail.com>

Looks fine to me.

> ---
> I wasn't sure where this should go or if the ordering matters.

The usual answer is: "Look at where the section goes in the standard
linker scripts."   But that doesn't apply here.  The section will be
empty for a kernel build so it doesn't matter where it goes.

> ---
>  arch/powerpc/kernel/vmlinux.lds.S | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S
> index 434581bcd5b4..6d5fd1b95311 100644
> --- a/arch/powerpc/kernel/vmlinux.lds.S
> +++ b/arch/powerpc/kernel/vmlinux.lds.S
> @@ -313,6 +313,7 @@ SECTIONS
>  		*(.sdata2)
>  		*(.got.plt) *(.got)
>  		*(.plt)
> +		*(.branch_lt)
>  	}
>  #else
>  	.data : AT(ADDR(.data) - LOAD_OFFSET) {
> -- 
> 2.19.1

-- 
Alan Modra
Australia Development Lab, IBM

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

* Re: [PATCH] powerpc/32: Include .branch_lt in data section
  2018-11-14  4:00 ` Alan Modra
@ 2018-11-15 12:47   ` Michael Ellerman
  2018-11-18  8:26     ` Alan Modra
  0 siblings, 1 reply; 6+ messages in thread
From: Michael Ellerman @ 2018-11-15 12:47 UTC (permalink / raw)
  To: Alan Modra, Joel Stanley; +Cc: linuxppc-dev

Alan Modra <amodra@gmail.com> writes:

> On Wed, Nov 14, 2018 at 01:32:18PM +1030, Joel Stanley wrote:
>> When building a 32 bit powerpc kernel with Binutils 2.31.1 this warning
>> is emitted:
>> 
>>  powerpc-linux-gnu-ld: warning: orphan section `.branch_lt' from
>>  `arch/powerpc/kernel/head_44x.o' being placed in section `.branch_lt'
>> 
>> As of binutils commit 2d7ad24e8726 ("Support PLT16 relocs against local
>> symbols")[1], 32 bit targets can produce .branch_lt sections in their
>> output.
>> 
>> Include these symbols in the .data section as the ppc64 kernel does.
>> 
>> [1] https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commitdiff;h=2d7ad24e8726ba4c45c9e67be08223a146a837ce
>> Signed-off-by: Joel Stanley <joel@jms.id.au>
> Reviewed-by: Alan Modra <amodra@gmail.com>
>
> Looks fine to me.
>
>> ---
>> I wasn't sure where this should go or if the ordering matters.
>
> The usual answer is: "Look at where the section goes in the standard
> linker scripts."   But that doesn't apply here.  The section will be
> empty for a kernel build so it doesn't matter where it goes.

If it's empty why don't we just discard it?

cheers

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

* Re: [PATCH] powerpc/32: Include .branch_lt in data section
  2018-11-15 12:47   ` Michael Ellerman
@ 2018-11-18  8:26     ` Alan Modra
  2018-12-19  9:51       ` Michael Ellerman
  0 siblings, 1 reply; 6+ messages in thread
From: Alan Modra @ 2018-11-18  8:26 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc-dev, Joel Stanley

On Thu, Nov 15, 2018 at 11:47:52PM +1100, Michael Ellerman wrote:
> Alan Modra <amodra@gmail.com> writes:
> 
> > On Wed, Nov 14, 2018 at 01:32:18PM +1030, Joel Stanley wrote:
> >> I wasn't sure where this should go or if the ordering matters.
> >
> > The usual answer is: "Look at where the section goes in the standard
> > linker scripts."   But that doesn't apply here.  The section will be
> > empty for a kernel build so it doesn't matter where it goes.
> 
> If it's empty why don't we just discard it?

That can be a recipe for finding linker bugs.  Not that I'm against
you finding linker bugs.  ;-)

-- 
Alan Modra
Australia Development Lab, IBM

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

* Re: [PATCH] powerpc/32: Include .branch_lt in data section
  2018-11-18  8:26     ` Alan Modra
@ 2018-12-19  9:51       ` Michael Ellerman
  0 siblings, 0 replies; 6+ messages in thread
From: Michael Ellerman @ 2018-12-19  9:51 UTC (permalink / raw)
  To: Alan Modra; +Cc: linuxppc-dev, Joel Stanley

Alan Modra <amodra@gmail.com> writes:
> On Thu, Nov 15, 2018 at 11:47:52PM +1100, Michael Ellerman wrote:
>> Alan Modra <amodra@gmail.com> writes:
>> 
>> > On Wed, Nov 14, 2018 at 01:32:18PM +1030, Joel Stanley wrote:
>> >> I wasn't sure where this should go or if the ordering matters.
>> >
>> > The usual answer is: "Look at where the section goes in the standard
>> > linker scripts."   But that doesn't apply here.  The section will be
>> > empty for a kernel build so it doesn't matter where it goes.
>> 
>> If it's empty why don't we just discard it?
>
> That can be a recipe for finding linker bugs.  Not that I'm against
> you finding linker bugs.  ;-)

Seems we might have found a linker bug :)

With a binutils 2.29 toolchain discarding .branch_lt causes a segfault
when linking:

  http://kisskb.ellerman.id.au/kisskb/buildresult/13618838/log/

  /kisskb/src/scripts/link-vmlinux.sh: line 85: 74627 Segmentation fault      (core dumped) ${LD} ${KBUILD_LDFLAGS} ${LDFLAGS_vmlinux} -o ${2} -T ${lds} ${objects}


That toolchain is here:

  https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/5.5.0/x86_64-gcc-5.5.0-nolibc-powerpc64-linux.tar.xz

It seems to be better with binutils 2.30, it doesn't crash but still
doesn't link:

  http://kisskb.ellerman.id.au/kisskb/buildresult/13620269/log/

  /opt/cross/kisskb/korg/gcc-8.1.0-nolibc/powerpc64-linux/bin/powerpc64-linux-ld: linkage table error against `0002bf55.xdp_rxq_info_reg_mem_model'
  /opt/cross/kisskb/korg/gcc-8.1.0-nolibc/powerpc64-linux/bin/powerpc64-linux-ld: stubs don't match calculated size
  /opt/cross/kisskb/korg/gcc-8.1.0-nolibc/powerpc64-linux/bin/powerpc64-linux-ld: can not build stubs: Bad value
  make[1]: *** [/kisskb/src/Makefile:1036: vmlinux] Error 1

So I guess I'll take this version of the patch for now.

cheers

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

* Re: powerpc/32: Include .branch_lt in data section
  2018-11-14  3:02 [PATCH] powerpc/32: Include .branch_lt in data section Joel Stanley
  2018-11-14  4:00 ` Alan Modra
@ 2019-02-08 13:02 ` Michael Ellerman
  1 sibling, 0 replies; 6+ messages in thread
From: Michael Ellerman @ 2019-02-08 13:02 UTC (permalink / raw)
  To: Joel Stanley, linuxppc-dev; +Cc: Alan Modra

On Wed, 2018-11-14 at 03:02:18 UTC, Joel Stanley wrote:
> When building a 32 bit powerpc kernel with Binutils 2.31.1 this warning
> is emitted:
> 
>  powerpc-linux-gnu-ld: warning: orphan section `.branch_lt' from
>  `arch/powerpc/kernel/head_44x.o' being placed in section `.branch_lt'
> 
> As of binutils commit 2d7ad24e8726 ("Support PLT16 relocs against local
> symbols")[1], 32 bit targets can produce .branch_lt sections in their
> output.
> 
> Include these symbols in the .data section as the ppc64 kernel does.
> 
> [1] https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commitdiff;h=2d7ad24e8726ba4c45c9e67be08223a146a837ce
> Signed-off-by: Joel Stanley <joel@jms.id.au>
> Reviewed-by: Alan Modra <amodra@gmail.com>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/98ecc6768e8fdba95da1fc1efa0ef2d7

cheers

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

end of thread, back to index

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-14  3:02 [PATCH] powerpc/32: Include .branch_lt in data section Joel Stanley
2018-11-14  4:00 ` Alan Modra
2018-11-15 12:47   ` Michael Ellerman
2018-11-18  8:26     ` Alan Modra
2018-12-19  9:51       ` Michael Ellerman
2019-02-08 13:02 ` Michael Ellerman

LinuxPPC-Dev Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linuxppc-dev/0 linuxppc-dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linuxppc-dev linuxppc-dev/ https://lore.kernel.org/linuxppc-dev \
		linuxppc-dev@lists.ozlabs.org linuxppc-dev@ozlabs.org linuxppc-dev@archiver.kernel.org
	public-inbox-index linuxppc-dev


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.ozlabs.lists.linuxppc-dev


AGPL code for this site: git clone https://public-inbox.org/ public-inbox