@@ -520,35 +520,31 @@ static Error handleArgs(const CopyConfig &Config, Object &Obj,
520
520
}
521
521
}
522
522
}
523
-
524
- if (!Config.AddSection .empty ()) {
525
- for (const auto &Flag : Config.AddSection ) {
526
- std::pair<StringRef, StringRef> SecPair = Flag.split (" =" );
527
- StringRef SecName = SecPair.first ;
528
- StringRef File = SecPair.second ;
529
- ErrorOr<std::unique_ptr<MemoryBuffer>> BufOrErr =
530
- MemoryBuffer::getFile (File);
531
- if (!BufOrErr)
532
- return createFileError (File, errorCodeToError (BufOrErr.getError ()));
533
- std::unique_ptr<MemoryBuffer> Buf = std::move (*BufOrErr);
534
- ArrayRef<uint8_t > Data (
535
- reinterpret_cast <const uint8_t *>(Buf->getBufferStart ()),
536
- Buf->getBufferSize ());
537
- OwnedDataSection &NewSection =
538
- Obj.addSection <OwnedDataSection>(SecName, Data);
539
- if (SecName.startswith (" .note" ) && SecName != " .note.GNU-stack" )
540
- NewSection.Type = SHT_NOTE;
541
- }
523
+
524
+ for (const auto &Flag : Config.AddSection ) {
525
+ std::pair<StringRef, StringRef> SecPair = Flag.split (" =" );
526
+ StringRef SecName = SecPair.first ;
527
+ StringRef File = SecPair.second ;
528
+ ErrorOr<std::unique_ptr<MemoryBuffer>> BufOrErr =
529
+ MemoryBuffer::getFile (File);
530
+ if (!BufOrErr)
531
+ return createFileError (File, errorCodeToError (BufOrErr.getError ()));
532
+ std::unique_ptr<MemoryBuffer> Buf = std::move (*BufOrErr);
533
+ ArrayRef<uint8_t > Data (
534
+ reinterpret_cast <const uint8_t *>(Buf->getBufferStart ()),
535
+ Buf->getBufferSize ());
536
+ OwnedDataSection &NewSection =
537
+ Obj.addSection <OwnedDataSection>(SecName, Data);
538
+ if (SecName.startswith (" .note" ) && SecName != " .note.GNU-stack" )
539
+ NewSection.Type = SHT_NOTE;
542
540
}
543
541
544
- if (!Config.DumpSection .empty ()) {
545
- for (const auto &Flag : Config.DumpSection ) {
546
- std::pair<StringRef, StringRef> SecPair = Flag.split (" =" );
547
- StringRef SecName = SecPair.first ;
548
- StringRef File = SecPair.second ;
549
- if (Error E = dumpSectionToFile (SecName, File, Obj))
550
- return createFileError (Config.InputFilename , std::move (E));
551
- }
542
+ for (const auto &Flag : Config.DumpSection ) {
543
+ std::pair<StringRef, StringRef> SecPair = Flag.split (" =" );
544
+ StringRef SecName = SecPair.first ;
545
+ StringRef File = SecPair.second ;
546
+ if (Error E = dumpSectionToFile (SecName, File, Obj))
547
+ return createFileError (Config.InputFilename , std::move (E));
552
548
}
553
549
554
550
if (!Config.AddGnuDebugLink .empty ())
0 commit comments