Fix problem where -u is ignored when a weak undef is seen.
authorCary Coutant <ccoutant@google.com>
Fri, 7 Feb 2014 01:12:50 +0000 (17:12 -0800)
committerCary Coutant <ccoutant@google.com>
Fri, 7 Feb 2014 01:15:02 +0000 (17:15 -0800)
commit1f25b93bc6e10b314ccdc5c42583f77db1b33e2e
treed7141deb29a5c81b6728666967f0af067faf42f8
parent699e9b8780835c321da32a6c32cd6dd56fcd6d54
Fix problem where -u is ignored when a weak undef is seen.

When the linker has a weak undefined symbol, it normally does not
select an archive library member just to satisfy the reference.
If the same symbol is also listed in a -u option, however, we
should select the archive library member.  This patch reorders
the code in Library_base::should_include_member so that the
additional checks are performed in the case of a weak undef.

gold/

2014-02-06  Cary Coutant  <ccoutant@google.com>

* archive.cc (Library_base::should_include_member): Reorder
code to check for -u option if a weak undef has already been seen.
* testsuite/Makefile.am (weak_undef_test_2): New test case.
* testsuite/Makefile.in: Regenerate.
* testsuite/weak_undef_file3.cc: New file.
* testsuite/weak_undef_file4.cc: New file.
* testsuite/weak_undef_test_2.cc: New file.
gold/archive.cc
gold/testsuite/Makefile.am
gold/testsuite/Makefile.in
gold/testsuite/weak_undef_file3.cc [new file with mode: 0644]
gold/testsuite/weak_undef_file4.cc [new file with mode: 0644]
gold/testsuite/weak_undef_test_2.cc [new file with mode: 0644]