Fix -Wdeclaration-after-statement: move tp_offset declaration before the for-loop in R_RISCV_TPREL_HI20/LO12_I relocation handler.
Unified · Split
| @@ -408,6 +408,7 @@ ST_FUNC void relocate(TCCState *s1, ElfW_Rel *rel, int type, unsigned char *ptr, · 407 unmodified lines | |||
| 408 | case R_RISCV_TPREL_HI20: | 408 | case R_RISCV_TPREL_HI20: |
| 409 | case R_RISCV_TPREL_LO12_I: { | 409 | case R_RISCV_TPREL_LO12_I: { |
| 410 | addr_t tls_start = 0; | 410 | addr_t tls_start = 0; |
| 411 | int64_t tp_offset; | ||
| 411 | int i; | 412 | int i; |
| 412 | for (i = 1; i < s1->nb_sections; i++) { | 413 | for (i = 1; i < s1->nb_sections; i++) { |
| 413 | Section *s = s1->sections[i]; | 414 | Section *s = s1->sections[i]; |
| @@ -416,7 +417,7 @@ ST_FUNC void relocate(TCCState *s1, ElfW_Rel *rel, int type, unsigned char *ptr, · 2 unmodified lines | |||
| 416 | tls_start = s->sh_addr; | 417 | tls_start = s->sh_addr; |
| 417 | } | 418 | } |
| 418 | } | 419 | } |
| 419 | int64_t tp_offset = val - tls_start; | 420 | tp_offset = val - tls_start; |
| 420 | if (type == R_RISCV_TPREL_HI20) { | 421 | if (type == R_RISCV_TPREL_HI20) { |
| 421 | off64 = (int64_t)(tp_offset + 0x800) >> 12; | 422 | off64 = (int64_t)(tp_offset + 0x800) >> 12; |
| 422 | if ((off64 + ((uint64_t)1 << 20)) >> 21) | 423 | if ((off64 + ((uint64_t)1 << 20)) >> 21) |