mirror of
git://repo.or.cz/tinycc.git
synced 2026-06-17 15:44:18 +08:00
riscv64-link: fix C90 mixed declaration warning
Fix -Wdeclaration-after-statement: move tp_offset declaration before the for-loop in R_RISCV_TPREL_HI20/LO12_I relocation handler.
This commit is contained in:
parent
6b53465347
commit
1444843fd1
@ -408,6 +408,7 @@ ST_FUNC void relocate(TCCState *s1, ElfW_Rel *rel, int type, unsigned char *ptr,
|
||||
case R_RISCV_TPREL_HI20:
|
||||
case R_RISCV_TPREL_LO12_I: {
|
||||
addr_t tls_start = 0;
|
||||
int64_t tp_offset;
|
||||
int i;
|
||||
for (i = 1; i < s1->nb_sections; i++) {
|
||||
Section *s = s1->sections[i];
|
||||
@ -416,7 +417,7 @@ ST_FUNC void relocate(TCCState *s1, ElfW_Rel *rel, int type, unsigned char *ptr,
|
||||
tls_start = s->sh_addr;
|
||||
}
|
||||
}
|
||||
int64_t tp_offset = val - tls_start;
|
||||
tp_offset = val - tls_start;
|
||||
if (type == R_RISCV_TPREL_HI20) {
|
||||
off64 = (int64_t)(tp_offset + 0x800) >> 12;
|
||||
if ((off64 + ((uint64_t)1 << 20)) >> 21)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user