File tree 1 file changed +15
-3
lines changed
1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change 23
23
#define ZLIB_LEVEL 6
24
24
25
25
using namespace rpx ;
26
+ using crc = be2_val<uint32_t >;
26
27
27
28
void rpx::writerpx (const rpx& elf, std::ostream& os) {
28
29
// write elf header out
@@ -130,10 +131,21 @@ void rpx::relink(rpx& elf) {
130
131
return s.hdr .sh_type == SHT_RPL_CRCS;
131
132
});
132
133
crc_section->crc32 = 0 ;
134
+
135
+ // check if size wrong
136
+ if (crc_section->data .size () != elf.sections .size () * sizeof (crc)) {
137
+ printf (" WARN: crc section is %x bytes - should be %x! Fixing.\n " ,
138
+ crc_section->data .size (),
139
+ elf.sections .size () * sizeof (crc)
140
+ );
141
+
142
+ crc_section->data .resize (elf.sections .size () * sizeof (crc));
143
+ }
144
+
133
145
// spans: keeping all the jank in one place since 2020
134
- std::span<be2_val< uint32_t > > crcs (
135
- (be2_val< uint32_t > *)crc_section->data .data (),
136
- crc_section->data .size () / sizeof (be2_val< uint32_t > )
146
+ std::span<crc > crcs (
147
+ (crc *)crc_section->data .data (),
148
+ crc_section->data .size () / sizeof (crc )
137
149
);
138
150
139
151
bool first_section = true ;
You can’t perform that action at this time.
0 commit comments