Verified Commit 1a355d38 authored by Camil Staps's avatar Camil Staps 🚀

Remove new_label, because it can overlap with local labels generated by the...

Remove new_label, because it can overlap with local labels generated by the Clean compiler and is not needed any more since new_internal_label was added
parent 54a308f0
Pipeline #21887 canceled with stages
in 11 seconds
......@@ -184,15 +184,6 @@ struct label *new_internal_label(void) {
return label;
}
struct label *new_label(uint32_t offset) {
char name[16];
snprintf(name, 16, "i%x", offset);
name[15] = '\0';
struct label *label = enter_label(name);
label->label_offset = offset;
return label;
}
void make_label_global(struct label *label) {
if (label->label_module_n != -1) {
label->label_module_n = -1;
......
......@@ -633,9 +633,10 @@ int parse_program(struct parser *state, struct char_provider *cp) {
#ifdef LINKER
struct label *label;
if (sym->name[0] == '\0')
label = new_label(sym->offset);
else
if (sym->name[0] == '\0') {
label = new_internal_label();
label->label_offset = sym->offset;
} else
label = enter_label(sym->name);
add_code_relocation(label, code_i + state->code_offset);
#else
......@@ -661,9 +662,10 @@ int parse_program(struct parser *state, struct char_provider *cp) {
#ifdef LINKER
struct label *label;
if (sym->name[0] == '\0')
label = new_label(sym->offset);
else
if (sym->name[0] == '\0') {
label = new_internal_label();
label->label_offset = sym->offset;
} else
label = enter_label(sym->name);
add_data_relocation(label, data_i + state->data_offset);
#else
......
......@@ -379,7 +379,7 @@ static void activate_label(struct s_label *label) {
if (export_label(lab->name))
make_label_global(lab->bcgen_label);
} else
lab->bcgen_label=new_label(pgrm->code_size<<2);
lab->bcgen_label=new_internal_label();
} else if (lab->bcgen_label->label_offset!=-1 && lab->bcgen_label->label_offset!=(pgrm->code_size<<2)) {
EPRINTF("Error: overwriting label '%s'\n",lab->bcgen_label->label_name);
EXIT(NULL,1);
......
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