From: Christoph Mallon Date: Sat, 13 Feb 2010 18:08:57 +0000 (+0000) Subject: Output proper local lables (starting with .L/L) for the PIC base, switch tables and... X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=14b4e9b3f48cd53db6c3179283ce8354d5127ce1;p=libfirm Output proper local lables (starting with .L/L) for the PIC base, switch tables and stabs text marker, too. [r27152] --- diff --git a/ir/be/arm/bearch_arm.c b/ir/be/arm/bearch_arm.c index f2d73da58..1143fd702 100644 --- a/ir/be/arm/bearch_arm.c +++ b/ir/be/arm/bearch_arm.c @@ -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; diff --git a/ir/be/begnuas.c b/ir/be/begnuas.c index a259ff593..6d4d337d6 100644 --- a/ir/be/begnuas.c +++ b/ir/be/begnuas.c @@ -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)); } } diff --git a/ir/be/begnuas.h b/ir/be/begnuas.h index 6c873bb3f..95639cd65 100644 --- a/ir/be/begnuas.h +++ b/ir/be/begnuas.h @@ -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). diff --git a/ir/be/bestabs.c b/ir/be/bestabs.c index 57853e796..d0bd3406e 100644 --- a/ir/be/bestabs.c +++ b/ir/be/bestabs.c @@ -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 */ diff --git a/ir/be/ia32/bearch_ia32.c b/ir/be/ia32/bearch_ia32.c index aa0d8613d..0a934faaf 100644 --- a/ir/be/ia32/bearch_ia32.c +++ b/ir/be/ia32/bearch_ia32.c @@ -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; diff --git a/ir/be/ia32/ia32_emitter.c b/ir/be/ia32/ia32_emitter.c index ba007bfcf..2fce1aa57 100644 --- a/ir/be/ia32/ia32_emitter.c +++ b/ir/be/ia32/ia32_emitter.c @@ -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);