blob: 4990ed0ecef05c5118890421d9c4fda325261f56 [file] [log] [blame]
Brian Carlstrom6a47b9d2013-05-17 10:58:25 -07001/*
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 Carlstromfc0e3212013-07-17 14:40:12 -070017#ifndef ART_COMPILER_ELF_WRITER_QUICK_H_
18#define ART_COMPILER_ELF_WRITER_QUICK_H_
Brian Carlstrom6a47b9d2013-05-17 10:58:25 -070019
Brian Carlstromb12f3472014-06-11 14:54:46 -070020#include "elf_utils.h"
Brian Carlstrom6a47b9d2013-05-17 10:58:25 -070021#include "elf_writer.h"
22
23namespace art {
24
Nicolas Geoffrayf9b87b12014-09-02 08:12:09 +000025template <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 Rogers3d504072014-03-01 09:16:49 -080028class ElfWriterQuick FINAL : public ElfWriter {
Brian Carlstrom6a47b9d2013-05-17 10:58:25 -070029 public:
30 // Write an ELF file. Returns true on success, false on failure.
31 static bool Create(File* file,
Ian Rogers3d504072014-03-01 09:16:49 -080032 OatWriter* oat_writer,
Brian Carlstrom6a47b9d2013-05-17 10:58:25 -070033 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 Rogers3d504072014-03-01 09:16:49 -080040 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 Carlstrom6a47b9d2013-05-17 10:58:25 -070045 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
46
47 private:
Ian Rogers3d504072014-03-01 09:16:49 -080048 ElfWriterQuick(const CompilerDriver& driver, File* elf_file)
49 : ElfWriter(driver, elf_file) {}
50 ~ElfWriterQuick() {}
Brian Carlstrom6a47b9d2013-05-17 10:58:25 -070051
52 DISALLOW_IMPLICIT_CONSTRUCTORS(ElfWriterQuick);
53};
54
Nicolas Geoffrayf9b87b12014-09-02 08:12:09 +000055// Explicitly instantiated in elf_writer_quick.cc
56typedef ElfWriterQuick<Elf32_Word, Elf32_Sword, Elf32_Addr, Elf32_Dyn,
57 Elf32_Sym, Elf32_Ehdr, Elf32_Phdr, Elf32_Shdr> ElfWriterQuick32;
58typedef ElfWriterQuick<Elf64_Word, Elf64_Sword, Elf64_Addr, Elf64_Dyn,
59 Elf64_Sym, Elf64_Ehdr, Elf64_Phdr, Elf64_Shdr> ElfWriterQuick64;
60
Brian Carlstrom6a47b9d2013-05-17 10:58:25 -070061} // namespace art
62
Brian Carlstromfc0e3212013-07-17 14:40:12 -070063#endif // ART_COMPILER_ELF_WRITER_QUICK_H_