Brian Carlstrom | 6a47b9d | 2013-05-17 10:58:25 -0700 | [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 | fc0e321 | 2013-07-17 14:40:12 -0700 | [diff] [blame] | 17 | #ifndef ART_COMPILER_ELF_WRITER_QUICK_H_ |
| 18 | #define ART_COMPILER_ELF_WRITER_QUICK_H_ |
Brian Carlstrom | 6a47b9d | 2013-05-17 10:58:25 -0700 | [diff] [blame] | 19 | |
Brian Carlstrom | b12f347 | 2014-06-11 14:54:46 -0700 | [diff] [blame] | 20 | #include "elf_utils.h" |
Brian Carlstrom | 6a47b9d | 2013-05-17 10:58:25 -0700 | [diff] [blame] | 21 | #include "elf_writer.h" |
| 22 | |
| 23 | namespace art { |
| 24 | |
Nicolas Geoffray | f9b87b1 | 2014-09-02 08:12:09 +0000 | [diff] [blame] | 25 | template <typename Elf_Word, typename Elf_Sword, typename Elf_Addr, |
| 26 | typename Elf_Dyn, typename Elf_Sym, typename Elf_Ehdr, |
| 27 | typename Elf_Phdr, typename Elf_Shdr> |
Ian Rogers | 3d50407 | 2014-03-01 09:16:49 -0800 | [diff] [blame] | 28 | class ElfWriterQuick FINAL : public ElfWriter { |
Brian Carlstrom | 6a47b9d | 2013-05-17 10:58:25 -0700 | [diff] [blame] | 29 | public: |
| 30 | // Write an ELF file. Returns true on success, false on failure. |
| 31 | static bool Create(File* file, |
Ian Rogers | 3d50407 | 2014-03-01 09:16:49 -0800 | [diff] [blame] | 32 | OatWriter* oat_writer, |
Brian Carlstrom | 6a47b9d | 2013-05-17 10:58:25 -0700 | [diff] [blame] | 33 | const std::vector<const DexFile*>& dex_files, |
| 34 | const std::string& android_root, |
| 35 | bool is_host, |
| 36 | const CompilerDriver& driver) |
| 37 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); |
| 38 | |
| 39 | protected: |
Ian Rogers | 3d50407 | 2014-03-01 09:16:49 -0800 | [diff] [blame] | 40 | bool Write(OatWriter* oat_writer, |
| 41 | const std::vector<const DexFile*>& dex_files, |
| 42 | const std::string& android_root, |
| 43 | bool is_host) |
| 44 | OVERRIDE |
Brian Carlstrom | 6a47b9d | 2013-05-17 10:58:25 -0700 | [diff] [blame] | 45 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); |
| 46 | |
| 47 | private: |
Ian Rogers | 3d50407 | 2014-03-01 09:16:49 -0800 | [diff] [blame] | 48 | ElfWriterQuick(const CompilerDriver& driver, File* elf_file) |
| 49 | : ElfWriter(driver, elf_file) {} |
| 50 | ~ElfWriterQuick() {} |
Brian Carlstrom | 6a47b9d | 2013-05-17 10:58:25 -0700 | [diff] [blame] | 51 | |
| 52 | DISALLOW_IMPLICIT_CONSTRUCTORS(ElfWriterQuick); |
| 53 | }; |
| 54 | |
Nicolas Geoffray | f9b87b1 | 2014-09-02 08:12:09 +0000 | [diff] [blame] | 55 | // Explicitly instantiated in elf_writer_quick.cc |
| 56 | typedef ElfWriterQuick<Elf32_Word, Elf32_Sword, Elf32_Addr, Elf32_Dyn, |
| 57 | Elf32_Sym, Elf32_Ehdr, Elf32_Phdr, Elf32_Shdr> ElfWriterQuick32; |
| 58 | typedef ElfWriterQuick<Elf64_Word, Elf64_Sword, Elf64_Addr, Elf64_Dyn, |
| 59 | Elf64_Sym, Elf64_Ehdr, Elf64_Phdr, Elf64_Shdr> ElfWriterQuick64; |
| 60 | |
Brian Carlstrom | 6a47b9d | 2013-05-17 10:58:25 -0700 | [diff] [blame] | 61 | } // namespace art |
| 62 | |
Brian Carlstrom | fc0e321 | 2013-07-17 14:40:12 -0700 | [diff] [blame] | 63 | #endif // ART_COMPILER_ELF_WRITER_QUICK_H_ |