Hi,
We should not add .eh_frame sections as root nodes for GC even if they
are requested to be KEPT by the linker script. These sections are
handled in a special way and their references to other sections should
not prevent GC to collect the referenced sections if they are unused.
Please note that the KEEP statement for .eh_frame* sections cannot be
removed because in that case ld won't store these sections into the
output file.
The test for this patch requires PR20717 to be fixed.
Best regards,
Igor Kudrin
---
gold/ChangeLog
* object.cc (Sized_relobj_file::do_layout): Don't add
.eh_frame* sections as root nodes for GC.
* testsuite/Makefile.am (gc_keep_eh_frame): New test.
* testsuite/Makefile.in: Regenerate.
* testsuite/gc_keep_eh_frame.cc: New test source file.
* testsuite/gc_keep_eh_frame.sh: New test script.
* testsuite/gc_keep_eh_frame.t: New test linker script.