@@ -1227,7 +1227,7 @@ void InputSectionBase::adjustSplitStackFunctionPrologues(uint8_t *buf,
1227
1227
1228
1228
template <class ELFT > void InputSection::writeTo (uint8_t *buf) {
1229
1229
if (auto *s = dyn_cast<SyntheticSection>(this )) {
1230
- s->writeTo (buf + outSecOff );
1230
+ s->writeTo (buf);
1231
1231
return ;
1232
1232
}
1233
1233
@@ -1236,38 +1236,37 @@ template <class ELFT> void InputSection::writeTo(uint8_t *buf) {
1236
1236
// If -r or --emit-relocs is given, then an InputSection
1237
1237
// may be a relocation section.
1238
1238
if (LLVM_UNLIKELY (type == SHT_RELA)) {
1239
- copyRelocations<ELFT>(buf + outSecOff , getDataAs<typename ELFT::Rela>());
1239
+ copyRelocations<ELFT>(buf, getDataAs<typename ELFT::Rela>());
1240
1240
return ;
1241
1241
}
1242
1242
if (LLVM_UNLIKELY (type == SHT_REL)) {
1243
- copyRelocations<ELFT>(buf + outSecOff , getDataAs<typename ELFT::Rel>());
1243
+ copyRelocations<ELFT>(buf, getDataAs<typename ELFT::Rel>());
1244
1244
return ;
1245
1245
}
1246
1246
1247
1247
// If -r is given, we may have a SHT_GROUP section.
1248
1248
if (LLVM_UNLIKELY (type == SHT_GROUP)) {
1249
- copyShtGroup<ELFT>(buf + outSecOff );
1249
+ copyShtGroup<ELFT>(buf);
1250
1250
return ;
1251
1251
}
1252
1252
1253
1253
// If this is a compressed section, uncompress section contents directly
1254
1254
// to the buffer.
1255
1255
if (uncompressedSize >= 0 ) {
1256
1256
size_t size = uncompressedSize;
1257
- if (Error e = zlib::uncompress (toStringRef (rawData),
1258
- (char *)(buf + outSecOff), size))
1257
+ if (Error e = zlib::uncompress (toStringRef (rawData), (char *)buf, size))
1259
1258
fatal (toString (this ) +
1260
1259
" : uncompress failed: " + llvm::toString (std::move (e)));
1261
- uint8_t *bufEnd = buf + outSecOff + size;
1262
- relocate<ELFT>(buf + outSecOff , bufEnd);
1260
+ uint8_t *bufEnd = buf + size;
1261
+ relocate<ELFT>(buf, bufEnd);
1263
1262
return ;
1264
1263
}
1265
1264
1266
1265
// Copy section contents from source object file to output file
1267
1266
// and then apply relocations.
1268
- memcpy (buf + outSecOff , data ().data (), data ().size ());
1269
- uint8_t *bufEnd = buf + outSecOff + data ().size ();
1270
- relocate<ELFT>(buf + outSecOff , bufEnd);
1267
+ memcpy (buf, data ().data (), data ().size ());
1268
+ uint8_t *bufEnd = buf + data ().size ();
1269
+ relocate<ELFT>(buf, bufEnd);
1271
1270
}
1272
1271
1273
1272
void InputSection::replace (InputSection *other) {
0 commit comments