Add TARGET_SUPPORTS_PIC flag and check that the flag_pic = 2
authorEdgar E. Iglesias <edgar.iglesias@gmail.com>
Sat, 16 Feb 2013 19:32:15 +0000 (19:32 +0000)
committerMichael Eager <eager@gcc.gnu.org>
Sat, 16 Feb 2013 19:32:15 +0000 (19:32 +0000)
 * config/microblaze/linux.h (TARGET_SUPPORTS_PIC): Define as 1.
 * config/microblaze/microblaze.h (TARGET_SUPPORTS_PIC): Define as 1.
 * config/microblaze/microblaze.c (microblaze_option_override):
    Bail out early for PIC modes when target does not support PIC.
 * gcc.dg/20020312-2.c: Define MicroBlaze PIC register

From-SVN: r196104

gcc/ChangeLog
gcc/config/microblaze/linux.h
gcc/config/microblaze/microblaze.c
gcc/config/microblaze/microblaze.h
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/20020312-2.c

index 555e946d8dd0134788038494d7f61021b51428f2..1373e8bc9bf55eb2c451418a464e8cdefda4f05b 100644 (file)
@@ -1,3 +1,10 @@
+2013-02-16  Edgar E. Iglesias  <edgar.iglesias@gmail.com>
+
+       * config/microblaze/linux.h (TARGET_SUPPORTS_PIC): Define as 1.
+       * config/microblaze/microblaze.h (TARGET_SUPPORTS_PIC): Define as 1.
+       * config/microblaze/microblaze.c (microblaze_option_override):
+       Bail out early for PIC modes when target does not support PIC.
+
 2013-02-16  Edgar E. Iglesias  <edgar.iglesias@gmail.com>
 
        * config/microblaze/microblaze.c (microblaze_asm_trampoline_template): 
index 7455ec7ca42af8d306fd48252094e2f44111ea8d..eca777640a7cd78279709750eda46529cad90c2d 100644 (file)
@@ -19,6 +19,8 @@
    along with GCC; see the file COPYING3.  If not see
    <http://www.gnu.org/licenses/>.  */
 
+#undef TARGET_SUPPORTS_PIC
+#define TARGET_SUPPORTS_PIC 1
 
 #define DYNAMIC_LINKER "/lib/ld.so.1"
 #undef  SUBTARGET_EXTRA_SPECS
index 90c962b2eabf2bb0764519a558ce8092f64f0404..449626b2e38ce6fa166ae7e7eaf413f7a618f6de 100644 (file)
@@ -1299,6 +1299,18 @@ microblaze_option_override (void)
                                  ? g_switch_value
                                  : MICROBLAZE_DEFAULT_GVALUE);
 
+  if (flag_pic)
+    {
+      /* Make sure it's 2, we only support one kind of PIC.  */
+      flag_pic = 2;
+      if (!TARGET_SUPPORTS_PIC)
+        {
+          error ("-fPIC/-fpic not supported for this target");
+          /* Clear it to avoid further errors.  */
+          flag_pic = 0;
+        }
+    }
+
   /* Check the MicroBlaze CPU version for any special action to be done.  */
   if (microblaze_select_cpu == NULL)
     microblaze_select_cpu = MICROBLAZE_DEFAULT_CPU;
index 327614544f2036fb5f392a3f364988fc54f93346..b552665ac63faf3f95fc849c26b34533594c0356 100644 (file)
@@ -58,6 +58,9 @@ extern enum pipeline_type microblaze_pipe;
 #define TARGET_DEFAULT      (MASK_SOFT_MUL | MASK_SOFT_DIV | MASK_SOFT_FLOAT \
                              | TARGET_ENDIAN_DEFAULT)
 
+/* The default is to support PIC.  */
+#define TARGET_SUPPORTS_PIC 1
+
 /* What is the default setting for -mcpu= . We set it to v4.00.a even though 
    we are actually ahead. This is safest version that has generate code 
    compatible for the original ISA */
index 1508a65d66cb6ee8b72a74ce2242c59ba70d9b73..2377db0a2e88e44a431b0fb76bb6ca270036ae46 100644 (file)
@@ -1,3 +1,7 @@
+2013-02-16  Edgar E. Iglesias  <edgar.iglesias@gmail.com>
+
+       * gcc.dg/20020312-2.c: Define MicroBlaze PIC register
+
 2013-02-16  Jakub Jelinek  <jakub@redhat.com>
            Dodji Seketeli  <dodji@redhat.com>
 
index 47c2d0fc64895d6ebd0691d49c28d981d29e1b10..633da5be189cfdd8cd15261402bf4e910ff05f3b 100644 (file)
@@ -42,6 +42,8 @@ extern void abort (void);
 /* No pic register.  */
 #elif defined(__mcore__)
 /* No pic register.  */
+#elif defined(__MICROBLAZE__)
+# define PIC_REG "r20"
 #elif defined(__mips__)
 /* PIC register is $28, but is used even without -fpic.  */
 #elif defined(__MMIX__)