Skip to content

Commit 3c9d02d

Browse files
Don't build shared libopcodes for uClibc toolchain
There was a discrepancy between baremetal and Linux/uClibc toolchains. Linux/uClibc toolchain had opcodes and bfd built as shared libraries, but baremeatl had them linked statically into their users. Practically that meant that location of those libraries should have been added too the LD_LIBRARY_PATH for Linux/uClibc toolchain, while baremetal toolchain worked just fine. Otherwise things worked just fine on Linux hosts. However on macOS I've encountered a weird problem, where those dynamic libraries would fail to load, complaining that symbols related to gettext/libintl cann't be resolved. libintl itself is built as a static library, and presumably there are some issues here on macOS. I've been too confused by macOS development tools to understand better what exactly goes wrong there. Solution is fairly obvious - make those libraries static, similarly to baremetal toolchain. The original discrepancy has been caused by different values of --enable-shared/--disable-shared used for baremetal and Linux/uClibc. As far as I understand (I could be wrong here), value of -shared is used by both libraries built for host and libraries built for target. Historically ARC build scripts pass the value that is desired for the target libraries - baremetal toolchain is static-only, Linux/uClibc should use shared libraries. However, that was also affecting the host libraries. To avoid discrepancy, with this patch build scripts now will pass --disable-shared option to binutils configure script, thus making sure that binutils doesn't produce undesired shared libraries. Signed-off-by: Anton Kolesov <[email protected]>
1 parent 7f6f62d commit 3c9d02d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

build-uclibc.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,8 +337,15 @@ fi
337337

338338
# -----------------------------------------------------------------------------
339339
# Build Binutils - will be used by both state 1 and stage2
340+
# Note the --disable-shared option. It is used here, because binutils libraries
341+
# shouldn't be build as dynamic libs (this causes issues on macOS), however the
342+
# target libraries should be built as shared ones. But as far as I see same
343+
# option is used for both host and target, so --enable-shared should be used
344+
# for components that build target libraries (like gcc and libgcc), but
345+
# shouldn't be used for binutils, since it doesn't has target libraries and is
346+
# known to have troubles when shared libraries are used.
340347
build_dir_init binutils
341-
configure_uclibc_stage2 binutils binutils --disable-gdb
348+
configure_uclibc_stage2 binutils binutils --disable-gdb --disable-shared
342349
make_target building all
343350

344351
# Gas requires opcodes to be installed, LD requires BFD to be installed.

0 commit comments

Comments
 (0)