This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC,PATCH] Introduce -msdata=explicit for powerpc

On Aug  8, 2018, Segher Boessenkool <> wrote:

> Then you get sdata2 used (via srodata in generic code), and it is accessed
> via GPR2 (via the sda21 reloc and linker magic).  It is hard to trace down :-)

Aah, it didn't occur to me that the r2 uses could be introduced by the
linker.  I was cutting corners and looking at the asm output, after
building only gcc, without binutils.  Thanks for the explanation.  Mind
if I add a comment about that next to... hmm...  how about the
SMALL_DATA_* macros?

for  gcc/ChangeLog

	* config/rs6000/rs6000.c (SMALL_DATA_RELOC, SMALL_DATA_REG): Add
	a comment about how uses of r2 for .sdata2 come about.

diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index ddc61bdaffe7..bbc564de41ae 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -21240,6 +21240,9 @@ rs6000_output_function_entry (FILE *file, const char *fname)
 /* Print an operand.  Recognize special options, documented below.  */
+/* Access to .sdata2 through r2 (see -msdata=eabi in invoke.texi) is
+   only introduced by the linker, when applying the sda21
+   relocation.  */
 #define SMALL_DATA_RELOC ((rs6000_sdata == SDATA_EABI) ? "sda21" : "sdarel")
 #define SMALL_DATA_REG ((rs6000_sdata == SDATA_EABI) ? 0 : 13)

Alexandre Oliva, freedom fighter
Be the change, be Free!         FSF Latin America board member
GNU Toolchain Engineer                Free Software Evangelist

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]