From: Simon Glass <sjg@chromium.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v4 07/14] elf: arm: Add a few ARM relocation types
Date: Mon, 7 Nov 2016 08:47:09 -0700 [thread overview]
Message-ID: <1478533636-17577-8-git-send-email-sjg@chromium.org> (raw)
In-Reply-To: <1478533636-17577-1-git-send-email-sjg@chromium.org>
Rather than hard-coding the relocation type, add it to the ELF header file
and use it from there.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
Changes in v4: None
Changes in v3: None
Changes in v2: None
arch/arm/lib/relocate.S | 3 ++-
arch/arm/lib/relocate_64.S | 3 ++-
include/elf.h | 13 +++++++++++++
3 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/arch/arm/lib/relocate.S b/arch/arm/lib/relocate.S
index 475d503..a6fb07c 100644
--- a/arch/arm/lib/relocate.S
+++ b/arch/arm/lib/relocate.S
@@ -8,6 +8,7 @@
#include <asm-offsets.h>
#include <config.h>
+#include <elf.h>
#include <linux/linkage.h>
#ifdef CONFIG_CPU_V7M
#include <asm/armv7m.h>
@@ -96,7 +97,7 @@ copy_loop:
fixloop:
ldmia r2!, {r0-r1} /* (r0,r1) <- (SRC location,fixup) */
and r1, r1, #0xff
- cmp r1, #23 /* relative fixup? */
+ cmp r1, #R_ARM_RELATIVE
bne fixnext
/* relative fix: increase location by offset */
diff --git a/arch/arm/lib/relocate_64.S b/arch/arm/lib/relocate_64.S
index 5c51cae..242e56e 100644
--- a/arch/arm/lib/relocate_64.S
+++ b/arch/arm/lib/relocate_64.S
@@ -10,6 +10,7 @@
#include <asm-offsets.h>
#include <config.h>
+#include <elf.h>
#include <linux/linkage.h>
#include <asm/macro.h>
@@ -47,7 +48,7 @@ fixloop:
ldp x0, x1, [x2], #16 /* (x0,x1) <- (SRC location, fixup) */
ldr x4, [x2], #8 /* x4 <- addend */
and x1, x1, #0xffffffff
- cmp x1, #1027 /* relative fixup? */
+ cmp x1, #R_AARCH64_RELATIVE
bne fixnext
/* relative fix: store addend plus offset@dest location */
diff --git a/include/elf.h b/include/elf.h
index bcc5eb7..aaecac7 100644
--- a/include/elf.h
+++ b/include/elf.h
@@ -13,6 +13,7 @@
#ifndef _ELF_H
#define _ELF_H
+#ifndef __ASSEMBLER__
#include "compiler.h"
/*
@@ -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 */
+#endif /* __ASSEMBLER */
+
/*
* XXX - PowerPC defines really don't belong in here,
* but we'll put them in for simplicity.
@@ -602,6 +605,16 @@ unsigned long elf_hash(const unsigned char *name);
that may still be in object files. */
#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);
+#endif
#endif /* _ELF_H */
--
2.8.0.rc3.226.g39d4020
next prev parent reply other threads:[~2016-11-07 15:47 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-07 15:47 [U-Boot] [PATCH v4 00/14] efi: x86: Add EFI hello world and loader support for x86 Simon Glass
2016-11-07 15:47 ` [U-Boot] [PATCH v4 01/14] x86: Correct a build warning in x86 tables Simon Glass
2016-11-14 23:05 ` [U-Boot] [U-Boot, v4, " Alexander Graf
2016-11-07 15:47 ` [U-Boot] [PATCH v4 02/14] efi: Correct cache flush alignment Simon Glass
2016-11-14 23:06 ` [U-Boot] [U-Boot,v4,02/14] " Alexander Graf
2016-11-07 15:47 ` [U-Boot] [PATCH v4 03/14] efi: Fix debug message address format Simon Glass
2016-11-14 23:06 ` [U-Boot] [U-Boot, v4, " Alexander Graf
2016-11-07 15:47 ` [U-Boot] [PATCH v4 04/14] x86: Tidy up selection of building the EFI stub Simon Glass
2016-11-14 23:05 ` [U-Boot] [U-Boot, v4, " Alexander Graf
2016-11-07 15:47 ` [U-Boot] [PATCH v4 05/14] efi: Makefile: Export variables for use with EFI Simon Glass
2016-11-14 23:06 ` [U-Boot] [U-Boot, v4, " Alexander Graf
2016-11-07 15:47 ` [U-Boot] [PATCH v4 06/14] efi: Add support for a hello world test program Simon Glass
2016-11-14 23:06 ` [U-Boot] [U-Boot, v4, " Alexander Graf
2016-11-07 15:47 ` Simon Glass [this message]
2016-11-14 23:06 ` [U-Boot] [U-Boot, v4, 07/14] elf: arm: Add a few ARM relocation types Alexander Graf
2016-11-07 15:47 ` [U-Boot] [PATCH v4 08/14] efi: arm: Add EFI app support Simon Glass
2016-11-14 23:06 ` [U-Boot] [U-Boot,v4,08/14] " Alexander Graf
2016-11-07 15:47 ` [U-Boot] [PATCH v4 09/14] efi: arm: Add aarch64 " Simon Glass
2016-11-14 23:06 ` [U-Boot] [U-Boot, v4, " Alexander Graf
2016-11-07 15:47 ` [U-Boot] [PATCH v4 10/14] efi: arm: Enable the hello world test program Simon Glass
2016-11-07 15:47 ` [U-Boot] [PATCH v4 11/14] x86: Move efi .lds files into the 'lib' directory Simon Glass
2016-11-14 23:06 ` [U-Boot] [U-Boot, v4, " Alexander Graf
2016-11-07 15:47 ` [U-Boot] [PATCH v4 12/14] x86: Move efi .S " Simon Glass
2016-11-14 23:05 ` [U-Boot] [U-Boot, v4, " Alexander Graf
2016-11-07 15:47 ` [U-Boot] [PATCH v4 13/14] efi: x86: Adjust EFI files support efi_loader Simon Glass
2016-11-14 23:06 ` [U-Boot] [U-Boot, v4, " Alexander Graf
2016-11-07 15:47 ` [U-Boot] [PATCH v4 14/14] x86: Enable EFI loader support Simon Glass
2016-11-14 23:05 ` [U-Boot] [U-Boot,v4,14/14] " Alexander Graf
2016-11-14 21:39 ` [U-Boot] [PATCH v4 00/14] efi: x86: Add EFI hello world and loader support for x86 Simon Glass
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1478533636-17577-8-git-send-email-sjg@chromium.org \
--to=sjg@chromium.org \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.