This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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: libgcc move to the top level


+.PHONY: check installcheck
+check: check-subdir
+installcheck: installcheck-subdir

Why the dependencies?



+# 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. +ifeq ($(ASM_HIDDEN_OP),) +ASM_HIDDEN_OP = .hidden +endif

This is a good candidate to be set in config.host (only Darwin sets it, and it's already converted to toplevel libgcc) instead of the Makefile.


+# 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.
+vis_hide := $(strip $(subst @,-,\
+    $(shell if echo 'void foo(void); void foo(void) {}' | \
+          $(gcc_compile_bare) -fvisibility=hidden -Werror \
+          -c -xc - -o vis_temp_file$$$$.o 2> /dev/null; \
+          then echo @fvisibility=hidden @DHIDE_EXPORTS; \
+          rm vis_temp_file$$$$.o 2> /dev/null; \
+          fi)))

Consider moving this to configure.ac, after the config.host fragment. You can reuse some code in libffi's configure.ac, like this:


AC_CACHE_CHECK([for __attribute__((visibility("hidden")))],
libgcc_cv_hidden_visibility_attribute, [
echo 'int __attribute__ ((visibility ("hidden"))) foo (void) { return 1; }' > conftest.c
libgcc_cv_hidden_visibility_attribute=no
if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
if grep "\\$ASM_HIDDEN_OP.*foo' conftest.s >/dev/null; then
libgcc_cv_hidden_visibility_attribute=yes
fi
fi
rm -f conftest.*
])


if test $libgcc_cv_hidden_visibility_attribute = yes; then
    vis_hide='-fvisibility=hidden -DHIDE_EXPORTS'
else
    vis_hide=
fi
AC_SUBST(vis_hide)


+ifeq ($(LIB2_SIDITI_CONV_FUNCS),)
+  lib2funcs += $(subst XX,si,$(swfloatfuncs))
+  lib2funcs += $(subst XX,di,$(dwfloatfuncs))
+endif
...
+ifneq ($(LIB2_SIDITI_CONV_FUNCS),)
+# Build libgcc2.c for each conversion function, with a specific
+# L<func> definition and LIBGCC2_UNITS_PER_WORD setting.  The DImode
+# functions are built with a wordsize of 4; the TImode functions are
+# built with the same labels, but a wordsize of 8.
+
+sifuncs = $(subst XX,si,$(swfloatfuncs))
+difuncs = $(subst XX,di,$(dwfloatfuncs))
+tifuncs = $(subst XX,ti,$(dwfloatfuncs))

Please extract [sdt]ifuncs out of the if, and use a single ifeq/else/endif for both cases.



+$(patsubst %,%.vis,$(LIB1ASMFUNCS)): %.vis: %_s.o
+	$(gen-hide-list)

Replace .o with $(objext).




+libgcc.a libgcov.a libunwind.a libgcc_eh.a:
+	-rm -f $@
+
+	objects="$(objects)";	

No blank lines (i.e. no lines with the tab only).



+all: $(HOST_EXTRA)
+install: $(HOST_EXTRA_INSTALL)
+

Just add the dependencies in the target fragment.


It's ok if you post only an incremental patch, rather than the whole stuff again.

Thanks!

Paolo


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