blob: 5c8063a25393736f213ecb9f8df984ff36d6bc5d [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"
22#include "object.h"
23
24#include <android/librsloader.h>
25#include <vector>
26
27namespace art {
28 class Method;
29}
30
31namespace art {
32namespace compiler_llvm {
33
34class ElfLoader {
35 public:
36 ~ElfLoader();
37
Logan Chien0f0899a2012-03-23 10:48:18 +080038 bool LoadElfAt(size_t elf_idx, const ElfImage& elf_image);
Logan Chienf7015fd2012-03-18 01:19:37 +080039
40 const void* GetMethodCodeAddr(size_t elf_idx, const Method* method) const;
41
42 const Method::InvokeStub* GetMethodInvokeStubAddr(size_t elf_idx,
43 const Method* method) const;
44
45 private:
46 const void* GetAddr(size_t elf_idx, const char* sym_name) const;
47
48 std::vector<RSExecRef> executables_;
49};
50
51
52} // namespace compiler_llvm
53} // namespace art
54
55#endif // ART_SRC_COMPILER_LLVM_ELF_LOADER_H_