All of lore.kernel.org
 help / color / mirror / Atom feed
From: Francesco Lavra <francescolavra.fl@gmail.com>
To: The development of GNU GRUB <grub-devel@gnu.org>
Subject: [PATCH] Add missing ARM relocation codes and fix existing ones
Date: Sun, 17 Mar 2013 21:36:06 +0100	[thread overview]
Message-ID: <51462936.1020106@gmail.com> (raw)

I'm working on the GRUB port to ARM using the EFI platform. When
generating a relocatable ARM image, some relocation entries use a
relocation code (0x33) which is not defined in include/grub/elf.h. So I
went through the latest edition of the ELF specification for the ARM
architecture (ARM IHI 0044E) and added the missing definitions to the
header file. I also noticed some differences between the existing
definitions and the spec: some relocation names are different from the
spec, some definitions aren't in the spec at all, and one
(R_ARM_IRELATIVE) has a different value than that from the spec. So
while at it I fixed those differences as well. Hence this patch.

2013-03-17  Francesco Lavra  <francescolavra.fl@gmail.com>

	* include/grub/elf.h: Add missing ARM relocation codes and fix
	  existing ones.

=== modified file 'include/grub/elf.h'
--- include/grub/elf.h	2013-01-20 22:01:47 +0000
+++ include/grub/elf.h	2013-03-17 20:34:40 +0000
@@ -2067,7 +2067,7 @@
 #define R_ARM_PC24		1	/* PC relative 26 bit branch */
 #define R_ARM_ABS32		2	/* Direct 32 bit  */
 #define R_ARM_REL32		3	/* PC relative 32 bit */
-#define R_ARM_PC13		4
+#define R_ARM_LDR_PC_G0		4
 #define R_ARM_ABS16		5	/* Direct 16 bit */
 #define R_ARM_ABS12		6	/* Direct 12 bit */
 #define R_ARM_THM_ABS5		7
@@ -2075,18 +2075,21 @@
 #define R_ARM_SBREL32		9
 #define R_ARM_THM_CALL		10
 #define R_ARM_THM_PC8		11
-#define R_ARM_AMP_VCALL9	12
-#define R_ARM_SWI24		13
+#define R_ARM_BREL_ADJ		12
+#define R_ARM_TLS_DESC		13
 #define R_ARM_THM_SWI8		14
 #define R_ARM_XPC25		15
 #define R_ARM_THM_XPC22		16
+#define R_ARM_TLS_DTPMOD32	17
+#define R_ARM_TLS_DTPOFF32	18
+#define R_ARM_TLS_TPOFF32	19
 #define R_ARM_COPY		20	/* Copy symbol at runtime */
 #define R_ARM_GLOB_DAT		21	/* Create GOT entry */
 #define R_ARM_JUMP_SLOT		22	/* Create PLT entry */
 #define R_ARM_RELATIVE		23	/* Adjust by program base */
-#define R_ARM_GOTOFF		24	/* 32 bit offset to GOT */
-#define R_ARM_GOTPC		25	/* 32 bit PC relative offset to GOT */
-#define R_ARM_GOT32		26	/* 32 bit GOT entry */
+#define R_ARM_GOTOFF32		24	/* 32 bit offset to GOT */
+#define R_ARM_BASE_PREL		25	/* 32 bit PC relative offset to GOT */
+#define R_ARM_GOT_BREL		26	/* 32 bit GOT entry */
 #define R_ARM_PLT32		27	/* 32 bit PLT address */
 #define R_ARM_CALL		28
 #define R_ARM_JUMP24		29
@@ -2098,14 +2101,72 @@
 #define R_ARM_LDR_SBREL_11_0	35
 #define R_ARM_ALU_SBREL_19_12	36
 #define R_ARM_ALU_SBREL_27_20	37
+#define R_ARM_TARGET1		38
+#define R_ARM_SBREL31		39
+#define R_ARM_V4BX		40
+#define R_ARM_TARGET2		41
+#define R_ARM_PREL31		42
+#define R_ARM_MOVW_ABS_NC	43
+#define R_ARM_MOVT_ABS		44
+#define R_ARM_MOVW_PREL_NC	45
+#define R_ARM_MOVT_PREL		46
+#define R_ARM_THM_MOVW_ABS_NC	47
+#define R_ARM_THM_MOVT_ABS	48
+#define R_ARM_THM_MOVW_PREL_NC	49
+#define R_ARM_THM_MOVT_PREL	50
+#define R_ARM_THM_JUMP19	51
+#define R_ARM_THM_JUMP6		52
+#define R_ARM_THM_ALU_PREL_11_0	53
+#define R_ARM_THM_PC12		54
+#define R_ARM_ABS32_NOI		55
+#define R_ARM_REL32_NOI		56
+#define R_ARM_ALU_PC_G0_NC	57
+#define R_ARM_ALU_PC_G0		58
+#define R_ARM_ALU_PC_G1_NC	59
+#define R_ARM_ALU_PC_G1		60
+#define R_ARM_ALU_PC_G2		61
+#define R_ARM_LDR_PC_G1		62
+#define R_ARM_LDR_PC_G2		63
+#define R_ARM_LDRS_PC_G0	64
+#define R_ARM_LDRS_PC_G1	65
+#define R_ARM_LDRS_PC_G2	66
+#define R_ARM_LDC_PC_G0		67
+#define R_ARM_LDC_PC_G1		68
+#define R_ARM_LDC_PC_G2		69
+#define R_ARM_ALU_SB_G0_NC	70
+#define R_ARM_ALU_SB_G0		71
+#define R_ARM_ALU_SB_G1_NC	72
+#define R_ARM_ALU_SB_G1		73
+#define R_ARM_ALU_SB_G2		74
+#define R_ARM_LDR_SB_G0		75
+#define R_ARM_LDR_SB_G1		76
+#define R_ARM_LDR_SB_G2		77
+#define R_ARM_LDRS_SB_G0	78
+#define R_ARM_LDRS_SB_G1	79
+#define R_ARM_LDRS_SB_G2	80
+#define R_ARM_LDC_SB_G0		81
+#define R_ARM_LDC_SB_G1		82
+#define R_ARM_LDC_SB_G2		83
+#define R_ARM_MOVW_BREL_NC	84
+#define R_ARM_MOVT_BREL		85
+#define R_ARM_MOVW_BREL		86
+#define R_ARM_THM_MOVW_BREL_NC	87
+#define R_ARM_THM_MOVT_BREL	88
+#define R_ARM_THM_MOVW_BREL	89
 #define R_ARM_TLS_GOTDESC	90
 #define R_ARM_TLS_CALL		91
 #define R_ARM_TLS_DESCSEQ	92
 #define R_ARM_THM_TLS_CALL	93
+#define R_ARM_PLT32_ABS		94
+#define R_ARM_GOT_ABS		95
+#define R_ARM_GOT_PREL		96
+#define R_ARM_GOT_BREL12	97
+#define R_ARM_GOTOFF12		98
+#define R_ARM_GOTRELAX		99
 #define R_ARM_GNU_VTENTRY	100
 #define R_ARM_GNU_VTINHERIT	101
-#define R_ARM_THM_PC11		102	/* thumb unconditional branch */
-#define R_ARM_THM_PC9		103	/* thumb conditional branch */
+#define R_ARM_THM_JUMP11	102	/* thumb unconditional branch */
+#define R_ARM_THM_JUMP8		103	/* thumb conditional branch */
 #define R_ARM_TLS_GD32		104	/* PC-rel 32 bit for global dynamic
 					   thread local data */
 #define R_ARM_TLS_LDM32		105	/* PC-rel 32 bit for local dynamic
@@ -2116,15 +2177,30 @@
 					   static TLS block offset */
 #define R_ARM_TLS_LE32		108	/* 32 bit offset relative to static
 					   TLS block */
-#define	R_ARM_THM_TLS_DESCSEQ	129
-#define R_ARM_IRELATIVE		160
-#define R_ARM_RXPC25		249
-#define R_ARM_RSBREL32		250
-#define R_ARM_THM_RPC22		251
-#define R_ARM_RREL32		252
-#define R_ARM_RABS22		253
-#define R_ARM_RPC24		254
-#define R_ARM_RBASE		255
+#define R_ARM_TLS_LDO12		109
+#define R_ARM_TLS_LE12		110
+#define R_ARM_IE12GP		111
+#define R_ARM_PRIVATE_0		112
+#define R_ARM_PRIVATE_1		113
+#define R_ARM_PRIVATE_2		114
+#define R_ARM_PRIVATE_3		115
+#define R_ARM_PRIVATE_4		116
+#define R_ARM_PRIVATE_5		117
+#define R_ARM_PRIVATE_6		118
+#define R_ARM_PRIVATE_7		119
+#define R_ARM_PRIVATE_8		120
+#define R_ARM_PRIVATE_9		121
+#define R_ARM_PRIVATE_10	122
+#define R_ARM_PRIVATE_11	123
+#define R_ARM_PRIVATE_12	124
+#define R_ARM_PRIVATE_13	125
+#define R_ARM_PRIVATE_14	126
+#define R_ARM_PRIVATE_15	127
+#define R_ARM_ME_TOO		128
+#define R_ARM_THM_TLS_DESCSEQ16	129
+#define R_ARM_THM_TLS_DESCSEQ32	130
+#define R_ARM_THM_GOT_BREL12	131
+#define R_ARM_IRELATIVE		140
 /* Keep this the last entry.  */
 #define R_ARM_NUM		256
 

--
Regards,
Francesco


             reply	other threads:[~2013-03-17 20:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-17 20:36 Francesco Lavra [this message]
2013-04-01 16:45 ` [PATCH] Add missing ARM relocation codes and fix existing ones Francesco Lavra
2013-04-03  8:07   ` Leif Lindholm

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=51462936.1020106@gmail.com \
    --to=francescolavra.fl@gmail.com \
    --cc=grub-devel@gnu.org \
    /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.