+2005-04-12 Bernd Schmidt <bernd.schmidt@analog.com>
+
+ * config/bfin/bfin.c (bfin_library_id_string): Remove.
+ (bfin_library_id): New variable.
+ (bfin_expand_prologue): Use bfin_library_id and bfin_lib_id_given
+ instead of bfin_library_id_string.
+ (bfin_handle_option): New function.
+ (override_options): Remove most code to deal with shared library IDs,
+ just check they aren't used without -mid-shared-library.
+ (TARGET_HANDLE_OPTION): Define.
+ * config/bfin/bfin.h (TARGET_OPTIONS): Delete macro.
+ * config/bfin/bfin.opt (mshared-library-id=): New.
+
2005-04-12 Kazu Hirata <kazu@cs.umass.edu>
* tree-vect-transform.c: Fix comment typos.
static int arg_regs[] = FUNCTION_ARG_REGISTERS;
-const char *bfin_library_id_string;
+/* The value passed to -mshared-library-id=. */
+static int bfin_library_id;
static void
bfin_globalize_label (FILE *stream, const char *name)
{
rtx addr;
- if (bfin_library_id_string)
- addr = plus_constant (pic_offset_table_rtx, atoi (bfin_library_id_string));
+ if (bfin_lib_id_given)
+ addr = plus_constant (pic_offset_table_rtx, -4 - bfin_library_id * 4);
else
addr = gen_rtx_PLUS (Pmode, pic_offset_table_rtx,
gen_rtx_UNSPEC (Pmode, gen_rtvec (1, const0_rtx),
return secondary_input_reload_class (class, mode, x);
}
\f
+/* Implement TARGET_HANDLE_OPTION. */
+
+static bool
+bfin_handle_option (size_t code, const char *arg, int value)
+{
+ switch (code)
+ {
+ case OPT_mshared_library_id_:
+ if (value > MAX_LIBRARY_ID)
+ error ("-mshared-library-id=%s is not between 0 and %d",
+ arg, MAX_LIBRARY_ID);
+ else
+ bfin_library_id = value;
+ return true;
+
+ default:
+ return true;
+ }
+}
+
/* Implement the macro OVERRIDE_OPTIONS. */
void
flag_omit_frame_pointer = 1;
/* Library identification */
- if (bfin_library_id_string)
- {
- int id;
-
- if (! TARGET_ID_SHARED_LIBRARY)
- error ("-mshared-library-id= specified without -mid-shared-library");
- id = atoi (bfin_library_id_string);
- if (id < 0 || id > MAX_LIBRARY_ID)
- error ("-mshared-library-id=%d is not between 0 and %d", id, MAX_LIBRARY_ID);
-
- /* From now on, bfin_library_id_string will contain the library offset. */
- asprintf ((char **)&bfin_library_id_string, "%d", (id * -4) - 4);
- }
+ if (bfin_lib_id_given && ! TARGET_ID_SHARED_LIBRARY)
+ error ("-mshared-library-id= specified without -mid-shared-library");
if (TARGET_ID_SHARED_LIBRARY)
/* ??? Provide a way to use a bigger GOT. */
#undef TARGET_VECTOR_MODE_SUPPORTED_P
#define TARGET_VECTOR_MODE_SUPPORTED_P bfin_vector_mode_supported_p
+#undef TARGET_HANDLE_OPTION
+#define TARGET_HANDLE_OPTION bfin_handle_option
+
struct gcc_target targetm = TARGET_INITIALIZER;
#define TARGET_DEFAULT MASK_CSYNC
-/* This macro is similar to `TARGET_SWITCHES' but defines names of
- command options that have values. Its definition is an
- initializer with a subgrouping for each command option.
-
- Each subgrouping contains a string constant, that defines the
- fixed part of the option name, and the address of a variable. The
- variable, type `char *', is set to the variable part of the given
- option if the fixed part matches. The actual option name is made
- by appending `-m' to the specified name. */
-#define TARGET_OPTIONS \
-{ { "shared-library-id=", &bfin_library_id_string, \
- "ID of shared library to build", 0} \
-}
-
/* Maximum number of library ids we permit */
#define MAX_LIBRARY_ID 255