PR25570, ld duplicate "warning: changing start of section"

Message ID 20200304055731.GU5384@bubble.grove.modra.org
State New
Headers show
Series
  • PR25570, ld duplicate "warning: changing start of section"
Related show

Commit Message

Alan Modra March 4, 2020, 5:57 a.m.
PR 25570
	* ldlang.c (lang_size_sections_1): Delay emitting non-fatal
	errors/warnings until final pass.
	* ldexp.c (fold_name): Likewise.


-- 
Alan Modra
Australia Development Lab, IBM

Comments

Alan Modra March 4, 2020, 6:12 a.m. | #1
On Wed, Mar 04, 2020 at 04:27:31PM +1030, Alan Modra wrote:
> 	PR 25570

> 	* ldlang.c (lang_size_sections_1): Delay emitting non-fatal

> 	errors/warnings until final pass.

> 	* ldexp.c (fold_name): Likewise.


Oops, no.  lang_size_sections isn't called on the final pass so this
patch would never emit the warnings.  Reverted.

-- 
Alan Modra
Australia Development Lab, IBM

Patch

diff --git a/ld/ldexp.c b/ld/ldexp.c
index 6d1457b929..d2b1b43a5a 100644
--- a/ld/ldexp.c
+++ b/ld/ldexp.c
@@ -742,7 +742,7 @@  fold_name (etree_type *tree)
 	      output_section = h->u.def.section->output_section;
 	      if (output_section == NULL)
 		{
-		  if (expld.phase <= lang_mark_phase_enum)
+		  if (expld.phase != lang_final_phase_enum)
 		    new_rel (h->u.def.value, h->u.def.section);
 		  else
 		    einfo (_("%X%P:%pS: unresolvable symbol `%s'"
diff --git a/ld/ldlang.c b/ld/ldlang.c
index be9ac36ede..b089ac304b 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -5554,7 +5554,7 @@  lang_size_sections_1
 			&& (strcmp (lang_memory_region_list->name_list.name,
 				    DEFAULT_MEMORY_REGION) != 0
 			    || lang_memory_region_list->next != NULL)
-			&& expld.phase != lang_mark_phase_enum)
+			&& expld.phase == lang_final_phase_enum)
 		      {
 			/* By default this is an error rather than just a
 			   warning because if we allocate the section to the
@@ -5592,7 +5592,7 @@  lang_size_sections_1
 		    if (dotdelta != 0
 			&& (config.warn_section_align
 			    || os->addr_tree != NULL)
-			&& expld.phase != lang_mark_phase_enum)
+			&& expld.phase == lang_final_phase_enum)
 		      einfo (ngettext ("%P: warning: changing start of "
 				       "section %s by %lu byte\n",
 				       "%P: warning: changing start of "