Skip to contentSkip to conversation

toolchain-external: fix support of uClibc-ng toolchains

PATCH New Thomas Petazzoni 2 participants 2 messages Jul 13, 2015 – Jul 14, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 toolchain-external: fix support of uClibc-ng toolchains

The uClibc-ng dynamic loader is called ld-uClibc.so.1, but gcc is not patched specifically for uClibc-ng, so it continues to generate binaries that expect the dynamic loader to be named ld-uClibc.so.0, like with the original uClibc.

Therefore, when a uClibc-ng toolchain is used as an external toolchain, we need to create an additional symbolic link to make uClibc-ng systems work properly.

---
 toolchain/toolchain-external/toolchain-external.mk | 12 ++++++++++++
 1 file changed, 12 insertions(+)
toolchain/toolchain-external/toolchain-external.mk +12 -0
index 070f068..e6ad4c6 100644
@@ -710,6 +710,17 @@ define TOOLCHAIN_EXTERNAL_INSTALL_GDBINIT
 	fi
 endef
 
+# uClibc-ng dynamic loader is called ld-uClibc.so.1, but gcc is not
+# patched specifically for uClibc-ng, so it continues to generate
+# binaries that expect the dynamic loader to be named ld-uClibc.so.0,
+# like with the original uClibc. Therefore, we create an additional
+# symbolic link to make uClibc-ng systems work properly.
+define TOOLCHAIN_EXTERNAL_FIXUP_UCLIBCNG_LDSO
+	if test -L $(TARGET_DIR)/lib/ld-uClibc.so.1; then \
+		ln -s ld-uClibc.so.1 $(TARGET_DIR)/lib/ld-uClibc.so.0 ; \
+	fi
+endef
+
 define TOOLCHAIN_EXTERNAL_INSTALL_STAGING_CMDS
 	$(TOOLCHAIN_EXTERNAL_INSTALL_SYSROOT_LIBS)
 	$(TOOLCHAIN_EXTERNAL_INSTALL_WRAPPER)
@@ -723,6 +734,7 @@ define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_CMDS
 	$(TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBS)
 	$(TOOLCHAIN_EXTERNAL_INSTALL_BFIN_FDPIC)
 	$(TOOLCHAIN_EXTERNAL_INSTALL_BFIN_FLAT)
+	$(TOOLCHAIN_EXTERNAL_FIXUP_UCLIBCNG_LDSO)
 endef
 
 $(eval $(generic-package))
Signature · 1 line
2.4.5
#1 lore raw

PATCH 1/1 toolchain-external: fix support of uClibc-ng toolchains

On 2015-07-13 12:56 +0200, Thomas Petazzoni spake thusly:

Quoted 19 lines

The uClibc-ng dynamic loader is called ld-uClibc.so.1, but gcc is not patched specifically for uClibc-ng, so it continues to generate binaries that expect the dynamic loader to be named ld-uClibc.so.0, like with the original uClibc.

Therefore, when a uClibc-ng toolchain is used as an external toolchain, we need to create an additional symbolic link to make uClibc-ng systems work properly.

---
 toolchain/toolchain-external/toolchain-external.mk | 12 ++++++++++++
 1 file changed, 12 insertions(+)
toolchain/toolchain-external/toolchain-external.mk +0 -0
index 070f068..e6ad4c6 100644

toolchain/toolchain-external/toolchain-external.mk define TOOLCHAIN_EXTERNAL_INSTALL_GDBINIT · line 719

Quoted 10 lines
toolchain/toolchain-external/toolchain-external.mk +7 -0
@@ -710,6 +710,17 @@ define TOOLCHAIN_EXTERNAL_INSTALL_GDBINIT
 	fi
 endef
 
+# uClibc-ng dynamic loader is called ld-uClibc.so.1, but gcc is not
+# patched specifically for uClibc-ng, so it continues to generate
+# binaries that expect the dynamic loader to be named ld-uClibc.so.0,
+# like with the original uClibc. Therefore, we create an additional
+# symbolic link to make uClibc-ng systems work properly.
+define TOOLCHAIN_EXTERNAL_FIXUP_UCLIBCNG_LDSO
+	if test -L $(TARGET_DIR)/lib/ld-uClibc.so.1; then \

Use 'test -e' to just tet for existence: we don't care if it is a symlink or a real file; we're just interested in the fact that it exists.

toolchain/toolchain-external/toolchain-external.mk define TOOLCHAIN_EXTERNAL_INSTALL_GDBINIT · line 720

Quoted 1 line
toolchain/toolchain-external/toolchain-external.mk +1 -0
+		ln -s ld-uClibc.so.1 $(TARGET_DIR)/lib/ld-uClibc.so.0 ; \

ln -sf

Regards,
Yann E. MORIN.

Quoted 21 lines
toolchain/toolchain-external/toolchain-external.mk +4 -0
+	fi
+endef
+
 define TOOLCHAIN_EXTERNAL_INSTALL_STAGING_CMDS
 	$(TOOLCHAIN_EXTERNAL_INSTALL_SYSROOT_LIBS)
 	$(TOOLCHAIN_EXTERNAL_INSTALL_WRAPPER)
@@ -723,6 +734,7 @@ define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_CMDS
 	$(TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBS)
 	$(TOOLCHAIN_EXTERNAL_INSTALL_BFIN_FDPIC)
 	$(TOOLCHAIN_EXTERNAL_INSTALL_BFIN_FLAT)
+	$(TOOLCHAIN_EXTERNAL_FIXUP_UCLIBCNG_LDSO)
 endef
 
 $(eval $(generic-package))
Signature · 6 lines
2.4.5

_______________________________________________
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.  |
'------------------------------^-------^------------------^--------------------'