public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Re: ld: Neither "FILL(x);" nor "{ }>Memory = x" allow symbols
       [not found] <01ba01d5d26f$9b37dcf0$d1a796d0$@BigPond.com>
@ 2020-01-27 23:43 ` Alan Modra
  0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2020-01-27 23:43 UTC (permalink / raw)
  To: John.Adriaan; +Cc: Bug-BinUtils, binutils

On Fri, Jan 24, 2020 at 03:34:45PM +1100, John.Adriaan@BigPond.com wrote:
[on trying to use a symbol in a fill expression]

> arm-none-eabi/bin/ld.exe: bfd_link_hash_lookup failed: no error (It's the
> "no error" part that I like the most!)

Yes, that is silly.  I'm going to commit the following to fix that.

	* ldexp.c (fold_name): Don't print bfd_link_hash_lookup failed
	in first phase.

diff --git a/ld/ldexp.c b/ld/ldexp.c
index 1fda65d714..6d1457b929 100644
--- a/ld/ldexp.c
+++ b/ld/ldexp.c
@@ -730,7 +730,10 @@ fold_name (etree_type *tree)
 					    tree->name.name,
 					    TRUE, FALSE, TRUE);
 	  if (!h)
-	    einfo (_("%F%P: bfd_link_hash_lookup failed: %E\n"));
+	    {
+	      if (expld.phase != lang_first_phase_enum)
+		einfo (_("%F%P: bfd_link_hash_lookup failed: %E\n"));
+	    }
 	  else if (h->type == bfd_link_hash_defined
 		   || h->type == bfd_link_hash_defweak)
 	    {


> It seems like the Fill algorithm doesn't like to use symbols.

Right.  The fill expression is evaluated when parsing the script for
the first time, before the symbol table is even created.

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-01-27 23:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <01ba01d5d26f$9b37dcf0$d1a796d0$@BigPond.com>
2020-01-27 23:43 ` ld: Neither "FILL(x);" nor "{ }>Memory = x" allow symbols 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).