Brian Carlstrom | 700c8d3 | 2012-11-05 10:42:02 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2012 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 | */ |
| 16 | |
Brian Carlstrom | 700c8d3 | 2012-11-05 10:42:02 -0800 | [diff] [blame] | 17 | #include "elf_writer.h" |
| 18 | #include "os.h" |
| 19 | |
Ian Rogers | 1212a02 | 2013-03-04 10:48:41 -0800 | [diff] [blame] | 20 | namespace art { |
| 21 | class CompilerDriver; |
Brian Carlstrom | 265091e | 2013-01-30 14:08:26 -0800 | [diff] [blame] | 22 | class DexFile; |
Ian Rogers | 1212a02 | 2013-03-04 10:48:41 -0800 | [diff] [blame] | 23 | } // namespace art |
| 24 | |
| 25 | extern "C" bool WriteElf(art::CompilerDriver& driver, |
Brian Carlstrom | 3f47c12 | 2013-03-07 00:02:40 -0800 | [diff] [blame^] | 26 | const std::string& android_root, |
Brian Carlstrom | 265091e | 2013-01-30 14:08:26 -0800 | [diff] [blame] | 27 | bool is_host, |
| 28 | const std::vector<const art::DexFile*>& dex_files, |
Brian Carlstrom | 700c8d3 | 2012-11-05 10:42:02 -0800 | [diff] [blame] | 29 | std::vector<uint8_t>& oat_contents, |
Brian Carlstrom | 265091e | 2013-01-30 14:08:26 -0800 | [diff] [blame] | 30 | art::File* file) |
| 31 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Brian Carlstrom | 3f47c12 | 2013-03-07 00:02:40 -0800 | [diff] [blame^] | 32 | return art::ElfWriter::Create(file, oat_contents, dex_files, android_root, is_host, driver); |
Brian Carlstrom | 700c8d3 | 2012-11-05 10:42:02 -0800 | [diff] [blame] | 33 | } |
| 34 | extern "C" bool FixupElf(art::File* file, uintptr_t oat_data_begin) { |
| 35 | return art::ElfWriter::Fixup(file, oat_data_begin); |
| 36 | } |
| 37 | extern "C" void GetOatElfInformation(art::File* file, |
| 38 | size_t& oat_loaded_size, |
| 39 | size_t& oat_data_offset) { |
| 40 | art::ElfWriter::GetOatElfInformation(file, oat_loaded_size, oat_data_offset); |
| 41 | } |
Brian Carlstrom | 265091e | 2013-01-30 14:08:26 -0800 | [diff] [blame] | 42 | extern "C" bool StripElf(art::File* file) { |
| 43 | return art::ElfWriter::Strip(file); |
| 44 | } |