History

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.

Meng Zhuo committed 5 months ago

Commit 14448431 parent 6b534651 file · +2 −1Browse files

Unified · Split

riscv64-link.c+2−1
@@ -408,6 +408,7 @@ ST_FUNC void relocate(TCCState *s1, ElfW_Rel *rel, int type, unsigned char *ptr, · 407 unmodified lines
408408 case R_RISCV_TPREL_HI20:
409409 case R_RISCV_TPREL_LO12_I: {
410410 addr_t tls_start = 0;
411+ int64_t tp_offset;
411412 int i;
412413 for (i = 1; i < s1->nb_sections; i++) {
413414 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
416417 tls_start = s->sh_addr;
417418 }
418419 }
419− int64_t tp_offset = val - tls_start;
420+ tp_offset = val - tls_start;
420421 if (type == R_RISCV_TPREL_HI20) {
421422 off64 = (int64_t)(tp_offset + 0x800) >> 12;
422423 if ((off64 + ((uint64_t)1 << 20)) >> 21)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t