linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] objtool: Rename elf_open to prevent conflict with libelf from elftoolchain
@ 2019-06-16 23:14 Michael Forney
  2019-06-16 23:15 ` [PATCH 2/2] objtool: Use Elf_Scn typedef instead of assuming tag name Michael Forney
  2019-06-28  0:22 ` [PATCH 1/2] objtool: Rename elf_open to prevent conflict with libelf from elftoolchain Josh Poimboeuf
  0 siblings, 2 replies; 5+ messages in thread
From: Michael Forney @ 2019-06-16 23:14 UTC (permalink / raw)
  To: Josh Poimboeuf, Peter Zijlstra; +Cc: linux-kernel, elftoolchain-developers

Signed-off-by: Michael Forney <mforney@mforney.org>
---
 tools/objtool/check.c | 2 +-
 tools/objtool/elf.c   | 2 +-
 tools/objtool/elf.h   | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index 172f99195726..6ed46c36c54f 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -2407,7 +2407,7 @@ int check(const char *_objname, bool orc)
 
 	objname = _objname;
 
-	file.elf = elf_open(objname, orc ? O_RDWR : O_RDONLY);
+	file.elf = elf_open_path(objname, orc ? O_RDWR : O_RDONLY);
 	if (!file.elf)
 		return 1;
 
diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c
index e99e1be19ad9..4116f564a0b0 100644
--- a/tools/objtool/elf.c
+++ b/tools/objtool/elf.c
@@ -401,7 +401,7 @@ static int read_relas(struct elf *elf)
 	return 0;
 }
 
-struct elf *elf_open(const char *name, int flags)
+struct elf *elf_open_path(const char *name, int flags)
 {
 	struct elf *elf;
 	Elf_Cmd cmd;
diff --git a/tools/objtool/elf.h b/tools/objtool/elf.h
index e44ca5d51871..c59100d243ac 100644
--- a/tools/objtool/elf.h
+++ b/tools/objtool/elf.h
@@ -74,7 +74,7 @@ struct elf {
 };
 
 
-struct elf *elf_open(const char *name, int flags);
+struct elf *elf_open_path(const char *name, int flags);
 struct section *find_section_by_name(struct elf *elf, const char *name);
 struct symbol *find_symbol_by_offset(struct section *sec, unsigned long offset);
 struct symbol *find_symbol_by_name(struct elf *elf, const char *name);
-- 
2.20.1


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

* [PATCH 2/2] objtool: Use Elf_Scn typedef instead of assuming tag name
  2019-06-16 23:14 [PATCH 1/2] objtool: Rename elf_open to prevent conflict with libelf from elftoolchain Michael Forney
@ 2019-06-16 23:15 ` Michael Forney
  2019-06-28  0:22 ` [PATCH 1/2] objtool: Rename elf_open to prevent conflict with libelf from elftoolchain Josh Poimboeuf
  1 sibling, 0 replies; 5+ messages in thread
From: Michael Forney @ 2019-06-16 23:15 UTC (permalink / raw)
  To: Josh Poimboeuf, Peter Zijlstra; +Cc: linux-kernel, elftoolchain-developers

The libelf implementation might use a different tag name, and the
Elf_Scn typedef is already used throughout the rest of objtool.

Signed-off-by: Michael Forney <mforney@mforney.org>
---
 tools/objtool/elf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c
index 4116f564a0b0..a4258d80d4ce 100644
--- a/tools/objtool/elf.c
+++ b/tools/objtool/elf.c
@@ -463,7 +463,7 @@ struct section *elf_create_section(struct elf *elf, const char *name,
 {
 	struct section *sec, *shstrtab;
 	size_t size = entsize * nr;
-	struct Elf_Scn *s;
+	Elf_Scn *s;
 	Elf_Data *data;
 
 	sec = malloc(sizeof(*sec));
-- 
2.20.1


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

* Re: [PATCH 1/2] objtool: Rename elf_open to prevent conflict with libelf from elftoolchain
  2019-06-16 23:14 [PATCH 1/2] objtool: Rename elf_open to prevent conflict with libelf from elftoolchain Michael Forney
  2019-06-16 23:15 ` [PATCH 2/2] objtool: Use Elf_Scn typedef instead of assuming tag name Michael Forney
@ 2019-06-28  0:22 ` Josh Poimboeuf
  2019-06-28  0:52   ` Michael Forney
  1 sibling, 1 reply; 5+ messages in thread
From: Josh Poimboeuf @ 2019-06-28  0:22 UTC (permalink / raw)
  To: Michael Forney; +Cc: Peter Zijlstra, linux-kernel, elftoolchain-developers

On Sun, Jun 16, 2019 at 04:14:59PM -0700, Michael Forney wrote:
> Signed-off-by: Michael Forney <mforney@mforney.org>
> ---
>  tools/objtool/check.c | 2 +-
>  tools/objtool/elf.c   | 2 +-
>  tools/objtool/elf.h   | 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)

Sorry for the delay, I was out for a bit and I'm still trying to get
caught back up on email.

These patches look fine.  I'll try to send them on to the -tip tree
shortly.

Just curious, have you done much testing with the elftoolchain version
of libelf and objtool?  So far objtool has only been successfully used
with the elfutils version, so I'm just curious how compatible your
libelf is with the elfutils version.

-- 
Josh

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

* Re: [PATCH 1/2] objtool: Rename elf_open to prevent conflict with libelf from elftoolchain
  2019-06-28  0:22 ` [PATCH 1/2] objtool: Rename elf_open to prevent conflict with libelf from elftoolchain Josh Poimboeuf
@ 2019-06-28  0:52   ` Michael Forney
  2019-06-28  1:53     ` Josh Poimboeuf
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Forney @ 2019-06-28  0:52 UTC (permalink / raw)
  To: Josh Poimboeuf; +Cc: Peter Zijlstra, linux-kernel, elftoolchain-developers

On 2019-06-27, Josh Poimboeuf <jpoimboe@redhat.com> wrote:
> On Sun, Jun 16, 2019 at 04:14:59PM -0700, Michael Forney wrote:
>> Signed-off-by: Michael Forney <mforney@mforney.org>
>> ---
>>  tools/objtool/check.c | 2 +-
>>  tools/objtool/elf.c   | 2 +-
>>  tools/objtool/elf.h   | 2 +-
>>  3 files changed, 3 insertions(+), 3 deletions(-)
>
> Sorry for the delay, I was out for a bit and I'm still trying to get
> caught back up on email.

No worries :)

> These patches look fine.  I'll try to send them on to the -tip tree
> shortly.

Thanks!

> Just curious, have you done much testing with the elftoolchain version
> of libelf and objtool?  So far objtool has only been successfully used
> with the elfutils version, so I'm just curious how compatible your
> libelf is with the elfutils version.

I'm not affiliated with elftoolchain, I am just trying it out on my
system as an alternative to elfutils libelf for its clean codebase
that doesn't use many GNU C extensions.

I've done some basic testing to make sure that the .o files after
being processed with `objtool generate --no-fp --retpoline` match
between elfutils and elftoolchain. I noticed two differences, one of
which was due to a bug in elftoolchain that has since been fixed, and
the other is with the offset of SHT_NOBITS section after rewriting[0],
which I think doesn't matter.

[0] https://sourceforge.net/p/elftoolchain/tickets/571/

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

* Re: [PATCH 1/2] objtool: Rename elf_open to prevent conflict with libelf from elftoolchain
  2019-06-28  0:52   ` Michael Forney
@ 2019-06-28  1:53     ` Josh Poimboeuf
  0 siblings, 0 replies; 5+ messages in thread
From: Josh Poimboeuf @ 2019-06-28  1:53 UTC (permalink / raw)
  To: Michael Forney; +Cc: Peter Zijlstra, linux-kernel, elftoolchain-developers

On Thu, Jun 27, 2019 at 05:52:53PM -0700, Michael Forney wrote:
> On 2019-06-27, Josh Poimboeuf <jpoimboe@redhat.com> wrote:
> > On Sun, Jun 16, 2019 at 04:14:59PM -0700, Michael Forney wrote:
> >> Signed-off-by: Michael Forney <mforney@mforney.org>
> >> ---
> >>  tools/objtool/check.c | 2 +-
> >>  tools/objtool/elf.c   | 2 +-
> >>  tools/objtool/elf.h   | 2 +-
> >>  3 files changed, 3 insertions(+), 3 deletions(-)
> >
> > Sorry for the delay, I was out for a bit and I'm still trying to get
> > caught back up on email.
> 
> No worries :)
> 
> > These patches look fine.  I'll try to send them on to the -tip tree
> > shortly.
> 
> Thanks!
> 
> > Just curious, have you done much testing with the elftoolchain version
> > of libelf and objtool?  So far objtool has only been successfully used
> > with the elfutils version, so I'm just curious how compatible your
> > libelf is with the elfutils version.
> 
> I'm not affiliated with elftoolchain, I am just trying it out on my
> system as an alternative to elfutils libelf for its clean codebase
> that doesn't use many GNU C extensions.
> 
> I've done some basic testing to make sure that the .o files after
> being processed with `objtool generate --no-fp --retpoline` match
> between elfutils and elftoolchain. I noticed two differences, one of
> which was due to a bug in elftoolchain that has since been fixed, and
> the other is with the offset of SHT_NOBITS section after rewriting[0],
> which I think doesn't matter.

Awesome, that gives me a lot more confidence.  Thanks!

-- 
Josh

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

end of thread, other threads:[~2019-06-28  1:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-16 23:14 [PATCH 1/2] objtool: Rename elf_open to prevent conflict with libelf from elftoolchain Michael Forney
2019-06-16 23:15 ` [PATCH 2/2] objtool: Use Elf_Scn typedef instead of assuming tag name Michael Forney
2019-06-28  0:22 ` [PATCH 1/2] objtool: Rename elf_open to prevent conflict with libelf from elftoolchain Josh Poimboeuf
2019-06-28  0:52   ` Michael Forney
2019-06-28  1:53     ` Josh Poimboeuf

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).