+# Flag whether we need eh_dummy.c
+need_eh_dummy=
+
+if [ "$SHLIB_LINK" ]; then
+ # Test -fvisibility=hidden. We need both a -fvisibility=hidden on
+ # the command line, and a #define to prevent libgcc2.h etc from
+ # overriding that with #pragmas. The dance with @ is to prevent
+ # echo from seeing anything it might take for an option.
+ # echo turns the \$\$\$\$ into $$$$ and when make sees it it
+ # becomes $$ and the shell substitutes the pid. Makes for a
+ # slightly safer temp file.
+ echo "vis_hide := \$(strip \$(subst @,-,\\"
+ echo " \$(shell if echo 'void foo(void); void foo(void) {}' | \\"
+ echo " $gcc_compile -fvisibility=hidden -Werror \\"
+ echo " -c -xc - -o vis_temp_file\$\$\$\$.o 2> /dev/null; \\"
+ echo " then echo @fvisibility=hidden @DHIDE_EXPORTS; \\"
+ echo " rm vis_temp_file\$\$\$\$.o 2> /dev/null; \\"
+ echo " fi)))"
+ echo
+
+ # If we have -fvisibility=hidden, then we need to generate hide
+ # lists for object files implemented in assembly. The default
+ # pseudo-op for this is ".hidden", but can be overridden with
+ # ASM_HIDDEN_OP.
+ [ "$ASM_HIDDEN_OP" ] || ASM_HIDDEN_OP=".hidden"
+
+ echo "ifneq (,\$(vis_hide))"
+ echo "define gen-hide-list"
+ echo "\$(NM_FOR_TARGET) ${SHLIB_NM_FLAGS} \$< | \\"
+ # non-GNU nm emits three fields even for undefined and typeless symbols,
+ # so explicitly omit them
+ echo " \$(AWK) 'NF == 3 && \$\$2 !~ /^[UN]\$\$/ { print \"\\t${ASM_HIDDEN_OP}\", \$\$3 }' > \$@T"
+ echo "mv -f \$@T \$@"
+ echo "endef"
+ echo "else"
+ echo "gen-hide-list = echo > \$@"
+ echo "endif"
+ echo
+else
+ # It is too hard to guarantee that vis_hide and gen-hide-list will never
+ # be referenced if SHLIB_LINK is not set, so set them to the values they'd
+ # have if SHLIB_LINK were set and we didn't have visibility support.
+ echo "vis_hide ="
+ echo "gen-hide-list = echo > \$@"
+fi
+
+# Remove any objects from lib2funcs and LIB2_DIVMOD_FUNCS that are
+# defined as optimized assembly code in LIB1ASMFUNCS.
+for name in $LIB1ASMFUNCS; do
+ lib2funcs=`echo $lib2funcs | sed -e 's/^'$name' //' \
+ -e 's/ '$name' / /' \
+ -e 's/ '$name'$//'`
+ LIB2_DIVMOD_FUNCS=`echo $LIB2_DIVMOD_FUNCS | sed -e 's/^'$name' //' \
+ -e 's/ '$name' / /' \
+ -e 's/ '$name'$//'`
+done
+