summaryrefslogtreecommitdiffstats
path: root/linker/linker_relocs.h
diff options
context:
space:
mode:
authorDmitriy Ivanov <dimitry@google.com>2015-01-08 23:30:15 -0800
committerDmitriy Ivanov <dimitry@google.com>2015-01-09 14:57:53 -0800
commitcefef7dab67472d59d45ef1d002a20edf8edde75 (patch)
tree78a565fe74bf79bbe2d1f856acd693a68bc7d150 /linker/linker_relocs.h
parenta137f539801a05d395cfef1dd7a61b6fd8c36330 (diff)
downloadbionic-cefef7dab67472d59d45ef1d002a20edf8edde75.zip
bionic-cefef7dab67472d59d45ef1d002a20edf8edde75.tar.gz
bionic-cefef7dab67472d59d45ef1d002a20edf8edde75.tar.bz2
Refactor soinfo::relocate
Move common relocation types outside of ifdefs Change-Id: I713800ce123a18178b5ac80c0b3c7bd6b21a02c2
Diffstat (limited to 'linker/linker_relocs.h')
-rw-r--r--linker/linker_relocs.h54
1 files changed, 54 insertions, 0 deletions
diff --git a/linker/linker_relocs.h b/linker/linker_relocs.h
new file mode 100644
index 0000000..12c1497
--- /dev/null
+++ b/linker/linker_relocs.h
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __LINKER_RELOCS_H
+#define __LINKER_RELOCS_H
+
+#include <elf.h>
+
+#define R_GENERIC_NONE 0 // R_*_NONE is always 0
+
+#if defined (__aarch64__)
+
+#define R_GENERIC_JUMP_SLOT R_AARCH64_JUMP_SLOT
+#define R_GENERIC_GLOB_DAT R_AARCH64_GLOB_DAT
+#define R_GENERIC_RELATIVE R_AARCH64_RELATIVE
+#define R_GENERIC_IRELATIVE R_AARCH64_IRELATIVE
+
+#elif defined (__arm__)
+
+#define R_GENERIC_JUMP_SLOT R_ARM_JUMP_SLOT
+#define R_GENERIC_GLOB_DAT R_ARM_GLOB_DAT
+#define R_GENERIC_RELATIVE R_ARM_RELATIVE
+#define R_GENERIC_IRELATIVE R_ARM_IRELATIVE
+
+#elif defined (__i386__)
+
+#define R_GENERIC_JUMP_SLOT R_386_JMP_SLOT
+#define R_GENERIC_GLOB_DAT R_386_GLOB_DAT
+#define R_GENERIC_RELATIVE R_386_RELATIVE
+#define R_GENERIC_IRELATIVE R_386_IRELATIVE
+
+#elif defined (__x86_64__)
+
+#define R_GENERIC_JUMP_SLOT R_X86_64_JUMP_SLOT
+#define R_GENERIC_GLOB_DAT R_X86_64_GLOB_DAT
+#define R_GENERIC_RELATIVE R_X86_64_RELATIVE
+#define R_GENERIC_IRELATIVE R_X86_64_IRELATIVE
+
+#endif
+
+#endif // __LINKER_RELOCS_H