[PATCH] RISC-V: Force variables to .data for code_elim.

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] RISC-V: Force variables to .data for code_elim.

Jim Wilson-2
RISC-V puts a global variable in .sdata by default, which causes the
add-symbol-file commands with -s .data to fail as there is no .data section.
This fixes 3 testsuite failures.

Jim

        gdb/testsuite/
        * gdb.base/code_elim.exp: For riscv, set additional_flags
        to include -msmall-data-limit=0.
---
 gdb/testsuite/gdb.base/code_elim.exp | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/gdb/testsuite/gdb.base/code_elim.exp b/gdb/testsuite/gdb.base/code_elim.exp
index 962df4d773..1c76827754 100644
--- a/gdb/testsuite/gdb.base/code_elim.exp
+++ b/gdb/testsuite/gdb.base/code_elim.exp
@@ -28,6 +28,11 @@ lappend opts "additional_flags=-fdata-sections"
 lappend opts "additional_flags=-Wl,-gc-sections"
 lappend opts "additional_flags=-Wl,-e,main"
 
+# Place variables in .data instead of .sdata.
+if {[istarget "riscv*-*-*"]} {
+   lappend opts "additional_flags=-msmall-data-limit=0"
+}
+
 remote_exec build "rm -f ${binfile1}"
 remote_exec build "rm -f ${binfile2}"
 
--
2.17.1

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] RISC-V: Force variables to .data for code_elim.

Simon Marchi-4
Hi Andrew,

While scanning my inbox, I saw this was unanswered.  This looks good to me,
but you (or Palmer) should probably approve.

Simon

On 2018-10-26 6:14 p.m., Jim Wilson wrote:

> RISC-V puts a global variable in .sdata by default, which causes the
> add-symbol-file commands with -s .data to fail as there is no .data section.
> This fixes 3 testsuite failures.
>
> Jim
>
> gdb/testsuite/
> * gdb.base/code_elim.exp: For riscv, set additional_flags
> to include -msmall-data-limit=0.
> ---
>  gdb/testsuite/gdb.base/code_elim.exp | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/gdb/testsuite/gdb.base/code_elim.exp b/gdb/testsuite/gdb.base/code_elim.exp
> index 962df4d773..1c76827754 100644
> --- a/gdb/testsuite/gdb.base/code_elim.exp
> +++ b/gdb/testsuite/gdb.base/code_elim.exp
> @@ -28,6 +28,11 @@ lappend opts "additional_flags=-fdata-sections"
>  lappend opts "additional_flags=-Wl,-gc-sections"
>  lappend opts "additional_flags=-Wl,-e,main"
>  
> +# Place variables in .data instead of .sdata.
> +if {[istarget "riscv*-*-*"]} {
> +   lappend opts "additional_flags=-msmall-data-limit=0"
> +}
> +
>  remote_exec build "rm -f ${binfile1}"
>  remote_exec build "rm -f ${binfile2}"
>  
>

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] RISC-V: Force variables to .data for code_elim.

Andrew Burgess
In reply to this post by Jim Wilson-2
* Jim Wilson <[hidden email]> [2018-10-26 15:14:26 -0700]:

> RISC-V puts a global variable in .sdata by default, which causes the
> add-symbol-file commands with -s .data to fail as there is no .data section.
> This fixes 3 testsuite failures.
>
> Jim
>
> gdb/testsuite/
> * gdb.base/code_elim.exp: For riscv, set additional_flags
> to include -msmall-data-limit=0.

This is fine with me.  Sorry for not reviewing this earlier.

Thanks,
Andrew



> ---
>  gdb/testsuite/gdb.base/code_elim.exp | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/gdb/testsuite/gdb.base/code_elim.exp b/gdb/testsuite/gdb.base/code_elim.exp
> index 962df4d773..1c76827754 100644
> --- a/gdb/testsuite/gdb.base/code_elim.exp
> +++ b/gdb/testsuite/gdb.base/code_elim.exp
> @@ -28,6 +28,11 @@ lappend opts "additional_flags=-fdata-sections"
>  lappend opts "additional_flags=-Wl,-gc-sections"
>  lappend opts "additional_flags=-Wl,-e,main"
>  
> +# Place variables in .data instead of .sdata.
> +if {[istarget "riscv*-*-*"]} {
> +   lappend opts "additional_flags=-msmall-data-limit=0"
> +}
> +
>  remote_exec build "rm -f ${binfile1}"
>  remote_exec build "rm -f ${binfile2}"
>  
> --
> 2.17.1
>
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] RISC-V: Force variables to .data for code_elim.

Jim Wilson-2
On Tue, Nov 6, 2018 at 1:49 AM Andrew Burgess
<[hidden email]> wrote:
> >       gdb/testsuite/
> >       * gdb.base/code_elim.exp: For riscv, set additional_flags
> >       to include -msmall-data-limit=0.
>
> This is fine with me.  Sorry for not reviewing this earlier.
>
> Thanks,
> Andrew

Committed and pushed.

Jim