to = build_decl (DECL_SOURCE_LOCATION (decl),
VAR_DECL, name, TREE_TYPE (decl));
SET_DECL_ASSEMBLER_NAME (to, DECL_NAME (to));
- DECL_TLS_MODEL (to) = TLS_MODEL_EMULATED;
+
DECL_ARTIFICIAL (to) = 1;
TREE_USED (to) = TREE_USED (decl);
TREE_READONLY (to) = 1;
DECL_IGNORED_P (to) = 1;
DECL_CONTEXT (to) = DECL_CONTEXT (decl);
DECL_SECTION_NAME (to) = DECL_SECTION_NAME (decl);
+ DECL_PRESERVE_P (to) = DECL_PRESERVE_P (decl);
DECL_WEAK (to) = DECL_WEAK (decl);
if (DECL_ONE_ONLY (decl))
else
TREE_STATIC (to) = 1;
+ DECL_VISIBILITY_SPECIFIED (to) = DECL_VISIBILITY_SPECIFIED (decl);
DECL_INITIAL (to) = DECL_INITIAL (decl);
DECL_INITIAL (decl) = NULL;
VAR_DECL, get_emutls_object_name (name),
get_emutls_object_type ());
- h = GGC_NEW (struct tree_map);
+ h = ggc_alloc_tree_map ();
h->hash = in.hash;
h->base.from = decl;
h->to = to;
DECL_TLS_MODEL (to) = TLS_MODEL_EMULATED;
DECL_ARTIFICIAL (to) = 1;
DECL_IGNORED_P (to) = 1;
+ /* FIXME: work around PR44132. */
+ DECL_PRESERVE_P (to) = 1;
TREE_READONLY (to) = 0;
SET_DECL_ASSEMBLER_NAME (to, DECL_NAME (to));
if (DECL_ONE_ONLY (decl))
DECL_COMMON (to) = DECL_COMMON (decl);
DECL_WEAK (to) = DECL_WEAK (decl);
DECL_VISIBILITY (to) = DECL_VISIBILITY (decl);
+ DECL_VISIBILITY_SPECIFIED (to) = DECL_VISIBILITY_SPECIFIED (decl);
+
+ /* Fortran might pass this to us. */
+ DECL_RESTRICTED_P (to) = DECL_RESTRICTED_P (decl);
return to;
}
return 1;
}
+/* Callback to finalize one emutls control variable. */
+
+static int
+emutls_finalize_control_var (void **loc,
+ void *unused ATTRIBUTE_UNUSED)
+{
+ struct tree_map *h = *(struct tree_map **) loc;
+ if (h != NULL)
+ {
+ struct varpool_node *node = varpool_node (h->to);
+ /* Because varpool_finalize_decl () has side-effects,
+ only apply to un-finalized vars. */
+ if (node && !node->finalized)
+ varpool_finalize_decl (h->to);
+ }
+ return 1;
+}
+
+/* Finalize emutls control vars and add a static constructor if
+ required. */
+
void
emutls_finish (void)
{
+ if (emutls_htab == NULL)
+ return;
+ htab_traverse_noresize (emutls_htab,
+ emutls_finalize_control_var, NULL);
+
if (targetm.emutls.register_common)
{
tree body = NULL_TREE;
- if (emutls_htab == NULL)
- return;
-
htab_traverse_noresize (emutls_htab, emutls_common_1, &body);
if (body == NULL_TREE)
return;
{
section *sect;
- sect = GGC_NEW (section);
+ sect = ggc_alloc_section ();
sect->unnamed.common.flags = flags | SECTION_UNNAMED;
sect->unnamed.callback = callback;
sect->unnamed.data = data;
{
section *sect;
- sect = GGC_NEW (section);
+ sect = ggc_alloc_section ();
sect->noswitch.common.flags = flags | SECTION_NOSWITCH;
sect->noswitch.callback = callback;
flags |= SECTION_NAMED;
if (*slot == NULL)
{
- sect = GGC_NEW (section);
+ sect = ggc_alloc_section ();
sect->named.common.flags = flags;
sect->named.name = ggc_strdup (name);
sect->named.decl = decl;
block = (struct object_block *) *slot;
if (block == NULL)
{
- block = (struct object_block *)
- ggc_alloc_cleared (sizeof (struct object_block));
+ block = ggc_alloc_cleared_object_block ();
block->sect = sect;
*slot = block;
}
/* Create the extended SYMBOL_REF. */
size = RTX_HDR_SIZE + sizeof (struct block_symbol);
- symbol = (rtx) ggc_alloc_zone (size, &rtl_zone);
+ symbol = ggc_alloc_zone_rtx_def (size, &rtl_zone);
/* Initialize the normal SYMBOL_REF fields. */
memset (symbol, 0, size);
/* Assemble a label named NAME. */
void
-assemble_label (const char *name)
+assemble_label (FILE *file, const char *name)
{
- ASM_OUTPUT_LABEL (asm_out_file, name);
+ ASM_OUTPUT_LABEL (file, name);
}
/* Set the symbol_referenced flag for ID. */
int labelno;
tree decl;
- desc = GGC_NEW (struct constant_descriptor_tree);
+ desc = ggc_alloc_constant_descriptor_tree ();
desc->value = copy_constant (exp);
/* Propagate marked-ness to copied constant. */
size = get_constant_size (exp);
/* Do any machine/system dependent processing of the constant. */
-#ifdef ASM_DECLARE_CONSTANT_NAME
- ASM_DECLARE_CONSTANT_NAME (asm_out_file, label, exp, size);
-#else
- /* Standard thing is just output label for the constant. */
- ASM_OUTPUT_LABEL (asm_out_file, label);
-#endif /* ASM_DECLARE_CONSTANT_NAME */
+ targetm.asm_out.declare_constant_name (asm_out_file, label, exp, size);
/* Output the value of EXP. */
output_constant (exp, size, align);
{
struct rtx_constant_pool *pool;
- pool = GGC_NEW (struct rtx_constant_pool);
+ pool = ggc_alloc_rtx_constant_pool ();
pool->const_rtx_htab = htab_create_ggc (31, const_desc_rtx_hash,
const_desc_rtx_eq, NULL);
pool->first = NULL;
return copy_rtx (desc->mem);
/* Otherwise, create a new descriptor. */
- desc = GGC_NEW (struct constant_descriptor_rtx);
+ desc = ggc_alloc_constant_descriptor_rtx ();
*slot = desc;
/* Align the location counter as required by EXP's data type. */
if (vis != VISIBILITY_DEFAULT)
{
- targetm.asm_out.visibility (decl, vis);
+ targetm.asm_out.assemble_visibility (decl, vis);
return 1;
}
else
ASM_OUTPUT_INTERNAL_LABEL (stream, buf);
}
+
+/* The default implementation of ASM_DECLARE_CONSTANT_NAME. */
+
+void
+default_asm_declare_constant_name (FILE *file, const char *name,
+ const_tree exp ATTRIBUTE_UNUSED,
+ HOST_WIDE_INT size ATTRIBUTE_UNUSED)
+{
+ assemble_label (file, name);
+}
+
/* This is the default behavior at the beginning of a file. It's
controlled by two other target-hook toggles. */
void
default_file_start (void)
{
- if (targetm.file_start_app_off
+ if (targetm.asm_file_start_app_off
&& !(flag_verbose_asm || flag_debug_asm || flag_dump_rtl_in_asm))
fputs (ASM_APP_OFF, asm_out_file);
- if (targetm.file_start_file_directive)
+ if (targetm.asm_file_start_file_directive)
output_file_directive (asm_out_file, main_input_filename);
}
int
elf_record_gcc_switches (print_switch_type type, const char * name)
{
- static char buffer[1024];
-
- /* This variable is used as part of a simplistic heuristic to detect
- command line switches which take an argument:
-
- "If a command line option does not start with a dash then
- it is an argument for the previous command line option."
-
- This fails in the case of the command line option which is the name
- of the file to compile, but otherwise it is pretty reasonable. */
- static bool previous_name_held_back = FALSE;
-
switch (type)
{
case SWITCH_TYPE_PASSED:
- if (* name != '-')
- {
- if (previous_name_held_back)
- {
- unsigned int len = strlen (buffer);
-
- snprintf (buffer + len, sizeof buffer - len, " %s", name);
- ASM_OUTPUT_ASCII (asm_out_file, buffer, strlen (buffer));
- ASM_OUTPUT_SKIP (asm_out_file, (unsigned HOST_WIDE_INT) 1);
- previous_name_held_back = FALSE;
- }
- else
- {
- strncpy (buffer, name, sizeof buffer);
- ASM_OUTPUT_ASCII (asm_out_file, buffer, strlen (buffer));
- ASM_OUTPUT_SKIP (asm_out_file, (unsigned HOST_WIDE_INT) 1);
- }
- }
- else
- {
- if (previous_name_held_back)
- {
- ASM_OUTPUT_ASCII (asm_out_file, buffer, strlen (buffer));
- ASM_OUTPUT_SKIP (asm_out_file, (unsigned HOST_WIDE_INT) 1);
- }
-
- strncpy (buffer, name, sizeof buffer);
- previous_name_held_back = TRUE;
- }
+ ASM_OUTPUT_ASCII (asm_out_file, name, strlen (name));
+ ASM_OUTPUT_SKIP (asm_out_file, (unsigned HOST_WIDE_INT) 1);
break;
case SWITCH_TYPE_DESCRIPTIVE:
/* Distinguish between invocations where name is NULL. */
static bool started = false;
- if (started)
- {
- if (previous_name_held_back)
- {
- ASM_OUTPUT_ASCII (asm_out_file, buffer, strlen (buffer));
- ASM_OUTPUT_SKIP (asm_out_file, (unsigned HOST_WIDE_INT) 1);
- }
- }
- else
+ if (!started)
{
section * sec;