/* needed for the debug support */
be_gas_emit_switch_section(GAS_SECTION_TEXT);
- be_emit_cstring(".Ltext0:\n");
+ be_emit_irprintf("%stext0:\n", be_gas_get_private_prefix());
be_emit_write_line();
inited = 1;
}
}
-static void emit_private_prefix(void)
+char const *be_gas_get_private_prefix(void)
{
- if (be_gas_object_file_format == OBJECT_FILE_FORMAT_MACH_O) {
- be_emit_char('L');
- } else {
- be_emit_cstring(".L");
- }
+ return
+ be_gas_object_file_format == OBJECT_FILE_FORMAT_MACH_O ? "L" :
+ ".L";
}
void be_gas_emit_entity(const ir_entity *entity)
{
if (entity->type == firm_code_type) {
ir_label_t label = get_entity_label(entity);
- emit_private_prefix();
- be_emit_irprintf("_%lu", label);
+ be_emit_irprintf("%s_%lu", be_gas_get_private_prefix(), label);
return;
}
if (get_entity_visibility(entity) == ir_visibility_private) {
- emit_private_prefix();
+ be_emit_string(be_gas_get_private_prefix());
}
be_emit_ident(get_entity_ld_ident(entity));
}
ir_entity *entity = get_Block_entity(block);
be_gas_emit_entity(entity);
} else {
- emit_private_prefix();
- be_emit_irprintf("%ld", get_irn_node_nr(block));
+ be_emit_irprintf("%s%ld", be_gas_get_private_prefix(), get_irn_node_nr(block));
}
}
void be_gas_emit_function_epilog(const ir_entity *entity);
+char const *be_gas_get_private_prefix(void);
+
/**
* emit ld_ident of an entity and performs additional mangling if necessary.
* (mangling is necessary for ir_visibility_private for example).
#include "bemodule.h"
#include "beemitter.h"
#include "dbginfo.h"
+#include "begnuas.h"
/* Non-Stab Symbol and Stab Symbol Types */
enum stabs_types {
{
stabs_handle *h = (stabs_handle *)handle;
h->main_file = h->curr_file = filename;
- be_emit_irprintf("\t.stabs\t\"%s\",%d,0,0,.Ltext0\n", filename, N_SO);
+ be_emit_irprintf("\t.stabs\t\"%s\",%d,0,0,%stext0\n", filename, N_SO, be_gas_get_private_prefix());
be_emit_write_line();
} /* stabs_so */
/* needed for the debug support */
be_gas_emit_switch_section(GAS_SECTION_TEXT);
- be_emit_cstring(".Ltext0:\n");
+ be_emit_irprintf("%stext0:\n", be_gas_get_private_prefix());
be_emit_write_line();
return &isa->arch_env;
static char *get_unique_label(char *buf, size_t buflen, const char *prefix)
{
static unsigned long id = 0;
- snprintf(buf, buflen, "%s%lu", prefix, ++id);
+ snprintf(buf, buflen, "%s%s%lu", be_gas_get_private_prefix(), prefix, ++id);
return buf;
}
const ir_edge_t *edge;
/* fill the table structure */
- get_unique_label(tbl->label, SNPRINTF_BUF_LEN, ".TBL_");
+ get_unique_label(tbl->label, SNPRINTF_BUF_LEN, "TBL_");
tbl->defProj = NULL;
tbl->num_branches = get_irn_n_edges(node) - 1;
tbl->branches = XMALLOCNZ(branch_t, tbl->num_branches);
ia32_register_emitters();
- get_unique_label(pic_base_label, sizeof(pic_base_label), ".PIC_BASE");
+ get_unique_label(pic_base_label, sizeof(pic_base_label), "PIC_BASE");
be_dbg_method_begin(entity, be_abi_get_stack_layout(cg->birg->abi));
be_gas_emit_function_prolog(entity, ia32_cg_config.function_alignment);