Commit 335b7b5a by Segher Boessenkool Committed by Segher Boessenkool

rs6000: -mreadonly-in-sdata (PR82411)

This adds a new option -mreadonly-in-sdata (on by default) that
controls whether readonly data can be put in sdata.  (For EABI this
does nothing, readonly data is put in sdata2 as usual).


	PR target/82411
	* config/rs6000/rs6000.c (rs6000_elf_in_small_data_p): Don't put
	readonly data in sdata, if that is disabled.
	* config/rs6000/sysv4.opt (mreadonly-in-sdata): New option.
	* doc/invoke.texi (RS/6000 and PowerPC Options): Document
	-mreadonly-in-sdata option.

gcc/testsuite/
	PR target/82411
	* gcc.target/powerpc/ppc-sdata-2.c: Skip if -mno-readonly-in-sdata.

From-SVN: r258340
parent a76acaed
2018-03-07 Segher Boessenkool <segher@kernel.crashing.org>
PR target/82411
* config/rs6000/rs6000.c (rs6000_elf_in_small_data_p): Don't put
readonly data in sdata, if that is disabled.
* config/rs6000/sysv4.opt (mreadonly-in-sdata): New option.
* doc/invoke.texi (RS/6000 and PowerPC Options): Document
-mreadonly-in-sdata option.
2018-03-07 Martin Sebor <msebor@redhat.com> 2018-03-07 Martin Sebor <msebor@redhat.com>
PR tree-optimization/84468 PR tree-optimization/84468
......
...@@ -33259,6 +33259,11 @@ rs6000_elf_in_small_data_p (const_tree decl) ...@@ -33259,6 +33259,11 @@ rs6000_elf_in_small_data_p (const_tree decl)
} }
else else
{ {
/* If we are told not to put readonly data in sdata, then don't. */
if (TREE_READONLY (decl) && rs6000_sdata != SDATA_EABI
&& !rs6000_readonly_in_sdata)
return false;
HOST_WIDE_INT size = int_size_in_bytes (TREE_TYPE (decl)); HOST_WIDE_INT size = int_size_in_bytes (TREE_TYPE (decl));
if (size > 0 if (size > 0
...@@ -27,6 +27,10 @@ msdata= ...@@ -27,6 +27,10 @@ msdata=
Target RejectNegative Joined Var(rs6000_sdata_name) Target RejectNegative Joined Var(rs6000_sdata_name)
Select method for sdata handling. Select method for sdata handling.
mreadonly-in-sdata
Target Report Var(rs6000_readonly_in_sdata) Init(1) Save
Allow readonly data in sdata.
mtls-size= mtls-size=
Target RejectNegative Joined Var(rs6000_tls_size) Enum(rs6000_tls_size) Target RejectNegative Joined Var(rs6000_tls_size) Enum(rs6000_tls_size)
Specify bit size of immediate TLS offsets. Specify bit size of immediate TLS offsets.
......
...@@ -1087,7 +1087,7 @@ See RS/6000 and PowerPC Options. ...@@ -1087,7 +1087,7 @@ See RS/6000 and PowerPC Options.
-mdlmzb -mno-dlmzb @gol -mdlmzb -mno-dlmzb @gol
-mprototype -mno-prototype @gol -mprototype -mno-prototype @gol
-msim -mmvme -mads -myellowknife -memb -msdata @gol -msim -mmvme -mads -myellowknife -memb -msdata @gol
-msdata=@var{opt} -mvxworks -G @var{num} @gol -msdata=@var{opt} -mreadonly-in-sdata -mvxworks -G @var{num} @gol
-mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
-mno-recip-precision @gol -mno-recip-precision @gol
-mveclibabi=@var{type} -mfriz -mno-friz @gol -mveclibabi=@var{type} -mfriz -mno-friz @gol
...@@ -24114,6 +24114,13 @@ On embedded PowerPC systems, put all initialized global and static data ...@@ -24114,6 +24114,13 @@ On embedded PowerPC systems, put all initialized global and static data
in the @code{.data} section, and all uninitialized data in the in the @code{.data} section, and all uninitialized data in the
@code{.bss} section. @code{.bss} section.
@item -mreadonly-in-sdata
@itemx -mreadonly-in-sdata
@opindex mreadonly-in-sdata
@opindex mno-readonly-in-sdata
Put read-only objects in the @code{.sdata} section as well. This is the
default.
@item -mblock-move-inline-limit=@var{num} @item -mblock-move-inline-limit=@var{num}
@opindex mblock-move-inline-limit @opindex mblock-move-inline-limit
Inline all block moves (such as calls to @code{memcpy} or structure Inline all block moves (such as calls to @code{memcpy} or structure
2018-03-07 Segher Boessenkool <segher@kernel.crashing.org>
PR target/82411
* gcc.target/powerpc/ppc-sdata-2.c: Skip if -mno-readonly-in-sdata.
2018-03-07 Martin Sebor <msebor@redhat.com> 2018-03-07 Martin Sebor <msebor@redhat.com>
PR tree-optimization/84468 PR tree-optimization/84468
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
/* { dg-final { scan-assembler-not "\\.section\[ \t\]\\.sdata2," } } */ /* { dg-final { scan-assembler-not "\\.section\[ \t\]\\.sdata2," } } */
/* { dg-final { scan-assembler "sdat@sdarel\\(13\\)" } } */ /* { dg-final { scan-assembler "sdat@sdarel\\(13\\)" } } */
/* { dg-final { scan-assembler "sdat2@sdarel\\(13\\)" } } */ /* { dg-final { scan-assembler "sdat2@sdarel\\(13\\)" } } */
/* { dg-skip-if "" { *-*-* } { "-mno-readonly-in-sdata" } { "" } } */
int sdat = 2; int sdat = 2;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment