Reduce --warn-section-align output
authorAlan Modra <amodra@gmail.com>
Thu, 5 Mar 2020 11:04:23 +0000 (21:34 +1030)
committerAlan Modra <amodra@gmail.com>
Thu, 5 Mar 2020 11:22:04 +0000 (21:52 +1030)
PR 25570
* ldlang.c (lang_size_sections_1): Don't report changes on
second and subsequent iterations that make no change in
alignment from that already reported.

ld/ChangeLog
ld/ldlang.c

index b634dd8732efb1f325c70ad7f988aa6727eb3b30..666ce5cb7dec230dfe203f568fe620db74e79f7b 100644 (file)
@@ -1,3 +1,10 @@
+2020-03-05  Alan Modra  <amodra@gmail.com>
+
+       PR 25570
+       * ldlang.c (lang_size_sections_1): Don't report changes on
+       second and subsequent iterations that make no change in
+       alignment from that already reported.
+
 2020-03-05  Alan Modra  <amodra@gmail.com>
 
        PR 25570
index 6ffa7af5754bb66fcb972147e64b87b1aa331fee..63f9d182eae416538ec9b2eda242d9cefb1577fb 100644 (file)
@@ -5597,7 +5597,13 @@ lang_size_sections_1
                    if (lang_sizing_iteration == 1)
                      diff = dotdelta;
                    else if (lang_sizing_iteration > 1)
-                     diff = newdot - os->bfd_section->vma;
+                     {
+                       /* Only report adjustments that would change
+                          alignment from what we have already reported.  */
+                       diff = newdot - os->bfd_section->vma;
+                       if (!(diff & (((bfd_vma) 1 << section_alignment) - 1)))
+                         diff = 0;
+                     }
                    if (diff != 0
                        && (config.warn_section_align
                            || os->addr_tree != NULL))