@@ -415,46 +415,46 @@ Error offloading::intel::containerizeOpenMPSPIRVImage(
415415 std::string YamlFile;
416416 llvm::raw_string_ostream YamlFileStream (YamlFile);
417417
418- // Write YAML template file.
419- {
420- // We use 64-bit little-endian ELF currently.
421- ELFYAML::FileHeader Header{};
422- Header.Class = ELF::ELFCLASS64;
423- Header.Data = ELF::ELFDATA2LSB;
424- Header.Type = ELF::ET_DYN;
425- // Use an existing Intel machine type as there is not one specifically for
426- // Intel GPUs.
427- Header.Machine = ELF::EM_IA_64;
428-
429- // Create a section with notes.
430- ELFYAML::NoteSection Section{};
431- Section.Type = ELF::SHT_NOTE;
432- Section.AddressAlign = 0 ;
433- Section.Name = " .note.inteloneompoffload" ;
434- Section.Notes .emplace (std::move (Notes));
435-
436- ELFYAML::Object Object{};
437- Object.Header = Header;
438- Object.Chunks .push_back (
439- std::make_unique<ELFYAML::NoteSection>(std::move (Section)));
440-
441- // Create the section that will hold the image
442- ELFYAML::RawContentSection ImageSection{};
443- ImageSection.Type = ELF::SHT_PROGBITS;
444- ImageSection.AddressAlign = 0 ;
445- std::string Name = " __openmp_offload_spirv_0" ;
446- ImageSection.Name = Name;
447- ImageSection.Content =
448- llvm::yaml::BinaryRef (arrayRefFromStringRef (Img->getBuffer ()));
449- Object.Chunks .push_back (
450- std::make_unique<ELFYAML::RawContentSection>(std::move (ImageSection)));
451- Error Err = Error::success ();
452- llvm::yaml::yaml2elf (
453- Object, YamlFileStream,
454- [&Err](const Twine &Msg) { Err = createStringError (Msg); }, UINT64_MAX);
455- if (Err)
456- return Err;
457- }
418+ // Write the YAML template file.
419+
420+ // We use 64-bit little-endian ELF currently.
421+ ELFYAML::FileHeader Header{};
422+ Header.Class = ELF::ELFCLASS64;
423+ Header.Data = ELF::ELFDATA2LSB;
424+ Header.Type = ELF::ET_DYN;
425+ // Use an existing Intel machine type as there is not one specifically for
426+ // Intel GPUs.
427+ Header.Machine = ELF::EM_IA_64;
428+
429+ // Create a section with notes.
430+ ELFYAML::NoteSection Section{};
431+ Section.Type = ELF::SHT_NOTE;
432+ Section.AddressAlign = 0 ;
433+ Section.Name = " .note.inteloneompoffload" ;
434+ Section.Notes .emplace (std::move (Notes));
435+
436+ ELFYAML::Object Object{};
437+ Object.Header = Header;
438+ Object.Chunks .push_back (
439+ std::make_unique<ELFYAML::NoteSection>(std::move (Section)));
440+
441+ // Create the section that will hold the image
442+ ELFYAML::RawContentSection ImageSection{};
443+ ImageSection.Type = ELF::SHT_PROGBITS;
444+ ImageSection.AddressAlign = 0 ;
445+ std::string Name = " __openmp_offload_spirv_0" ;
446+ ImageSection.Name = Name;
447+ ImageSection.Content =
448+ llvm::yaml::BinaryRef (arrayRefFromStringRef (Img->getBuffer ()));
449+ Object.Chunks .push_back (
450+ std::make_unique<ELFYAML::RawContentSection>(std::move (ImageSection)));
451+ Error Err = Error::success ();
452+ llvm::yaml::yaml2elf (
453+ Object, YamlFileStream,
454+ [&Err](const Twine &Msg) { Err = createStringError (Msg); }, UINT64_MAX);
455+ if (Err)
456+ return Err;
457+
458458 Img = MemoryBuffer::getMemBufferCopy (YamlFile);
459459 return Error::success ();
460460}
0 commit comments