public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [top-level patch] Do proper target tool checks for readelf
@ 2011-11-02 23:16 Roland McGrath
  2011-11-03  3:41 ` Ian Lance Taylor
  0 siblings, 1 reply; 9+ messages in thread
From: Roland McGrath @ 2011-11-02 23:16 UTC (permalink / raw)
  To: newlib, binutils, gcc-patches

newlib has a configure check that works by running readelf on a target
binary.  While a native readelf is generally pretty generic and
cross-friendly, it's possible for a build host not to have any readelf at
all.  It's clearly the right thing that configure use a target readelf tool
if there is one.  Right now, this seems to happen for the "main" newlib
build but doesn't happen for a multilib variant newlib build (e.g. in an
x86_64-foo config, build/x86_64-foo/newlib/... uses a target readelf but
build/x86_64-foo/32/newlib/... doesn't find one and so uses unadorned
"readelf", which might not exist on the build host in a cross situation).

Frankly I couldn't entirely tell which of all these magic spots were the
ones necessary to get the multilib newlib build to do the right thing.  But
it makes sense that the treatment of readelf be uniformly analogous to the
treatment of objdump, so I did that everywhere I found it.

MAINTAINERS doesn't make it entirely clear what the procedure really is for
touching these files.  Looking at src/ChangeLog I see both what appear to
be instances where changes were first committed to GCC and then merged over
to src/, and instances where changes were committed directly to src/.  I'm
able to commit (after approval) to src/ CVS, but not to GCC.

Ok for src/ trunk, or should somebody be putting this into GCC first?

I've omitted the generated files from the patch, but of course would
include them in a commit.


Thanks,
Roland

2011-11-02  Roland McGrath  <mcgrathr@google.com>

	* configure.ac: Add tool checks for READELF and READELF_FOR_TARGET.
	* configure: Rebuild.
	* Makefile.def (flags_to_pass): Add READELF_FOR_TARGET.
	* Makefile.tpl (READELF, READELF_FOR_TARGET): New variables.
	(HOST_EXPORTS): Add READELF, READELF_FOR_TARGET.
	(BASE_FLAGS_TO_PASS): Add READELF_FOR_TARGET.
	(BASE_TARGET_EXPORTS, EXTRA_HOST_FLAGS, EXTRA_TARGET_FLAGS):
	Add READELF.
	* Makefile.in: Rebuild.

diff --git a/Makefile.def b/Makefile.def
index 5116341..27434d3 100644
--- a/Makefile.def
+++ b/Makefile.def
@@ -259,6 +259,7 @@ flags_to_pass = { flag= LIBCXXFLAGS_FOR_TARGET ; };
 flags_to_pass = { flag= NM_FOR_TARGET ; };
 flags_to_pass = { flag= OBJDUMP_FOR_TARGET ; };
 flags_to_pass = { flag= RANLIB_FOR_TARGET ; };
+flags_to_pass = { flag= READELF_FOR_TARGET ; };
 flags_to_pass = { flag= STRIP_FOR_TARGET ; };
 flags_to_pass = { flag= WINDRES_FOR_TARGET ; };
 flags_to_pass = { flag= WINDMC_FOR_TARGET ; };
diff --git a/Makefile.tpl b/Makefile.tpl
index 4dd2391..a42d154 100644
--- a/Makefile.tpl
+++ b/Makefile.tpl
@@ -6,7 +6,7 @@ in
 #
 # Makefile for directory with subdirs to build.
 #   Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-#   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+#   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
 #   Free Software Foundation
 #
 # This file is free software; you can redistribute it and/or modify
@@ -209,6 +209,7 @@ HOST_EXPORTS = \
 	WINDMC="$(WINDMC)"; export WINDMC; \
 	OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \
 	OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \
+	READELF="$(READELF)"; export READELF; \
 	AR_FOR_TARGET="$(AR_FOR_TARGET)"; export AR_FOR_TARGET; \
 	AS_FOR_TARGET="$(AS_FOR_TARGET)"; export AS_FOR_TARGET; \
 	GCC_FOR_TARGET="$(GCC_FOR_TARGET)"; export GCC_FOR_TARGET; \
@@ -216,6 +217,7 @@ HOST_EXPORTS = \
 	NM_FOR_TARGET="$(NM_FOR_TARGET)"; export NM_FOR_TARGET; \
 	OBJDUMP_FOR_TARGET="$(OBJDUMP_FOR_TARGET)"; export OBJDUMP_FOR_TARGET; \
 	RANLIB_FOR_TARGET="$(RANLIB_FOR_TARGET)"; export RANLIB_FOR_TARGET; \
+	READELF_FOR_TARGET="$(READELF_FOR_TARGET)"; export READELF_FOR_TARGET; \
 	TOPLEVEL_CONFIGURE_ARGUMENTS="$(TOPLEVEL_CONFIGURE_ARGUMENTS)"; export TOPLEVEL_CONFIGURE_ARGUMENTS; \
 	HOST_LIBS="$(STAGE1_LIBS)"; export HOST_LIBS; \
 	GMPLIBS="$(HOST_GMPLIBS)"; export GMPLIBS; \
@@ -288,6 +290,7 @@ BASE_TARGET_EXPORTS = \
 	NM="$(COMPILER_NM_FOR_TARGET)"; export NM; \
 	OBJDUMP="$(OBJDUMP_FOR_TARGET)"; export OBJDUMP; \
 	RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \
+	READELF="$(READELF_FOR_TARGET)"; export READELF; \
 	STRIP="$(STRIP_FOR_TARGET)"; export STRIP; \
 	WINDRES="$(WINDRES_FOR_TARGET)"; export WINDRES; \
 	WINDMC="$(WINDMC_FOR_TARGET)"; export WINDMC; \
@@ -400,6 +403,7 @@ LIPO = @LIPO@
 NM = @NM@
 OBJDUMP = @OBJDUMP@
 RANLIB = @RANLIB@
+READELF = @READELF@
 STRIP = @STRIP@
 WINDRES = @WINDRES@
 WINDMC = @WINDMC@
@@ -493,6 +497,7 @@ LIPO_FOR_TARGET=@LIPO_FOR_TARGET@
 NM_FOR_TARGET=@NM_FOR_TARGET@
 OBJDUMP_FOR_TARGET=@OBJDUMP_FOR_TARGET@
 RANLIB_FOR_TARGET=@RANLIB_FOR_TARGET@
+READELF_FOR_TARGET=@READELF_FOR_TARGET@
 STRIP_FOR_TARGET=@STRIP_FOR_TARGET@
 WINDRES_FOR_TARGET=@WINDRES_FOR_TARGET@
 WINDMC_FOR_TARGET=@WINDMC_FOR_TARGET@
@@ -612,6 +617,7 @@ EXTRA_HOST_FLAGS = \
 	'NM=$(NM)' \
 	'OBJDUMP=$(OBJDUMP)' \
 	'RANLIB=$(RANLIB)' \
+	'READELF=$(READELF)' \
 	'STRIP=$(STRIP)' \
 	'WINDRES=$(WINDRES)' \
 	'WINDMC=$(WINDMC)'
@@ -652,6 +658,7 @@ EXTRA_TARGET_FLAGS = \
 	'NM=$(COMPILER_NM_FOR_TARGET)' \
 	'OBJDUMP=$$(OBJDUMP_FOR_TARGET)' \
 	'RANLIB=$$(RANLIB_FOR_TARGET)' \
+	'READELF=$$(READELF_FOR_TARGET)' \
 	'WINDRES=$$(WINDRES_FOR_TARGET)' \
 	'WINDMC=$$(WINDMC_FOR_TARGET)' \
 	'XGCC_FLAGS_FOR_TARGET=$(XGCC_FLAGS_FOR_TARGET)' \
diff --git a/configure.ac b/configure.ac
index 337e11d..50907f3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3042,6 +3042,7 @@ NCN_STRICT_CHECK_TOOLS(WINDRES, windres)
 NCN_STRICT_CHECK_TOOLS(WINDMC, windmc)
 NCN_STRICT_CHECK_TOOLS(OBJCOPY, objcopy)
 NCN_STRICT_CHECK_TOOLS(OBJDUMP, objdump)
+NCN_STRICT_CHECK_TOOLS(READELF, readelf)
 AC_SUBST(CC)
 AC_SUBST(CXX)
 AC_SUBST(CFLAGS)
@@ -3075,6 +3076,7 @@ ACX_CHECK_INSTALLED_TARGET_TOOL(LIPO_FOR_TARGET, lipo)
 ACX_CHECK_INSTALLED_TARGET_TOOL(NM_FOR_TARGET, nm)
 ACX_CHECK_INSTALLED_TARGET_TOOL(OBJDUMP_FOR_TARGET, objdump)
 ACX_CHECK_INSTALLED_TARGET_TOOL(RANLIB_FOR_TARGET, ranlib)
+ACX_CHECK_INSTALLED_TARGET_TOOL(READELF_FOR_TARGET, readelf)
 ACX_CHECK_INSTALLED_TARGET_TOOL(STRIP_FOR_TARGET, strip)
 ACX_CHECK_INSTALLED_TARGET_TOOL(WINDRES_FOR_TARGET, windres)
 ACX_CHECK_INSTALLED_TARGET_TOOL(WINDMC_FOR_TARGET, windmc)
@@ -3104,6 +3106,7 @@ GCC_TARGET_TOOL(lipo, LIPO_FOR_TARGET, LIPO)
 GCC_TARGET_TOOL(nm, NM_FOR_TARGET, NM, [binutils/nm-new])
 GCC_TARGET_TOOL(objdump, OBJDUMP_FOR_TARGET, OBJDUMP, [binutils/objdump])
 GCC_TARGET_TOOL(ranlib, RANLIB_FOR_TARGET, RANLIB, [binutils/ranlib])
+GCC_TARGET_TOOL(readelf, READELF_FOR_TARGET, READELF, [binutils/readelf])
 GCC_TARGET_TOOL(strip, STRIP_FOR_TARGET, STRIP, [binutils/strip-new])
 GCC_TARGET_TOOL(windres, WINDRES_FOR_TARGET, WINDRES, [binutils/windres])
 GCC_TARGET_TOOL(windmc, WINDMC_FOR_TARGET, WINDMC, [binutils/windmc])

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

* Re: [top-level patch] Do proper target tool checks for readelf
  2011-11-02 23:16 [top-level patch] Do proper target tool checks for readelf Roland McGrath
@ 2011-11-03  3:41 ` Ian Lance Taylor
  2011-11-03 16:48   ` Roland McGrath
  0 siblings, 1 reply; 9+ messages in thread
From: Ian Lance Taylor @ 2011-11-03  3:41 UTC (permalink / raw)
  To: Roland McGrath; +Cc: newlib, binutils, gcc-patches

Roland McGrath <mcgrathr@google.com> writes:

> MAINTAINERS doesn't make it entirely clear what the procedure really is for
> touching these files.  Looking at src/ChangeLog I see both what appear to
> be instances where changes were first committed to GCC and then merged over
> to src/, and instances where changes were committed directly to src/.  I'm
> able to commit (after approval) to src/ CVS, but not to GCC.

The top level is not automatically merged between gcc and src.  However,
people are expected to merge manually.  Normally gcc is considered to be
the master.

> Ok for src/ trunk, or should somebody be putting this into GCC first?

So, yes, should probably go into gcc first.

Ian

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

* Re: [top-level patch] Do proper target tool checks for readelf
  2011-11-03  3:41 ` Ian Lance Taylor
@ 2011-11-03 16:48   ` Roland McGrath
  2011-11-03 17:53     ` Ian Lance Taylor
  0 siblings, 1 reply; 9+ messages in thread
From: Roland McGrath @ 2011-11-03 16:48 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: newlib, binutils, gcc-patches

On Wed, Nov 2, 2011 at 8:32 PM, Ian Lance Taylor <iant@google.com> wrote:
> The top level is not automatically merged between gcc and src.  However,
> people are expected to merge manually.  Normally gcc is considered to be
> the master.

Ok.  src/MAINTAINERS could be clearer about that.

>> Ok for src/ trunk, or should somebody be putting this into GCC first?
>
> So, yes, should probably go into gcc first.

Ok.  Would you like to commit it for me, then?  I can take care of the src/
merge myself if you prefer.


Thanks,
Roland

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

* Re: [top-level patch] Do proper target tool checks for readelf
  2011-11-03 16:48   ` Roland McGrath
@ 2011-11-03 17:53     ` Ian Lance Taylor
  2011-11-03 17:55       ` Roland McGrath
  2011-11-03 18:06       ` DJ Delorie
  0 siblings, 2 replies; 9+ messages in thread
From: Ian Lance Taylor @ 2011-11-03 17:53 UTC (permalink / raw)
  To: Roland McGrath; +Cc: newlib, binutils, gcc-patches

Roland McGrath <mcgrathr@google.com> writes:

> On Wed, Nov 2, 2011 at 8:32 PM, Ian Lance Taylor <iant@google.com> wrote:
>> The top level is not automatically merged between gcc and src.  However,
>> people are expected to merge manually.  Normally gcc is considered to be
>> the master.
>
> Ok.  src/MAINTAINERS could be clearer about that.
>
>>> Ok for src/ trunk, or should somebody be putting this into GCC first?
>>
>> So, yes, should probably go into gcc first.
>
> Ok.  Would you like to commit it for me, then?  I can take care of the src/
> merge myself if you prefer.

Ideally I'd like to see a build maintainer approve it.  Perhaps I missed
that.

Ian

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

* Re: [top-level patch] Do proper target tool checks for readelf
  2011-11-03 17:53     ` Ian Lance Taylor
@ 2011-11-03 17:55       ` Roland McGrath
  2011-11-03 18:06       ` DJ Delorie
  1 sibling, 0 replies; 9+ messages in thread
From: Roland McGrath @ 2011-11-03 17:55 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: newlib, binutils, gcc-patches

On Thu, Nov 3, 2011 at 10:39 AM, Ian Lance Taylor <iant@google.com> wrote:
> Ideally I'd like to see a build maintainer approve it.  Perhaps I missed
> that.

Ah.  The src/MAINTAINERS file says, "Any global maintainer can approve
changes to these files, ...", which in that context I think includes you.
But since "..." is "but they should be aware that they need to be kept in
sync with their counterparts in the GCC repository," I've now looked at
gcc/MAINTAINERS and see that it has a category "build machinery (*.in)"
that you are not in.  (You are in its "global reviewers" category, which
the wording there suggests is in fact sufficient.  But I certainly can't
argue with wanting to hear from one of the build maintainers, though I do
hope they respond soon.  That said, it seems hard to imagine that my change
would be objectionable.)


Thanks,
Roland

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

* Re: [top-level patch] Do proper target tool checks for readelf
  2011-11-03 17:53     ` Ian Lance Taylor
  2011-11-03 17:55       ` Roland McGrath
@ 2011-11-03 18:06       ` DJ Delorie
  2011-11-03 18:09         ` Roland McGrath
  1 sibling, 1 reply; 9+ messages in thread
From: DJ Delorie @ 2011-11-03 18:06 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: mcgrathr, newlib, binutils, gcc-patches


> Ideally I'd like to see a build maintainer approve it.  Perhaps I missed
> that.

I've got my usual paranoia about command line lengths being stressed,
but I suspect we're already way past the limits on the ones that will
actually fail.

The patch looks OK to me.

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

* Re: [top-level patch] Do proper target tool checks for readelf
  2011-11-03 18:06       ` DJ Delorie
@ 2011-11-03 18:09         ` Roland McGrath
  2011-11-09 18:55           ` Roland McGrath
  0 siblings, 1 reply; 9+ messages in thread
From: Roland McGrath @ 2011-11-03 18:09 UTC (permalink / raw)
  To: DJ Delorie; +Cc: Ian Lance Taylor, newlib, binutils, gcc-patches

On Thu, Nov 3, 2011 at 10:55 AM, DJ Delorie <dj@redhat.com> wrote:
> The patch looks OK to me.

Thanks!  As I'm still not a GCC committer, someone please check it in for me.
If people would like me to handle the merge over to src/ myself, I'd be
glad to do that step.


Thanks,
Roland

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

* Re: [top-level patch] Do proper target tool checks for readelf
  2011-11-03 18:09         ` Roland McGrath
@ 2011-11-09 18:55           ` Roland McGrath
  2011-11-09 19:04             ` DJ Delorie
  0 siblings, 1 reply; 9+ messages in thread
From: Roland McGrath @ 2011-11-09 18:55 UTC (permalink / raw)
  To: DJ Delorie; +Cc: Ian Lance Taylor, newlib, binutils, gcc-patches

On Thu, Nov 3, 2011 at 11:05 AM, Roland McGrath <mcgrathr@google.com> wrote:
> On Thu, Nov 3, 2011 at 10:55 AM, DJ Delorie <dj@redhat.com> wrote:
>> The patch looks OK to me.
>
> Thanks!  As I'm still not a GCC committer, someone please check it in for me.
> If people would like me to handle the merge over to src/ myself, I'd be
> glad to do that step.

Ping.  Anybody going to do this commit for me?  (If insteaed someone would
like to add me to the gcc group so I can do "write after approval", that
would be fine too.)


Thanks,
Roland

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

* Re: [top-level patch] Do proper target tool checks for readelf
  2011-11-09 18:55           ` Roland McGrath
@ 2011-11-09 19:04             ` DJ Delorie
  0 siblings, 0 replies; 9+ messages in thread
From: DJ Delorie @ 2011-11-09 19:04 UTC (permalink / raw)
  To: Roland McGrath; +Cc: iant, newlib, binutils, gcc-patches


> Ping.  Anybody going to do this commit for me?  (If insteaed someone would
> like to add me to the gcc group so I can do "write after approval", that
> would be fine too.)

Done.

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

end of thread, other threads:[~2011-11-09 18:58 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-02 23:16 [top-level patch] Do proper target tool checks for readelf Roland McGrath
2011-11-03  3:41 ` Ian Lance Taylor
2011-11-03 16:48   ` Roland McGrath
2011-11-03 17:53     ` Ian Lance Taylor
2011-11-03 17:55       ` Roland McGrath
2011-11-03 18:06       ` DJ Delorie
2011-11-03 18:09         ` Roland McGrath
2011-11-09 18:55           ` Roland McGrath
2011-11-09 19:04             ` DJ Delorie

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