Skip to content
Snippets Groups Projects
Commit c70f74a0 authored by Simon Glass's avatar Simon Glass Committed by Alexander Graf
Browse files

elf: arm: Add a few ARM relocation types


Rather than hard-coding the relocation type, add it to the ELF header file
and use it from there.

Signed-off-by: default avatarSimon Glass <sjg@chromium.org>
Signed-off-by: default avatarAlexander Graf <agraf@suse.de>
parent c7ae3dfd
Branches repro
Tags
No related merge requests found
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include <asm-offsets.h> #include <asm-offsets.h>
#include <config.h> #include <config.h>
#include <elf.h>
#include <linux/linkage.h> #include <linux/linkage.h>
#ifdef CONFIG_CPU_V7M #ifdef CONFIG_CPU_V7M
#include <asm/armv7m.h> #include <asm/armv7m.h>
...@@ -96,7 +97,7 @@ copy_loop: ...@@ -96,7 +97,7 @@ copy_loop:
fixloop: fixloop:
ldmia r2!, {r0-r1} /* (r0,r1) <- (SRC location,fixup) */ ldmia r2!, {r0-r1} /* (r0,r1) <- (SRC location,fixup) */
and r1, r1, #0xff and r1, r1, #0xff
cmp r1, #23 /* relative fixup? */ cmp r1, #R_ARM_RELATIVE
bne fixnext bne fixnext
/* relative fix: increase location by offset */ /* relative fix: increase location by offset */
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include <asm-offsets.h> #include <asm-offsets.h>
#include <config.h> #include <config.h>
#include <elf.h>
#include <linux/linkage.h> #include <linux/linkage.h>
#include <asm/macro.h> #include <asm/macro.h>
...@@ -47,7 +48,7 @@ fixloop: ...@@ -47,7 +48,7 @@ fixloop:
ldp x0, x1, [x2], #16 /* (x0,x1) <- (SRC location, fixup) */ ldp x0, x1, [x2], #16 /* (x0,x1) <- (SRC location, fixup) */
ldr x4, [x2], #8 /* x4 <- addend */ ldr x4, [x2], #8 /* x4 <- addend */
and x1, x1, #0xffffffff and x1, x1, #0xffffffff
cmp x1, #1027 /* relative fixup? */ cmp x1, #R_AARCH64_RELATIVE
bne fixnext bne fixnext
/* relative fix: store addend plus offset at dest location */ /* relative fix: store addend plus offset at dest location */
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#ifndef _ELF_H #ifndef _ELF_H
#define _ELF_H #define _ELF_H
#ifndef __ASSEMBLER__
#include "compiler.h" #include "compiler.h"
/* /*
...@@ -517,6 +518,8 @@ unsigned long elf_hash(const unsigned char *name); ...@@ -517,6 +518,8 @@ unsigned long elf_hash(const unsigned char *name);
#define ELF_TARG_VER 1 /* The ver for which this code is intended */ #define ELF_TARG_VER 1 /* The ver for which this code is intended */
#endif /* __ASSEMBLER */
/* /*
* XXX - PowerPC defines really don't belong in here, * XXX - PowerPC defines really don't belong in here,
* but we'll put them in for simplicity. * but we'll put them in for simplicity.
...@@ -602,6 +605,16 @@ unsigned long elf_hash(const unsigned char *name); ...@@ -602,6 +605,16 @@ unsigned long elf_hash(const unsigned char *name);
that may still be in object files. */ that may still be in object files. */
#define R_PPC_TOC16 255 #define R_PPC_TOC16 255
/* ARM relocs */
#define R_ARM_NONE 0 /* No reloc */
#define R_ARM_RELATIVE 23 /* Adjust by program base */
/* AArch64 relocs */
#define R_AARCH64_NONE 0 /* No relocation. */
#define R_AARCH64_RELATIVE 1027 /* Adjust by program base. */
#ifndef __ASSEMBLER__
int valid_elf_image(unsigned long addr); int valid_elf_image(unsigned long addr);
#endif
#endif /* _ELF_H */ #endif /* _ELF_H */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment