[SLOF] [PATCH slof] qemu/js2x/client: Support binutils >= 2.25.1
Alexey Kardashevskiy
aik at ozlabs.ru
Mon Nov 2 12:40:47 AEDT 2015
On 10/26/2015 05:37 PM, Alexey Kardashevskiy wrote:
> The recent binutils version introduces explicit definition of
> a TOC symbol which points to the .toc section and enforces .toc
> alignment to 256 rather than 8 bytes before.
>
> For now the TOC symbol points to same location as it was before -
> start of .toc + 0x8000; however as this might change, we should not
> rely on that in the source code.
>
> This changes __toc_start (for qemu and js2x boards), _got (for net-snk,
> takeover, rtas) in linker scripts to use explicitely defined TOC if
> defined and fall back to the older scheme if not.
>
> This changes r2 (the register pointing to TOC) setup code not to add
> 0x8000 as linker scripts do that now.
No opinion on this, really? So I just push it and then watch people
complaining? :)
>
> Here is a bit more information about the change:
> https://sourceware.org/ml/binutils/2015-10/msg00124.html
> https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=a27e685fa0a6480bdb07e3be359558524cec89b7
>
> Reported-by: William Grant <wgrant at ubuntu.com>
> Signed-off-by: Alexey Kardashevskiy <aik at ozlabs.ru>
> ---
> board-js2x/llfw/stage2.lds | 3 ++-
> board-js2x/llfw/stage2_head.S | 2 --
> board-qemu/llfw/stage2.lds | 3 ++-
> board-qemu/llfw/stage2_head.S | 2 --
> clients/net-snk/client.lds | 4 ++--
> clients/net-snk/kernel/entry.S | 2 +-
> clients/takeover/client.lds | 4 ++--
> clients/takeover/entry.S | 2 +-
> rtas/reloc.S | 2 +-
> rtas/rtas.lds | 3 ++-
> rtas/rtas_entry.S | 2 +-
> 11 files changed, 14 insertions(+), 15 deletions(-)
>
> diff --git a/board-js2x/llfw/stage2.lds b/board-js2x/llfw/stage2.lds
> index f91f065..e6315c3 100644
> --- a/board-js2x/llfw/stage2.lds
> +++ b/board-js2x/llfw/stage2.lds
> @@ -45,7 +45,8 @@ SECTIONS {
> __bss_end = .;
> __bss_size = (__bss_end - __bss_start);
>
> - __toc_start = .;
> + . = ALIGN(256);
> + __toc_start = DEFINED (.TOC.) ? .TOC. : ADDR (.got) + 0x8000;
> .got :
> {
> *(.toc .got)
> diff --git a/board-js2x/llfw/stage2_head.S b/board-js2x/llfw/stage2_head.S
> index 5460bfe..f3f5e0c 100644
> --- a/board-js2x/llfw/stage2_head.S
> +++ b/board-js2x/llfw/stage2_head.S
> @@ -79,8 +79,6 @@ bsscdone:
> /* ------------------------------------ */
> ASM_ENTRY(toc_init)
> LOAD64(r2, __toc_start)
> - addi r2,r2,0x4000
> - addi r2,r2,0x4000
> blr
>
> /* ------------------------------------ */
> diff --git a/board-qemu/llfw/stage2.lds b/board-qemu/llfw/stage2.lds
> index e060dd1..28c9dca 100644
> --- a/board-qemu/llfw/stage2.lds
> +++ b/board-qemu/llfw/stage2.lds
> @@ -49,7 +49,8 @@ SECTIONS {
> __bss_end = .;
> __bss_size = (__bss_end - __bss_start);
>
> - __toc_start = .;
> + . = ALIGN(256);
> + __toc_start = DEFINED (.TOC.) ? .TOC. : ADDR (.got) + 0x8000;
> .got :
> {
> *(.toc .got)
> diff --git a/board-qemu/llfw/stage2_head.S b/board-qemu/llfw/stage2_head.S
> index c56b117..adf7554 100644
> --- a/board-qemu/llfw/stage2_head.S
> +++ b/board-qemu/llfw/stage2_head.S
> @@ -77,8 +77,6 @@ bsscdone:
> /* ------------------------------------ */
> ASM_ENTRY(toc_init)
> LOAD64(r2, __toc_start)
> - addi r2,r2,0x4000
> - addi r2,r2,0x4000
> blr
>
> /* ------------------------------------ */
> diff --git a/clients/net-snk/client.lds b/clients/net-snk/client.lds
> index 39d0459..c208644 100644
> --- a/clients/net-snk/client.lds
> +++ b/clients/net-snk/client.lds
> @@ -44,10 +44,10 @@ SECTIONS {
> *(.opd)
> }
>
> - . = ALIGN(0x10);
> + . = ALIGN(256);
> .got :
> {
> - _got = .;
> + _got = DEFINED (.TOC.) ? .TOC. : ADDR (.got) + 0x8000;
> *(.got)
> *(.toc)
> _got_end = .;
> diff --git a/clients/net-snk/kernel/entry.S b/clients/net-snk/kernel/entry.S
> index 8849fb9..bf10542 100644
> --- a/clients/net-snk/kernel/entry.S
> +++ b/clients/net-snk/kernel/entry.S
> @@ -44,7 +44,7 @@ C_ENTRY(_entry)
> bcl 20,31,over # branch after pointer table
> base:
> .align 3
> -.LCgot: .quad _got-base+0x8000
> +.LCgot: .quad _got-base
> .LCstack: .quad _stack+STACKSIZE-0x80-base
> over:
> mflr r8 # gpr 8 is the base
> diff --git a/clients/takeover/client.lds b/clients/takeover/client.lds
> index 2701d8e..0ab428a 100644
> --- a/clients/takeover/client.lds
> +++ b/clients/takeover/client.lds
> @@ -43,8 +43,8 @@ SECTIONS {
>
> .got :
> {
> - . = ALIGN(8);
> - _got = .;
> + . = ALIGN(256);
> + _got = DEFINED (.TOC.) ? .TOC. : ADDR (.got) + 0x8000;
> *(.got .toc)
> _got_end = .;
> }
> diff --git a/clients/takeover/entry.S b/clients/takeover/entry.S
> index a1030eb..ff48273 100644
> --- a/clients/takeover/entry.S
> +++ b/clients/takeover/entry.S
> @@ -21,7 +21,7 @@ _wrapclient:
> bcl 20,31,over # branch after pointer table
> base:
> .align 3
> -.LCgot: .quad _got-base+0x8000
> +.LCgot: .quad _got-base
> over:
> mflr r8 # gpr 8 is the base
> ld r2, .LCgot-base(r8) # load got pointer
> diff --git a/rtas/reloc.S b/rtas/reloc.S
> index e24d293..1b5b59a 100644
> --- a/rtas/reloc.S
> +++ b/rtas/reloc.S
> @@ -61,7 +61,7 @@ _rtas_start:
> ._rtas_entry_offset: .quad rtas_entry-_rtas_start
> ._rtas_config_offset: .quad rtas_config-_rtas_start
> ._rtas_stack: .quad .stack-_rtas_start+RTAS_STACKSIZE-0x60
> -._rtas_toc: .quad _got-_rtas_start+0x8000
> +._rtas_toc: .quad _got-_rtas_start
>
> .over:
> mflr r8 # gpr 8 is the base
> diff --git a/rtas/rtas.lds b/rtas/rtas.lds
> index a5ba1da..30b18dd 100644
> --- a/rtas/rtas.lds
> +++ b/rtas/rtas.lds
> @@ -28,7 +28,8 @@ SECTIONS {
> }
> .got :
> {
> - _got = .;
> + . = ALIGN(256);
> + _got = DEFINED (.TOC.) ? .TOC. : ADDR (.got) + 0x8000;
> *(.got .toc)
> }
> .reloc :
> diff --git a/rtas/rtas_entry.S b/rtas/rtas_entry.S
> index 74693aa..424137b 100644
> --- a/rtas/rtas_entry.S
> +++ b/rtas/rtas_entry.S
> @@ -39,7 +39,7 @@ rtas_entry:
> bcl 20,31,.over # branch to over
> .base:
> .align 3
> -..got: .quad _got-.base+0x8000
> +..got: .quad _got-.base
> ..stack: .quad .stack+RTAS_STACKSIZE-0x60-.base
> .over:
> mflr r8 # gpr 8 is the base
>
--
Alexey
More information about the SLOF
mailing list