Skip to content

Commit a404393

Browse files
committed
remove unused variables
1 parent e04b487 commit a404393

File tree

3 files changed

+4
-26
lines changed

3 files changed

+4
-26
lines changed

src/ballet/sbpf/fd_sbpf_loader.c

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -840,8 +840,6 @@ fd_sbpf_lenient_elf_parse( fd_sbpf_elf_info_t * info,
840840
/* This documents the values that will be set in this function */
841841
info->rodata_sz = (uint)bin_sz; // FIXME
842842
info->rodata_footprint = (uint)bin_sz;
843-
info->dynstr_off = 0U;
844-
info->dynstr_sz = 0U;
845843
info->phndx_dyn = -1;
846844
info->shndx_dyn = -1;
847845
info->shndx_symtab = -1;
@@ -853,13 +851,6 @@ fd_sbpf_lenient_elf_parse( fd_sbpf_elf_info_t * info,
853851
if( FD_UNLIKELY( bin_sz<sizeof(fd_elf64_ehdr) ) ) {
854852
return FD_SBPF_ELF_PARSER_ERR_OUT_OF_BOUNDS;
855853
}
856-
/* TODO: decide whether we want to enforce that bin is aligned,
857-
in which case we can simply cast pointers to the various
858-
table entries, or if we want to allow misaligned bin,
859-
in which case we have to keep the FD_LOAD calls. */
860-
if( FD_UNLIKELY( !fd_ulong_is_aligned( (ulong)bin, 8UL ) ) ) {
861-
return FD_SBPF_ELF_PARSER_ERR_INVALID_ALIGNMENT;
862-
}
863854

864855
fd_elf64_ehdr ehdr = FD_LOAD( fd_elf64_ehdr, bin );
865856
ulong ehdr_start = 0;
@@ -1071,8 +1062,6 @@ fd_sbpf_lenient_elf_parse( fd_sbpf_elf_info_t * info,
10711062
return FD_SBPF_ELF_PARSER_ERR_INVALID_SECTION_HEADER;
10721063
}
10731064
info->shndx_dynstr = (int)i;
1074-
info->dynstr_off = (uint)shdr.sh_offset;
1075-
info->dynstr_sz = (uint)shdr.sh_size;
10761065
}
10771066
}
10781067
}
@@ -1102,7 +1091,7 @@ fd_sbpf_lenient_elf_parse( fd_sbpf_elf_info_t * info,
11021091
if( FD_UNLIKELY( dynamic_table_end<dynamic_table_start ||
11031092
dynamic_table_end>bin_sz ||
11041093
dyn_ph.p_filesz%sizeof(fd_elf64_dyn)!=0UL ||
1105-
((ulong)bin+dynamic_table_start)%8UL!=0UL ) ) {
1094+
!fd_ulong_is_aligned( dynamic_table_start, 8UL ) ) ) {
11061095
/* skip - try SHT_DYNAMIC instead */
11071096
dynamic_table_start = ULONG_MAX;
11081097
dynamic_table_end = ULONG_MAX;
@@ -1432,8 +1421,6 @@ fd_sbpf_elf_peek( fd_sbpf_elf_info_t * info,
14321421
.text_off = 0U,
14331422
.text_cnt = 0U,
14341423
.text_sz = 0UL,
1435-
.dynstr_off = 0U,
1436-
.dynstr_sz = 0U,
14371424
.rodata_sz = 0U,
14381425
.rodata_footprint = 0U,
14391426
.shndx_text = -1,

src/ballet/sbpf/fd_sbpf_loader.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,6 @@ struct fd_sbpf_elf_info {
149149
uint text_cnt; /* Instruction count */
150150
ulong text_sz; /* Length of text segment */
151151

152-
uint dynstr_off; /* File offset of .dynstr section (0=missing) */
153-
uint dynstr_sz; /* Dynstr char count */
154-
155152
uint rodata_sz; /* size of rodata segment */
156153
uint rodata_footprint; /* size of ELF binary */
157154

@@ -174,9 +171,6 @@ struct fd_sbpf_elf_info {
174171
uint entry_pc; /* Program counter of entry point
175172
NOTE: MIGHT BE OUT OF BOUNDS! */
176173

177-
/* Bitmap of sections to be loaded (LSB => MSB) */
178-
ulong loaded_sections[ 1024UL ];
179-
180174
/* SBPF version, SIMD-0161 */
181175
ulong sbpf_version;
182176
};

src/flamenco/runtime/tests/fd_elf_harness.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,8 @@ fd_solfuzz_elf_loader_run( fd_solfuzz_runner_t * runner,
9494
elf_effects->text_off = prog->text_off;
9595
elf_effects->entry_pc = prog->entry_pc;
9696

97-
pb_size_t calldests_sz = (pb_size_t) fd_sbpf_calldests_cnt( prog->calldests)+1UL;
98-
elf_effects->calldests_count = calldests_sz;
99-
elf_effects->calldests = FD_SCRATCH_ALLOC_APPEND(l, 8UL, calldests_sz * sizeof(uint64_t));
97+
pb_size_t max_calldests_sz = (pb_size_t) fd_sbpf_calldests_cnt( prog->calldests)+1UL;
98+
elf_effects->calldests = FD_SCRATCH_ALLOC_APPEND(l, 8UL, max_calldests_sz * sizeof(uint64_t));
10099
if( FD_UNLIKELY( _l > output_end ) ) {
101100
return 0UL;
102101
}
@@ -106,12 +105,10 @@ fd_solfuzz_elf_loader_run( fd_solfuzz_runner_t * runner,
106105
fd_sbpf_calldests_insert( prog->calldests, entrypoint );
107106
}
108107

109-
ulong i = 0;
110108
for( ulong target_pc=fd_sbpf_calldests_const_iter_init(prog->calldests);
111109
!fd_sbpf_calldests_const_iter_done(target_pc);
112110
target_pc=fd_sbpf_calldests_const_iter_next(prog->calldests, target_pc) ) {
113-
elf_effects->calldests[i] = target_pc;
114-
++i;
111+
elf_effects->calldests[elf_effects->calldests_count++] = target_pc;
115112
}
116113
} while(0);
117114

0 commit comments

Comments
 (0)