Skip to contentSkip to conversation

infra: BR2_PREFER_STATIC_LIB now selects static building of packages

PATCH New Alexey Brodkin 3 participants 3 messages Oct 12, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 infra: BR2_PREFER_STATIC_LIB now selects static building of packages

With time BR2_PREFER_STATIC_LIB option meaning changed from "prefer static libs when possible" to "do not build dynamic libs and build statically linked applications".

This patch changes variable description and takes care of uClibc settings so it doesn't build shared libs.

Note that variable name is kept unchanged on purpose - it will be modified later when real "prefer static" mode will be introduced.

Cc Thomas Petazzoni <[email protected]>
Cc Gustavo Zacarias <[email protected]>
Cc Peter Korsgaard <[email protected]>
---
 Config.in                             | 14 ++++++++------
 package/uclibc/uClibc-0.9.31.config   |  1 -
 package/uclibc/uClibc-0.9.33.config   |  1 -
 package/uclibc/uClibc-snapshot.config |  1 -
 package/uclibc/uclibc.mk              | 11 +++++++++++
 5 files changed, 19 insertions(+), 9 deletions(-)
Config.in +8 -6
index 24aa883..e58dae6 100644
@@ -536,15 +536,17 @@ comment "enabling Stack Smashing Protection requires support in the toolchain"
 	depends on !BR2_TOOLCHAIN_HAS_SSP
 
 config BR2_PREFER_STATIC_LIB
-	bool "prefer static libraries"
+	bool "build statically linked applications, no dynamic libraries"
 	help
-	  Where possible, build and use static libraries for the target.
-	  This potentially increases your code size and should only be
+	  Build all application for the target statically linked.
+	  This potentially increases your filesystem size and should only be
 	  used if you know what you do.
-	  The default is to build dynamic libraries and use those on
-	  the target filesystem.
 
-	  WARNING: This is highly experimental at the moment.
+	  Note that some applications cannot be build statically and so are
+	  intentionally disabled.
+
+	  The default is to build dynamic libraries and dynamically linked
+	  applications to use those on the target filesystem.
 
 config BR2_PACKAGE_OVERRIDE_FILE
 	string "location of a package override file"
package/uclibc/uClibc-0.9.31.config +0 -1
index b23ba73..76772e8 100644
@@ -61,7 +61,6 @@ HAVE_DOT_CONFIG=y
 DOPIC=y
 # ARCH_HAS_NO_SHARED is not set
 # ARCH_HAS_NO_LDSO is not set
-HAVE_SHARED=y
 # FORCE_SHAREABLE_TEXT_SEGMENTS is not set
 LDSO_LDD_SUPPORT=y
 # LDSO_CACHE_SUPPORT is not set
package/uclibc/uClibc-0.9.33.config +0 -1
index 0fbce19..1b07d4a 100644
@@ -83,7 +83,6 @@ HAVE_DOT_CONFIG=y
 DOPIC=y
 # ARCH_HAS_NO_SHARED is not set
 # ARCH_HAS_NO_LDSO is not set
-HAVE_SHARED=y
 # FORCE_SHAREABLE_TEXT_SEGMENTS is not set
 LDSO_LDD_SUPPORT=y
 # LDSO_CACHE_SUPPORT is not set
package/uclibc/uClibc-snapshot.config +0 -1
index 11dde03..1f04561 100644
@@ -85,7 +85,6 @@ HAVE_DOT_CONFIG=y
 DOPIC=y
 # ARCH_HAS_NO_SHARED is not set
 # ARCH_HAS_NO_LDSO is not set
-HAVE_SHARED=y
 # FORCE_SHAREABLE_TEXT_SEGMENTS is not set
 LDSO_LDD_SUPPORT=y
 # LDSO_CACHE_SUPPORT is not set
package/uclibc/uclibc.mk +11 -0
index 4e09b31..5b83c74 100644
@@ -395,6 +395,16 @@ UCLIBC_WCHAR_CONFIG = $(call KCONFIG_DISABLE_OPT,UCLIBC_HAS_WCHAR,$(@D)/.config)
 endif
 
 #
+# static/shared libs
+#
+
+ifeq ($(BR2_PREFER_STATIC_LIB),y)
+UCLIBC_SHARED_LIBS_CONFIG = $(call KCONFIG_DISABLE_OPT,HAVE_SHARED,$(@D)/.config)
+else
+UCLIBC_SHARED_LIBS_CONFIG = $(call KCONFIG_ENABLE_OPT,HAVE_SHARED,$(@D)/.config)
+endif
+
+#
 # Commands
 #
 
@@ -434,6 +444,7 @@ define UCLIBC_KCONFIG_FIXUP_CMDS
 	$(UCLIBC_THREAD_DEBUG_CONFIG)
 	$(UCLIBC_LOCALE_CONFIG)
 	$(UCLIBC_WCHAR_CONFIG)
+	$(UCLIBC_SHARED_LIBS_CONFIG)
 endef
 
 ifeq ($(BR2_UCLIBC_INSTALL_TEST_SUITE),y)
Signature · 1 line
1.9.3
#1 lore raw

PATCH 1/1 infra: BR2_PREFER_STATIC_LIB now selects static building of packages

Dear Alexey Brodkin,

Quoted 15 lines · Alexey Brodkin

With time BR2_PREFER_STATIC_LIB option meaning changed from "prefer static libs when possible" to "do not build dynamic libs and build statically linked applications".

This patch changes variable description and takes care of uClibc settings so it doesn't build shared libs.

Note that variable name is kept unchanged on purpose - it will be modified later when real "prefer static" mode will be introduced.

Cc Thomas Petazzoni <[email protected]>
Cc Gustavo Zacarias <[email protected]>
Cc Peter Korsgaard <[email protected]>
Quoted 7 lines
---
 Config.in                             | 14 ++++++++------
 package/uclibc/uClibc-0.9.31.config   |  1 -
 package/uclibc/uClibc-0.9.33.config   |  1 -
 package/uclibc/uClibc-snapshot.config |  1 -
 package/uclibc/uclibc.mk              | 11 +++++++++++
 5 files changed, 19 insertions(+), 9 deletions(-)

This should definitely be two separate patches. One updating the BR2_PREFER_STATIC_LIB description, and one making sure that uClibc obeys to the correct semantic of BR2_PREFER_STATIC_LIB.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#2 lore raw

PATCH 1/1 infra: BR2_PREFER_STATIC_LIB now selects static building of packages

In reply to Alexey Brodkin

Alexey, All,

On 2014-10-12 17:34 +0200, Alexey Brodkin spake thusly:

Quoted 11 lines

With time BR2_PREFER_STATIC_LIB option meaning changed from "prefer static libs when possible" to "do not build dynamic libs and build statically linked applications".

This patch changes variable description and takes care of uClibc settings so it doesn't build shared libs.

Note that variable name is kept unchanged on purpose - it will be modified later when real "prefer static" mode will be introduced.

Besides what Thomas said, small typo, see below...

Quoted 16 lines
Cc Thomas Petazzoni <[email protected]>
Cc Gustavo Zacarias <[email protected]>
Cc Peter Korsgaard <[email protected]>
---
 Config.in                             | 14 ++++++++------
 package/uclibc/uClibc-0.9.31.config   |  1 -
 package/uclibc/uClibc-0.9.33.config   |  1 -
 package/uclibc/uClibc-snapshot.config |  1 -
 package/uclibc/uclibc.mk              | 11 +++++++++++
 5 files changed, 19 insertions(+), 9 deletions(-)
Config.in +0 -0
index 24aa883..e58dae6 100644

Config.in comment "enabling Stack Smashing Protection requires support in the toolchain" · line 541

Quoted 9 lines
Config.in +2 -3
@@ -536,15 +536,17 @@ comment "enabling Stack Smashing Protection requires support in the toolchain"
 	depends on !BR2_TOOLCHAIN_HAS_SSP
 
 config BR2_PREFER_STATIC_LIB
-	bool "prefer static libraries"
+	bool "build statically linked applications, no dynamic libraries"
 	help
-	  Where possible, build and use static libraries for the target.
-	  This potentially increases your code size and should only be
+	  Build all application for the target statically linked.

... all application_s_ ...

Quoted 86 lines
Config.in +6 -3
+	  This potentially increases your filesystem size and should only be
 	  used if you know what you do.
-	  The default is to build dynamic libraries and use those on
-	  the target filesystem.
 
-	  WARNING: This is highly experimental at the moment.
+	  Note that some applications cannot be build statically and so are
+	  intentionally disabled.
+
+	  The default is to build dynamic libraries and dynamically linked
+	  applications to use those on the target filesystem.
 
 config BR2_PACKAGE_OVERRIDE_FILE
 	string "location of a package override file"
package/uclibc/uClibc-0.9.31.config +0 -1
index b23ba73..76772e8 100644
@@ -61,7 +61,6 @@ HAVE_DOT_CONFIG=y
 DOPIC=y
 # ARCH_HAS_NO_SHARED is not set
 # ARCH_HAS_NO_LDSO is not set
-HAVE_SHARED=y
 # FORCE_SHAREABLE_TEXT_SEGMENTS is not set
 LDSO_LDD_SUPPORT=y
 # LDSO_CACHE_SUPPORT is not set
package/uclibc/uClibc-0.9.33.config +0 -1
index 0fbce19..1b07d4a 100644
@@ -83,7 +83,6 @@ HAVE_DOT_CONFIG=y
 DOPIC=y
 # ARCH_HAS_NO_SHARED is not set
 # ARCH_HAS_NO_LDSO is not set
-HAVE_SHARED=y
 # FORCE_SHAREABLE_TEXT_SEGMENTS is not set
 LDSO_LDD_SUPPORT=y
 # LDSO_CACHE_SUPPORT is not set
package/uclibc/uClibc-snapshot.config +0 -1
index 11dde03..1f04561 100644
@@ -85,7 +85,6 @@ HAVE_DOT_CONFIG=y
 DOPIC=y
 # ARCH_HAS_NO_SHARED is not set
 # ARCH_HAS_NO_LDSO is not set
-HAVE_SHARED=y
 # FORCE_SHAREABLE_TEXT_SEGMENTS is not set
 LDSO_LDD_SUPPORT=y
 # LDSO_CACHE_SUPPORT is not set
package/uclibc/uclibc.mk +11 -0
index 4e09b31..5b83c74 100644
@@ -395,6 +395,16 @@ UCLIBC_WCHAR_CONFIG = $(call KCONFIG_DISABLE_OPT,UCLIBC_HAS_WCHAR,$(@D)/.config)
 endif
 
 #
+# static/shared libs
+#
+
+ifeq ($(BR2_PREFER_STATIC_LIB),y)
+UCLIBC_SHARED_LIBS_CONFIG = $(call KCONFIG_DISABLE_OPT,HAVE_SHARED,$(@D)/.config)
+else
+UCLIBC_SHARED_LIBS_CONFIG = $(call KCONFIG_ENABLE_OPT,HAVE_SHARED,$(@D)/.config)
+endif
+
+#
 # Commands
 #
 
@@ -434,6 +444,7 @@ define UCLIBC_KCONFIG_FIXUP_CMDS
 	$(UCLIBC_THREAD_DEBUG_CONFIG)
 	$(UCLIBC_LOCALE_CONFIG)
 	$(UCLIBC_WCHAR_CONFIG)
+	$(UCLIBC_SHARED_LIBS_CONFIG)
 endef
 
 ifeq ($(BR2_UCLIBC_INSTALL_TEST_SUITE),y)
Signature · 6 lines
1.9.3

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'