]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR target/17751 (Undefined .LCTOC0 symbol)
authorJakub Jelinek <jakub@redhat.com>
Mon, 24 Jan 2005 17:39:37 +0000 (18:39 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 24 Jan 2005 17:39:37 +0000 (18:39 +0100)
PR target/17751
* config/rs6000/rs6000.c (rs6000_file_start): Create toc section
for AIX ABI or ELF -fPIC.
(rs6000_emit_load_toc_table): Don't create toc_section here.
(rs6000_xcoff_file_start): Nor here.

* gcc.dg/ppc64-toc.c: New test.

From-SVN: r94166

gcc/ChangeLog
gcc/config/rs6000/rs6000.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/ppc64-toc.c [new file with mode: 0644]

index 9ef730b588a57bd405261f2a4b337613a253591b..d0ecd6e57c34d60cdbc5a43b740d18deb86bf282 100644 (file)
@@ -1,3 +1,11 @@
+2005-01-24  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/17751
+       * config/rs6000/rs6000.c (rs6000_file_start): Create toc section
+       for AIX ABI or ELF -fPIC.
+       (rs6000_emit_load_toc_table): Don't create toc_section here.
+       (rs6000_xcoff_file_start): Nor here.
+
 2005-01-24  J"orn Rennecke <joern.rennecke@st.com>
 
        * sh.c (ra.h): Don't #include.
index 278751bf814d1499104667e43b777902566ee4cd..ccf9ace34d443928750b55a8a596f29e41e29d0d 100644 (file)
@@ -1768,6 +1768,12 @@ rs6000_file_start (void)
       if (*start == '\0')
        putc ('\n', file);
     }
+
+  if (DEFAULT_ABI == ABI_AIX || (TARGET_ELF && flag_pic == 2))
+    {
+      toc_section ();
+      text_section ();
+    }
 }
 
 \f
@@ -13294,13 +13300,6 @@ rs6000_emit_load_toc_table (int fromprolog)
                   : gen_reg_rtx (Pmode));
       rtx symF;
 
-      /* possibly create the toc section */
-      if (! toc_initialized)
-       {
-         toc_section ();
-         function_section (current_function_decl);
-       }
-
       if (fromprolog)
        {
          rtx symL;
@@ -18086,7 +18085,6 @@ rs6000_xcoff_file_start (void)
   fputs ("\t.file\t", asm_out_file);
   output_quoted_string (asm_out_file, main_input_filename);
   fputc ('\n', asm_out_file);
-  toc_section ();
   if (write_symbols != NO_DEBUG)
     private_data_section ();
   text_section ();
index d1bde8aa50d1c666ec9914154c46e7dc9c011c05..e6889c0f9b280a013cb94c470fe7ec5eb386202d 100644 (file)
@@ -1,5 +1,8 @@
 2005-01-24  Jakub Jelinek  <jakub@redhat.com>
 
+       PR target/17751
+       * gcc.dg/ppc64-toc.c: New test.
+
        * g++.dg/tree-ssa/empty-1.C: New test.
 
        PR middle-end/19551
diff --git a/gcc/testsuite/gcc.dg/ppc64-toc.c b/gcc/testsuite/gcc.dg/ppc64-toc.c
new file mode 100644 (file)
index 0000000..747f137
--- /dev/null
@@ -0,0 +1,22 @@
+/* { dg-do link } */
+/* { dg-options "-m64 -mminimal-toc" { target powerpc64-*-* } } */
+
+char *strchr (const char *, int);
+
+int
+foo (int a)
+{
+  int b;
+
+  b = 0;
+  if ("/"[1] != '\0')
+    if (strchr ("/", a))
+      b = 1;
+  return b;
+}
+
+int
+main (void)
+{
+  return 0;
+}