Output proper local lables (starting with .L/L) for the PIC base, switch tables and...
authorChristoph Mallon <christoph.mallon@gmx.de>
Sat, 13 Feb 2010 18:08:57 +0000 (18:08 +0000)
committerChristoph Mallon <christoph.mallon@gmx.de>
Sat, 13 Feb 2010 18:08:57 +0000 (18:08 +0000)
[r27152]

ir/be/arm/bearch_arm.c
ir/be/begnuas.c
ir/be/begnuas.h
ir/be/bestabs.c
ir/be/ia32/bearch_ia32.c
ir/be/ia32/ia32_emitter.c

index f2d73da..1143fd7 100644 (file)
@@ -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;
index a259ff5..6d4d337 100644 (file)
@@ -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));
        }
 }
 
index 6c873bb..95639cd 100644 (file)
@@ -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).
index 57853e7..d0bd340 100644 (file)
@@ -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 */
 
index aa0d861..0a934fa 100644 (file)
@@ -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;
index ba007bf..2fce1aa 100644 (file)
@@ -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);