blob: 159a308fb3059c692b99ab67a7f91625feac37db [file] [log] [blame]
Elliott Hughes2faa5f12012-01-30 14:42:07 -08001/*
2 * Copyright (C) 2011 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
Brian Carlstrom4a289ed2011-08-16 17:17:49 -070016
Brian Carlstromfc0e3212013-07-17 14:40:12 -070017#ifndef ART_RUNTIME_IMAGE_H_
18#define ART_RUNTIME_IMAGE_H_
Brian Carlstrom4a289ed2011-08-16 17:17:49 -070019
20#include <string.h>
21
Vladimir Marko6cfbdbc2017-07-25 13:26:39 +010022#include "base/bit_utils.h"
Andreas Gampe542451c2016-07-26 09:02:02 -070023#include "base/enums.h"
Brian Carlstrom4a289ed2011-08-16 17:17:49 -070024#include "globals.h"
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080025#include "mirror/object.h"
Brian Carlstrom4a289ed2011-08-16 17:17:49 -070026
27namespace art {
28
Mathieu Chartier54d220e2015-07-30 16:20:06 -070029class ArtField;
30class ArtMethod;
31
Vladimir Marko74527972016-11-29 15:57:32 +000032namespace linker {
33class ImageWriter;
34} // namespace linker
35
David Sehra49e0532017-08-25 08:05:29 -070036class ObjectVisitor {
37 public:
38 virtual ~ObjectVisitor() {}
39
40 virtual void Visit(mirror::Object* object) = 0;
41};
42
Mathieu Chartier54d220e2015-07-30 16:20:06 -070043class ArtMethodVisitor {
44 public:
45 virtual ~ArtMethodVisitor() {}
46
47 virtual void Visit(ArtMethod* method) = 0;
48};
49
50class ArtFieldVisitor {
51 public:
52 virtual ~ArtFieldVisitor() {}
53
54 virtual void Visit(ArtField* method) = 0;
55};
56
Mathieu Chartiere401d142015-04-22 13:56:20 -070057class PACKED(4) ImageSection {
58 public:
59 ImageSection() : offset_(0), size_(0) { }
60 ImageSection(uint32_t offset, uint32_t size) : offset_(offset), size_(size) { }
61 ImageSection(const ImageSection& section) = default;
62 ImageSection& operator=(const ImageSection& section) = default;
63
64 uint32_t Offset() const {
65 return offset_;
66 }
67
68 uint32_t Size() const {
69 return size_;
70 }
71
72 uint32_t End() const {
73 return Offset() + Size();
74 }
75
76 bool Contains(uint64_t offset) const {
77 return offset - offset_ < size_;
78 }
79
80 private:
81 uint32_t offset_;
82 uint32_t size_;
83};
84
Brian Carlstrom4a289ed2011-08-16 17:17:49 -070085// header of image files written by ImageWriter, read and validated by Space.
Ian Rogersdf1ce912012-11-27 17:07:11 -080086class PACKED(4) ImageHeader {
Brian Carlstrom4a289ed2011-08-16 17:17:49 -070087 public:
Mathieu Chartierceb07b32015-12-10 09:33:21 -080088 enum StorageMode : uint32_t {
89 kStorageModeUncompressed,
90 kStorageModeLZ4,
Mathieu Chartiera6e81ed2016-02-25 13:52:10 -080091 kStorageModeLZ4HC,
Mathieu Chartierceb07b32015-12-10 09:33:21 -080092 kStorageModeCount, // Number of elements in enum.
93 };
94 static constexpr StorageMode kDefaultStorageMode = kStorageModeUncompressed;
95
Sebastien Hertzaa50d3a2015-08-25 15:25:41 +020096 ImageHeader()
Mathieu Chartierceb07b32015-12-10 09:33:21 -080097 : image_begin_(0U),
98 image_size_(0U),
99 oat_checksum_(0U),
100 oat_file_begin_(0U),
101 oat_data_begin_(0U),
102 oat_data_end_(0U),
103 oat_file_end_(0U),
Mathieu Chartierfbc31082016-01-24 11:59:56 -0800104 boot_image_begin_(0U),
105 boot_image_size_(0U),
106 boot_oat_begin_(0U),
107 boot_oat_size_(0U),
Mathieu Chartierceb07b32015-12-10 09:33:21 -0800108 patch_delta_(0),
109 image_roots_(0U),
110 pointer_size_(0U),
111 compile_pic_(0),
Mathieu Chartierfbc31082016-01-24 11:59:56 -0800112 is_pic_(0),
Mathieu Chartierceb07b32015-12-10 09:33:21 -0800113 storage_mode_(kDefaultStorageMode),
114 data_size_(0) {}
Brian Carlstrom4a289ed2011-08-16 17:17:49 -0700115
Ian Rogers30fab402012-01-23 15:43:46 -0800116 ImageHeader(uint32_t image_begin,
Mathieu Chartier763a31e2015-11-16 16:05:55 -0800117 uint32_t image_size,
Mathieu Chartiere401d142015-04-22 13:56:20 -0700118 ImageSection* sections,
Brian Carlstrome24fa612011-09-29 00:53:55 -0700119 uint32_t image_roots,
120 uint32_t oat_checksum,
Brian Carlstrom700c8d32012-11-05 10:42:02 -0800121 uint32_t oat_file_begin,
122 uint32_t oat_data_begin,
123 uint32_t oat_data_end,
Igor Murashkin46774762014-10-22 11:37:02 -0700124 uint32_t oat_file_end,
Mathieu Chartierfbc31082016-01-24 11:59:56 -0800125 uint32_t boot_image_begin,
126 uint32_t boot_image_size,
127 uint32_t boot_oat_begin,
128 uint32_t boot_oat_size,
Mathieu Chartiere401d142015-04-22 13:56:20 -0700129 uint32_t pointer_size,
Mathieu Chartierceb07b32015-12-10 09:33:21 -0800130 bool compile_pic,
Mathieu Chartierfbc31082016-01-24 11:59:56 -0800131 bool is_pic,
Mathieu Chartierceb07b32015-12-10 09:33:21 -0800132 StorageMode storage_mode,
133 size_t data_size);
Brian Carlstrom4a289ed2011-08-16 17:17:49 -0700134
Brian Carlstrom68708f52013-09-03 14:15:31 -0700135 bool IsValid() const;
136 const char* GetMagic() const;
Brian Carlstrom78128a62011-09-15 17:21:19 -0700137
Ian Rogers13735952014-10-08 12:43:28 -0700138 uint8_t* GetImageBegin() const {
139 return reinterpret_cast<uint8_t*>(image_begin_);
Brian Carlstrome24fa612011-09-29 00:53:55 -0700140 }
141
Mathieu Chartier31e89252013-08-28 11:29:12 -0700142 size_t GetImageSize() const {
143 return static_cast<uint32_t>(image_size_);
144 }
145
Brian Carlstrome24fa612011-09-29 00:53:55 -0700146 uint32_t GetOatChecksum() const {
147 return oat_checksum_;
148 }
149
Brian Carlstroma85b8372012-10-18 17:00:32 -0700150 void SetOatChecksum(uint32_t oat_checksum) {
151 oat_checksum_ = oat_checksum;
152 }
153
Mathieu Chartier5351da02016-02-17 16:19:53 -0800154 // The location that the oat file was expected to be when the image was created. The actual
155 // oat file may be at a different location for application images.
Ian Rogers13735952014-10-08 12:43:28 -0700156 uint8_t* GetOatFileBegin() const {
157 return reinterpret_cast<uint8_t*>(oat_file_begin_);
Brian Carlstrome24fa612011-09-29 00:53:55 -0700158 }
159
Ian Rogers13735952014-10-08 12:43:28 -0700160 uint8_t* GetOatDataBegin() const {
161 return reinterpret_cast<uint8_t*>(oat_data_begin_);
Brian Carlstrom700c8d32012-11-05 10:42:02 -0800162 }
163
Ian Rogers13735952014-10-08 12:43:28 -0700164 uint8_t* GetOatDataEnd() const {
165 return reinterpret_cast<uint8_t*>(oat_data_end_);
Brian Carlstrom700c8d32012-11-05 10:42:02 -0800166 }
167
Ian Rogers13735952014-10-08 12:43:28 -0700168 uint8_t* GetOatFileEnd() const {
169 return reinterpret_cast<uint8_t*>(oat_file_end_);
Brian Carlstrom4a289ed2011-08-16 17:17:49 -0700170 }
171
Andreas Gampebda1d602016-08-29 17:43:45 -0700172 PointerSize GetPointerSize() const;
Andreas Gampe542451c2016-07-26 09:02:02 -0700173
174 uint32_t GetPointerSizeUnchecked() const {
Mathieu Chartiere401d142015-04-22 13:56:20 -0700175 return pointer_size_;
176 }
177
Alex Light53cb16b2014-06-12 11:26:29 -0700178 off_t GetPatchDelta() const {
179 return patch_delta_;
180 }
181
Alex Klyubind1d5c952017-12-15 12:57:33 -0800182 void SetPatchDelta(off_t patch_delta) {
183 patch_delta_ = patch_delta;
184 }
185
Nicolas Geoffray9583fbc2014-02-28 15:21:07 +0000186 static std::string GetOatLocationFromImageLocation(const std::string& image) {
David Brazdil7b49e6c2016-09-01 11:06:18 +0100187 return GetLocationFromImageLocation(image, "oat");
188 }
189
190 static std::string GetVdexLocationFromImageLocation(const std::string& image) {
191 return GetLocationFromImageLocation(image, "vdex");
Nicolas Geoffray9583fbc2014-02-28 15:21:07 +0000192 }
193
Mathieu Chartiere401d142015-04-22 13:56:20 -0700194 enum ImageMethod {
Ian Rogers19846512012-02-24 11:42:47 -0800195 kResolutionMethod,
Jeff Hao88474b42013-10-23 16:24:40 -0700196 kImtConflictMethod,
Mathieu Chartier2d2621a2014-10-23 16:48:06 -0700197 kImtUnimplementedMethod,
Vladimir Markofd36f1f2016-08-03 18:49:58 +0100198 kSaveAllCalleeSavesMethod,
199 kSaveRefsOnlyMethod,
200 kSaveRefsAndArgsMethod,
Vladimir Marko952dbb12016-07-28 12:01:51 +0100201 kSaveEverythingMethod,
Mingyao Yang0a87a652017-04-12 13:43:15 -0700202 kSaveEverythingMethodForClinit,
203 kSaveEverythingMethodForSuspendCheck,
Mathieu Chartiere401d142015-04-22 13:56:20 -0700204 kImageMethodsCount, // Number of elements in enum.
205 };
206
207 enum ImageRoot {
Brian Carlstrom58ae9412011-10-04 00:56:06 -0700208 kDexCaches,
Brian Carlstrom34f426c2011-10-04 12:58:02 -0700209 kClassRoots,
Vladimir Markoeca3eda2016-11-09 16:26:44 +0000210 kClassLoader, // App image only.
Brian Carlstrom16192862011-09-12 17:50:06 -0700211 kImageRootsMax,
212 };
213
Mathieu Chartiere401d142015-04-22 13:56:20 -0700214 enum ImageSections {
215 kSectionObjects,
216 kSectionArtFields,
217 kSectionArtMethods,
Mathieu Chartiere42888f2016-04-14 10:49:19 -0700218 kSectionRuntimeMethods,
Artem Udovichenkoa62cb9b2016-06-30 09:18:25 +0000219 kSectionImTables,
Mathieu Chartiere42888f2016-04-14 10:49:19 -0700220 kSectionIMTConflictTables,
Vladimir Marko05792b92015-08-03 11:56:49 +0100221 kSectionDexCacheArrays,
Mathieu Chartierd39645e2015-06-09 17:50:29 -0700222 kSectionInternedStrings,
Mathieu Chartier208a5cb2015-12-02 15:44:07 -0800223 kSectionClassTable,
Mathieu Chartiere401d142015-04-22 13:56:20 -0700224 kSectionImageBitmap,
225 kSectionCount, // Number of elements in enum.
226 };
227
Vladimir Markoeca3eda2016-11-09 16:26:44 +0000228 static size_t NumberOfImageRoots(bool app_image) {
229 return app_image ? kImageRootsMax : kImageRootsMax - 1u;
230 }
231
Mathieu Chartiere401d142015-04-22 13:56:20 -0700232 ArtMethod* GetImageMethod(ImageMethod index) const;
233 void SetImageMethod(ImageMethod index, ArtMethod* method);
234
Vladimir Markocd87c3e2017-09-05 13:11:57 +0100235 const ImageSection& GetImageSection(ImageSections index) const {
236 DCHECK_LT(static_cast<size_t>(index), kSectionCount);
237 return sections_[index];
238 }
239
240 const ImageSection& GetObjectsSection() const {
241 return GetImageSection(kSectionObjects);
242 }
243
244 const ImageSection& GetFieldsSection() const {
245 return GetImageSection(ImageHeader::kSectionArtFields);
246 }
Mathieu Chartiere42888f2016-04-14 10:49:19 -0700247
Mathieu Chartiere401d142015-04-22 13:56:20 -0700248 const ImageSection& GetMethodsSection() const {
249 return GetImageSection(kSectionArtMethods);
250 }
251
Mathieu Chartiere42888f2016-04-14 10:49:19 -0700252 const ImageSection& GetRuntimeMethodsSection() const {
253 return GetImageSection(kSectionRuntimeMethods);
254 }
255
Vladimir Markocd87c3e2017-09-05 13:11:57 +0100256 const ImageSection& GetImTablesSection() const {
257 return GetImageSection(kSectionImTables);
258 }
259
260 const ImageSection& GetIMTConflictTablesSection() const {
261 return GetImageSection(kSectionIMTConflictTables);
262 }
263
264 const ImageSection& GetDexCacheArraysSection() const {
265 return GetImageSection(kSectionDexCacheArrays);
266 }
267
268 const ImageSection& GetInternedStringsSection() const {
269 return GetImageSection(kSectionInternedStrings);
270 }
271
272 const ImageSection& GetClassTableSection() const {
273 return GetImageSection(kSectionClassTable);
274 }
275
276 const ImageSection& GetImageBitmapSection() const {
277 return GetImageSection(kSectionImageBitmap);
Mathieu Chartiere42888f2016-04-14 10:49:19 -0700278 }
279
Mathieu Chartier4a26f172016-01-26 14:26:18 -0800280 template <ReadBarrierOption kReadBarrierOption = kWithReadBarrier>
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800281 mirror::Object* GetImageRoot(ImageRoot image_root) const
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700282 REQUIRES_SHARED(Locks::mutator_lock_);
Mathieu Chartier4a26f172016-01-26 14:26:18 -0800283
284 template <ReadBarrierOption kReadBarrierOption = kWithReadBarrier>
Hiroshi Yamauchi2cd334a2015-01-09 14:03:35 -0800285 mirror::ObjectArray<mirror::Object>* GetImageRoots() const
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700286 REQUIRES_SHARED(Locks::mutator_lock_);
Brian Carlstromaded5f72011-10-07 17:15:04 -0700287
Alex Light53cb16b2014-06-12 11:26:29 -0700288 void RelocateImage(off_t delta);
Mathieu Chartierfbc31082016-01-24 11:59:56 -0800289 void RelocateImageMethods(off_t delta);
290 void RelocateImageObjects(off_t delta);
Alex Light53cb16b2014-06-12 11:26:29 -0700291
Igor Murashkin46774762014-10-22 11:37:02 -0700292 bool CompilePic() const {
293 return compile_pic_ != 0;
294 }
295
Mathieu Chartierfbc31082016-01-24 11:59:56 -0800296 bool IsPic() const {
297 return is_pic_ != 0;
298 }
299
300 uint32_t GetBootImageBegin() const {
301 return boot_image_begin_;
302 }
303
304 uint32_t GetBootImageSize() const {
305 return boot_image_size_;
306 }
307
308 uint32_t GetBootOatBegin() const {
309 return boot_oat_begin_;
310 }
311
312 uint32_t GetBootOatSize() const {
313 return boot_oat_size_;
314 }
315
Mathieu Chartierceb07b32015-12-10 09:33:21 -0800316 StorageMode GetStorageMode() const {
317 return storage_mode_;
318 }
319
320 uint64_t GetDataSize() const {
321 return data_size_;
322 }
323
Mathieu Chartierfbc31082016-01-24 11:59:56 -0800324 bool IsAppImage() const {
325 // App images currently require a boot image, if the size is non zero then it is an app image
326 // header.
327 return boot_image_size_ != 0u;
328 }
329
Vladimir Marko6cfbdbc2017-07-25 13:26:39 +0100330 uint32_t GetBootImageConstantTablesOffset() const {
331 // Interned strings table and class table for boot image are mmapped read only.
332 DCHECK(!IsAppImage());
333 const ImageSection& interned_strings = GetInternedStringsSection();
334 DCHECK_ALIGNED(interned_strings.Offset(), kPageSize);
335 return interned_strings.Offset();
336 }
337
338 uint32_t GetBootImageConstantTablesSize() const {
339 uint32_t start_offset = GetBootImageConstantTablesOffset();
340 const ImageSection& class_table = GetClassTableSection();
341 DCHECK_LE(start_offset, class_table.Offset());
342 size_t tables_size = class_table.Offset() + class_table.Size() - start_offset;
343 return RoundUp(tables_size, kPageSize);
344 }
345
David Sehra49e0532017-08-25 08:05:29 -0700346 // Visit mirror::Objects in the section starting at base.
347 // TODO: Delete base parameter if it is always equal to GetImageBegin.
348 void VisitObjects(ObjectVisitor* visitor,
349 uint8_t* base,
350 PointerSize pointer_size) const
351 REQUIRES_SHARED(Locks::mutator_lock_);
352
Mathieu Chartiere42888f2016-04-14 10:49:19 -0700353 // Visit ArtMethods in the section starting at base. Includes runtime methods.
354 // TODO: Delete base parameter if it is always equal to GetImageBegin.
Andreas Gampe542451c2016-07-26 09:02:02 -0700355 void VisitPackedArtMethods(ArtMethodVisitor* visitor,
356 uint8_t* base,
357 PointerSize pointer_size) const;
Mathieu Chartiere42888f2016-04-14 10:49:19 -0700358
359 // Visit ArtMethods in the section starting at base.
360 // TODO: Delete base parameter if it is always equal to GetImageBegin.
361 void VisitPackedArtFields(ArtFieldVisitor* visitor, uint8_t* base) const;
362
363 template <typename Visitor>
Artem Udovichenkoa62cb9b2016-06-30 09:18:25 +0000364 void VisitPackedImTables(const Visitor& visitor,
365 uint8_t* base,
Andreas Gampe542451c2016-07-26 09:02:02 -0700366 PointerSize pointer_size) const;
Artem Udovichenkoa62cb9b2016-06-30 09:18:25 +0000367
368 template <typename Visitor>
Mathieu Chartiere42888f2016-04-14 10:49:19 -0700369 void VisitPackedImtConflictTables(const Visitor& visitor,
370 uint8_t* base,
Andreas Gampe542451c2016-07-26 09:02:02 -0700371 PointerSize pointer_size) const;
Mathieu Chartiere42888f2016-04-14 10:49:19 -0700372
Alex Light53cb16b2014-06-12 11:26:29 -0700373 private:
Ian Rogers13735952014-10-08 12:43:28 -0700374 static const uint8_t kImageMagic[4];
375 static const uint8_t kImageVersion[4];
Brian Carlstrom4a289ed2011-08-16 17:17:49 -0700376
David Brazdil7b49e6c2016-09-01 11:06:18 +0100377 static std::string GetLocationFromImageLocation(const std::string& image,
378 const std::string& extension) {
379 std::string filename = image;
380 if (filename.length() <= 3) {
381 filename += "." + extension;
382 } else {
383 filename.replace(filename.length() - 3, 3, extension);
384 }
385 return filename;
386 }
387
Ian Rogers13735952014-10-08 12:43:28 -0700388 uint8_t magic_[4];
389 uint8_t version_[4];
Brian Carlstroma663ea52011-08-19 23:33:41 -0700390
Brian Carlstrom700c8d32012-11-05 10:42:02 -0800391 // Required base address for mapping the image.
Ian Rogers30fab402012-01-23 15:43:46 -0800392 uint32_t image_begin_;
Brian Carlstrome24fa612011-09-29 00:53:55 -0700393
Mathieu Chartier31e89252013-08-28 11:29:12 -0700394 // Image size, not page aligned.
395 uint32_t image_size_;
396
Brian Carlstrom700c8d32012-11-05 10:42:02 -0800397 // Checksum of the oat file we link to for load time sanity check.
Brian Carlstrome24fa612011-09-29 00:53:55 -0700398 uint32_t oat_checksum_;
399
Brian Carlstrom700c8d32012-11-05 10:42:02 -0800400 // Start address for oat file. Will be before oat_data_begin_ for .so files.
401 uint32_t oat_file_begin_;
Brian Carlstrome24fa612011-09-29 00:53:55 -0700402
Brian Carlstrom700c8d32012-11-05 10:42:02 -0800403 // Required oat address expected by image Method::GetCode() pointers.
404 uint32_t oat_data_begin_;
Brian Carlstrom16192862011-09-12 17:50:06 -0700405
Brian Carlstrom700c8d32012-11-05 10:42:02 -0800406 // End of oat data address range for this image file.
407 uint32_t oat_data_end_;
408
409 // End of oat file address range. will be after oat_data_end_ for
410 // .so files. Used for positioning a following alloc spaces.
411 uint32_t oat_file_end_;
412
Mathieu Chartierfbc31082016-01-24 11:59:56 -0800413 // Boot image begin and end (app image headers only).
414 uint32_t boot_image_begin_;
415 uint32_t boot_image_size_;
416
417 // Boot oat begin and end (app image headers only).
418 uint32_t boot_oat_begin_;
419 uint32_t boot_oat_size_;
420
421 // TODO: We should probably insert a boot image checksum for app images.
422
Alex Light53cb16b2014-06-12 11:26:29 -0700423 // The total delta that this image has been patched.
424 int32_t patch_delta_;
425
Brian Carlstrom700c8d32012-11-05 10:42:02 -0800426 // Absolute address of an Object[] of objects needed to reinitialize from an image.
Brian Carlstrom16192862011-09-12 17:50:06 -0700427 uint32_t image_roots_;
428
Mathieu Chartiere401d142015-04-22 13:56:20 -0700429 // Pointer size, this affects the size of the ArtMethods.
430 uint32_t pointer_size_;
431
Igor Murashkin46774762014-10-22 11:37:02 -0700432 // Boolean (0 or 1) to denote if the image was compiled with --compile-pic option
433 const uint32_t compile_pic_;
434
Mathieu Chartierfbc31082016-01-24 11:59:56 -0800435 // Boolean (0 or 1) to denote if the image can be mapped at a random address, this only refers to
436 // the .art file. Currently, app oat files do not depend on their app image. There are no pointers
437 // from the app oat code to the app image.
438 const uint32_t is_pic_;
439
Mathieu Chartier67ad20e2015-12-09 15:41:09 -0800440 // Image section sizes/offsets correspond to the uncompressed form.
Mathieu Chartiere401d142015-04-22 13:56:20 -0700441 ImageSection sections_[kSectionCount];
442
Mathieu Chartierfbc31082016-01-24 11:59:56 -0800443 // Image methods, may be inside of the boot image for app images.
Mathieu Chartiere401d142015-04-22 13:56:20 -0700444 uint64_t image_methods_[kImageMethodsCount];
445
Mathieu Chartierceb07b32015-12-10 09:33:21 -0800446 // Storage method for the image, the image may be compressed.
447 StorageMode storage_mode_;
448
449 // Data size for the image data excluding the bitmap and the header. For compressed images, this
450 // is the compressed size in the file.
451 uint32_t data_size_;
452
Vladimir Marko74527972016-11-29 15:57:32 +0000453 friend class linker::ImageWriter;
Brian Carlstrom4a289ed2011-08-16 17:17:49 -0700454};
455
Mathieu Chartiere401d142015-04-22 13:56:20 -0700456std::ostream& operator<<(std::ostream& os, const ImageHeader::ImageMethod& policy);
457std::ostream& operator<<(std::ostream& os, const ImageHeader::ImageRoot& policy);
458std::ostream& operator<<(std::ostream& os, const ImageHeader::ImageSections& section);
459std::ostream& operator<<(std::ostream& os, const ImageSection& section);
Mathieu Chartierceb07b32015-12-10 09:33:21 -0800460std::ostream& operator<<(std::ostream& os, const ImageHeader::StorageMode& mode);
Mathieu Chartiere401d142015-04-22 13:56:20 -0700461
Brian Carlstrom4a289ed2011-08-16 17:17:49 -0700462} // namespace art
463
Brian Carlstromfc0e3212013-07-17 14:40:12 -0700464#endif // ART_RUNTIME_IMAGE_H_