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
This commit is contained in:
Edgar E. Iglesias 2013-02-16 19:32:15 +00:00 committed by Michael Eager
parent 8ec77be0fc
commit debd11d9fb
6 changed files with 30 additions and 0 deletions

View 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):

View 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

View 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;

View 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 */

View 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>

View 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__)