OSDN Git Service

Backport PR 51623 change
authormeissner <meissner@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 28 Dec 2011 20:53:30 +0000 (20:53 +0000)
committermeissner <meissner@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 28 Dec 2011 20:53:30 +0000 (20:53 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@182712 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/rs6000/rs6000.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/powerpc/pr51623.c [new file with mode: 0644]

index bb71f57..679b0b9 100644 (file)
@@ -1,3 +1,13 @@
+2011-12-28  Michael Meissner  <meissner@linux.vnet.ibm.com>
+
+       Backport from mainline
+       2011-12-28  Michael Meissner  <meissner@linux.vnet.ibm.com>
+
+       PR target/51623
+       * config/rs6000/rs6000.c (rs6000_assemble_integer): Don't call
+       unlikely_text_section_p.  Instead check for being in a code
+       section.
+
 2011-12-23  Richard Guenther  <rguenther@suse.de>
 
        PR rtl-optimization/50396
index 2bc90ca..c069629 100644 (file)
@@ -16615,7 +16615,7 @@ rs6000_assemble_integer (rtx x, unsigned int size, int aligned_p)
       if (TARGET_RELOCATABLE
          && in_section != toc_section
          && in_section != text_section
-         && !unlikely_text_section_p (in_section)
+         && (in_section && (in_section->common.flags & SECTION_CODE)) == 0
          && !recurse
          && GET_CODE (x) != CONST_INT
          && GET_CODE (x) != CONST_DOUBLE
index a33c997..3bef6a7 100644 (file)
@@ -1,3 +1,11 @@
+2011-12-28  Michael Meissner  <meissner@linux.vnet.ibm.com>
+
+       Backport from mainline
+       2011-12-28  Michael Meissner  <meissner@linux.vnet.ibm.com>
+
+       PR target/51623
+       * gcc.target/powerpc/pr51623.c: New file.
+
 2011-12-28  Uros Bizjak  <ubizjak@gmail.com>
 
        * gcc.dg/torture/pr50396.c: Use dg-add-options ieee.
diff --git a/gcc/testsuite/gcc.target/powerpc/pr51623.c b/gcc/testsuite/gcc.target/powerpc/pr51623.c
new file mode 100644 (file)
index 0000000..37b7d65
--- /dev/null
@@ -0,0 +1,123 @@
+/* PR target/51623 */
+/* { dg-do compile { target { { powerpc*-*-linux* && ilp32 } || { powerpc-*-eabi* } } } } */
+/* { dg-options "-mrelocatable -ffreestanding" } */
+
+/* This generated an error, since the compiler was calling
+   unlikely_text_section_p in a context where it wasn't valid.  */
+
+typedef long long loff_t;
+typedef unsigned size_t;
+
+
+struct mtd_info {
+  unsigned writesize;
+  unsigned oobsize;
+  const char *name;
+};
+
+extern int strcmp(const char *,const char *);
+extern char * strchr(const char *,int);
+
+struct cmd_tbl_s {
+  char *name;
+};
+
+
+int printf(const char *fmt, ...) __attribute__ ((format (__printf__, 1, 2)));
+void* malloc(size_t);
+void free(void*);
+
+
+extern int nand_curr_device;
+extern struct mtd_info nand_info[];
+
+static int nand_dump(struct mtd_info *nand, unsigned long off, int only_oob)
+{
+  int i;
+  unsigned char *datbuf, *oobbuf, *p;
+
+  datbuf = malloc(nand->writesize + nand->oobsize);
+  oobbuf = malloc(nand->oobsize);
+  off &= ~(nand->writesize - 1);
+
+  printf("Page %08lx dump:\n", off);
+  i = nand->writesize >> 4;
+  p = datbuf;
+
+  while (i--) {
+    if (!only_oob)
+      printf("\t%02x %02x %02x %02x %02x %02x %02x %02x"
+            "  %02x %02x %02x %02x %02x %02x %02x %02x\n",
+            p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7],
+            p[8], p[9], p[10], p[11], p[12], p[13], p[14],
+            p[15]);
+    p += 16;
+  }
+
+  i = nand->oobsize >> 3;
+  free(datbuf);
+  free(oobbuf);
+
+  return 0;
+}
+
+int do_nand(struct cmd_tbl_s * cmdtp, int flag, int argc, char *argv[])
+{
+  int dev;
+  unsigned long  off;
+  char *cmd, *s;
+  struct mtd_info *nand;
+
+  if (argc < 2)
+    goto usage;
+
+  cmd = argv[1];
+
+  if (strcmp(cmd, "info") == 0) {
+    putc('\n');
+    return 0;
+  }
+
+  if (strcmp(cmd, "device") == 0) {
+    if (argc < 3) {
+      putc('\n');
+    }
+    dev = (int)simple_strtoul(argv[2], ((void *)0), 10);
+    nand_curr_device = dev;
+    return 0;
+  }
+
+  if (strcmp(cmd, "bad") != 0 && strcmp(cmd, "erase") != 0  )
+    goto usage;
+  
+  if (nand_curr_device < 0 ) {
+    return 1;
+  }
+  nand = &nand_info[nand_curr_device];
+
+  if (strcmp(cmd, "erase") == 0 || strcmp(cmd, "scrub") == 0) {
+    int clean = argc > 2 && !strcmp("clean", argv[2]);
+    int scrub = !strcmp(cmd, "scrub");
+    return 0;
+  }
+
+  if (strncmp(cmd, "dump", 4) == 0) {
+    if (argc < 3)
+      goto usage;
+
+    s = strchr(cmd, '.');
+    off = (int)simple_strtoul(argv[2], ((void *)0), 16);
+    
+    if (s != ((void *)0) && strcmp(s, ".oob") == 0)
+      nand_dump(nand, off, 1);
+    else
+      nand_dump(nand, off, 0);
+    
+    return 0;
+  }
+usage:
+  cmd_usage(cmdtp);
+  return 1;
+}
+
+void *ptr = do_nand;