]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: varasm.c (output_constant_pool_1): Pass down alignment from constant pool...
authorRohit Arul Raj <rohitarulraj@freescale.com>
Tue, 26 May 2015 20:11:44 +0000 (20:11 +0000)
committerEdmar Wienskoski <edmarwjr@gcc.gnu.org>
Tue, 26 May 2015 20:11:44 +0000 (20:11 +0000)
Backported from mainline
2015-05-14  Rohit Arul Raj  <rohitarulraj@freescale.com>

* varasm.c (output_constant_pool_1): Pass down alignment from
constant pool entry's descriptor to output_constant_pool_2.
(output_object_block): Add comment prior to call to
output_constant_pool_1.

* gcc.target/powerpc/pr60158.c: New test.

From-SVN: r223713

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/powerpc/pr60158.c [new file with mode: 0644]
gcc/varasm.c

index 360499b26c6b40aab3879dd39b9685e1bec94e06..29b1662716d0fffe3c1a74d35ae0f595f8e01b13 100644 (file)
@@ -1,3 +1,13 @@
+2015-05-26  Rohit Arul Raj  <rohitarulraj@freescale.com>
+
+       Backported from mainline
+       2015-05-14  Rohit Arul Raj  <rohitarulraj@freescale.com>
+
+       * varasm.c (output_constant_pool_1): Pass down alignment from
+       constant pool entry's descriptor to output_constant_pool_2.
+       (output_object_block): Add comment prior to call to
+       output_constant_pool_1.
+
 2015-05-21  Sandra Loosemore  <sandra@codesourcery.com>
 
        Backport from mainline r223418:
index 1aa99399aa188620a2a431e949b4bfe530afb6cc..042b34a5dd7714d035e01afc00453e59def96dd4 100644 (file)
@@ -1,3 +1,10 @@
+2015-05-26  Rohit Arul Raj  <rohitarulraj@freescale.com>
+
+       Backported from mainline
+       2015-05-14  Rohit Arul Raj  <rohitarulraj@freescale.com>
+
+       * gcc.target/powerpc/pr60158.c: New test.
+
 2015-05-16  Uros Bizjak  <ubizjak@gmail.com>
 
        PR target/66140
diff --git a/gcc/testsuite/gcc.target/powerpc/pr60158.c b/gcc/testsuite/gcc.target/powerpc/pr60158.c
new file mode 100644 (file)
index 0000000..e832397
--- /dev/null
@@ -0,0 +1,89 @@
+/* { dg-do compile } */
+/* { dg-skip-if "not an SPE target" { ! powerpc_spe_nocache } { "*" } { "" } } */
+/* { dg-options "-mcpu=8548 -mno-spe -mfloat-gprs=double -Os -fdata-sections -fpic -mrelocatable" } */
+
+#define NULL 0
+int func (int val);
+void *func2 (void *ptr);
+
+static const char *ifs;
+static char map[256];
+
+typedef struct {
+/* None of these fields are used, but removing any
+   of them makes the problem go away.  */
+  char *data;
+  int length;
+  int maxlen;
+  int quote;
+} o_string;
+
+#define NULL_O_STRING {NULL,0,0,0}
+
+static int parse_stream (void *dest, void *ctx)
+{
+  int ch = func (0), m;
+
+  while (ch != -1) {
+    m = map[ch];
+    if (ch != '\n')
+    func2(dest);
+
+    ctx = func2 (ctx);
+    if (!func (0))
+      return 0;
+    if (m != ch) {
+      func2 ("htns");
+      break;
+    }
+  }
+  return -1;
+}
+
+static void mapset (const char *set, int code)
+{
+  const char *s;
+  for (s=set; *s; s++)  map[(int)*s] = code;
+}
+
+static void update_ifs_map(void)
+{
+  /* char *ifs and char map[256] are both globals.  */
+  ifs = func2 ("abc");
+  if (ifs == NULL) ifs="def";
+
+  func2 (map);
+  {
+    char subst[2] = {4, 0};
+    mapset (subst, 3);
+  }
+  mapset (";&|#", 1);
+}
+
+int parse_stream_outer (int flag)
+{
+  int blah;
+  o_string temp=NULL_O_STRING;
+  int rcode;
+
+  do {
+    update_ifs_map ();
+    func2 (&blah); /* a memory clobber works as well.  */
+    rcode = parse_stream (&temp, NULL);
+    func2 ("aoeu");
+    if (func (0) != 0) {
+      func2 (NULL);
+    }
+  } while (rcode != -1);
+  return 0;
+}
+
+/* { dg-final { if ![file exists pr60158.s] { fail "pr60158.c (compile)"; return; } } } */
+
+/* { dg-final { set c_rel [llength [grep pr60158.s \\.data\\.rel\\.ro\\.local]] } } */
+/* { dg-final { set c_fix [llength [grep pr60158.s \\.fixup]] } } */
+/* { dg-final { if [string match $c_rel $c_fix] \{     } } */
+/* { dg-final {     pass "pr60158.c (passed)"  } } */
+/* { dg-final { \} else \{     } } */
+/* { dg-final {     fail "pr60158.c (.fixup table entries not generated for .data.rel.ro.local section)"       } } */
+/* { dg-final { \}     } } */
index eb406b7cc96ab4a850c7dae1ba284e1c09c0fd4d..d39d2910a980acf6d93e28c746c9e29265b2beb6 100644 (file)
@@ -3764,8 +3764,12 @@ output_constant_pool_1 (struct constant_descriptor_rtx *desc,
   /* Output the label.  */
   targetm.asm_out.internal_label (asm_out_file, "LC", desc->labelno);
 
-  /* Output the data.  */
-  output_constant_pool_2 (desc->mode, x, align);
+  /* Output the data.
+     Pass actual alignment value while emitting string constant to asm code
+     as function 'output_constant_pool_1' explicitly passes the alignment as 1
+     assuming that the data is already aligned which prevents the generation 
+     of fix-up table entries.  */
+  output_constant_pool_2 (desc->mode, x, desc->align);
 
   /* Make sure all constants in SECTION_MERGE and not SECTION_STRINGS
      sections have proper size.  */
@@ -7119,6 +7123,8 @@ output_object_block (struct object_block *block)
       if (CONSTANT_POOL_ADDRESS_P (symbol))
        {
          desc = SYMBOL_REF_CONSTANT (symbol);
+         /* Pass 1 for align as we have already laid out everything in the block.
+            So aligning shouldn't be necessary.  */
          output_constant_pool_1 (desc, 1);
          offset += GET_MODE_SIZE (desc->mode);
        }