Commit 14b4e9b3 authored by Christoph Mallon's avatar Christoph Mallon
Browse files

Output proper local lables (starting with .L/L) for the PIC base, switch...

Output proper local lables (starting with .L/L) for the PIC base, switch tables and stabs text marker, too.

[r27152]
parent 4a00c4a2
......@@ -714,7 +714,7 @@ static arch_env_t *arm_init(FILE *file_handle)
/* 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;
......
......@@ -1382,26 +1382,23 @@ static void emit_indirect_symbol(const ir_entity *entity, be_gas_section_t secti
}
}
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));
}
......@@ -1412,8 +1409,7 @@ void be_gas_emit_block_name(const ir_node *block)
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));
}
}
......
......@@ -86,6 +86,8 @@ void be_gas_emit_function_prolog(const ir_entity *entity,
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).
......
......@@ -45,6 +45,7 @@
#include "bemodule.h"
#include "beemitter.h"
#include "dbginfo.h"
#include "begnuas.h"
/* Non-Stab Symbol and Stab Symbol Types */
enum stabs_types {
......@@ -623,7 +624,7 @@ static void stabs_so(dbg_handle *handle, const char *filename)
{
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 */
......
......@@ -1710,7 +1710,7 @@ static arch_env_t *ia32_init(FILE *file_handle)
/* 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;
......
......@@ -215,7 +215,7 @@ static const arch_register_t *get_out_reg(const ir_node *irn, int pos)
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;
}
......@@ -1283,7 +1283,7 @@ static void generate_jump_table(jmp_tbl_t *tbl, const ir_node *node)
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);
......@@ -2250,7 +2250,7 @@ void ia32_gen_routine(ia32_code_gen_t *ia32_cg, ir_graph *irg)
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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment