Commit debd11d9 by Edgar E. Iglesias Committed by Michael Eager

Add TARGET_SUPPORTS_PIC flag and check that the flag_pic = 2

 * 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
parent 8ec77be0
2013-02-16 Edgar E. Iglesias <edgar.iglesias@gmail.com> 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): * config/microblaze/microblaze.c (microblaze_asm_trampoline_template):
Replace with a microblaze version. Replace with a microblaze version.
(microblaze_trampoline_init): Adapt for microblaze. (microblaze_trampoline_init): Adapt for microblaze.
......
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
along with GCC; see the file COPYING3. If not see along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */ <http://www.gnu.org/licenses/>. */
#undef TARGET_SUPPORTS_PIC
#define TARGET_SUPPORTS_PIC 1
#define DYNAMIC_LINKER "/lib/ld.so.1" #define DYNAMIC_LINKER "/lib/ld.so.1"
#undef SUBTARGET_EXTRA_SPECS #undef SUBTARGET_EXTRA_SPECS
......
...@@ -1299,6 +1299,18 @@ microblaze_option_override (void) ...@@ -1299,6 +1299,18 @@ microblaze_option_override (void)
? g_switch_value ? g_switch_value
: MICROBLAZE_DEFAULT_GVALUE); : 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. */ /* Check the MicroBlaze CPU version for any special action to be done. */
if (microblaze_select_cpu == NULL) if (microblaze_select_cpu == NULL)
microblaze_select_cpu = MICROBLAZE_DEFAULT_CPU; microblaze_select_cpu = MICROBLAZE_DEFAULT_CPU;
......
...@@ -58,6 +58,9 @@ extern enum pipeline_type microblaze_pipe; ...@@ -58,6 +58,9 @@ extern enum pipeline_type microblaze_pipe;
#define TARGET_DEFAULT (MASK_SOFT_MUL | MASK_SOFT_DIV | MASK_SOFT_FLOAT \ #define TARGET_DEFAULT (MASK_SOFT_MUL | MASK_SOFT_DIV | MASK_SOFT_FLOAT \
| TARGET_ENDIAN_DEFAULT) | 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 /* 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 we are actually ahead. This is safest version that has generate code
compatible for the original ISA */ compatible for the original ISA */
......
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> 2013-02-16 Jakub Jelinek <jakub@redhat.com>
Dodji Seketeli <dodji@redhat.com> Dodji Seketeli <dodji@redhat.com>
......
...@@ -42,6 +42,8 @@ extern void abort (void); ...@@ -42,6 +42,8 @@ extern void abort (void);
/* No pic register. */ /* No pic register. */
#elif defined(__mcore__) #elif defined(__mcore__)
/* No pic register. */ /* No pic register. */
#elif defined(__MICROBLAZE__)
# define PIC_REG "r20"
#elif defined(__mips__) #elif defined(__mips__)
/* PIC register is $28, but is used even without -fpic. */ /* PIC register is $28, but is used even without -fpic. */
#elif defined(__MMIX__) #elif defined(__MMIX__)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment