This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Fix garbage collection of common symbols


On Mon, Jan 19, 2015 at 8:47 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Mon, Jan 19, 2015 at 3:03 AM, Alan Modra <amodra@gmail.com> wrote:
>> Running lang_common before garbage collection means slightly less work
>> in garbage collection code, since common symbols should no longer
>> appear there.  It does have the side effect of keeping linker script
>> symbols (at least those defined outside of sections) global too,
>> hence some testsuite churn.
>>
>> bfd/
>>         PR 17165
>             ^^^^^^^^^^^
>
> Didn't you mean PR ld/17615:
>
> https://sourceware.org/bugzilla/show_bug.cgi?id=17615
>
>>         * elf-bfd.h (ELF_COMMON_DEF): Note that this might be true for
>>         linker script assignments too.
>>         * elflink.c (elf_gc_sweep_symbol): Don't drop ELF_COMMON_DEF syms.
>>         (bfd_elf_gc_mark_dynamic_ref_symbol): Similarly.
>> ld/
>>         PR 17165
>>         * ldlang.c (lang_process): Run lang_common before lang_gc_sections.
>> ld/testsuite/
>>         * ld-gc/pr14265.d,
>>         * ld-cris/tls-gc-68.d,
>>         * ld-cris/tls-gc-69.d,
>>         * ld-cris/tls-gc-70.d,
>>         * ld-cris/tls-gc-71.d,
>>         * ld-cris/tls-gc-75.d,
>>         * ld-cris/tls-gc-76.d,
>>         * ld-cris/tls-gc-79.d,
>>         * ld-mmix/bpo-10.d,
>>         * ld-mmix/bpo-11.d: Update.
>>

I checked in this patch to add a testcase for

https://sourceware.org/bugzilla/show_bug.cgi?id=17615


-- 
H.J.
----
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index ab45ad8..06cfacb 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,6 +1,6 @@
 2015-01-19  Alan Modra  <amodra@gmail.com>

- PR 17165
+ PR ld/17615
  * elf-bfd.h (ELF_COMMON_DEF_P): Note that this might be true for
  linker script assignments too.
  * elflink.c (elf_gc_sweep_symbol): Don't drop ELF_COMMON_DEF syms.
diff --git a/ld/ChangeLog b/ld/ChangeLog
index e9c3ed3..ae0b29a 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,6 +1,6 @@
 2015-01-19  Alan Modra  <amodra@gmail.com>

- PR 17165
+ PR ld/17615
  * ldlang.c (lang_process): Run lang_common before lang_gc_sections.

 2015-01-14  Jiong Wang  <jiong.wang@arm.com>
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index d08ff1a..10f109c 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2015-01-19  H.J. Lu  <hongjiu.lu@intel.com>
+
+ PR ld/17615
+ * ld-elf/pr17615.d: New file.
+ * ld-elf/pr17615.s: Likewise.
+
 2015-01-19  Alan Modra  <amodra@gmail.com>

  * ld-gc/pr14265.d,
diff --git a/ld/testsuite/ld-elf/pr17615.d b/ld/testsuite/ld-elf/pr17615.d
new file mode 100644
index 0000000..a2a2f70
--- /dev/null
+++ b/ld/testsuite/ld-elf/pr17615.d
@@ -0,0 +1,12 @@
+#ld: --gc-sections -shared
+#readelf: -S --wide --dyn-syms
+#target: *-*-linux* *-*-gnu*
+#notarget: arc-*-* d30v-*-* dlx-*-* i960-*-* pj*-*-*
+#notarget: hppa64-*-* i370-*-* i860-*-* ia64-*-* mep-*-* mn10200-*-*
+# generic linker targets don't support --gc-sections, nor do a bunch of others
+
+#...
+  \[[ 0-9]+\] \.bss[ \t]+NOBITS[ \t0-9a-f]+WA.*
+#...
+ +[0-9]+: +[0-9a-f]+ +4 +OBJECT +GLOBAL +DEFAULT +[1-9]+ foo
+#pass
diff --git a/ld/testsuite/ld-elf/pr17615.s b/ld/testsuite/ld-elf/pr17615.s
new file mode 100644
index 0000000..a177cf2
--- /dev/null
+++ b/ld/testsuite/ld-elf/pr17615.s
@@ -0,0 +1 @@
+ .comm foo,4,4


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]