public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] bfd+ld: when / whether to generate .c files
@ 2023-03-31 14:19 Jan Beulich
  2023-04-01  7:25 ` Alan Modra
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Beulich @ 2023-03-31 14:19 UTC (permalink / raw)
  To: Binutils; +Cc: Nick Clifton, Alan Modra

Having been irritated by seeing bfd/elf{32,64}-aarch64.c to be re-
generated in x86-only builds, I came across 769a27ade588 ("Re: bfd
BLD-POTFILES.in dependencies"). I think this went slightly too far, as
outside of maintainer mode dependencies will cause the subset of files
to be (re-)generated which are actually needed for the build.
Generating them all is only needed when wanting to update certain files
under bfd/po/, i.e. in maintainer mode.

In the course of looking around in an attempt to try to understand how
things are meant to work, I further noticed that ld has got things
slightly wrong too: BLD-POTFILES.in depending on $(BLD_POTFILES) isn't
quite right (the output doesn't change when any of the enumerated files
changes; it's the mere presence which matters); like in bfd it looks
like we would better extend BUILT_SOURCES accordingly.

Furthermore it became apparent that ld fails to enumerate the .c files
generated from the .l and .y ones. While in their absence it was benign
whether translatable strings in the source files were actually marked as
such, this now becomes relevant. Mark respective strings at the same
time, but skipping ones which look to be of interest for debugging
purposes only (e.g. such used by printf() enclosed in #ifdef TRACE).

--- a/bfd/Makefile.am
+++ b/bfd/Makefile.am
@@ -721,7 +721,7 @@ BUILD_HFILES = \
 	bfdver.h elf32-target.h elf64-target.h targmatch.h
 
 # Ensure they are built early:
-BUILT_SOURCES = $(BUILD_HFILES) $(BUILD_CFILES)
+BUILT_SOURCES = $(BUILD_HFILES) @MAINT@ $(BUILD_CFILES)
 
 HFILES = $(SOURCE_HFILES) $(BUILD_HFILES)
 
--- a/bfd/Makefile.in
+++ b/bfd/Makefile.in
@@ -1174,7 +1174,7 @@ BUILD_HFILES = \
 
 
 # Ensure they are built early:
-BUILT_SOURCES = $(BUILD_HFILES) $(BUILD_CFILES)
+BUILT_SOURCES = $(BUILD_HFILES) @MAINT@ $(BUILD_CFILES)
 HFILES = $(SOURCE_HFILES) $(BUILD_HFILES)
 BFD_H_DEPS = $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h $(INCDIR)/diagnostics.h
 LOCAL_H_DEPS = libbfd.h sysdep.h config.h
--- a/ld/Makefile.am
+++ b/ld/Makefile.am
@@ -493,7 +493,8 @@ GENERATED_HFILES = ldgram.h ldemul-list.
 
 # Require an early dependency on the generated headers, as the dependency
 # tracking will not cause them to be built beforehand.
-BUILT_SOURCES = $(GENERATED_HFILES)
+BUILT_SOURCES = $(GENERATED_HFILES) @MAINT@ $(GENERATED_CFILES) \
+	$(ALL_EMULATION_SOURCES) $(ALL_64_EMULATION_SOURCES)
 
 OFILES = ldgram.@OBJEXT@ ldlex-wrapper.@OBJEXT@ lexsup.@OBJEXT@ ldlang.@OBJEXT@ \
 	mri.@OBJEXT@ ldctor.@OBJEXT@ ldmain.@OBJEXT@ plugin.@OBJEXT@ \
@@ -548,7 +549,7 @@ po/SRC-POTFILES.in: @MAINT@ Makefile
 	for f in $(SRC_POTFILES); do echo $$f; done | LC_ALL=C sort > $@-tmp \
 	  && mv $@-tmp $(srcdir)/po/SRC-POTFILES.in
 
-po/BLD-POTFILES.in: @MAINT@ Makefile $(BLD_POTFILES)
+po/BLD-POTFILES.in: @MAINT@ Makefile
 	for f in $(BLD_POTFILES); do echo $$f; done | LC_ALL=C sort > $@-tmp \
 	  && mv $@-tmp $(srcdir)/po/BLD-POTFILES.in
 
--- a/ld/Makefile.in
+++ b/ld/Makefile.in
@@ -992,7 +992,8 @@ GENERATED_HFILES = ldgram.h ldemul-list.
 
 # Require an early dependency on the generated headers, as the dependency
 # tracking will not cause them to be built beforehand.
-BUILT_SOURCES = $(GENERATED_HFILES)
+BUILT_SOURCES = $(GENERATED_HFILES) @MAINT@ $(GENERATED_CFILES) \
+	$(ALL_EMULATION_SOURCES) $(ALL_64_EMULATION_SOURCES)
 OFILES = ldgram.@OBJEXT@ ldlex-wrapper.@OBJEXT@ lexsup.@OBJEXT@ ldlang.@OBJEXT@ \
 	mri.@OBJEXT@ ldctor.@OBJEXT@ ldmain.@OBJEXT@ plugin.@OBJEXT@ \
 	ldwrite.@OBJEXT@ ldexp.@OBJEXT@  ldemul.@OBJEXT@ ldver.@OBJEXT@ ldmisc.@OBJEXT@ \
@@ -2288,7 +2289,7 @@ po/SRC-POTFILES.in: @MAINT@ Makefile
 	for f in $(SRC_POTFILES); do echo $$f; done | LC_ALL=C sort > $@-tmp \
 	  && mv $@-tmp $(srcdir)/po/SRC-POTFILES.in
 
-po/BLD-POTFILES.in: @MAINT@ Makefile $(BLD_POTFILES)
+po/BLD-POTFILES.in: @MAINT@ Makefile
 	for f in $(BLD_POTFILES); do echo $$f; done | LC_ALL=C sort > $@-tmp \
 	  && mv $@-tmp $(srcdir)/po/BLD-POTFILES.in
 
--- a/ld/deffilep.y
+++ b/ld/deffilep.y
@@ -1134,7 +1134,7 @@ def_image_name (const char *name, bfd_vm
       const char* image_name = lbasename (name);
 
       if (image_name != name)
-	einfo ("%s:%d: Warning: path components stripped from %s, '%s'\n",
+	einfo (_("%s:%d: Warning: path components stripped from %s, '%s'\n"),
 	       def_filename, linenumber, is_dll ? "LIBRARY" : "NAME",
 	       name);
       free (def->name);
--- a/ld/ldgram.y
+++ b/ld/ldgram.y
@@ -720,7 +720,7 @@ length:
 fill_exp:
 	mustbe_exp
 		{
-		  $$ = exp_get_fill ($1, 0, "fill value");
+		  $$ = exp_get_fill ($1, 0, _("fill value"));
 		}
 	;
 
@@ -1512,7 +1512,7 @@ yyerror(arg)
     einfo (_("%P:%s: file format not recognized; treating as linker script\n"),
 	   ldlex_filename ());
   if (error_index > 0 && error_index < ERROR_NAME_MAX)
-    einfo ("%F%P:%pS: %s in %s\n", NULL, arg, error_names[error_index - 1]);
+    einfo (_("%F%P:%pS: %s in %s\n"), NULL, arg, error_names[error_index - 1]);
   else
     einfo ("%F%P:%pS: %s\n", NULL, arg);
 }
--- a/ld/ldlex.l
+++ b/ld/ldlex.l
@@ -489,8 +489,8 @@ V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^\\]([
   return END;
 }
 
-<SCRIPT,WILD,MRI,VERS_START,VERS_SCRIPT,VERS_NODE>.	lex_warn_invalid (" in script", yytext);
-<EXPRESSION>.	lex_warn_invalid (" in expression", yytext);
+<SCRIPT,WILD,MRI,VERS_START,VERS_SCRIPT,VERS_NODE>.	lex_warn_invalid (_(" in script"), yytext);
+<EXPRESSION>.	lex_warn_invalid (_(" in expression"), yytext);
 
 %%
 \f

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

* Re: [PATCH] bfd+ld: when / whether to generate .c files
  2023-03-31 14:19 [PATCH] bfd+ld: when / whether to generate .c files Jan Beulich
@ 2023-04-01  7:25 ` Alan Modra
  0 siblings, 0 replies; 2+ messages in thread
From: Alan Modra @ 2023-04-01  7:25 UTC (permalink / raw)
  To: Jan Beulich; +Cc: Binutils, Nick Clifton

On Fri, Mar 31, 2023 at 04:19:21PM +0200, Jan Beulich wrote:
> Having been irritated by seeing bfd/elf{32,64}-aarch64.c to be re-
> generated in x86-only builds, I came across 769a27ade588 ("Re: bfd
> BLD-POTFILES.in dependencies"). I think this went slightly too far, as

Fair enough.

> outside of maintainer mode dependencies will cause the subset of files
> to be (re-)generated which are actually needed for the build.
> Generating them all is only needed when wanting to update certain files
> under bfd/po/, i.e. in maintainer mode.
> 
> In the course of looking around in an attempt to try to understand how
> things are meant to work, I further noticed that ld has got things
> slightly wrong too: BLD-POTFILES.in depending on $(BLD_POTFILES) isn't
> quite right (the output doesn't change when any of the enumerated files
> changes; it's the mere presence which matters); like in bfd it looks
> like we would better extend BUILT_SOURCES accordingly.

Yes, that looks good.

-- 
Alan Modra
Australia Development Lab, IBM

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

end of thread, other threads:[~2023-04-01  7:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-31 14:19 [PATCH] bfd+ld: when / whether to generate .c files Jan Beulich
2023-04-01  7:25 ` Alan Modra

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