linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Detect section mismatches in thumb relocations
@ 2014-01-31 18:33 David Long
  2014-02-01 10:53 ` Rusty Russell
  0 siblings, 1 reply; 2+ messages in thread
From: David Long @ 2014-01-31 18:33 UTC (permalink / raw)
  To: linux-arm-kernel

From: "David A. Long" <dave.long@linaro.org>

Add processing for normally encountered thumb relocation types so that
section mismatches will be detected.

Signed-off-by: David A. Long <dave.long@linaro.org>
---
 scripts/mod/modpost.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 1785576..9e6c996 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -1498,6 +1498,16 @@ static int addend_386_rel(struct elf_info *elf, Elf_Shdr *sechdr, Elf_Rela *r)
 #define R_ARM_JUMP24	29
 #endif
 
+#ifndef	R_ARM_THM_CALL
+#define	R_ARM_THM_CALL		10
+#endif
+#ifndef	R_ARM_THM_JUMP24
+#define	R_ARM_THM_JUMP24	30
+#endif
+#ifndef	R_ARM_THM_JUMP19
+#define	R_ARM_THM_JUMP19	51
+#endif
+
 static int addend_arm_rel(struct elf_info *elf, Elf_Shdr *sechdr, Elf_Rela *r)
 {
 	unsigned int r_typ = ELF_R_TYPE(r->r_info);
@@ -1511,6 +1521,9 @@ static int addend_arm_rel(struct elf_info *elf, Elf_Shdr *sechdr, Elf_Rela *r)
 	case R_ARM_PC24:
 	case R_ARM_CALL:
 	case R_ARM_JUMP24:
+	case R_ARM_THM_CALL:
+	case R_ARM_THM_JUMP24:
+	case R_ARM_THM_JUMP19:
 		/* From ARM ABI: ((S + A) | T) - P */
 		r->r_addend = (int)(long)(elf->hdr +
 		              sechdr->sh_offset +
-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH] Detect section mismatches in thumb relocations
  2014-01-31 18:33 [PATCH] Detect section mismatches in thumb relocations David Long
@ 2014-02-01 10:53 ` Rusty Russell
  0 siblings, 0 replies; 2+ messages in thread
From: Rusty Russell @ 2014-02-01 10:53 UTC (permalink / raw)
  To: linux-arm-kernel

David Long <dave.long@linaro.org> writes:
> From: "David A. Long" <dave.long@linaro.org>
>
> Add processing for normally encountered thumb relocation types so that
> section mismatches will be detected.
>
> Signed-off-by: David A. Long <dave.long@linaro.org>

Happiest for this to go through an ARM tree, so:

Acked-by: Rusty Russell <rusty@rustcorp.com.au>

Cheers,
Rusty.

> ---
>  scripts/mod/modpost.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
>
> diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
> index 1785576..9e6c996 100644
> --- a/scripts/mod/modpost.c
> +++ b/scripts/mod/modpost.c
> @@ -1498,6 +1498,16 @@ static int addend_386_rel(struct elf_info *elf, Elf_Shdr *sechdr, Elf_Rela *r)
>  #define R_ARM_JUMP24	29
>  #endif
>  
> +#ifndef	R_ARM_THM_CALL
> +#define	R_ARM_THM_CALL		10
> +#endif
> +#ifndef	R_ARM_THM_JUMP24
> +#define	R_ARM_THM_JUMP24	30
> +#endif
> +#ifndef	R_ARM_THM_JUMP19
> +#define	R_ARM_THM_JUMP19	51
> +#endif
> +
>  static int addend_arm_rel(struct elf_info *elf, Elf_Shdr *sechdr, Elf_Rela *r)
>  {
>  	unsigned int r_typ = ELF_R_TYPE(r->r_info);
> @@ -1511,6 +1521,9 @@ static int addend_arm_rel(struct elf_info *elf, Elf_Shdr *sechdr, Elf_Rela *r)
>  	case R_ARM_PC24:
>  	case R_ARM_CALL:
>  	case R_ARM_JUMP24:
> +	case R_ARM_THM_CALL:
> +	case R_ARM_THM_JUMP24:
> +	case R_ARM_THM_JUMP19:
>  		/* From ARM ABI: ((S + A) | T) - P */
>  		r->r_addend = (int)(long)(elf->hdr +
>  		              sechdr->sh_offset +
> -- 
> 1.8.1.2

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-02-01 10:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-31 18:33 [PATCH] Detect section mismatches in thumb relocations David Long
2014-02-01 10:53 ` Rusty Russell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).