[PATCH] tests/tcg/nios2: Tweak 10m50-ghrd.ld

Richard Henderson posted 1 patch 1 year, 6 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20221024132459.3229709-3-richard.henderson@linaro.org
tests/tcg/nios2/10m50-ghrd.ld | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
[PATCH] tests/tcg/nios2: Tweak 10m50-ghrd.ld
Posted by Richard Henderson 1 year, 6 months ago
More closely follow the default linker script for nios2.
This magically fixes a problem resolving .got relocs from
the toolchain's libgcc.a.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1258
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 tests/tcg/nios2/10m50-ghrd.ld | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/tests/tcg/nios2/10m50-ghrd.ld b/tests/tcg/nios2/10m50-ghrd.ld
index 7db0d59ad7..71cdda450c 100644
--- a/tests/tcg/nios2/10m50-ghrd.ld
+++ b/tests/tcg/nios2/10m50-ghrd.ld
@@ -44,11 +44,15 @@ SECTIONS
     .data : ALIGN(4) {
         *(.shdata)
         *(.data .data.* .gnu.linkonce.d.*)
-        . = ALIGN(4);
-        _gp = ABSOLUTE(. + 0x8000);
-        *(.got.plt) *(.got)
-        *(.lit8)
-        *(.lit4)
+    } >ram :RAM
+
+    HIDDEN (_gp = ALIGN(16) + 0x7ff0);
+    PROVIDE_HIDDEN (gp = _gp);
+    .got : ALIGN(4) {
+        *(.got.plt) *(.igot.plt) *(.got) *(.igot)
+    } >ram :RAM
+
+    .sdata : ALIGN(4) {
         *(.sdata .sdata.* .gnu.linkonce.s.*)
     } >ram :RAM
 
-- 
2.34.1
Re: [PATCH] tests/tcg/nios2: Tweak 10m50-ghrd.ld
Posted by Claudio Fontana 1 year, 6 months ago
This is unrelated to the "tcg: Fix x86 TARGET_TB_PCREL (#1269)" series right?

For some reason it appears to me as part of it, as a reply to the cover letter.
Ignoring this one as I don't understand it at all.

Ciao,

C

On 10/24/22 15:24, Richard Henderson wrote:
> More closely follow the default linker script for nios2.
> This magically fixes a problem resolving .got relocs from
> the toolchain's libgcc.a.
> 
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1258
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>  tests/tcg/nios2/10m50-ghrd.ld | 14 +++++++++-----
>  1 file changed, 9 insertions(+), 5 deletions(-)
> 
> diff --git a/tests/tcg/nios2/10m50-ghrd.ld b/tests/tcg/nios2/10m50-ghrd.ld
> index 7db0d59ad7..71cdda450c 100644
> --- a/tests/tcg/nios2/10m50-ghrd.ld
> +++ b/tests/tcg/nios2/10m50-ghrd.ld
> @@ -44,11 +44,15 @@ SECTIONS
>      .data : ALIGN(4) {
>          *(.shdata)
>          *(.data .data.* .gnu.linkonce.d.*)
> -        . = ALIGN(4);
> -        _gp = ABSOLUTE(. + 0x8000);
> -        *(.got.plt) *(.got)
> -        *(.lit8)
> -        *(.lit4)
> +    } >ram :RAM
> +
> +    HIDDEN (_gp = ALIGN(16) + 0x7ff0);
> +    PROVIDE_HIDDEN (gp = _gp);
> +    .got : ALIGN(4) {
> +        *(.got.plt) *(.igot.plt) *(.got) *(.igot)
> +    } >ram :RAM
> +
> +    .sdata : ALIGN(4) {
>          *(.sdata .sdata.* .gnu.linkonce.s.*)
>      } >ram :RAM
>