public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* Subject: [PATCH] Make elflint and libebl understand .rela.eh_frame like other section type
@ 2020-11-13 14:47 Navin P
  2020-11-17 14:14 ` Mark Wielaard
  0 siblings, 1 reply; 4+ messages in thread
From: Navin P @ 2020-11-13 14:47 UTC (permalink / raw)
  To: elfutils-devel

Hi,
 elflint doesn't recognize .rela.eh_frame like it does for other .rela sections.

Signed-off-by: Navin P <navinp0304@gmail.com>
---
 libebl/eblcheckreloctargettype.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libebl/eblcheckreloctargettype.c b/libebl/eblcheckreloctargettype.c
index 068ad8f1..9d814d27 100644
--- a/libebl/eblcheckreloctargettype.c
+++ b/libebl/eblcheckreloctargettype.c
@@ -47,6 +47,7 @@ ebl_check_reloc_target_type (Ebl *ebl, Elf64_Word sh_type)
       case SHT_FINI_ARRAY:
       case SHT_PREINIT_ARRAY:
       case SHT_NOTE:
+      case SHT_X86_64_UNWIND: // required by .rela.eh_frame
  return true;

       default:
-- 
2.25.1

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

* Re: Subject: [PATCH] Make elflint and libebl understand .rela.eh_frame like other section type
  2020-11-13 14:47 Subject: [PATCH] Make elflint and libebl understand .rela.eh_frame like other section type Navin P
@ 2020-11-17 14:14 ` Mark Wielaard
  2020-11-18  4:38   ` Navin P
  0 siblings, 1 reply; 4+ messages in thread
From: Mark Wielaard @ 2020-11-17 14:14 UTC (permalink / raw)
  To: Navin P, elfutils-devel

[-- Attachment #1: Type: text/plain, Size: 437 bytes --]

Hi Navin,


On Fri, 2020-11-13 at 20:17 +0530, Navin P via Elfutils-devel wrote:
>  elflint doesn't recognize .rela.eh_frame like it does for other
> .rela sections.

Timm also noticed https://sourceware.org/bugzilla/show_bug.cgi?id=26878

I have an alternative patch that only recognizes SHT_X86_64_UNWIND for
x86_64, because it is an architecture specific section type.

Does the attached work for you?

Thanks,

Mark

[-- Attachment #2: 0001-backends-Handle-SHT_X86_64_UNWIND-as-valid-relocatio.patch --]
[-- Type: text/x-patch, Size: 1861 bytes --]

From 00a25cf38d56bacae6b82c79cf226c22d12295a5 Mon Sep 17 00:00:00 2001
From: Mark Wielaard <mark@klomp.org>
Date: Tue, 17 Nov 2020 15:08:05 +0100
Subject: [PATCH] backends: Handle SHT_X86_64_UNWIND as valid relocation target
 type.

The x86_64 abi defines a special section type for .eh_frame[_hdr],
SHT_X86_64_UNWIND, which is a valid relocation target type.

https://sourceware.org/bugzilla/show_bug.cgi?id=26878

Signed-off-by: Mark Wielaard <mark@klomp.org>
---
 backends/ChangeLog       | 5 +++++
 backends/x86_64_init.c   | 1 +
 backends/x86_64_symbol.c | 8 ++++++++
 3 files changed, 14 insertions(+)

diff --git a/backends/ChangeLog b/backends/ChangeLog
index 81d4127c..e88dedf9 100644
--- a/backends/ChangeLog
+++ b/backends/ChangeLog
@@ -1,3 +1,8 @@
+2020-11-17  Mark Wielard  <mark@klomp.org>
+
+	* x86_64_symbol.c (x86_64_check_reloc_target_type): New function.
+	* x86_64_init.c (x86_64_init): Hook check_reloc_target_type.
+
 2020-10-19  Mark Wielard  <mark@klomp.org>
 
 	* Makefile.am (modules): Remove tilegx.
diff --git a/backends/x86_64_init.c b/backends/x86_64_init.c
index 8db9b643..be965fa6 100644
--- a/backends/x86_64_init.c
+++ b/backends/x86_64_init.c
@@ -63,6 +63,7 @@ x86_64_init (Elf *elf __attribute__ ((unused)),
   eh->frame_nregs = 17;
   HOOK (eh, set_initial_registers_tid);
   HOOK (eh, unwind);
+  HOOK (eh, check_reloc_target_type);
 
   return eh;
 }
diff --git a/backends/x86_64_symbol.c b/backends/x86_64_symbol.c
index 98457bcb..d5f62e8f 100644
--- a/backends/x86_64_symbol.c
+++ b/backends/x86_64_symbol.c
@@ -71,3 +71,11 @@ x86_64_section_type_name (int type,
 
   return NULL;
 }
+
+/* The SHT_X86_64_UNWIND section type is a valid target for relocation.  */
+bool
+x86_64_check_reloc_target_type (Ebl *ebl __attribute__ ((unused)),
+				Elf64_Word sh_type)
+{
+  return sh_type == SHT_X86_64_UNWIND;
+}
-- 
2.18.4


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

* Re: Subject: [PATCH] Make elflint and libebl understand .rela.eh_frame like other section type
  2020-11-17 14:14 ` Mark Wielaard
@ 2020-11-18  4:38   ` Navin P
  2020-11-18 10:44     ` Mark Wielaard
  0 siblings, 1 reply; 4+ messages in thread
From: Navin P @ 2020-11-18  4:38 UTC (permalink / raw)
  To: Mark Wielaard; +Cc: elfutils-devel

with clang compiler build, before applying this patch 3 tests were
failing and after
applying the patch all tests pass.
your  patch is much better as it fixes the backend.

On Tue, Nov 17, 2020 at 7:44 PM Mark Wielaard <mark@klomp.org> wrote:
>
> Hi Navin,
>
>
> On Fri, 2020-11-13 at 20:17 +0530, Navin P via Elfutils-devel wrote:
> >  elflint doesn't recognize .rela.eh_frame like it does for other
> > .rela sections.
>
> Timm also noticed https://sourceware.org/bugzilla/show_bug.cgi?id=26878
>
> I have an alternative patch that only recognizes SHT_X86_64_UNWIND for
> x86_64, because it is an architecture specific section type.
>
> Does the attached work for you?
>
> Thanks,
>
> Mark

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

* Re: Subject: [PATCH] Make elflint and libebl understand .rela.eh_frame like other section type
  2020-11-18  4:38   ` Navin P
@ 2020-11-18 10:44     ` Mark Wielaard
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Wielaard @ 2020-11-18 10:44 UTC (permalink / raw)
  To: Navin P; +Cc: elfutils-devel

Hi Navin,

On Wed, 2020-11-18 at 10:08 +0530, Navin P via Elfutils-devel wrote:
> with clang compiler build, before applying this patch 3 tests were
> failing and after
> applying the patch all tests pass.
> your  patch is much better as it fixes the backend.

Great, thanks for testing. I pushed it now.

Cheers,

Mark

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

end of thread, other threads:[~2020-11-18 10:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-13 14:47 Subject: [PATCH] Make elflint and libebl understand .rela.eh_frame like other section type Navin P
2020-11-17 14:14 ` Mark Wielaard
2020-11-18  4:38   ` Navin P
2020-11-18 10:44     ` Mark Wielaard

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 read-only IMAP folder(s) and NNTP newsgroup(s).