Commit 16b814eb authored by Matthias Braun's avatar Matthias Braun
Browse files

fix some problems with PIC symbols

[r22139]
parent 2a8124bb
......@@ -2131,13 +2131,13 @@ static void fix_pic_symconsts(ir_node *node, void *data)
mode = get_irn_mode(pred);
unknown = new_r_Unknown(irg, mode);
pic_base = arch_code_generator_get_pic_base(env->birg->cg);
add = new_r_Add(irg, block, pic_base, pred, mode);
/* make sure the walker doesn't visit this add again */
mark_irn_visited(add);
/* all ok now for locally constructed stuff */
if (can_address_relative(entity)) {
ir_node *add = new_r_Add(irg, block, pic_base, pred, mode);
/* make sure the walker doesn't visit this add again */
mark_irn_visited(add);
set_irn_n(node, i, add);
continue;
}
......@@ -2147,7 +2147,8 @@ static void fix_pic_symconsts(ir_node *node, void *data)
pic_symbol = get_pic_symbol(be, entity);
pic_symconst = new_rd_SymConst_addr_ent(dbgi, irg, mode_P_code,
pic_symbol, NULL);
set_Add_right(add, pic_symconst);
add = new_r_Add(irg, block, pic_base, pic_symconst, mode);
mark_irn_visited(add);
/* we need an extra indirection for global data outside our current
module. The loads are always safe and can therefore float
......
......@@ -1220,14 +1220,21 @@ static void dump_global(be_gas_decl_env_t *env, ir_entity *ent)
be_emit_write_line();
break;
}
} else if (section == GAS_SECTION_PIC_TRAMPOLINES) {
} else if (section == GAS_SECTION_PIC_TRAMPOLINES
|| section == GAS_SECTION_PIC_SYMBOLS) {
if (be_gas_flavour == GAS_FLAVOUR_MACH_O) {
be_emit_cstring("\t.indirect_symbol ");
be_emit_ident(get_entity_ident(ent));
be_emit_char('\n');
be_emit_write_line();
be_emit_cstring("\thlt ; hlt ; hlt ; hlt ; hlt\n");
be_emit_write_line();
if (section == GAS_SECTION_PIC_TRAMPOLINES) {
be_emit_cstring("\thlt ; hlt ; hlt ; hlt ; hlt\n");
be_emit_write_line();
} else {
assert(section == GAS_SECTION_PIC_SYMBOLS);
be_emit_cstring("\t.long 0\n");
be_emit_write_line();
}
} else {
panic("PIC trampolines not yet supported in this gas mode");
}
......
Supports Markdown
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