svn commit: trunk/busybox
aldot at busybox.net
aldot at busybox.net
Fri Jan 27 15:45:57 UTC 2006
Author: aldot
Date: 2006-01-27 07:45:56 -0800 (Fri, 27 Jan 2006)
New Revision: 13638
Log:
- add a macro to check for ld and as flags
Very unreliable as e.g the ld check will see the flags supported by each emulation, not just the active one.
good enough for now..
Fix would be to crate one or more dummy .c files and accually try if a flag
works.
Modified:
trunk/busybox/Makefile
trunk/busybox/Rules.mak
Changeset:
Modified: trunk/busybox/Makefile
===================================================================
--- trunk/busybox/Makefile 2006-01-27 15:37:19 UTC (rev 13637)
+++ trunk/busybox/Makefile 2006-01-27 15:45:56 UTC (rev 13638)
@@ -277,8 +277,7 @@
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(LDFLAGS) -shared \
$(CFLAGS_PIC) \
-Wl,-soname=$(LD_LIBBUSYBOX).$(MAJOR_VERSION) \
- -Wl,--enable-new-dtags -Wl,--reduce-memory-overheads \
- -Wl,-z,combreloc -Wl,-shared -Wl,--as-needed -Wl,--warn-shared-textrel \
+ -Wl,-z,combreloc $(LIB_LDFLAGS) \
-o $(@) \
-Wl,--start-group -Wl,--whole-archive \
$(LIBRARY_DEFINE) $(^) \
Modified: trunk/busybox/Rules.mak
===================================================================
--- trunk/busybox/Rules.mak 2006-01-27 15:37:19 UTC (rev 13637)
+++ trunk/busybox/Rules.mak 2006-01-27 15:45:56 UTC (rev 13638)
@@ -115,6 +115,20 @@
then echo "$(1)"; else echo "$(2)"; fi \
fi)
+# A not very robust macro to check for available ld flags
+check_ld=$(shell \
+ echo "checking='$(1)'" >> foo.txt ; \
+ if [ "x$(1)" != "x" ]; then \
+ $(LD) --help | grep -q \\$(1) && echo "-Wl,$(1)$(2)" ; \
+ fi)
+
+# A not very robust macro to check for available as flags
+check_as=$(shell \
+ if [ "x$(1)" != "x" ]; then \
+ $(AS) --help | grep -q "\\$(1)" && echo "-Wa,$(1)$(2)" ; \
+ fi)
+
+
# Setup some shortcuts so that silent mode is silent like it should be
ifeq ($(subst s,,$(MAKEFLAGS)),$(MAKEFLAGS))
export MAKE_IS_SILENT=n
@@ -145,10 +159,15 @@
PROG_CFLAGS+=$(call check_gcc,-fwhole-program,)
endif # CONFIG_BUILD_AT_ONCE
+LIB_LDFLAGS:=$(call check_ld,--enable-new-dtags,)
+#LIB_LDFLAGS+=$(call check_ld,--reduce-memory-overheads,)
+#LIB_LDFLAGS+=$(call check_ld,--as-needed,)
+#LIB_LDFLAGS+=$(call check_ld,--warn-shared-textrel,)
+
+
# Some nice architecture specific optimizations
ifeq ($(strip $(TARGET_ARCH)),arm)
OPTIMIZATION+=-fstrict-aliasing
- OPTIMIZATION+=$(call check_gcc,-msingle-pic-base,)
endif
ifeq ($(strip $(TARGET_ARCH)),i386)
OPTIMIZATION+=$(call check_gcc,-march=i386,)
@@ -169,7 +188,7 @@
OPTIMIZATION+=$(call check_gcc,-fno-branch-count-reg,)
endif # gcc-4.1 and beyond
endif
-OPTIMIZATIONS:=$(OPTIMIZATION) -fomit-frame-pointer
+OPTIMIZATIONS:=$(OPTIMIZATION) $(call check_gcc,-fomit-frame-pointer,)
#
#--------------------------------------------------------
@@ -195,21 +214,22 @@
endif
ifeq ($(strip $(CONFIG_DEBUG)),y)
CFLAGS +=$(WARNINGS) -g -D_GNU_SOURCE
- LDFLAGS +=-Wl,-warn-common
+ LDFLAGS += $(call check_ld,-warn-common,)
STRIPCMD:=/bin/true -Not_stripping_since_we_are_debugging
else
CFLAGS+=$(WARNINGS) $(OPTIMIZATIONS) -D_GNU_SOURCE -DNDEBUG
- LDFLAGS += -Wl,-warn-common -Wl,--sort-common
+ LDFLAGS += $(call check_ld,-warn-common,)
+ LDFLAGS += $(call check_ld,--sort-common,)
STRIPCMD:=$(STRIP) -s --remove-section=.note --remove-section=.comment
endif
ifeq ($(strip $(CONFIG_STATIC)),y)
- LDFLAGS += --static
+ LDFLAGS += $(call check_ld,--static,)
#else
# LIBRARIES += -ldl
endif
ifeq ($(strip $(CONFIG_BUILD_LIBBUSYBOX)),y)
- CFLAGS_PIC:= -fPIC #-DPIC
+ CFLAGS_PIC:= $(call check_gcc,-fPIC,)
endif
ifeq ($(strip $(CONFIG_SELINUX)),y)
More information about the busybox-cvs
mailing list