blob: 6388bb0d7676e6e9dd61724825142ac912f4fd30 [file] [log] [blame]
Dmitriy Ivanovfa26eee2015-02-03 16:06:47 -08001/*
2 * Copyright (C) 2015 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 __LINKER_RELOC_ITERATORS_H
18#define __LINKER_RELOC_ITERATORS_H
19
20#include "linker.h"
21
22class plain_reloc_iterator {
23#if defined(USE_RELA)
24 typedef ElfW(Rela) rel_t;
25#else
26 typedef ElfW(Rel) rel_t;
27#endif
28 public:
29 plain_reloc_iterator(rel_t* rel_array, size_t count)
30 : begin_(rel_array), end_(begin_ + count), current_(begin_) {}
31
32 bool has_next() {
33 return current_ < end_;
34 }
35
36 rel_t* next() {
37 return current_++;
38 }
39 private:
40 rel_t* const begin_;
41 rel_t* const end_;
42 rel_t* current_;
43
44 DISALLOW_COPY_AND_ASSIGN(plain_reloc_iterator);
45};
46
47#endif // __LINKER_RELOC_ITERATORS_H