meta.stage.mk is handling ${SYMLINKS:T} for stage_libs already. The logic in
bsd.sys.mk to handle ${SYMLINKS} was brought in r247817 when it was moved out
of bsd.prog.mk and bsd.lib.mk into bsd.sys.mk. The logic previously was
limited to bsd.prog.mk.
This fixes a race, seen easily in lib/libthr, where libpthread_p.a is created
by both stage_libs and stage_symlinks resulting in 'ln: File exists'.
Sponsored by: EMC / Isilon Storage Division
STAGE_LINKS.links= ${LINKS}
.endif
-.if !empty(SYMLINKS)
+# Don't handle SYMLINKS for libraries since stage_libs is already doing so.
+.if !empty(SYMLINKS) && empty(_LIBS)
STAGE_TARGETS+= stage_symlinks
STAGE_SETS+= links
STAGE_SYMLINKS.links= ${SYMLINKS}