]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
rs6000: -mreadonly-in-sdata (PR82411)
authorSegher Boessenkool <segher@kernel.crashing.org>
Tue, 27 Mar 2018 23:28:25 +0000 (01:28 +0200)
committerSegher Boessenkool <segher@gcc.gnu.org>
Tue, 27 Mar 2018 23:28:25 +0000 (01:28 +0200)
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).

Backport from mainline
2018-03-08  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.

gcc/testsuite/
Backport from mainline
2018-03-08  Segher Boessenkool  <segher@kernel.crashing.org>

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

From-SVN: r258909

gcc/ChangeLog
gcc/config/rs6000/rs6000.c
gcc/config/rs6000/sysv4.opt
gcc/doc/invoke.texi
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/powerpc/ppc-sdata-2.c

index 556080abc49da4c5183a40efdedef8ab571b2347..8acb3088d462ab995cec5b97330a53ed6ee65723 100644 (file)
@@ -1,3 +1,15 @@
+2018-03-28  Segher Boessenkool  <segher@kernel.crashing.org>
+
+       Backport from mainline
+       2018-03-08  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-27  Carl Love  <cel@us.ibm.com>
 
        Backport from mainline
index d1485e337d3ff315067fc7fa4ca401a273243fc1..c03f1f9c1e40d433a47d3855afead861f0289e19 100644 (file)
@@ -32776,6 +32776,11 @@ rs6000_elf_in_small_data_p (const_tree decl)
     }
   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));
 
       if (size > 0
index 581fcde4c55543e0eec7cea72403480777641437..18995281a8a0436fea1810be11881b2f15a6f1cb 100644 (file)
@@ -27,6 +27,10 @@ msdata=
 Target RejectNegative Joined Var(rs6000_sdata_name)
 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=
 Target RejectNegative Joined Var(rs6000_tls_size) Enum(rs6000_tls_size)
 Specify bit size of immediate TLS offsets.
index 1d3a824d7b8f56004519bcac20b6dab567c44973..3e2ef3f4c6b6f69a8d4a51b442ecb686137b097f 100644 (file)
@@ -990,7 +990,7 @@ See RS/6000 and PowerPC Options.
 -mfloat-gprs=yes  -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol
 -mprototype  -mno-prototype @gol
 -msim  -mmvme  -mads  -myellowknife  -memb  -msdata @gol
--msdata=@var{opt}  -mvxworks  -G @var{num}  -pthread @gol
+-msdata=@var{opt}  -mreadonly-in-sdata  -mvxworks  -G @var{num}  -pthread @gol
 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
 -mno-recip-precision @gol
 -mveclibabi=@var{type} -mfriz -mno-friz @gol
@@ -20746,6 +20746,13 @@ On embedded PowerPC systems, put all initialized global and static data
 in the @code{.data} section, and all uninitialized data in the
 @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}
 @opindex mblock-move-inline-limit
 Inline all block moves (such as calls to @code{memcpy} or structure
index 010a6e9504981e8eab6c8521cb221e4cf3012994..3978f6ddbb08a41c74d9ba73e9738a7a8d66fa5f 100644 (file)
@@ -1,3 +1,11 @@
+2018-03-28  Segher Boessenkool  <segher@kernel.crashing.org>
+
+       Backport from mainline
+       2018-03-08  Segher Boessenkool  <segher@kernel.crashing.org>
+
+       PR target/82411
+       * gcc.target/powerpc/ppc-sdata-2.c: Skip if -mno-readonly-in-sdata.
+
 2018-03-27  Carl Love  <cel@us.ibm.com>
 
        * gcc.target/powerpc/crypto-builtin-1-runnable.c: New test file.
index 570c81f7e33033d2cce3bb362877dbce4851b660..ee77456ca4ff95271ea97d760c7b26930d33aa15 100644 (file)
@@ -5,6 +5,7 @@
 /* { dg-final { scan-assembler-not "\\.section\[ \t\]\\.sdata2," } } */
 /* { dg-final { scan-assembler "sdat@sdarel\\(13\\)" } } */
 /* { dg-final { scan-assembler "sdat2@sdarel\\(13\\)" } } */
+/* { dg-skip-if "" { *-*-* } { "-mno-readonly-in-sdata" } { "" } } */
 
 
 int sdat = 2;