/* LTO IL options.
- Copyright 2009, 2010 Free Software Foundation, Inc.
+ Copyright 2009, 2010, 2011 Free Software Foundation, Inc.
Contributed by Simon Baldwin <simonb@google.com>
This file is part of GCC.
output_data_stream (stream, &flag, sizeof (flag));
}
-/* Read LENGTH bytes from STREAM to ADDR. */
-
-static void
-input_data_block (struct lto_input_block *ib, void *addr, size_t length)
-{
- size_t i;
- unsigned char *const buffer = (unsigned char *const) addr;
-
- for (i = 0; i < length; i++)
- buffer[i] = lto_input_1_unsigned (ib);
-}
-
/* Return a string from IB. The string is allocated, and the caller is
responsible for freeing it. */
{
bool flag;
- input_data_block (ib, &flag, sizeof (flag));
+ lto_input_data_block (ib, &flag, sizeof (flag));
if (flag)
{
size_t length;
char *string;
- input_data_block (ib, &length, sizeof (length));
+ lto_input_data_block (ib, &length, sizeof (length));
string = (char *) xcalloc (1, length + 1);
- input_data_block (ib, string, length);
+ lto_input_data_block (ib, string, length);
return string;
}
Among others, optimization options may well be appropriate here. */
static bool
-register_user_option_p (size_t code, int type)
+register_user_option_p (size_t code, unsigned int type)
{
if (type == CL_TARGET)
return true;
If relevant to LTO, save it in the user options vector. */
void
-lto_register_user_option (size_t code, const char *arg, int value, int type)
+lto_register_user_option (size_t code, const char *arg, int value,
+ unsigned int type)
{
if (register_user_option_p (code, type))
{
{
size_t length, i;
- input_data_block (ib, &length, sizeof (length));
+ lto_input_data_block (ib, &length, sizeof (length));
for (i = 0; i < length; i++)
{
opt_t o;
- input_data_block (ib, &o.type, sizeof (o.type));
- input_data_block (ib, &o.code, sizeof (o.code));
+ lto_input_data_block (ib, &o.type, sizeof (o.type));
+ lto_input_data_block (ib, &o.code, sizeof (o.code));
o.arg = input_string_block (ib);
- input_data_block (ib, &o.value, sizeof (o.value));
+ lto_input_data_block (ib, &o.value, sizeof (o.value));
VEC_safe_push (opt_t, heap, file_options, &o);
}
}
DK_UNSPECIFIED, UNKNOWN_LOCATION, global_dc);
if (o->type == CL_TARGET)
- targetm.handle_option (o->code, o->arg, o->value);
+ {
+ struct cl_decoded_option decoded;
+ generate_option (o->code, o->arg, o->value, CL_TARGET, &decoded);
+ targetm.handle_option (&global_options, &global_options_set,
+ &decoded, UNKNOWN_LOCATION);
+ }
else if (o->type == CL_COMMON)
gcc_assert (flag_var);
else
gcc_unreachable ();
}
+ /* Flag_shlib is usually set by finish_options, but we are issuing flag_pic
+ too late. */
+ if (flag_pic && !flag_pie)
+ flag_shlib = 1;
VEC_free (opt_t, heap, opts);
}