diff --git a/arm-gen.c b/arm-gen.c index dc942d36..bf3c2cf9 100644 --- a/arm-gen.c +++ b/arm-gen.c @@ -538,11 +538,11 @@ static int negcc(int cc) /* Load value into register r. Use relative/got addressing to avoid setting DT_TEXTREL */ -static void load_value(SValue *sv, int fr, int r) +static void load_value(SValue *sv, int r) { o(0xE59F0000|(intr(r)<<12)); o(0xEA000000); - if(fr & VT_SYM) { + if(sv->r & VT_SYM) { if (sv->sym->type.t & VT_STATIC) { greloc(cur_text_section, sv->sym, ind, R_ARM_REL32); o(sv->c.i - 12); @@ -656,14 +656,14 @@ void load(int r, SValue *sv) if (v == VT_CONST) { op=stuff_const(0xE3A00000|(intr(r)<<12),sv->c.i); if (fr & VT_SYM || !op) - load_value(sv, fr, r); + load_value(sv, r); else o(op); return; } else if (v == VT_LOCAL) { op=stuff_const(0xE28B0000|(intr(r)<<12),sv->c.i); if (fr & VT_SYM || !op) { - load_value(sv, fr, r); + load_value(sv, r); o(0xE08B0000|(intr(r)<<12)|intr(r)); } else o(op); @@ -797,7 +797,7 @@ static void gcall_or_jmp(int is_jmp) o(x|(is_jmp?0xE0000000:0xE1000000)); } else { r = TREG_LR; - load_value(vtop, vtop->r, r); + load_value(vtop, r); if(is_jmp) o(0xE1A0F000 | intr(r)); // mov pc, r else diff --git a/tccelf.c b/tccelf.c index 9772ab6a..b333c51f 100644 --- a/tccelf.c +++ b/tccelf.c @@ -2243,7 +2243,7 @@ static int final_sections_reloc(TCCState *s1) These gaps are a result of final_sections_reloc. Here some relocs are removed. The gaps are then filled with 0 in tcc_output_elf. The 0 is intepreted as R_...NONE reloc. This does work on most targets but on OpenBSD/arm64 this - is illegal. */ + is illegal. OpenBSD/arm64 does not support R_...NONE reloc. */ static void update_reloc_sections(TCCState *s1, struct dyn_inf *dyninf) { int i; @@ -2256,7 +2256,7 @@ static void update_reloc_sections(TCCState *s1, struct dyn_inf *dyninf) for(i = 1; i < s1->nb_sections; i++) { s = s1->sections[i]; - if (s->sh_type == SHT_RELX && s->sh_size && s != relocplt) { + if (s->sh_type == SHT_RELX && s != relocplt) { if (dyninf->rel_size == 0) { dyninf->rel_addr = s->sh_addr; file_offset = s->sh_offset; diff --git a/tests/boundtest.c b/tests/boundtest.c index 0d833950..e4b2ab1c 100644 --- a/tests/boundtest.c +++ b/tests/boundtest.c @@ -172,6 +172,7 @@ int test13(void) #if defined __i386__ || defined __x86_64__ #define allocf(x) #else +#undef alloca #define alloca(x) malloc(x) #define allocf(x) free(x) #endif @@ -207,10 +208,10 @@ int test16() p = alloca(16); strcpy(p,"12345678901234"); - allocf(p); /* Test alloca embedded in a larger expression */ printf("alloca : %s : %s\n", p, strcpy(alloca(strlen(demo)+1),demo) ); + allocf(p); return 0; } @@ -223,10 +224,10 @@ int test17() p = alloca(16); strcpy(p,"12345678901234"); - allocf(p); /* Test alloca embedded in a larger expression */ printf("alloca : %s : %s\n", p, strcpy(alloca(strlen(demo)),demo) ); + allocf(p); return 0; }