summaryrefslogtreecommitdiff
path: root/libebl
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@suse.de>2018-10-02 14:46:51 +0200
committerMark Wielaard <mark@klomp.org>2018-10-13 22:54:51 +0200
commit2876b3b648f665736ac9c879d34de5e3866ba8f9 (patch)
treebe631dee293e01847e3eea43343b0d249a7532c6 /libebl
parent69d6e67eee30c483ba53a8e1da1b3568033e3dde (diff)
downloadelfutils-2876b3b648f665736ac9c879d34de5e3866ba8f9.tar.gz
Handle ADD/SUB relocations
This adds support for ADD and SUB relocations as seen on RISC-V. Signed-off-by: Andreas Schwab <schwab@suse.de>
Diffstat (limited to 'libebl')
-rw-r--r--libebl/ChangeLog7
-rw-r--r--libebl/ebl-hooks.h2
-rw-r--r--libebl/eblopenbackend.c5
-rw-r--r--libebl/eblrelocsimpletype.c4
-rw-r--r--libebl/libebl.h6
5 files changed, 17 insertions, 7 deletions
diff --git a/libebl/ChangeLog b/libebl/ChangeLog
index d36a2681..aec848b9 100644
--- a/libebl/ChangeLog
+++ b/libebl/ChangeLog
@@ -1,3 +1,10 @@
+2018-10-02 Andreas Schwab <schwab@suse.de>
+
+ * ebl-hooks.h (EBLHOOK(reloc_simple_type)): Add third parameter.
+ * libebl.h (ebl_reloc_simple_type): Likewise.
+ * eblopenbackend.c (default_reloc_simple_type): Likewise.
+ * eblrelocsimpletype.c (ebl_reloc_simple_type): Pass it down.
+
2018-09-12 Mark Wielaard <mark@klomp.org>
* eblsectionstripp.c (ebl_section_strip_p): Drop ehdr argument.
diff --git a/libebl/ebl-hooks.h b/libebl/ebl-hooks.h
index 7a355cd1..1e7960b8 100644
--- a/libebl/ebl-hooks.h
+++ b/libebl/ebl-hooks.h
@@ -33,7 +33,7 @@ const char *EBLHOOK(reloc_type_name) (int, char *, size_t);
bool EBLHOOK(reloc_type_check) (int);
/* Check if relocation type is for simple absolute relocations. */
-Elf_Type EBLHOOK(reloc_simple_type) (Ebl *, int);
+Elf_Type EBLHOOK(reloc_simple_type) (Ebl *, int, int *);
/* Check relocation type use. */
bool EBLHOOK(reloc_valid_use) (Elf *, int);
diff --git a/libebl/eblopenbackend.c b/libebl/eblopenbackend.c
index f5b3de29..d54b7207 100644
--- a/libebl/eblopenbackend.c
+++ b/libebl/eblopenbackend.c
@@ -145,7 +145,7 @@ static const struct
static const char *default_reloc_type_name (int ignore, char *buf, size_t len);
static bool default_reloc_type_check (int ignore);
static bool default_reloc_valid_use (Elf *elf, int ignore);
-static Elf_Type default_reloc_simple_type (Ebl *ebl, int ignore);
+static Elf_Type default_reloc_simple_type (Ebl *ebl, int ignore, int *addsub);
static bool default_gotpc_reloc_check (Elf *elf, int ignore);
static const char *default_segment_type_name (int ignore, char *buf,
size_t len);
@@ -452,7 +452,8 @@ default_reloc_valid_use (Elf *elf __attribute__ ((unused)),
static Elf_Type
default_reloc_simple_type (Ebl *eh __attribute__ ((unused)),
- int ignore __attribute__ ((unused)))
+ int ignore __attribute__ ((unused)),
+ int *addsub __attribute__ ((unused)))
{
return ELF_T_NUM;
}
diff --git a/libebl/eblrelocsimpletype.c b/libebl/eblrelocsimpletype.c
index 9bd29285..12292804 100644
--- a/libebl/eblrelocsimpletype.c
+++ b/libebl/eblrelocsimpletype.c
@@ -34,7 +34,7 @@
Elf_Type
-ebl_reloc_simple_type (Ebl *ebl, int reloc)
+ebl_reloc_simple_type (Ebl *ebl, int reloc, int *addsub)
{
- return ebl != NULL ? ebl->reloc_simple_type (ebl, reloc) : ELF_T_NUM;
+ return ebl != NULL ? ebl->reloc_simple_type (ebl, reloc, addsub) : ELF_T_NUM;
}
diff --git a/libebl/libebl.h b/libebl/libebl.h
index 5abc02d8..a34fe48d 100644
--- a/libebl/libebl.h
+++ b/libebl/libebl.h
@@ -99,8 +99,10 @@ extern bool ebl_reloc_type_check (Ebl *ebl, int reloc);
extern bool ebl_reloc_valid_use (Ebl *ebl, int reloc);
/* Check if relocation type is for simple absolute relocations.
- Return ELF_T_{BYTE,HALF,SWORD,SXWORD} for a simple type, else ELF_T_NUM. */
-extern Elf_Type ebl_reloc_simple_type (Ebl *ebl, int reloc);
+ Return ELF_T_{BYTE,HALF,SWORD,SXWORD} for a simple type, else ELF_T_NUM.
+ If the relocation type is an ADD or SUB relocation, set *ADDSUB to 1 or -1,
+ resp. */
+extern Elf_Type ebl_reloc_simple_type (Ebl *ebl, int reloc, int *addsub);
/* Return true if the symbol type is that referencing the GOT. E.g.,
R_386_GOTPC. */