[OpenWrt-Devel] Is this a bug? Busybox package can ignore TARGET_LDFLAGS

Andrew McDonnell bugs at andrewmcdonnell.net
Fri Sep 19 09:52:52 EDT 2014


I noticed whilst playing with some settings that busybox seems to not honour 
any settings in the global TARGET_LDFLAGS variable (file: 
package/utils/busybox) I tested this by checking the build log and noting that 
an additional linker flag I patched into rules.mak was being ignored.

I was wondering if this is actually an error, because in the situation where 
either CONFIG_BUSYBOX_USE_LIBRPC or CONFIG_BUSYBOX_CONFIG_PAM are set, LDFLAGS 
is exported as the value of $(TARGET_LDFLAGS)

LDFLAGS is not passed through anywhere else in the file

It should be noted that the busybox make also accepts EXTRA_LDFLAGS; possibly 
setting EXTRA_LDFLAGS=$(TARGET_LDFLAGS) might be a better way?

(The reason I was doing this is because a linker flag I set in the 
TARGET_OPTIMIZATION config was being ignored by busybox and I discovered that 
busybox doesnt honour -Wl,-z, style flags)

(Code extract:)

ifdef CONFIG_BUSYBOX_USE_LIBRPC
   TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include
   export LDFLAGS=$(TARGET_LDFLAGS)
   LDLIBS += rpc
endif

ifdef CONFIG_BUSYBOX_CONFIG_PAM
   TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include
   export LDFLAGS=$(TARGET_LDFLAGS)
   LDLIBS += pam pam_misc pthread
endif

define Build/Compile
	+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
		CC="$(TARGET_CC)" \
		CROSS_COMPILE="$(TARGET_CROSS)" \
		KBUILD_HAVE_NLS=no \
		EXTRA_CFLAGS="$(TARGET_CFLAGS)" \
		ARCH="$(ARCH)" \
		SKIP_STRIP=y \
		LDLIBS="$(LDLIBS)" \
		$(BB_MAKE_VERBOSE) \
		all
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list