diff options
author | Jie Zhang <jie.zhang@analog.com> | 2007-09-19 03:33:08 +0000 |
---|---|---|
committer | Jie Zhang <jiez@gcc.gnu.org> | 2007-09-19 03:33:08 +0000 |
commit | ea2382be3f07d1faa3c307d8afc974a0f6cb9122 (patch) | |
tree | 1a620cea00887fc92601dcbcdce06c0d1dba4bd3 /gcc/config/bfin | |
parent | aa317c97cf2fc0170203d7667c8cd41798793e1c (diff) | |
download | gcc-ea2382be3f07d1faa3c307d8afc974a0f6cb9122.zip gcc-ea2382be3f07d1faa3c307d8afc974a0f6cb9122.tar.gz gcc-ea2382be3f07d1faa3c307d8afc974a0f6cb9122.tar.bz2 |
config.gcc (bfin*-linux-uclibc*): Add ./linux-sysroot-suffix.h to tm_file.
* config.gcc (bfin*-linux-uclibc*): Add ./linux-sysroot-suffix.h
to tm_file.
* config/bfin/print-sysroot-suffix.sh: New.
* config/bfin/t-bfin-elf (EXTRA_PARTS): Remove.
(MULTILIB_OPTIONS, MULTILIB_DIRNAMES, MULTILIB_MATCHES,
MULTILIB_EXCEPTIONS): Redefine with new multilibs.
* config/bfin/t-bfin-uclinux (EXTRA_PARTS): Remove.
(MULTILIB_OPTIONS, MULTILIB_DIRNAMES, MULTILIB_MATCHES,
MULTILIB_EXCEPTIONS): Redefine with new multilibs.
* config/bfin/t-bfin-linux (EXTRA_PARTS): Remove.
(MULTILIB_OPTIONS, MULTILIB_DIRNAMES, MULTILIB_MATCHES,
MULTILIB_EXCEPTIONS): Redefine with new multilibs.
(linux-sysroot-suffix.h): New target.
* config/bfin/bfin.opt (mcsync-anomaly): Use Var instead of Mask.
(mspecld-anomaly): Likewise.
* config/bfin/bfin-protos.h (enum bfin_cpu_type): Renamed from
(enum bfin_cpu): ... this. Add BFIN_CPU_BF522, BFIN_CPU_BF525,
BFIN_CPU_BF527, BFIN_CPU_BF538, BFIN_CPU_BF539, BFIN_CPU_BF542,
BFIN_CPU_BF544, BFIN_CPU_BF548, and BFIN_CPU_BF549.
(bfin_si_revision): Declare.
(bfin_workarounds): Declare.
(WA_SPECULATIVE_LOADS): Define.
(ENABLE_WA_SPECULATIVE_LOADS): Define.
(WA_SPECULATIVE_SYNCS): Define.
(ENABLE_WA_SPECULATIVE_SYNCS): Define.
* config/bfin/elf.h (STARTFILE_SPEC): Rename crt532.o to basiccrt.o.
(LIB_SPEC): Add %s to the linker scripts.
Use proper linker script for bf522, bf525, bf527,
bf538, bf539, bf542, bf544, bf548, and bf549.
* config/bfin/bfin.c (bfin_si_revision): Define.
(bfin_workarounds): Define.
(struct bfin_cpu): New.
(bfin_cpus): New.
(bfin_handle_option): Handle silicon revision part of -mcpu option.
(override_options): Set bfin_workarounds.
(length_for_loop): Replace TARGET_CSYNC_ANOMALY with
ENABLE_WA_SPECULATIVE_SYNCS, TARGET_SPECLD_ANOMALY with
ENABLE_WA_SPECULATIVE_LOADS.
(bfin_reorg): Likewise.
* config/bfin/bfin.h (TARGET_CPU_CPP_BUILTINS): Define
macros for bf522, bf525, bf527, bf538, bf539,
bf542, bf544, bf548, and bf549.
Define __SILICON_REVISION__ and __WORKAROUND_* macros if needed.
Don't define __ID_SHARED_LIB__ when -msep-data.
(TARGET_DEFAULT): Define as 0.
(DRIVER_SELF_SPECS): Add -mcpu=bf532 if no -mcpu option.
* doc/invoke.texi (Blackfin Options): Document silicon
revision part of -mcpu option and it now accepts bf522, bf525,
bf527, bf538, bf539, bf542, bf544, bf548, and bf549.
Neither -mspecld-anomaly nor -mcsync-anomaly is enabled anymore.
testsuite/
* gcc.target/bfin/bfin.exp: New.
* gcc.target/bfin/{workarounds-any.c, workarounds-none.c,
workarounds-1.c, workarounds-2.c, workarounds-3.c, workarounds-4.c,
mcpu-bf522.c, mcpu-bf525.c, mcpu-bf527.c,
mcpu-bf531.c, mcpu-bf532.c, mcpu-bf533.c,
mcpu-bf534.c, mcpu-bf536.c, mcpu-bf537.c,
mcpu-bf538.c, mcpu-bf539.c, mcpu-bf542.c,
mcpu-bf544.c, mcpu-bf548.c, mcpu-bf549.c,
mcpu-bf561.c, mcpu-default.c}: New tests.
From-SVN: r128597
Diffstat (limited to 'gcc/config/bfin')
-rw-r--r-- | gcc/config/bfin/bfin-protos.h | 27 | ||||
-rw-r--r-- | gcc/config/bfin/bfin.c | 217 | ||||
-rw-r--r-- | gcc/config/bfin/bfin.h | 68 | ||||
-rw-r--r-- | gcc/config/bfin/bfin.opt | 4 | ||||
-rw-r--r-- | gcc/config/bfin/elf.h | 18 | ||||
-rw-r--r-- | gcc/config/bfin/print-sysroot-suffix.sh | 81 | ||||
-rw-r--r-- | gcc/config/bfin/t-bfin-elf | 19 | ||||
-rw-r--r-- | gcc/config/bfin/t-bfin-linux | 18 | ||||
-rw-r--r-- | gcc/config/bfin/t-bfin-uclinux | 16 |
9 files changed, 404 insertions, 64 deletions
diff --git a/gcc/config/bfin/bfin-protos.h b/gcc/config/bfin/bfin-protos.h index ad5e7b4..f7b1149 100644 --- a/gcc/config/bfin/bfin-protos.h +++ b/gcc/config/bfin/bfin-protos.h @@ -23,20 +23,45 @@ #define GCC_BFIN_PROTOS_H /* CPU type. */ -typedef enum bfin_cpu +typedef enum bfin_cpu_type { + BFIN_CPU_BF522, + BFIN_CPU_BF525, + BFIN_CPU_BF527, BFIN_CPU_BF531, BFIN_CPU_BF532, BFIN_CPU_BF533, BFIN_CPU_BF534, BFIN_CPU_BF536, BFIN_CPU_BF537, + BFIN_CPU_BF538, + BFIN_CPU_BF539, + BFIN_CPU_BF542, + BFIN_CPU_BF544, + BFIN_CPU_BF548, + BFIN_CPU_BF549, BFIN_CPU_BF561 } bfin_cpu_t; /* Value of -mcpu= */ extern bfin_cpu_t bfin_cpu_type; +/* Value of -msi-revision= */ +extern int bfin_si_revision; + +extern unsigned int bfin_workarounds; + +/* For the anomaly 05-00-0245 */ +#define WA_SPECULATIVE_LOADS 0x00000001 +#define ENABLE_WA_SPECULATIVE_LOADS \ + (bfin_workarounds & WA_SPECULATIVE_LOADS) + +/* For the anomaly 05-00-0244 */ +#define WA_SPECULATIVE_SYNCS 0x00000002 +#define ENABLE_WA_SPECULATIVE_SYNCS \ + (bfin_workarounds & WA_SPECULATIVE_SYNCS) + + #define Mmode enum machine_mode extern rtx function_arg (CUMULATIVE_ARGS *, Mmode, tree, int); diff --git a/gcc/config/bfin/bfin.c b/gcc/config/bfin/bfin.c index 9183138..3a23e84 100644 --- a/gcc/config/bfin/bfin.c +++ b/gcc/config/bfin/bfin.c @@ -95,6 +95,108 @@ static int bfin_flag_var_tracking; /* -mcpu support */ bfin_cpu_t bfin_cpu_type = DEFAULT_CPU_TYPE; +/* -msi-revision support. There are three special values: + -1 -msi-revision=none. + 0xffff -msi-revision=any. */ +int bfin_si_revision; + +/* The workarounds enabled */ +unsigned int bfin_workarounds = 0; + +struct bfin_cpu +{ + const char *name; + bfin_cpu_t type; + int si_revision; + unsigned int workarounds; +}; + +struct bfin_cpu bfin_cpus[] = +{ + {"bf522", BFIN_CPU_BF522, 0x0000, + WA_SPECULATIVE_LOADS}, + + {"bf525", BFIN_CPU_BF525, 0x0000, + WA_SPECULATIVE_LOADS}, + + {"bf527", BFIN_CPU_BF527, 0x0000, + WA_SPECULATIVE_LOADS}, + + {"bf531", BFIN_CPU_BF531, 0x0005, + WA_SPECULATIVE_LOADS}, + {"bf531", BFIN_CPU_BF531, 0x0004, + WA_SPECULATIVE_LOADS | WA_SPECULATIVE_SYNCS}, + {"bf531", BFIN_CPU_BF531, 0x0003, + WA_SPECULATIVE_LOADS | WA_SPECULATIVE_SYNCS}, + + {"bf532", BFIN_CPU_BF532, 0x0005, + WA_SPECULATIVE_LOADS}, + {"bf532", BFIN_CPU_BF532, 0x0004, + WA_SPECULATIVE_LOADS | WA_SPECULATIVE_SYNCS}, + {"bf532", BFIN_CPU_BF532, 0x0003, + WA_SPECULATIVE_LOADS | WA_SPECULATIVE_SYNCS}, + + {"bf533", BFIN_CPU_BF533, 0x0005, + WA_SPECULATIVE_LOADS}, + {"bf533", BFIN_CPU_BF533, 0x0004, + WA_SPECULATIVE_LOADS | WA_SPECULATIVE_SYNCS}, + {"bf533", BFIN_CPU_BF533, 0x0003, + WA_SPECULATIVE_LOADS | WA_SPECULATIVE_SYNCS}, + + {"bf534", BFIN_CPU_BF534, 0x0003, + WA_SPECULATIVE_LOADS}, + {"bf534", BFIN_CPU_BF534, 0x0002, + WA_SPECULATIVE_LOADS | WA_SPECULATIVE_SYNCS}, + {"bf534", BFIN_CPU_BF534, 0x0001, + WA_SPECULATIVE_LOADS | WA_SPECULATIVE_SYNCS}, + + {"bf536", BFIN_CPU_BF536, 0x0003, + WA_SPECULATIVE_LOADS}, + {"bf536", BFIN_CPU_BF536, 0x0002, + WA_SPECULATIVE_LOADS | WA_SPECULATIVE_SYNCS}, + {"bf536", BFIN_CPU_BF536, 0x0001, + WA_SPECULATIVE_LOADS | WA_SPECULATIVE_SYNCS}, + + {"bf537", BFIN_CPU_BF537, 0x0003, + WA_SPECULATIVE_LOADS}, + {"bf537", BFIN_CPU_BF537, 0x0002, + WA_SPECULATIVE_LOADS | WA_SPECULATIVE_SYNCS}, + {"bf537", BFIN_CPU_BF537, 0x0001, + WA_SPECULATIVE_LOADS | WA_SPECULATIVE_SYNCS}, + + {"bf538", BFIN_CPU_BF538, 0x0004, + WA_SPECULATIVE_LOADS}, + {"bf538", BFIN_CPU_BF538, 0x0003, + WA_SPECULATIVE_LOADS}, + + {"bf539", BFIN_CPU_BF539, 0x0004, + WA_SPECULATIVE_LOADS}, + {"bf539", BFIN_CPU_BF539, 0x0003, + WA_SPECULATIVE_LOADS}, + {"bf539", BFIN_CPU_BF539, 0x0002, + WA_SPECULATIVE_LOADS}, + + {"bf542", BFIN_CPU_BF542, 0x0000, + WA_SPECULATIVE_LOADS}, + + {"bf544", BFIN_CPU_BF544, 0x0000, + WA_SPECULATIVE_LOADS}, + + {"bf548", BFIN_CPU_BF548, 0x0000, + WA_SPECULATIVE_LOADS}, + + {"bf549", BFIN_CPU_BF549, 0x0000, + WA_SPECULATIVE_LOADS}, + + {"bf561", BFIN_CPU_BF561, 0x0005, 0}, + {"bf561", BFIN_CPU_BF561, 0x0003, + WA_SPECULATIVE_LOADS | WA_SPECULATIVE_SYNCS}, + {"bf561", BFIN_CPU_BF561, 0x0002, + WA_SPECULATIVE_LOADS | WA_SPECULATIVE_SYNCS}, + + {NULL, 0, 0, 0} +}; + int splitting_for_sched; static void @@ -2143,26 +2245,77 @@ bfin_handle_option (size_t code, const char *arg, int value) return true; case OPT_mcpu_: - if (strcmp (arg, "bf531") == 0) - bfin_cpu_type = BFIN_CPU_BF531; - else if (strcmp (arg, "bf532") == 0) - bfin_cpu_type = BFIN_CPU_BF532; - else if (strcmp (arg, "bf533") == 0) - bfin_cpu_type = BFIN_CPU_BF533; - else if (strcmp (arg, "bf534") == 0) - bfin_cpu_type = BFIN_CPU_BF534; - else if (strcmp (arg, "bf536") == 0) - bfin_cpu_type = BFIN_CPU_BF536; - else if (strcmp (arg, "bf537") == 0) - bfin_cpu_type = BFIN_CPU_BF537; - else if (strcmp (arg, "bf561") == 0) - { + { + const char *p, *q; + int i; + + i = 0; + while ((p = bfin_cpus[i].name) != NULL) + { + if (strncmp (arg, p, strlen (p)) == 0) + break; + i++; + } + + if (p == NULL) + { + error ("-mcpu=%s is not valid", arg); + return false; + } + + bfin_cpu_type = bfin_cpus[i].type; + + q = arg + strlen (p); + + if (*q == '\0') + { + bfin_si_revision = bfin_cpus[i].si_revision; + bfin_workarounds |= bfin_cpus[i].workarounds; + } + else if (strcmp (q, "-none") == 0) + bfin_si_revision = -1; + else if (strcmp (q, "-any") == 0) + { + bfin_si_revision = 0xffff; + while (bfin_cpus[i].type == bfin_cpu_type) + { + bfin_workarounds |= bfin_cpus[i].workarounds; + i++; + } + } + else + { + unsigned int si_major, si_minor; + int rev_len, n; + + rev_len = strlen (q); + + if (sscanf (q, "-%u.%u%n", &si_major, &si_minor, &n) != 2 + || n != rev_len + || si_major > 0xff || si_minor > 0xff) + { + invalid_silicon_revision: + error ("-mcpu=%s has invalid silicon revision", arg); + return false; + } + + bfin_si_revision = (si_major << 8) | si_minor; + + while (bfin_cpus[i].type == bfin_cpu_type + && bfin_cpus[i].si_revision != bfin_si_revision) + i++; + + if (bfin_cpus[i].type != bfin_cpu_type) + goto invalid_silicon_revision; + + bfin_workarounds |= bfin_cpus[i].workarounds; + } + + if (bfin_cpu_type == BFIN_CPU_BF561) warning (0, "bf561 support is incomplete yet."); - bfin_cpu_type = BFIN_CPU_BF561; - } - else - return false; - return true; + + return true; + } default: return true; @@ -2184,6 +2337,16 @@ bfin_init_machine_status (void) void override_options (void) { + if (bfin_csync_anomaly == 1) + bfin_workarounds |= WA_SPECULATIVE_SYNCS; + else if (bfin_csync_anomaly == 0) + bfin_workarounds &= ~WA_SPECULATIVE_SYNCS; + + if (bfin_specld_anomaly == 1) + bfin_workarounds |= WA_SPECULATIVE_LOADS; + else if (bfin_specld_anomaly == 0) + bfin_workarounds &= ~WA_SPECULATIVE_LOADS; + if (TARGET_OMIT_LEAF_FRAME_POINTER) flag_omit_frame_pointer = 1; @@ -3312,14 +3475,14 @@ length_for_loop (rtx insn) int length = 0; if (JUMP_P (insn) && any_condjump_p (insn) && !optimize_size) { - if (TARGET_CSYNC_ANOMALY) + if (ENABLE_WA_SPECULATIVE_SYNCS) length = 8; - else if (TARGET_SPECLD_ANOMALY) + else if (ENABLE_WA_SPECULATIVE_LOADS) length = 6; } else if (LABEL_P (insn)) { - if (TARGET_CSYNC_ANOMALY) + if (ENABLE_WA_SPECULATIVE_SYNCS) length = 4; } @@ -4428,7 +4591,7 @@ bfin_reorg (void) if (cfun->machine->has_hardware_loops) bfin_reorg_loops (dump_file); - if (! TARGET_SPECLD_ANOMALY && ! TARGET_CSYNC_ANOMALY) + if (! ENABLE_WA_SPECULATIVE_LOADS && ! ENABLE_WA_SPECULATIVE_SYNCS) return; /* First pass: find predicted-false branches; if something after them @@ -4467,12 +4630,12 @@ bfin_reorg (void) if (cycles_since_jump < INT_MAX) cycles_since_jump++; - if (load_insn && TARGET_SPECLD_ANOMALY) + if (load_insn && ENABLE_WA_SPECULATIVE_LOADS) { if (trapping_loads_p (load_insn)) delay_needed = 3; } - else if (type == TYPE_SYNC && TARGET_CSYNC_ANOMALY) + else if (type == TYPE_SYNC && ENABLE_WA_SPECULATIVE_SYNCS) delay_needed = 4; if (delay_needed > cycles_since_jump) @@ -4503,7 +4666,7 @@ bfin_reorg (void) } /* Second pass: for predicted-true branches, see if anything at the branch destination needs extra nops. */ - if (! TARGET_CSYNC_ANOMALY) + if (! ENABLE_WA_SPECULATIVE_SYNCS) return; for (insn = get_insns (); insn; insn = NEXT_INSN (insn)) @@ -4536,7 +4699,7 @@ bfin_reorg (void) if (cycles_since_jump < INT_MAX) cycles_since_jump++; - if (type == TYPE_SYNC && TARGET_CSYNC_ANOMALY) + if (type == TYPE_SYNC && ENABLE_WA_SPECULATIVE_SYNCS) delay_needed = 2; if (delay_needed > cycles_since_jump) diff --git a/gcc/config/bfin/bfin.h b/gcc/config/bfin/bfin.h index 1d8e8da..5a69ccc 100644 --- a/gcc/config/bfin/bfin.h +++ b/gcc/config/bfin/bfin.h @@ -39,16 +39,28 @@ extern int target_flags; /* Predefinition in the preprocessor for this target machine */ #ifndef TARGET_CPU_CPP_BUILTINS -#define TARGET_CPU_CPP_BUILTINS() \ - do \ - { \ - builtin_define_std ("bfin"); \ - builtin_define_std ("BFIN"); \ +#define TARGET_CPU_CPP_BUILTINS() \ + do \ + { \ + builtin_define_std ("bfin"); \ + builtin_define_std ("BFIN"); \ builtin_define ("__ADSPBLACKFIN__"); \ builtin_define ("__ADSPLPBLACKFIN__"); \ \ switch (bfin_cpu_type) \ { \ + case BFIN_CPU_BF522: \ + builtin_define ("__ADSPBF522__"); \ + builtin_define ("__ADSPBF52x__"); \ + break; \ + case BFIN_CPU_BF525: \ + builtin_define ("__ADSPBF525__"); \ + builtin_define ("__ADSPBF52x__"); \ + break; \ + case BFIN_CPU_BF527: \ + builtin_define ("__ADSPBF527__"); \ + builtin_define ("__ADSPBF52x__"); \ + break; \ case BFIN_CPU_BF531: \ builtin_define ("__ADSPBF531__"); \ break; \ @@ -67,22 +79,62 @@ extern int target_flags; case BFIN_CPU_BF537: \ builtin_define ("__ADSPBF537__"); \ break; \ + case BFIN_CPU_BF538: \ + builtin_define ("__ADSPBF538__"); \ + break; \ + case BFIN_CPU_BF539: \ + builtin_define ("__ADSPBF539__"); \ + break; \ + case BFIN_CPU_BF542: \ + builtin_define ("__ADSPBF542__"); \ + builtin_define ("__ADSPBF54x__"); \ + break; \ + case BFIN_CPU_BF544: \ + builtin_define ("__ADSPBF544__"); \ + builtin_define ("__ADSPBF54x__"); \ + break; \ + case BFIN_CPU_BF548: \ + builtin_define ("__ADSPBF548__"); \ + builtin_define ("__ADSPBF54x__"); \ + break; \ + case BFIN_CPU_BF549: \ + builtin_define ("__ADSPBF549__"); \ + builtin_define ("__ADSPBF54x__"); \ + break; \ case BFIN_CPU_BF561: \ builtin_define ("__ADSPBF561__"); \ break; \ } \ \ + if (bfin_si_revision != -1) \ + { \ + /* space of 0xnnnn and a NUL */ \ + char *buf = alloca (7); \ + \ + sprintf (buf, "0x%04x", bfin_si_revision); \ + builtin_define_with_value ("__SILICON_REVISION__", buf, 0); \ + } \ + \ + if (bfin_workarounds) \ + builtin_define ("__WORKAROUNDS_ENABLED"); \ + if (ENABLE_WA_SPECULATIVE_LOADS) \ + builtin_define ("__WORKAROUND_SPECULATIVE_LOADS"); \ + if (ENABLE_WA_SPECULATIVE_SYNCS) \ + builtin_define ("__WORKAROUND_SPECULATIVE_SYNCS"); \ + \ if (TARGET_FDPIC) \ builtin_define ("__BFIN_FDPIC__"); \ - if (TARGET_ID_SHARED_LIBRARY) \ + if (TARGET_ID_SHARED_LIBRARY \ + && !TARGET_SEP_DATA) \ builtin_define ("__ID_SHARED_LIB__"); \ if (flag_no_builtin) \ builtin_define ("__NO_BUILTIN"); \ - } \ + } \ while (0) #endif #define DRIVER_SELF_SPECS SUBTARGET_DRIVER_SELF_SPECS "\ + %{!mcpu=*:-mcpu=bf532} \ %{mleaf-id-shared-library:%{!mid-shared-library:-mid-shared-library}} \ %{mfdpic:%{!fpic:%{!fpie:%{!fPIC:%{!fPIE:\ %{!fno-pic:%{!fno-pie:%{!fno-PIC:%{!fno-PIE:-fpie}}}}}}}}} \ @@ -123,7 +175,7 @@ extern int target_flags; /* Generate DSP instructions, like DSP halfword loads */ #define TARGET_DSP (1) -#define TARGET_DEFAULT (MASK_SPECLD_ANOMALY | MASK_CSYNC_ANOMALY) +#define TARGET_DEFAULT 0 /* Maximum number of library ids we permit */ #define MAX_LIBRARY_ID 255 diff --git a/gcc/config/bfin/bfin.opt b/gcc/config/bfin/bfin.opt index 56d37b5..ed79e65 100644 --- a/gcc/config/bfin/bfin.opt +++ b/gcc/config/bfin/bfin.opt @@ -35,12 +35,12 @@ Target Report Mask(LOW_64K) Program is entirely located in low 64k of memory mcsync-anomaly -Target Report Mask(CSYNC_ANOMALY) +Target Report Var(bfin_csync_anomaly) Init(-1) Work around a hardware anomaly by adding a number of NOPs before a CSYNC or SSYNC instruction. mspecld-anomaly -Target Report Mask(SPECLD_ANOMALY) +Target Report Var(bfin_specld_anomaly) Init(-1) Avoid speculative loads to work around a hardware anomaly. mid-shared-library diff --git a/gcc/config/bfin/elf.h b/gcc/config/bfin/elf.h index c43ca11..f42f60a 100644 --- a/gcc/config/bfin/elf.h +++ b/gcc/config/bfin/elf.h @@ -1,9 +1,7 @@ #undef STARTFILE_SPEC #define STARTFILE_SPEC "\ %{msim:%{!shared:crt0%O%s}} \ -%{!msim:%{mcpu=bf531|mcpu=bf532|mcpu=bf533 \ - |mcpu=bf534|mcpu=bf536|mcpu=bf537:crt532%O%s} \ - %{!mcpu=*:crt532%O%s}} \ +%{!msim:basiccrt%O%s} \ crti%O%s crtbegin%O%s crtlibid%O%s" #undef ENDFILE_SPEC @@ -11,10 +9,16 @@ crti%O%s crtbegin%O%s crtlibid%O%s" #undef LIB_SPEC #define LIB_SPEC "--start-group -lc %{msim:-lsim}%{!msim:-lnosys} --end-group \ -%{!T*:%{!msim:%{mcpu=bf531:-Tbf531.ld}%{mcpu=bf532:-Tbf532.ld} \ - %{mcpu=bf533:-Tbf533.ld}%{mcpu=bf534:-Tbf534.ld} \ - %{mcpu=bf536:-Tbf536.ld}%{mcpu=bf537:-Tbf537.ld} \ - %{!mcpu=*:-Tbf532.ld}}}" +%{!T*:%{!msim:%{mcpu=bf522*:-T bf522.ld%s}%{mcpu=bf525*:-T bf525.ld%s} \ + %{mcpu=bf527*:-T bf527.ld%s} \ + %{mcpu=bf531*:-T bf531.ld%s}%{mcpu=bf532*:-T bf532.ld%s} \ + %{mcpu=bf533*:-T bf533.ld%s}%{mcpu=bf534*:-T bf534.ld%s} \ + %{mcpu=bf536*:-T bf536.ld%s}%{mcpu=bf537*:-T bf537.ld%s} \ + %{mcpu=bf538*:-T bf538.ld%s}%{mcpu=bf539*:-T bf539.ld%s} \ + %{mcpu=bf542*:-T bf542.ld%s}%{mcpu=bf544*:-T bf544.ld%s} \ + %{mcpu=bf548*:-T bf548.ld%s}%{mcpu=bf549*:-T bf549.ld%s} \ + %{!mcpu=*:-T bf532.ld%s} \ + -T bfin-common-sc.ld%s}}" #undef USER_LABEL_PREFIX #define USER_LABEL_PREFIX "_" diff --git a/gcc/config/bfin/print-sysroot-suffix.sh b/gcc/config/bfin/print-sysroot-suffix.sh new file mode 100644 index 0000000..c33ff47 --- /dev/null +++ b/gcc/config/bfin/print-sysroot-suffix.sh @@ -0,0 +1,81 @@ +#!/bin/sh +# Copyright (C) 2007 Free Software Foundation, Inc. +# This file is part of GCC. + +# GCC is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. + +# GCC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# <http://www.gnu.org/licenses/>. + +# This script takes the following arguments: +# +# - the target sysroot +# - the value of $(MULTILIB_MATCHES) +# - the value of $(MULTILIB_OPTIONS) +# +# It uses these arguments to construct a definition of SYSROOT_SUFFIX_SPEC, +# which it prints to the standard output. For each multilib directory FOO, +# the script checks whether $sysroot has a subdirectory FOO, and if so will +# use /FOO for all compatible command-line options. It will not add a +# suffix for /FOO's options otherwise. These suffixes are concatenated, +# with one subspec for each space-separated entry in $(MULTILIB_OPTIONS). +set -e +sysroot=$1 +matches=$2 +options=$3 + +# For each multilib option OPT, add to $substs a sed command of the +# form "-e 's/OPT/OPT/'". +substs="" +for option in `echo "$options" | tr '/' ' '` +do + substs="$substs -e 's/$option/$option/g'" +done + +# For each ALIAS=CANONICAL entry in $MULTILIB_MATCHES, look for sed +# arguments in $substs of the form "-e 's/CANONICAL/.../'". Replace +# such entries with "-e 's/CANONICAL/ALIAS|.../'". Both the ALIAS and +# CANONICAL parts of $MULTILIB_MATCHES use '?' to stand for '='. +# +# After this loop, a command of the form "echo FOO | eval sed $substs" +# will replace a canonical option FOO with a %{...}-style spec pattern. +for match in $matches +do + canonical=`echo "$match" | sed -e 's/=.*//' -e 's/?/=/g'` + alias=`echo "$match" | sed -e 's/.*=//' -e 's/?/=/g'` + substs=`echo "$substs" | sed -e "s,s/$canonical/,&$alias|,"` +done + +# Build up the final SYSROOT_SUFFIX_SPEC in $spec. +spec= +for combo in $options +do + # See which option alternatives in $combo have their own sysroot + # directory. Create a subspec of the form "%{PAT1:/DIR1;...;PATn:DIRn}" + # from each such option OPTi, where DIRi is the directory associated + # with OPTi and PATi is the result of passing OPTi through $substs. + subspec= + for option in `echo "$combo" | tr '/' ' '` + do + dir=`echo "$option" | sed 's/mcpu=//'` + if test -d "$sysroot/$dir"; then + test -z "$subspec" || subspec="$subspec;" + subspec="$subspec"`echo "$option" | eval sed $substs`":/$dir" + fi + done + # Concatenate all the subspecs. + test -z "$subspec" || spec="$spec%{$subspec}" +done +if test -n "$spec"; then + echo "#undef SYSROOT_SUFFIX_SPEC" + echo "#define SYSROOT_SUFFIX_SPEC \"$spec\"" +fi diff --git a/gcc/config/bfin/t-bfin-elf b/gcc/config/bfin/t-bfin-elf index 1d9fce6..d81da3c 100644 --- a/gcc/config/bfin/t-bfin-elf +++ b/gcc/config/bfin/t-bfin-elf @@ -4,8 +4,6 @@ LIB1ASMSRC = bfin/lib1funcs.asm LIB1ASMFUNCS = _divsi3 _udivsi3 _umodsi3 _modsi3 _umulsi3_highpart LIB1ASMFUNCS += _smulsi3_highpart -EXTRA_PARTS = crtbegin.o crtend.o crtbeginS.o crtendS.o crti.o crtn.o crtlibid.o - FPBIT = fp-bit.c DPBIT = dp-bit.c @@ -19,12 +17,17 @@ fp-bit.c: $(srcdir)/config/fp-bit.c CRTSTUFF_T_CFLAGS = -fpic TARGET_LIBGCC2_CFLAGS = -fpic -MULTILIB_OPTIONS=mid-shared-library mleaf-id-shared-library -MULTILIB_OPTIONS+=msep-data mfdpic -MULTILIB_DEFAULTS= -MULTILIB_DIRNAMES= -MULTILIB_EXCEPTIONS=mid-shared-library*/mfdpic mleaf-id-shared-library* -MULTILIB_EXCEPTIONS+=*msep-data* +MULTILIB_OPTIONS=mcpu=bf532-none/mcpu=bf532-0.3 +MULTILIB_OPTIONS+=mid-shared-library/msep-data/mfdpic mleaf-id-shared-library +MULTILIB_DIRNAMES=bf532-none bf532-0.3 mid-shared-library msep-data mfdpic mleaf-id-shared-library +MULTILIB_MATCHES=mcpu?bf532-none=mcpu?bf561 +MULTILIB_MATCHES+=mcpu?bf532-none=mcpu?bf531-none mcpu?bf532-none=mcpu?bf533-none mcpu?bf532-none=mcpu?bf534-none mcpu?bf532-none=mcpu?bf536-none mcpu?bf532-none=mcpu?bf537-none mcpu?bf532-none=mcpu?bf561-none mcpu?bf532-none=mcpu?bf561-0.5 +MULTILIB_MATCHES+=mcpu?bf532-0.3=mcpu?bf531-0.4 mcpu?bf532-0.3=mcpu?bf531-0.3 mcpu?bf532-0.3=mcpu?bf532-0.4 mcpu?bf532-0.3=mcpu?bf534-0.4 mcpu?bf532-0.3=mcpu?bf534-0.3 mcpu?bf532-0.3=mcpu?bf534-0.2 mcpu?bf532-0.3=mcpu?bf534-0.1 mcpu?bf532-0.3=mcpu?bf536-0.2 mcpu?bf532-0.3=mcpu?bf536-0.1 mcpu?bf532-0.3=mcpu?bf537-0.2 mcpu?bf532-0.3=mcpu?bf537-0.1 mcpu?bf532-0.3=mcpu?bf561-0.3 mcpu?bf532-0.3=mcpu?bf561-0.2 mcpu?bf532-0.3=mcpu?bf531-any mcpu?bf532-0.3=mcpu?bf532-any mcpu?bf532-0.3=mcpu?bf533-any mcpu?bf532-0.3=mcpu?bf534-any mcpu?bf532-0.3=mcpu?bf536-any mcpu?bf532-0.3=mcpu?bf537-any mcpu?bf532-0.3=mcpu?bf561-any +MULTILIB_EXCEPTIONS=mleaf-id-shared-library* +MULTILIB_EXCEPTIONS+=mcpu=bf532-0.3/mleaf-id-shared-library* +MULTILIB_EXCEPTIONS+=mcpu=bf532-none/mleaf-id-shared-library* +MULTILIB_EXCEPTIONS+=*mfdpic/mleaf-id-shared-library* +MULTILIB_EXCEPTIONS+=*msep-data/mleaf-id-shared-library* # Assemble startup files. $(T)crti.o: $(srcdir)/config/bfin/crti.s $(GCC_PASSES) diff --git a/gcc/config/bfin/t-bfin-linux b/gcc/config/bfin/t-bfin-linux index 249e115..a632e90 100644 --- a/gcc/config/bfin/t-bfin-linux +++ b/gcc/config/bfin/t-bfin-linux @@ -4,8 +4,6 @@ LIB1ASMSRC = bfin/lib1funcs.asm LIB1ASMFUNCS = _divsi3 _udivsi3 _umodsi3 _modsi3 _umulsi3_highpart LIB1ASMFUNCS += _smulsi3_highpart -EXTRA_PARTS = crtbegin.o crtend.o crtbeginS.o crtendS.o - FPBIT = fp-bit.c DPBIT = dp-bit.c @@ -19,6 +17,12 @@ fp-bit.c: $(srcdir)/config/fp-bit.c CRTSTUFF_T_CFLAGS = -fpic TARGET_LIBGCC2_CFLAGS = -fpic +MULTILIB_OPTIONS=mcpu=bf532-none/mcpu=bf532-0.3 +MULTILIB_DIRNAMES=bf532-none bf532-0.3 +MULTILIB_MATCHES=mcpu?bf532-none=mcpu?bf561 +MULTILIB_MATCHES+=mcpu?bf532-none=mcpu?bf531-none mcpu?bf532-none=mcpu?bf533-none mcpu?bf532-none=mcpu?bf534-none mcpu?bf532-none=mcpu?bf536-none mcpu?bf532-none=mcpu?bf537-none mcpu?bf532-none=mcpu?bf561-none mcpu?bf532-none=mcpu?bf561-0.5 +MULTILIB_MATCHES+=mcpu?bf532-0.3=mcpu?bf531-0.4 mcpu?bf532-0.3=mcpu?bf531-0.3 mcpu?bf532-0.3=mcpu?bf532-0.4 mcpu?bf532-0.3=mcpu?bf533-0.4 mcpu?bf532-0.3=mcpu?bf533-0.3 mcpu?bf532-0.3=mcpu?bf534-0.2 mcpu?bf532-0.3=mcpu?bf534-0.1 mcpu?bf532-0.3=mcpu?bf536-0.2 mcpu?bf532-0.3=mcpu?bf536-0.1 mcpu?bf532-0.3=mcpu?bf537-0.2 mcpu?bf532-0.3=mcpu?bf537-0.1 mcpu?bf532-0.3=mcpu?bf561-0.3 mcpu?bf532-0.3=mcpu?bf561-0.2 mcpu?bf532-0.3=mcpu?bf531-any mcpu?bf532-0.3=mcpu?bf532-any mcpu?bf532-0.3=mcpu?bf533-any mcpu?bf532-0.3=mcpu?bf534-any mcpu?bf532-0.3=mcpu?bf536-any mcpu?bf532-0.3=mcpu?bf537-any mcpu?bf532-0.3=mcpu?bf561-any + # Assemble startup files. $(T)crti.o: $(srcdir)/config/bfin/crti.s $(GCC_PASSES) $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \ @@ -28,7 +32,13 @@ $(T)crtn.o: $(srcdir)/config/bfin/crtn.s $(GCC_PASSES) $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \ -c -o $(T)crtn.o -x assembler-with-cpp $(srcdir)/config/bfin/crtn.s -EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o crtbeginS.o crtendS.o - SHLIB_MAPFILES=$(srcdir)/config/bfin/libgcc-bfin.ver +EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o crtbeginS.o crtendS.o crti.o crtn.o + +# This rule uses MULTILIB_MATCHES to generate a definition of +# SYSROOT_SUFFIX_SPEC. +linux-sysroot-suffix.h: $(srcdir)/config/bfin/print-sysroot-suffix.sh + $(SHELL) $(srcdir)/config/bfin/print-sysroot-suffix.sh \ + "$(SYSTEM_HEADER_DIR)/../.." "$(MULTILIB_MATCHES)" \ + "$(MULTILIB_OPTIONS)" > $@ diff --git a/gcc/config/bfin/t-bfin-uclinux b/gcc/config/bfin/t-bfin-uclinux index 5d2bfea..a323824 100644 --- a/gcc/config/bfin/t-bfin-uclinux +++ b/gcc/config/bfin/t-bfin-uclinux @@ -4,8 +4,6 @@ LIB1ASMSRC = bfin/lib1funcs.asm LIB1ASMFUNCS = _divsi3 _udivsi3 _umodsi3 _modsi3 _umulsi3_highpart LIB1ASMFUNCS += _smulsi3_highpart -EXTRA_PARTS = crtbegin.o crtend.o crtbeginS.o crtendS.o crti.o crtn.o crtlibid.o - FPBIT = fp-bit.c DPBIT = dp-bit.c @@ -19,12 +17,16 @@ fp-bit.c: $(srcdir)/config/fp-bit.c CRTSTUFF_T_CFLAGS = -fpic TARGET_LIBGCC2_CFLAGS = -fpic -MULTILIB_OPTIONS=mid-shared-library mleaf-id-shared-library -MULTILIB_OPTIONS+=msep-data -MULTILIB_DEFAULTS= -MULTILIB_DIRNAMES= +MULTILIB_OPTIONS=mcpu=bf532-none/mcpu=bf532-0.3 +MULTILIB_OPTIONS+=mid-shared-library/msep-data mleaf-id-shared-library +MULTILIB_DIRNAMES=bf532-none bf532-0.3 mid-shared-library msep-data mleaf-id-shared-library +MULTILIB_MATCHES=mcpu?bf532-none=mcpu?bf561 +MULTILIB_MATCHES+=mcpu?bf532-none=mcpu?bf531-none mcpu?bf532-none=mcpu?bf533-none mcpu?bf532-none=mcpu?bf534-none mcpu?bf532-none=mcpu?bf536-none mcpu?bf532-none=mcpu?bf537-none mcpu?bf532-none=mcpu?bf561-none mcpu?bf532-none=mcpu?bf561-0.5 +MULTILIB_MATCHES+=mcpu?bf532-0.3=mcpu?bf531-0.4 mcpu?bf532-0.3=mcpu?bf531-0.3 mcpu?bf532-0.3=mcpu?bf532-0.4 mcpu?bf532-0.3=mcpu?bf533-0.4 mcpu?bf532-0.3=mcpu?bf533-0.3 mcpu?bf532-0.3=mcpu?bf534-0.2 mcpu?bf532-0.3=mcpu?bf534-0.1 mcpu?bf532-0.3=mcpu?bf536-0.2 mcpu?bf532-0.3=mcpu?bf536-0.1 mcpu?bf532-0.3=mcpu?bf537-0.2 mcpu?bf532-0.3=mcpu?bf537-0.1 mcpu?bf532-0.3=mcpu?bf561-0.3 mcpu?bf532-0.3=mcpu?bf561-0.2 mcpu?bf532-0.3=mcpu?bf531-any mcpu?bf532-0.3=mcpu?bf532-any mcpu?bf532-0.3=mcpu?bf533-any mcpu?bf532-0.3=mcpu?bf534-any mcpu?bf532-0.3=mcpu?bf536-any mcpu?bf532-0.3=mcpu?bf537-any mcpu?bf532-0.3=mcpu?bf561-any MULTILIB_EXCEPTIONS=mleaf-id-shared-library* -MULTILIB_EXCEPTIONS+=*msep-data* +MULTILIB_EXCEPTIONS+=mcpu=bf532-0.3/mleaf-id-shared-library* +MULTILIB_EXCEPTIONS+=mcpu=bf532-none/mleaf-id-shared-library* +MULTILIB_EXCEPTIONS+=*msep-data/mleaf-id-shared-library* # Assemble startup files. $(T)crti.o: $(srcdir)/config/bfin/crti.s $(GCC_PASSES) |