Skip to contentSkip to conversation

BINFMT_FLAT_SHARED: is not really shared for buildroot purposes

PATCH New Arnout Vandecappelle (Essensium/Mind) 2 participants 2 messages Mar 27, 2015 – Mar 30, 2015

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 BINFMT_FLAT_SHARED: is not really shared for buildroot purposes

From: Sonic Zhang <[email protected]>

Although BINFMT_FLAT_SHARED is indeed a shared library format, it does not support dynamic library loading with dlopen(). So for buildroot purposes, BR2_STATIC_LIBS shouldn't be selected.

As it happens, the compiler options that are added for BINFMT_FLAT_SHARED also make the compiler ignore the -static option, so we can simply force BR2_STATIC_LIBS and things work out perfectly.

Therefore, remove the select of BR2_BINFMT_SUPPORTS_SHARED from BINFMT_FLAT_SHARED, which in turn makes sure that BR2_STATIC_LIBS is selected.

[Arnout: rewrite commit message, add explanatory comment]

---
v3 (Arnout): Remove accidentally added unrelated part.

v2 (Arnout): rewrite commit message, add explanatory comment.

---
 arch/Config.in | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
arch/Config.in +6 -1
index 16ad8be..59bf84a 100644
@@ -295,7 +295,12 @@ config BR2_BINFMT_FLAT_SEP_DATA
 
 config BR2_BINFMT_FLAT_SHARED
 	bool "Shared binary"
-	select BR2_BINFMT_SUPPORTS_SHARED
+	# Even though this really generates shared binaries, there is no libdl
+	# and dlopen() cannot be used. So packages that require shared
+	# libraries cannot be built. Therefore, we don't select
+	# BR2_BINFMT_SUPPORTS_SHARED and therefore force BR2_STATIC_LIBS.
+	# Although this adds -static to the compilation, that's not a problem
+	# because the -mid-shared-library option overrides it.
 	help
 	  Allow to load and link indiviual FLAT binaries at run time.
 
Signature · 1 line
2.1.4
#1 lore raw

PATCH v3 1/1 BINFMT_FLAT_SHARED: is not really shared for buildroot purposes

Dear Arnout Vandecappelle (Essensium/Mind),

Quoted 10 lines · Arnout Vandecappelle (Essensium/Mind)

From: Sonic Zhang <[email protected]>

Although BINFMT_FLAT_SHARED is indeed a shared library format, it does not support dynamic library loading with dlopen(). So for buildroot purposes, BR2_STATIC_LIBS shouldn't be selected.

As it happens, the compiler options that are added for BINFMT_FLAT_SHARED also make the compiler ignore the -static option, so we can simply force BR2_STATIC_LIBS and things work out perfectly.

Quoted 8 lines

Therefore, remove the select of BR2_BINFMT_SUPPORTS_SHARED from BINFMT_FLAT_SHARED, which in turn makes sure that BR2_STATIC_LIBS is selected.

[Arnout: rewrite commit message, add explanatory comment]

Applied, thanks.

Thomas

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