disable crt_fini compatibility in uClibc, compile custom ld-uClibc for broadcom utilities
authorFelix Fietkau <nbd@openwrt.org>
Fri, 9 Nov 2007 03:20:13 +0000 (03:20 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Fri, 9 Nov 2007 03:20:13 +0000 (03:20 +0000)
allows us to upgrade uClibc without breaking compatibility for nas and wl
breaks binary compatibility for packages from earlier kamikaze releases

SVN-Revision: 9518

package/broadcom-wl/Makefile
package/broadcom-wl/compat-ldso/build.mk [new file with mode: 0644]
package/broadcom-wl/compat-ldso/config [new file with mode: 0644]
package/broadcom-wl/compat-ldso/patches/100-start_main.patch [new file with mode: 0644]
toolchain/uClibc/config/mips
toolchain/uClibc/config/mipsel
toolchain/uClibc/config/powerpc

index f468646..ea80e2a 100644 (file)
@@ -70,9 +70,16 @@ define Package/wlc/description
  wl driver.
 endef
 
+define Package/brcm-compat-ldso
+  TITLE:=Broadcom wl/nas binary compatibility libraries
+  SECTION:=libs
+  CATEGORY:=Libraries
+endef
+
 define Package/wl
 $(call Package/broadcom-wl/Default)
   TITLE:=Proprietary Broadcom wl driver config utility
+  DEPENDS+=+brcm-compat-ldso
 endef
 
 define Package/wl/description
@@ -82,7 +89,7 @@ endef
 
 define Package/nas
 $(call Package/broadcom-wl/Default)
-  DEPENDS+= +nvram
+  DEPENDS+= +nvram +brcm-compat-ldso
   TITLE:=Proprietary Broadcom WPA/WPA2 authenticator
 endef
 
@@ -128,6 +135,15 @@ define Build/Compile
                $(TARGET_CONFIGURE_OPTS) \
                CFLAGS="-I$(PKG_BUILD_DIR)/wlc/include $(TARGET_CFLAGS)" \
                all
+       $(NO_TRACE_MAKE) -C compat-ldso -f build.mk PKG_INSTALL_DIR="$(PKG_BUILD_DIR)"
+       $(SED) 's,ld-uClibc.so.0,ld-uClibc.brcm,' \
+               $(PKG_BUILD_DIR)/wl \
+               $(PKG_BUILD_DIR)/nas
+endef
+
+define Package/brcm-compat-ldso/install
+       $(INSTALL_DIR) $(1)/lib
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/ld-uClibc.brcm $(1)/lib/
 endef
 
 define Package/wlc/install
@@ -152,6 +168,7 @@ endef
 
 $(eval $(call KernelPackage,brcm-wl))
 $(eval $(call KernelPackage,brcm-wl-mimo))
+$(eval $(call BuildPackage,brcm-compat-ldso))
 $(eval $(call BuildPackage,wlc))
 $(eval $(call BuildPackage,wl))
 $(eval $(call BuildPackage,nas))
diff --git a/package/broadcom-wl/compat-ldso/build.mk b/package/broadcom-wl/compat-ldso/build.mk
new file mode 100644 (file)
index 0000000..53598ae
--- /dev/null
@@ -0,0 +1,49 @@
+# 
+# Copyright (C) 2006 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+include $(TOPDIR)/rules.mk
+include $(INCLUDE_DIR)/target.mk
+
+PKG_NAME:=brcm-compat-ldso
+PKG_VERSION:=0.9.28
+PKG_EXTRAVERSION:=.2
+
+PKG_SOURCE:=uClibc-$(PKG_VERSION)$(PKG_EXTRAVERSION).tar.bz2
+PKG_SOURCE_URL:=http://www.uclibc.org/downloads
+PKG_MD5SUM:=959f25286e317f0d9e2103445c5a14c2
+PKG_CAT:=bzcat
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/brcm-compat/uClibc-$(PKG_VERSION)$(PKG_EXTRAVERSION)
+
+include $(INCLUDE_DIR)/package.mk
+
+UCLIBC_TARGET_ARCH:=mipsel
+
+define Build/Configure
+       $(CP) config $(PKG_BUILD_DIR)/.config
+       $(SED) 's,^KERNEL_SOURCE=.*,KERNEL_SOURCE=\"$(LINUX_HEADERS_DIR)\",g' \
+               -e 's,.*HAS_FPU.*,HAS_FPU=$(if $(CONFIG_SOFT_FLOAT),n\nUCLIBC_HAS_FLOATS=y\nUCLIBC_HAS_SOFT_FLOAT=y,n),g' \
+               -e 's,^.*UCLIBC_HAS_LFS.*,UCLIBC_HAS_LFS=$(if $(CONFIG_LARGEFILE),y,n),g' \
+               -e 's,.*DO_C99_MATH.*,DO_C99_MATH=$(if $(CONFIG_C99_MATH),y,n),g' \
+               $(PKG_BUILD_DIR)/.config
+endef
+
+UCLIBC_MAKE := PATH=$(TARGET_PATH) $(MAKE) -C $(PKG_BUILD_DIR) \
+               DEVEL_PREFIX=/ \
+               RUNTIME_PREFIX=/ \
+               HOSTCC="$(HOSTCC)" \
+               CPU_CFLAGS="$(TARGET_CFLAGS)"
+
+define Build/Compile
+       $(SED) 's,^CROSS=.*,CROSS=$(TARGET_CROSS),g' $(PKG_BUILD_DIR)/Rules.mak
+       $(UCLIBC_MAKE) PREFIX= pregen all
+endef
+
+define Build/InstallDev
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/ld-uClibc.so.0 $(PKG_INSTALL_DIR)/ld-uClibc.brcm
+endef
+
+$(eval $(call Build/DefaultTargets))
diff --git a/package/broadcom-wl/compat-ldso/config b/package/broadcom-wl/compat-ldso/config
new file mode 100644 (file)
index 0000000..ca9184d
--- /dev/null
@@ -0,0 +1,171 @@
+# 
+# Copyright (C) 2006 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+#
+# Automatically generated make config: don't edit
+#
+# TARGET_alpha is not set
+# TARGET_arm is not set
+# TARGET_avr32 is not set
+# TARGET_bfin is not set
+# TARGET_cris is not set
+# TARGET_e1 is not set
+# TARGET_frv is not set
+# TARGET_h8300 is not set
+# TARGET_i386 is not set
+# TARGET_i960 is not set
+# TARGET_m68k is not set
+# TARGET_microblaze is not set
+TARGET_mips=y
+# TARGET_nios is not set
+# TARGET_nios2 is not set
+# TARGET_powerpc is not set
+# TARGET_sh is not set
+# TARGET_sh64 is not set
+# TARGET_sparc is not set
+# TARGET_v850 is not set
+# TARGET_x86_64 is not set
+
+#
+# Target Architecture Features and Options
+#
+HAVE_ELF=y
+ARCH_SUPPORTS_LITTLE_ENDIAN=y
+TARGET_ARCH="mips"
+ARCH_CFLAGS="-mno-split-addresses"
+ARCH_SUPPORTS_BIG_ENDIAN=y
+# CONFIG_MIPS_ISA_1 is not set
+# CONFIG_MIPS_ISA_2 is not set
+# CONFIG_MIPS_ISA_3 is not set
+# CONFIG_MIPS_ISA_4 is not set
+CONFIG_MIPS_ISA_MIPS32=y
+# CONFIG_MIPS_ISA_MIPS64 is not set
+ARCH_LITTLE_ENDIAN=y
+# ARCH_BIG_ENDIAN is not set
+# ARCH_HAS_NO_MMU is not set
+ARCH_HAS_MMU=y
+UCLIBC_HAS_FLOATS=y
+HAS_FPU=y
+# DO_C99_MATH is not set
+KERNEL_SOURCE="./toolchain_build_mipsel/linux"
+C_SYMBOL_PREFIX=""
+HAVE_DOT_CONFIG=y
+
+#
+# General Library Settings
+#
+# HAVE_NO_PIC is not set
+DOPIC=y
+# HAVE_NO_SHARED is not set
+HAVE_SHARED=y
+# ARCH_HAS_NO_LDSO is not set
+BUILD_UCLIBC_LDSO=y
+# FORCE_SHAREABLE_TEXT_SEGMENTS is not set
+LDSO_LDD_SUPPORT=y
+LDSO_CACHE_SUPPORT=y
+# LDSO_PRELOAD_FILE_SUPPORT is not set
+LDSO_BASE_FILENAME="ld.so"
+LDSO_RUNPATH=y
+DL_FINI_CRT_COMPAT=y
+UCLIBC_CTOR_DTOR=y
+# HAS_NO_THREADS is not set
+UCLIBC_HAS_THREADS=y
+# PTHREADS_DEBUG_SUPPORT is not set
+UCLIBC_HAS_LFS=y
+# UCLIBC_STATIC_LDCONFIG is not set
+# MALLOC is not set
+# MALLOC_SIMPLE is not set
+MALLOC_STANDARD=y
+MALLOC_GLIBC_COMPAT=y
+UCLIBC_DYNAMIC_ATEXIT=y
+HAS_SHADOW=y
+# UNIX98PTY_ONLY is not set
+ASSUME_DEVPTS=y
+UCLIBC_HAS_TM_EXTENSIONS=y
+UCLIBC_HAS_TZ_CACHING=y
+UCLIBC_HAS_TZ_FILE=y
+UCLIBC_HAS_TZ_FILE_READ_MANY=y
+UCLIBC_TZ_FILE_PATH="/etc/TZ"
+
+#
+# Networking Support
+#
+UCLIBC_HAS_IPV6=y
+UCLIBC_HAS_RPC=y
+UCLIBC_HAS_FULL_RPC=y
+
+#
+# String and Stdio Support
+#
+UCLIBC_HAS_STRING_GENERIC_OPT=y
+UCLIBC_HAS_STRING_ARCH_OPT=y
+UCLIBC_HAS_CTYPE_TABLES=y
+UCLIBC_HAS_CTYPE_SIGNED=y
+# UCLIBC_HAS_CTYPE_UNSAFE is not set
+UCLIBC_HAS_CTYPE_CHECKED=y
+# UCLIBC_HAS_CTYPE_ENFORCED is not set
+UCLIBC_HAS_WCHAR=y
+# UCLIBC_HAS_LOCALE is not set
+UCLIBC_HAS_HEXADECIMAL_FLOATS=y
+UCLIBC_HAS_GLIBC_CUSTOM_PRINTF=y
+UCLIBC_PRINTF_SCANF_POSITIONAL_ARGS=9
+UCLIBC_HAS_SCANF_GLIBC_A_FLAG=y
+# UCLIBC_HAS_STDIO_BUFSIZ_NONE is not set
+# UCLIBC_HAS_STDIO_BUFSIZ_256 is not set
+# UCLIBC_HAS_STDIO_BUFSIZ_512 is not set
+# UCLIBC_HAS_STDIO_BUFSIZ_1024 is not set
+# UCLIBC_HAS_STDIO_BUFSIZ_2048 is not set
+UCLIBC_HAS_STDIO_BUFSIZ_4096=y
+# UCLIBC_HAS_STDIO_BUFSIZ_8192 is not set
+UCLIBC_HAS_STDIO_BUILTIN_BUFFER_NONE=y
+# UCLIBC_HAS_STDIO_BUILTIN_BUFFER_4 is not set
+# UCLIBC_HAS_STDIO_BUILTIN_BUFFER_8 is not set
+# UCLIBC_HAS_STDIO_SHUTDOWN_ON_ABORT is not set
+UCLIBC_HAS_STDIO_GETC_MACRO=y
+UCLIBC_HAS_STDIO_PUTC_MACRO=y
+UCLIBC_HAS_STDIO_AUTO_RW_TRANSITION=y
+# UCLIBC_HAS_FOPEN_LARGEFILE_MODE is not set
+UCLIBC_HAS_FOPEN_EXCLUSIVE_MODE=y
+UCLIBC_HAS_GLIBC_CUSTOM_STREAMS=y
+UCLIBC_HAS_PRINTF_M_SPEC=y
+UCLIBC_HAS_ERRNO_MESSAGES=y
+# UCLIBC_HAS_SYS_ERRLIST is not set
+UCLIBC_HAS_SIGNUM_MESSAGES=y
+# UCLIBC_HAS_SYS_SIGLIST is not set
+UCLIBC_HAS_GNU_GETOPT=y
+
+#
+# Big and Tall
+#
+UCLIBC_HAS_REGEX=y
+UCLIBC_HAS_WORDEXP=y
+UCLIBC_HAS_FTW=y
+UCLIBC_HAS_GLOB=y
+
+#
+# Library Installation Options
+#
+SHARED_LIB_LOADER_PREFIX="/lib"
+RUNTIME_PREFIX="/"
+DEVEL_PREFIX="/usr/"
+
+#
+# uClibc security related options
+#
+# UCLIBC_SECURITY is not set
+
+#
+# uClibc development/debugging options
+#
+CROSS_COMPILER_PREFIX=""
+# DODEBUG is not set
+# DODEBUG_PT is not set
+# DOASSERTS is not set
+# SUPPORT_LD_DEBUG is not set
+# SUPPORT_LD_DEBUG_EARLY is not set
+WARNINGS="-Wall"
+# UCLIBC_MJN3_ONLY is not set
diff --git a/package/broadcom-wl/compat-ldso/patches/100-start_main.patch b/package/broadcom-wl/compat-ldso/patches/100-start_main.patch
new file mode 100644 (file)
index 0000000..5f4c0d5
--- /dev/null
@@ -0,0 +1,66 @@
+Index: uClibc-0.9.28.2/ldso/ldso/dl-hash.c
+===================================================================
+--- uClibc-0.9.28.2.orig/ldso/ldso/dl-hash.c   2007-11-09 03:35:13.193591913 +0100
++++ uClibc-0.9.28.2/ldso/ldso/dl-hash.c        2007-11-09 03:52:41.713343652 +0100
+@@ -124,6 +124,15 @@
+       return tpnt;
+ }
++void (*__uClibc_main)(void *main, int argc, char **argv, void (*app_init)(void), void (*app_fini)(void), void *, void *) = NULL;
++int (*main)(int argc, char **argv, char **envp) = NULL;
++void
++__uClibc_start_main(int argc, char **argv, char **envp,
++            void (*app_fini)(void), void (*app_init)(void))
++{
++    __uClibc_main(main, argc, argv, app_init, app_fini, NULL, NULL);
++}
++
+ /*
+  * This function resolves externals, and this is either called when we process
+@@ -139,6 +148,12 @@
+       const ElfW(Sym) *sym;
+       char *weak_result = NULL;
++      if (_dl_strcmp(name, "__uClibc_start_main") == 0) {
++              main = _dl_find_hash("main", rpnt, mytpnt, type_class);
++              __uClibc_main = _dl_find_hash("__uClibc_main", rpnt, mytpnt, type_class);
++              return (char *) &__uClibc_start_main;
++      }
++
+       elf_hash_number = _dl_elf_hash(name);
+       for (; rpnt; rpnt = rpnt->next) {
+Index: uClibc-0.9.28.2/Makefile
+===================================================================
+--- uClibc-0.9.28.2.orig/Makefile      2007-11-09 03:54:20.814991133 +0100
++++ uClibc-0.9.28.2/Makefile   2007-11-09 03:58:56.346692786 +0100
+@@ -28,10 +28,7 @@
+ TOPDIR=./
+ include Rules.mak
+-DIRS = ldso libc libcrypt libresolv libnsl libutil libm libpthread librt
+-ifeq ($(strip $(UCLIBC_HAS_GETTEXT_AWARENESS)),y)
+-      DIRS += libintl
+-endif
++DIRS = ldso
+ ifeq ($(strip $(HAVE_DOT_CONFIG)),y)
+@@ -47,16 +44,6 @@
+       $(SECHO)
+       @$(MAKE) -C libc shared
+       @$(MAKE) -C ldso shared
+-      @$(MAKE) -C libcrypt shared
+-      @$(MAKE) -C libresolv shared
+-      @$(MAKE) -C libnsl shared
+-      @$(MAKE) -C libutil shared
+-      @$(MAKE) -C libm shared
+-      @$(MAKE) -C libpthread shared
+-      @$(MAKE) -C librt shared
+-ifeq ($(strip $(UCLIBC_HAS_GETTEXT_AWARENESS)),y)
+-      @$(MAKE) -C libintl shared
+-endif
+ else
+       $(SECHO)
+       $(SECHO) Not building shared libraries ...
index 47c13bf..2ae77d3 100644 (file)
@@ -70,7 +70,7 @@ LDSO_CACHE_SUPPORT=y
 # LDSO_PRELOAD_FILE_SUPPORT is not set
 LDSO_BASE_FILENAME="ld.so"
 LDSO_RUNPATH=y
-DL_FINI_CRT_COMPAT=y
+# DL_FINI_CRT_COMPAT is not set
 UCLIBC_CTOR_DTOR=y
 # HAS_NO_THREADS is not set
 UCLIBC_HAS_THREADS=y
index ca9184d..a8de762 100644 (file)
@@ -70,7 +70,7 @@ LDSO_CACHE_SUPPORT=y
 # LDSO_PRELOAD_FILE_SUPPORT is not set
 LDSO_BASE_FILENAME="ld.so"
 LDSO_RUNPATH=y
-DL_FINI_CRT_COMPAT=y
+# DL_FINI_CRT_COMPAT is not set
 UCLIBC_CTOR_DTOR=y
 # HAS_NO_THREADS is not set
 UCLIBC_HAS_THREADS=y
index dc43e06..2b42ecd 100644 (file)
@@ -68,7 +68,7 @@ LDSO_CACHE_SUPPORT=y
 # LDSO_PRELOAD_FILE_SUPPORT is not set
 LDSO_BASE_FILENAME="ld.so"
 LDSO_RUNPATH=y
-DL_FINI_CRT_COMPAT=y
+# DL_FINI_CRT_COMPAT is not set
 UCLIBC_CTOR_DTOR=y
 # HAS_NO_THREADS is not set
 UCLIBC_HAS_THREADS=y