blob: 9e8137f7e6680220b604b33ac4f1419dbbe87a39 [file] [log] [blame]
Logan Chienf7015fd2012-03-18 01:19:37 +08001/*
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
17#ifndef ART_SRC_COMPILER_LLVM_ELF_LOADER_H_
18#define ART_SRC_COMPILER_LLVM_ELF_LOADER_H_
19
Logan Chien0f0899a2012-03-23 10:48:18 +080020#include "elf_image.h"
Logan Chienf7015fd2012-03-18 01:19:37 +080021#include "globals.h"
Logan Chien0c717dd2012-03-28 18:31:07 +080022#include "oat_file.h"
Logan Chienf7015fd2012-03-18 01:19:37 +080023#include "object.h"
24
25#include <android/librsloader.h>
26#include <vector>
27
28namespace art {
29 class Method;
30}
31
32namespace art {
33namespace compiler_llvm {
34
35class ElfLoader {
36 public:
37 ~ElfLoader();
38
Logan Chien0c717dd2012-03-28 18:31:07 +080039 bool LoadElfAt(size_t elf_idx, const ElfImage& elf_image,
40 OatFile::RelocationBehavior reloc);
41
42 void RelocateExecutable();
Logan Chienf7015fd2012-03-18 01:19:37 +080043
44 const void* GetMethodCodeAddr(size_t elf_idx, const Method* method) const;
45
46 const Method::InvokeStub* GetMethodInvokeStubAddr(size_t elf_idx,
47 const Method* method) const;
48
49 private:
50 const void* GetAddr(size_t elf_idx, const char* sym_name) const;
51
52 std::vector<RSExecRef> executables_;
53};
54
55
56} // namespace compiler_llvm
57} // namespace art
58
59#endif // ART_SRC_COMPILER_LLVM_ELF_LOADER_H_