aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Meissner <meissner@linux.vnet.ibm.com>2011-12-28 18:02:49 +0000
committerMichael Meissner <meissner@gcc.gnu.org>2011-12-28 18:02:49 +0000
commit37f3b6804eab77c25fd498d5603d2868d91ca1ac (patch)
treef5d83b77aefa093bda1f184fdaa3a6829e82917c
parent0fe0620df5f91f4979dc7b9347e86a1acec4b156 (diff)
downloadgcc-37f3b6804eab77c25fd498d5603d2868d91ca1ac.zip
gcc-37f3b6804eab77c25fd498d5603d2868d91ca1ac.tar.gz
gcc-37f3b6804eab77c25fd498d5603d2868d91ca1ac.tar.bz2
Fix PR 51623
From-SVN: r182710
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/config/rs6000/rs6000.c2
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr51623.c123
4 files changed, 136 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 280ca15..9648baa 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+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-28 Ira Rosen <irar@il.ibm.com>
PR tree-optimization/51684
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index da35528..d61f14c 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -15461,7 +15461,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
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index c3b57c1..aba19e9 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+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
index 0000000..37b7d65
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr51623.c
@@ -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;