1 | /* |
---|
2 | * CLRadeonExtender - Unofficial OpenCL Radeon Extensions Library |
---|
3 | * Copyright (C) 2014-2016 Mateusz Szpakowski |
---|
4 | * |
---|
5 | * This library is free software; you can redistribute it and/or |
---|
6 | * modify it under the terms of the GNU Lesser General Public |
---|
7 | * License as published by the Free Software Foundation; either |
---|
8 | * version 2.1 of the License, or (at your option) any later version. |
---|
9 | * |
---|
10 | * This library is distributed in the hope that it will be useful, |
---|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
13 | * Lesser General Public License for more details. |
---|
14 | * |
---|
15 | * You should have received a copy of the GNU Lesser General Public |
---|
16 | * License along with this library; if not, write to the Free Software |
---|
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
---|
18 | */ |
---|
19 | |
---|
20 | #include <CLRX/Config.h> |
---|
21 | #include <cassert> |
---|
22 | #include <cstdint> |
---|
23 | #include <algorithm> |
---|
24 | #include <utility> |
---|
25 | #include <CLRX/amdbin/ElfBinaries.h> |
---|
26 | #include <CLRX/utils/Utilities.h> |
---|
27 | #include <CLRX/utils/MemAccess.h> |
---|
28 | #include <CLRX/utils/InputOutput.h> |
---|
29 | #include <CLRX/utils/Containers.h> |
---|
30 | #include <CLRX/amdbin/ROCmBinaries.h> |
---|
31 | |
---|
32 | using namespace CLRX; |
---|
33 | |
---|
34 | /* TODO: add support for various kernel code offset (now only 256 is supported) */ |
---|
35 | /* TODO: handle non-kernel functions (for Gallium also?) */ |
---|
36 | |
---|
37 | ROCmBinary::ROCmBinary(size_t binaryCodeSize, cxbyte* binaryCode, Flags creationFlags) |
---|
38 | : ElfBinary64(binaryCodeSize, binaryCode, creationFlags), |
---|
39 | regionsNum(0), codeSize(0), code(nullptr) |
---|
40 | { |
---|
41 | cxuint textIndex = SHN_UNDEF; |
---|
42 | try |
---|
43 | { textIndex = getSectionIndex(".text"); } |
---|
44 | catch(const Exception& ex) |
---|
45 | { } // ignore failed |
---|
46 | uint64_t codeOffset = 0; |
---|
47 | if (textIndex!=SHN_UNDEF) |
---|
48 | { |
---|
49 | code = getSectionContent(textIndex); |
---|
50 | const Elf64_Shdr& textShdr = getSectionHeader(textIndex); |
---|
51 | codeSize = ULEV(textShdr.sh_size); |
---|
52 | codeOffset = ULEV(textShdr.sh_offset); |
---|
53 | } |
---|
54 | |
---|
55 | regionsNum = 0; |
---|
56 | const size_t symbolsNum = getSymbolsNum(); |
---|
57 | for (size_t i = 0; i < symbolsNum; i++) |
---|
58 | { // count regions number |
---|
59 | const Elf64_Sym& sym = getSymbol(i); |
---|
60 | const cxbyte symType = ELF64_ST_TYPE(sym.st_info); |
---|
61 | const cxbyte bind = ELF64_ST_BIND(sym.st_info); |
---|
62 | if (ULEV(sym.st_shndx)==textIndex && |
---|
63 | (symType==STT_GNU_IFUNC || symType==STT_FUNC || |
---|
64 | (bind==STB_GLOBAL && symType==STT_OBJECT))) |
---|
65 | regionsNum++; |
---|
66 | } |
---|
67 | if (code==nullptr && regionsNum!=0) |
---|
68 | throw Exception("No code if regions number is not zero"); |
---|
69 | regions.reset(new ROCmRegion[regionsNum]); |
---|
70 | size_t j = 0; |
---|
71 | typedef std::pair<uint64_t, size_t> RegionOffsetEntry; |
---|
72 | std::unique_ptr<RegionOffsetEntry[]> symOffsets(new RegionOffsetEntry[regionsNum]); |
---|
73 | |
---|
74 | for (size_t i = 0; i < symbolsNum; i++) |
---|
75 | { |
---|
76 | const Elf64_Sym& sym = getSymbol(i); |
---|
77 | if (ULEV(sym.st_shndx)!=textIndex) |
---|
78 | continue; // if not in '.text' section |
---|
79 | const size_t value = ULEV(sym.st_value); |
---|
80 | if (value < codeOffset) |
---|
81 | throw Exception("Region offset is too small!"); |
---|
82 | const size_t size = ULEV(sym.st_size); |
---|
83 | |
---|
84 | const cxbyte symType = ELF64_ST_TYPE(sym.st_info); |
---|
85 | const cxbyte bind = ELF64_ST_BIND(sym.st_info); |
---|
86 | if (symType==STT_GNU_IFUNC || symType==STT_FUNC || |
---|
87 | (bind==STB_GLOBAL && symType==STT_OBJECT)) |
---|
88 | { |
---|
89 | ROCmRegionType type = ROCmRegionType::DATA; |
---|
90 | if (symType==STT_GNU_IFUNC) |
---|
91 | type = ROCmRegionType::KERNEL; |
---|
92 | else if (symType==STT_FUNC) |
---|
93 | type = ROCmRegionType::FKERNEL; |
---|
94 | symOffsets[j] = std::make_pair(value, j); |
---|
95 | if (type!=ROCmRegionType::DATA && value+0x100 > codeOffset+codeSize) |
---|
96 | throw Exception("Kernel or code offset is too big!"); |
---|
97 | regions[j++] = { getSymbolName(i), size, value, type }; |
---|
98 | } |
---|
99 | } |
---|
100 | std::sort(symOffsets.get(), symOffsets.get()+regionsNum, |
---|
101 | [](const RegionOffsetEntry& a, const RegionOffsetEntry& b) |
---|
102 | { return a.first < b.first; }); |
---|
103 | // checking distance between regions |
---|
104 | for (size_t i = 1; i <= regionsNum; i++) |
---|
105 | { |
---|
106 | size_t end = (i<regionsNum) ? symOffsets[i].first : codeOffset+codeSize; |
---|
107 | ROCmRegion& region = regions[symOffsets[i-1].second]; |
---|
108 | if (region.type==ROCmRegionType::KERNEL && symOffsets[i-1].first+0x100 > end) |
---|
109 | throw Exception("Kernel size is too small!"); |
---|
110 | |
---|
111 | const size_t regSize = end - symOffsets[i-1].first; |
---|
112 | if (region.size==0) |
---|
113 | region.size = regSize; |
---|
114 | else |
---|
115 | region.size = std::min(regSize, region.size); |
---|
116 | } |
---|
117 | |
---|
118 | if (hasRegionMap()) |
---|
119 | { // create region map |
---|
120 | regionsMap.resize(regionsNum); |
---|
121 | for (size_t i = 0; i < regionsNum; i++) |
---|
122 | regionsMap[i] = std::make_pair(regions[i].regionName, i); |
---|
123 | mapSort(regionsMap.begin(), regionsMap.end()); |
---|
124 | } |
---|
125 | } |
---|
126 | |
---|
127 | const ROCmRegion& ROCmBinary::getRegion(const char* name) const |
---|
128 | { |
---|
129 | RegionMap::const_iterator it = binaryMapFind(regionsMap.begin(), |
---|
130 | regionsMap.end(), name); |
---|
131 | if (it == regionsMap.end()) |
---|
132 | throw Exception("Can't find region name"); |
---|
133 | return regions[it->second]; |
---|
134 | } |
---|
135 | |
---|
136 | bool CLRX::isROCmBinary(size_t binarySize, const cxbyte* binary) |
---|
137 | { |
---|
138 | if (!isElfBinary(binarySize, binary)) |
---|
139 | return false; |
---|
140 | if (binary[EI_CLASS] != ELFCLASS64) |
---|
141 | return false; |
---|
142 | const Elf64_Ehdr* ehdr = reinterpret_cast<const Elf64_Ehdr*>(binary); |
---|
143 | if (ULEV(ehdr->e_machine) != 0xe0 || ULEV(ehdr->e_flags)!=0) |
---|
144 | return false; |
---|
145 | return true; |
---|
146 | } |
---|
147 | |
---|
148 | |
---|
149 | void ROCmInput::addEmptyKernel(const char* kernelName) |
---|
150 | { |
---|
151 | symbols.push_back({ kernelName, 0, 0, ROCmRegionType::KERNEL }); |
---|
152 | } |
---|
153 | /* |
---|
154 | * ROCm Binary Generator |
---|
155 | */ |
---|
156 | |
---|
157 | ROCmBinGenerator::ROCmBinGenerator() : manageable(false), input(nullptr) |
---|
158 | { } |
---|
159 | |
---|
160 | ROCmBinGenerator::ROCmBinGenerator(const ROCmInput* rocmInput) |
---|
161 | : manageable(false), input(rocmInput) |
---|
162 | { } |
---|
163 | |
---|
164 | ROCmBinGenerator::ROCmBinGenerator(GPUDeviceType deviceType, |
---|
165 | uint32_t archMinor, uint32_t archStepping, size_t codeSize, const cxbyte* code, |
---|
166 | const std::vector<ROCmSymbolInput>& symbols) |
---|
167 | { |
---|
168 | input = new ROCmInput{ deviceType, archMinor, archStepping, symbols, codeSize, code }; |
---|
169 | } |
---|
170 | |
---|
171 | ROCmBinGenerator::ROCmBinGenerator(GPUDeviceType deviceType, |
---|
172 | uint32_t archMinor, uint32_t archStepping, size_t codeSize, const cxbyte* code, |
---|
173 | std::vector<ROCmSymbolInput>&& symbols) |
---|
174 | { |
---|
175 | input = new ROCmInput{ deviceType, archMinor, archStepping, std::move(symbols), |
---|
176 | codeSize, code }; |
---|
177 | } |
---|
178 | |
---|
179 | ROCmBinGenerator::~ROCmBinGenerator() |
---|
180 | { |
---|
181 | if (manageable) |
---|
182 | delete input; |
---|
183 | } |
---|
184 | |
---|
185 | void ROCmBinGenerator::setInput(const ROCmInput* input) |
---|
186 | { |
---|
187 | if (manageable) |
---|
188 | delete input; |
---|
189 | manageable = false; |
---|
190 | this->input = input; |
---|
191 | } |
---|
192 | |
---|
193 | static const cxbyte noteDescType1[8] = |
---|
194 | { 2, 0, 0, 0, 1, 0, 0, 0 }; |
---|
195 | |
---|
196 | static const cxbyte noteDescType3[27] = |
---|
197 | { 4, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
---|
198 | 'A', 'M', 'D', 0, 'A', 'M', 'D', 'G', 'P', 'U', 0 }; |
---|
199 | |
---|
200 | // section index for symbol binding |
---|
201 | static const uint16_t mainBuiltinSectionTable[] = |
---|
202 | { |
---|
203 | 10, // ELFSECTID_SHSTRTAB |
---|
204 | 11, // ELFSECTID_STRTAB |
---|
205 | 9, // ELFSECTID_SYMTAB |
---|
206 | 3, // ELFSECTID_DYNSTR |
---|
207 | 1, // ELFSECTID_DYNSYM |
---|
208 | 4, // ELFSECTID_TEXT |
---|
209 | SHN_UNDEF, // ELFSECTID_RODATA |
---|
210 | SHN_UNDEF, // ELFSECTID_DATA |
---|
211 | SHN_UNDEF, // ELFSECTID_BSS |
---|
212 | 8, // ELFSECTID_COMMENT |
---|
213 | 2, // ROCMSECTID_HASH |
---|
214 | 5, // ROCMSECTID_DYNAMIC |
---|
215 | 6, // ROCMSECTID_NOTE |
---|
216 | 7 // ROCMSECTID_GPUCONFIG |
---|
217 | }; |
---|
218 | |
---|
219 | namespace CLRX |
---|
220 | { |
---|
221 | extern const AMDGPUArchValues rocmAmdGpuArchValuesTbl[]; |
---|
222 | } |
---|
223 | |
---|
224 | const AMDGPUArchValues CLRX::rocmAmdGpuArchValuesTbl[] = |
---|
225 | { |
---|
226 | { 0, 0, 0 }, // GPUDeviceType::CAPE_VERDE |
---|
227 | { 0, 0, 0 }, // GPUDeviceType::PITCAIRN |
---|
228 | { 0, 0, 0 }, // GPUDeviceType::TAHITI |
---|
229 | { 0, 0, 0 }, // GPUDeviceType::OLAND |
---|
230 | { 7, 0, 0 }, // GPUDeviceType::BONAIRE |
---|
231 | { 7, 0, 0 }, // GPUDeviceType::SPECTRE |
---|
232 | { 7, 0, 0 }, // GPUDeviceType::SPOOKY |
---|
233 | { 7, 0, 0 }, // GPUDeviceType::KALINDI |
---|
234 | { 0, 0, 0 }, // GPUDeviceType::HAINAN |
---|
235 | { 7, 0, 1 }, // GPUDeviceType::HAWAII |
---|
236 | { 8, 0, 0 }, // GPUDeviceType::ICELAND |
---|
237 | { 8, 0, 0 }, // GPUDeviceType::TONGA |
---|
238 | { 7, 0, 0 }, // GPUDeviceType::MULLINS |
---|
239 | { 8, 0, 3 }, // GPUDeviceType::FIJI |
---|
240 | { 8, 0, 1 }, // GPUDeviceType::CARRIZO |
---|
241 | { 0, 0, 0 }, // GPUDeviceType::DUMMY |
---|
242 | { 0, 0, 0 }, // GPUDeviceType::GOOSE |
---|
243 | { 0, 0, 0 }, // GPUDeviceType::HORSE |
---|
244 | { 8, 0, 1 }, // GPUDeviceType::STONEY |
---|
245 | { 8, 0, 4 }, // GPUDeviceType::ELLESMERE |
---|
246 | { 8, 0, 4 } // GPUDeviceType::BAFFIN |
---|
247 | }; |
---|
248 | |
---|
249 | void ROCmBinGenerator::generateInternal(std::ostream* osPtr, std::vector<char>* vPtr, |
---|
250 | Array<cxbyte>* aPtr) const |
---|
251 | { |
---|
252 | AMDGPUArchValues amdGpuArchValues = rocmAmdGpuArchValuesTbl[cxuint(input->deviceType)]; |
---|
253 | if (input->archMinor!=UINT32_MAX) |
---|
254 | amdGpuArchValues.minor = input->archMinor; |
---|
255 | if (input->archStepping!=UINT32_MAX) |
---|
256 | amdGpuArchValues.stepping = input->archStepping; |
---|
257 | |
---|
258 | const char* comment = "CLRX ROCmBinGenerator " CLRX_VERSION; |
---|
259 | uint32_t commentSize = ::strlen(comment); |
---|
260 | if (input->comment!=nullptr) |
---|
261 | { // if comment, store comment section |
---|
262 | comment = input->comment; |
---|
263 | commentSize = input->commentSize; |
---|
264 | if (commentSize==0) |
---|
265 | commentSize = ::strlen(comment); |
---|
266 | } |
---|
267 | |
---|
268 | ElfBinaryGen64 elfBinGen64({ 0U, 0U, 0x40, 0, ET_DYN, |
---|
269 | 0xe0, EV_CURRENT, UINT_MAX, 0, 0 }, true, true, true, PHREGION_FILESTART); |
---|
270 | // add symbols |
---|
271 | elfBinGen64.addSymbol(ElfSymbol64("_DYNAMIC", 5, |
---|
272 | ELF64_ST_INFO(STB_LOCAL, STT_NOTYPE), STV_HIDDEN, true, 0, 0)); |
---|
273 | for (const ROCmSymbolInput& symbol: input->symbols) |
---|
274 | { |
---|
275 | ElfSymbol64 elfsym; |
---|
276 | switch (symbol.type) |
---|
277 | { |
---|
278 | case ROCmRegionType::KERNEL: |
---|
279 | elfsym = ElfSymbol64(symbol.symbolName.c_str(), 4, |
---|
280 | ELF64_ST_INFO(STB_GLOBAL, STT_GNU_IFUNC), 0, true, |
---|
281 | symbol.offset, symbol.size); |
---|
282 | break; |
---|
283 | case ROCmRegionType::FKERNEL: |
---|
284 | elfsym = ElfSymbol64(symbol.symbolName.c_str(), 4, |
---|
285 | ELF64_ST_INFO(STB_GLOBAL, STT_FUNC), 0, true, |
---|
286 | symbol.offset, symbol.size); |
---|
287 | break; |
---|
288 | case ROCmRegionType::DATA: |
---|
289 | elfsym = ElfSymbol64(symbol.symbolName.c_str(), 4, |
---|
290 | ELF64_ST_INFO(STB_GLOBAL, STT_OBJECT), 0, true, |
---|
291 | symbol.offset, symbol.size); |
---|
292 | break; |
---|
293 | default: |
---|
294 | break; |
---|
295 | } |
---|
296 | elfBinGen64.addSymbol(elfsym); |
---|
297 | elfBinGen64.addDynSymbol(elfsym); |
---|
298 | } |
---|
299 | |
---|
300 | static const int32_t dynTags[] = { |
---|
301 | DT_SYMTAB, DT_SYMENT, DT_STRTAB, DT_STRSZ, DT_HASH }; |
---|
302 | elfBinGen64.addDynamics(sizeof(dynTags)/sizeof(int32_t), dynTags); |
---|
303 | // elf program headers |
---|
304 | elfBinGen64.addProgramHeader({ PT_PHDR, PF_R, 0, 1, |
---|
305 | true, Elf64Types::nobase, Elf64Types::nobase, 0 }); |
---|
306 | elfBinGen64.addProgramHeader({ PT_LOAD, PF_R, PHREGION_FILESTART, 4, |
---|
307 | true, Elf64Types::nobase, Elf64Types::nobase, 0, 0x1000 }); |
---|
308 | elfBinGen64.addProgramHeader({ PT_LOAD, PF_R|PF_X, 4, 1, |
---|
309 | true, Elf64Types::nobase, Elf64Types::nobase, 0 }); |
---|
310 | elfBinGen64.addProgramHeader({ PT_LOAD, PF_R|PF_W, 5, 1, |
---|
311 | true, Elf64Types::nobase, Elf64Types::nobase, 0 }); |
---|
312 | elfBinGen64.addProgramHeader({ PT_DYNAMIC, PF_R|PF_W, 5, 1, |
---|
313 | true, Elf64Types::nobase, Elf64Types::nobase, 0, 8 }); |
---|
314 | elfBinGen64.addProgramHeader({ PT_GNU_RELRO, PF_R, 5, 1, |
---|
315 | true, Elf64Types::nobase, Elf64Types::nobase, 0, 1 }); |
---|
316 | elfBinGen64.addProgramHeader({ PT_GNU_STACK, PF_R|PF_W, PHREGION_FILESTART, 0, |
---|
317 | true, 0, 0, 0 }); |
---|
318 | |
---|
319 | // elf notes |
---|
320 | elfBinGen64.addNote({"AMD", sizeof noteDescType1, noteDescType1, 1U}); |
---|
321 | std::unique_ptr<cxbyte[]> noteBuf(new cxbyte[0x1b]); |
---|
322 | ::memcpy(noteBuf.get(), noteDescType3, 0x1b); |
---|
323 | SULEV(*(uint32_t*)(noteBuf.get()+4), amdGpuArchValues.major); |
---|
324 | SULEV(*(uint32_t*)(noteBuf.get()+8), amdGpuArchValues.minor); |
---|
325 | SULEV(*(uint32_t*)(noteBuf.get()+12), amdGpuArchValues.stepping); |
---|
326 | elfBinGen64.addNote({"AMD", 0x1b, noteBuf.get(), 3U}); |
---|
327 | |
---|
328 | /// region and sections |
---|
329 | elfBinGen64.addRegion(ElfRegion64::programHeaderTable()); |
---|
330 | elfBinGen64.addRegion(ElfRegion64(0, (const cxbyte*)nullptr, 8, |
---|
331 | ".dynsym", SHT_DYNSYM, SHF_ALLOC, 0, 1, Elf64Types::nobase)); |
---|
332 | elfBinGen64.addRegion(ElfRegion64(0, (const cxbyte*)nullptr, 4, |
---|
333 | ".hash", SHT_HASH, SHF_ALLOC, 1, 0, Elf64Types::nobase)); |
---|
334 | elfBinGen64.addRegion(ElfRegion64(0, (const cxbyte*)nullptr, 1, ".dynstr", SHT_STRTAB, |
---|
335 | SHF_ALLOC, 0, 0, Elf64Types::nobase)); |
---|
336 | elfBinGen64.addRegion(ElfRegion64(input->codeSize, (const cxbyte*)input->code, |
---|
337 | 0x1000, ".text", SHT_PROGBITS, SHF_ALLOC|SHF_EXECINSTR, 0, 0, |
---|
338 | Elf64Types::nobase, 0, false, 256)); |
---|
339 | elfBinGen64.addRegion(ElfRegion64(0, (const cxbyte*)nullptr, 0x1000, |
---|
340 | ".dynamic", SHT_DYNAMIC, SHF_ALLOC|SHF_WRITE, 3, 0, |
---|
341 | Elf64Types::nobase, 0, false, 8)); |
---|
342 | elfBinGen64.addRegion(ElfRegion64::noteSection()); |
---|
343 | elfBinGen64.addRegion(ElfRegion64(0, (const cxbyte*)nullptr, 1, |
---|
344 | ".AMDGPU.config", SHT_PROGBITS, 0)); |
---|
345 | elfBinGen64.addRegion(ElfRegion64(commentSize, (const cxbyte*)comment, 1, ".comment", |
---|
346 | SHT_PROGBITS, SHF_MERGE|SHF_STRINGS, 0, 0, 0, 1)); |
---|
347 | elfBinGen64.addRegion(ElfRegion64(0, (const cxbyte*)nullptr, 8, |
---|
348 | ".symtab", SHT_SYMTAB, 0, 0, 1)); |
---|
349 | elfBinGen64.addRegion(ElfRegion64::shstrtabSection()); |
---|
350 | elfBinGen64.addRegion(ElfRegion64::strtabSection()); |
---|
351 | elfBinGen64.addRegion(ElfRegion64::sectionHeaderTable()); |
---|
352 | |
---|
353 | /* extra sections */ |
---|
354 | for (const BinSection& section: input->extraSections) |
---|
355 | elfBinGen64.addRegion(ElfRegion64(section, mainBuiltinSectionTable, |
---|
356 | ROCMSECTID_MAX, 12)); |
---|
357 | /* extra symbols */ |
---|
358 | for (const BinSymbol& symbol: input->extraSymbols) |
---|
359 | elfBinGen64.addSymbol(ElfSymbol64(symbol, mainBuiltinSectionTable, |
---|
360 | ROCMSECTID_MAX, 12)); |
---|
361 | |
---|
362 | size_t binarySize = elfBinGen64.countSize(); |
---|
363 | /**** |
---|
364 | * prepare for write binary to output |
---|
365 | ****/ |
---|
366 | std::unique_ptr<std::ostream> outStreamHolder; |
---|
367 | std::ostream* os = nullptr; |
---|
368 | if (aPtr != nullptr) |
---|
369 | { |
---|
370 | aPtr->resize(binarySize); |
---|
371 | outStreamHolder.reset( |
---|
372 | new ArrayOStream(binarySize, reinterpret_cast<char*>(aPtr->data()))); |
---|
373 | os = outStreamHolder.get(); |
---|
374 | } |
---|
375 | else if (vPtr != nullptr) |
---|
376 | { |
---|
377 | vPtr->resize(binarySize); |
---|
378 | outStreamHolder.reset(new VectorOStream(*vPtr)); |
---|
379 | os = outStreamHolder.get(); |
---|
380 | } |
---|
381 | else // from argument |
---|
382 | os = osPtr; |
---|
383 | |
---|
384 | const std::ios::iostate oldExceptions = os->exceptions(); |
---|
385 | try |
---|
386 | { |
---|
387 | os->exceptions(std::ios::failbit | std::ios::badbit); |
---|
388 | /**** |
---|
389 | * write binary to output |
---|
390 | ****/ |
---|
391 | FastOutputBuffer bos(256, *os); |
---|
392 | elfBinGen64.generate(bos); |
---|
393 | assert(bos.getWritten() == binarySize); |
---|
394 | } |
---|
395 | catch(...) |
---|
396 | { |
---|
397 | os->exceptions(oldExceptions); |
---|
398 | throw; |
---|
399 | } |
---|
400 | os->exceptions(oldExceptions); |
---|
401 | } |
---|
402 | |
---|
403 | void ROCmBinGenerator::generate(Array<cxbyte>& array) const |
---|
404 | { |
---|
405 | generateInternal(nullptr, nullptr, &array); |
---|
406 | } |
---|
407 | |
---|
408 | void ROCmBinGenerator::generate(std::ostream& os) const |
---|
409 | { |
---|
410 | generateInternal(&os, nullptr, nullptr); |
---|
411 | } |
---|
412 | |
---|
413 | void ROCmBinGenerator::generate(std::vector<char>& v) const |
---|
414 | { |
---|
415 | generateInternal(nullptr, &v, nullptr); |
---|
416 | } |
---|