toolchain: wrap 'ld' with toolchain-wrapper
PATCH v2 1/4 toolchain: wrap 'ld' with toolchain-wrapper
extend the toolchain wrapper to also wrap the ld linker.
Tested with gnu ld and gnu 'gold' BR2_BINUTILS_EXTRA_CONFIG_OPTIONS="--enable-gold=default --enable-plugins"
make host-binutils result in: (ld and ld.gold are equal) <ARCH>-buildroot-linux-uclibc-ld -> toolchain-wrapper <ARCH>-buildroot-linux-uclibc-ld.bfd <ARCH>-buildroot-linux-uclibc-ld.br_real <ARCH>-buildroot-linux-uclibc-ld.gold -> toolchain-wrapper <ARCH>-buildroot-linux-uclibc-ld.gold.br_real
<ARCH>-linux-ld -> toolchain-wrapper
<ARCH>-linux-ld.br_real -> <ARCH>-buildroot-linux-uclibc-ld.br_real <ARCH>-linux-ld.gold -> toolchain-wrapper <ARCH>-linux-ld.gold.br_real -> <ARCH>-buildroot-linux-uclibc-ld.gold.br_real toolchain-wrapper
after host-gcc-initial, toolchain-wrapper will be rebuild, but the ld symlinks remain
Based upon patch from Thomas Petazzoni:
http://thread.gmane.org/gmane.comp.lib.uclibc.buildroot/60942
--- package/binutils/binutils.mk | 23 ++++++ package/gcc/gcc-initial/gcc-initial.mk | 1 + toolchain/toolchain-external/toolchain-external.mk | 2 +- toolchain/toolchain-wrapper.c | 94 ++++++++++++++-------- 4 files changed, 85 insertions(+), 35 deletions(-)
package/binutils/binutils.mk +23 -0
@@ -82,6 +82,29 @@ HOST_BINUTILS_CONF_OPTS = \ $(BINUTILS_DISABLE_GDB_CONF_OPTS) \ $(BINUTILS_EXTRA_CONFIG_OPTIONS) +#TODO generalise this, this is in 3 places now... +HOST_BINUTILS_TOOLCHAIN_WRAPPER_ARGS += -DBR_CROSS_PATH_SUFFIX='".br_real"' +HOST_BINUTILS_POST_BUILD_HOOKS += TOOLCHAIN_BUILD_WRAPPER +HOST_BINUTILS_POST_INSTALL_HOOKS += HOST_BINUTILS_INSTALL_WRAPPER_AND_SIMPLE_SYMLINKS + +# Avoid that a .br_real is symlinked a second time. +define HOST_BINUTILS_INSTALL_WRAPPER_AND_SIMPLE_SYMLINKS + $(Q)cd $(HOST_DIR)/usr/bin; \ + for i in $(GNU_TARGET_NAME)-*; do \ + case "$$i" in \ + *.br_real) \ + ;; \ + *ld) \ + rm -f $$i.br_real; \ + mv $$i $$i.br_real; \ + ln -sf toolchain-wrapper $$i; \ + ln -sf toolchain-wrapper $(ARCH)-linux$${i##$(GNU_TARGET_NAME)}; \ + ln -snf $$i.br_real $(ARCH)-linux$${i##$(GNU_TARGET_NAME)}.br_real; \ + ;; \ + esac; \ + done +endef + # binutils run configure script of subdirs at make time, so ensure # our TARGET_CONFIGURE_ARGS are taken into consideration for those define BINUTILS_BUILD_CMDS
package/gcc/gcc-initial/gcc-initial.mk +1 -0
@@ -60,6 +60,7 @@ HOST_GCC_INITIAL_MAKE_OPTS += all-target-libgcc HOST_GCC_INITIAL_INSTALL_OPTS += install-target-libgcc endif +#rebuild the toolchain-wrapper (e.g. for ccache) already build once in binutils HOST_GCC_INITIAL_TOOLCHAIN_WRAPPER_ARGS += $(HOST_GCC_COMMON_TOOLCHAIN_WRAPPER_ARGS) HOST_GCC_INITIAL_POST_BUILD_HOOKS += TOOLCHAIN_BUILD_WRAPPER HOST_GCC_INITIAL_POST_INSTALL_HOOKS += HOST_GCC_INSTALL_WRAPPER_AND_SIMPLE_SYMLINKS
toolchain/toolchain-external/toolchain-external.mk +1 -1
@@ -741,7 +741,7 @@ define TOOLCHAIN_EXTERNAL_INSTALL_WRAPPER *-ar|*-ranlib|*-nm) \ ln -sf $$(echo $$i | sed 's%^$(HOST_DIR)%../..%') .; \ ;; \ - *cc|*cc-*|*++|*++-*|*cpp) \ + *cc|*cc-*|*++|*++-*|*cpp|*ld) \ ln -sf toolchain-wrapper $$base; \ ;; \ *gdb|*gdbtui) \
toolchain/toolchain-wrapper.c +60 -34
161 lines not on this page · raw message
Signature · 1 line
2.5.0
PATCH v2 2/4 toolchain: add option to specify ld emulation
On some architectures, such as MIPS, the linker supports several 'ld emulation', and depending on which flavor of the architecture you're building for, one should be passing the proper -m <something> option to ld, otherwise ld defaults to the default emulation, which may not necessarily be compatible with the object files that are being linked.
Add this new option to the ld toolchain-wrapper.
Based upon patch from Thomas Petazzoni:
http://thread.gmane.org/gmane.comp.lib.uclibc.buildroot/60942
--- arch/Config.in | 3 +++ toolchain/toolchain-wrapper.c | 3 +++ toolchain/toolchain-wrapper.mk | 5 +++++ 3 files changed, 11 insertions(+)
arch/Config.in +3 -0
@@ -265,6 +265,9 @@ config BR2_GCC_TARGET_CPU config BR2_GCC_TARGET_CPU_REVISION string +config BR2_LD_TARGET_EMULATION + string + # The value of this option will be passed as --with-fpu=<value> when # building gcc (internal backend) or -mfpu=<value> in the toolchain # wrapper (external toolchain)
toolchain/toolchain-wrapper.c +3 -0
@@ -82,6 +82,9 @@ static char *gcc_predef_args[] = {static char *ld_predef_args[] = { path, +#ifdef BR_LD_EMULATION +"-m" ,BR_LD_EMULATION , +#endif #ifdef BR_BINFMT_FLAT"-elf2flt" , #endif
toolchain/toolchain-wrapper.mk +5 -0
@@ -30,6 +30,11 @@ ifeq ($(BR2_CCACHE_USE_BASEDIR),y) TOOLCHAIN_WRAPPER_ARGS += -DBR_CCACHE_BASEDIR='"$(BASE_DIR)"' endif +LD_TARGET_EMULATION_ = $(call qstrip,$(BR2_LD_TARGET_EMULATION)) +ifneq ($(LD_TARGET_EMULATION_),) +TOOLCHAIN_WRAPPER_ARGS += -DBR_LD_EMULATION='"$(LD_TARGET_EMULATION_)"' +endif + # For simplicity, build directly into the install location define TOOLCHAIN_BUILD_WRAPPER $(Q)mkdir -p $(HOST_DIR)/usr/bin
Signature · 1 line
2.5.0
PATCH v2 3/4 toolchain: add TARGET_LDFLAGS to toolchain-wrapper
In reply to Jan Heylenonly done for ld-wrapper, LDFLAGS is still set as before for gcc
--- toolchain/toolchain-wrapper.c | 3 +++ toolchain/toolchain-wrapper.mk | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-)
toolchain/toolchain-wrapper.c +3 -0
@@ -94,6 +94,9 @@ static char *ld_predef_args[] = {#if defined(BR_MIPS_TARGET_BIG_ENDIAN ) || defined(BR_ARC_TARGET_BIG_ENDIAN ) "-EB",#endif +#ifdef BR_ADDITIONAL_LDFLAGS + BR_ADDITIONAL_LDFLAGS +#endif };static void check_unsafe_path (const char *path,int paranoid)
toolchain/toolchain-wrapper.mk +6 -2
@@ -14,9 +14,13 @@ TOOLCHAIN_WRAPPER_ARGS += -DBR_SYSROOT='"$(STAGING_SUBDIR)"' # We create a list like '"-mfoo", "-mbar", "-mbarfoo"' so that each flag is a # separate argument when used in execv() by the toolchain wrapper. -TOOLCHAIN_WRAPPER_OPTS = \ +TOOLCHAIN_WRAPPER_CFLAGS_OPTS = \ $(foreach f,$(call qstrip,$(BR2_TARGET_OPTIMIZATION)),"$(f)"$(comma)) -TOOLCHAIN_WRAPPER_ARGS += -DBR_ADDITIONAL_CFLAGS='$(TOOLCHAIN_WRAPPER_OPTS)' +TOOLCHAIN_WRAPPER_ARGS += -DBR_ADDITIONAL_CFLAGS='$(TOOLCHAIN_WRAPPER_CFLAGS_OPTS)' + +TOOLCHAIN_WRAPPER_LDFLAGS_OPTS = \ + $(foreach f,$(subst -Wl$(comma),$(empty),$(call qstrip,$(BR2_TARGET_LDFLAGS))),"$(f)"$(comma)) +TOOLCHAIN_WRAPPER_ARGS += -DBR_ADDITIONAL_LDFLAGS='$(TOOLCHAIN_WRAPPER_LDFLAGS_OPTS)' ifeq ($(BR2_CCACHE),y) TOOLCHAIN_WRAPPER_ARGS += -DBR_CCACHE
Signature · 1 line
2.5.0
PATCH v2 4/4 arch: define appropriate ld emulation values for the MIPS architecture
In reply to Jan Heylenbased upon patch from Thomas Petazzoni:
http://thread.gmane.org/gmane.comp.lib.uclibc.buildroot/60942
--- arch/Config.in.mips | 8 ++++++++ 1 file changed, 8 insertions(+)
arch/Config.in.mips +8 -0
@@ -83,3 +83,11 @@ config BR2_GCC_TARGET_ABI default "32" if BR2_MIPS_OABI32 default "n32" if BR2_MIPS_NABI32 default "64" if BR2_MIPS_NABI64 + +config BR2_LD_TARGET_EMULATION + default "elf64ltsmip" if BR2_mips64el && BR2_MIPS_NABI64 + default "elf64btsmip" if BR2_mips64 && BR2_MIPS_NABI64 + default "elf32ltsmipn32" if BR2_mips64el && BR2_MIPS_NABI32 + default "elf32btsmipn32" if BR2_mips64 && BR2_MIPS_NABI32 + default "elf32ltsmip" if (BR2_mips64el && BR2_MIPS_OABI32) || BR2_mipsel + default "elf32btsmip" if (BR2_mips64 && BR2_MIPS_OABI32) || BR2_mips
Signature · 1 line
2.5.0
PATCH v2 1/4 toolchain: wrap 'ld' with toolchain-wrapper
In reply to Jan HeylenHello,
Quoted 17 lines · Jan Heylen
extend the toolchain wrapper to also wrap the ld linker.
Tested with gnu ld and gnu 'gold' BR2_BINUTILS_EXTRA_CONFIG_OPTIONS="--enable-gold=default --enable-plugins"
make host-binutils result in: (ld and ld.gold are equal) <ARCH>-buildroot-linux-uclibc-ld -> toolchain-wrapper <ARCH>-buildroot-linux-uclibc-ld.bfd <ARCH>-buildroot-linux-uclibc-ld.br_real <ARCH>-buildroot-linux-uclibc-ld.gold -> toolchain-wrapper <ARCH>-buildroot-linux-uclibc-ld.gold.br_real
<ARCH>-linux-ld -> toolchain-wrapper
<ARCH>-linux-ld.br_real -> <ARCH>-buildroot-linux-uclibc-ld.br_real <ARCH>-linux-ld.gold -> toolchain-wrapper <ARCH>-linux-ld.gold.br_real -> <ARCH>-buildroot-linux-uclibc-ld.gold.br_real toolchain-wrapper
Quoted 5 lines
after host-gcc-initial, toolchain-wrapper will be rebuild, but the ld symlinks remain
Based upon patch from Thomas Petazzoni:
http://thread.gmane.org/gmane.comp.lib.uclibc.buildroot/60942
We had a discussion at the Buildroot Developers meeting today about this patch series. After discussion, we concluded that there should be no need to wrap ld. ld should not be used directly, except in very specific cases, where the caller knows what it is doing and should pass the right arguments.
As far as we know, the only case that was broken was the libiscsi package, but such a package should definitely *not* use ld directly. So the fix should be done in libiscsi, not in the wrapper.
However, your patch series triggered a very useful discussion about reworking how flags are handled by the wrapper, and we took the following notes of things to do:
- We want to refactor how the CFLAGS are handled by the wrapper:
- Combine BR2_TARGET_OPTIMIZATION and BR2_TARGET_LDFLAGS into a single BR2_TARGET_EXTRA_FLAGS
- Have a make variable called TARGET_WRAPPER_FLAGS that includes all flags we want to include in the wrapper:
* $(TARGET_ABI)
* $(TARGET_CPPFLAGS)
* $(BR2_TARGET_EXTRA_FLAGS)
* Custom flags added by package/Makefile.in
$(TARGET_OPTIMIZATION) and $(TARGET_DEBUGGING) are *NOT* in the wrapper.
- TARGET_CFLAGS = $(TARGET_WRAPPER_CFLAGS) $(TARGET_OPTIMIZATION) $(TARGET_DEBUGGING)
TARGET_CXXFLAGS = $(TARGET_CFLAGS)
TARGET_LDFLAGS = $(TARGET_CFLAGS)
TARGET_FCFLAGS = $(TARGET_CFLAGS)- The wrapper, instead of having special cases for different flags, just receives (at build time), the list of hardcoded flag. A special logic needs to be put in place to handle precious flags (mcpu, march, mtune, mfloat-abi, etc.), for which the command-line passed flag must be preserved if passed.
- Define LD to "false" in $(TARGET_CONFIGURE_OPTS) so that we detect the crappy packages that use LD directly. Individual packages can still pass LD=$(TARGET_LD) or LD=$(TARGET_CC) if really needed.
We're of course not asking you to work on those topics. Arnout has volunteered to do it already.
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
PATCH v2 1/4 toolchain: wrap 'ld' with toolchain-wrapper
So we should fix libdmalloc as well?
Quoted 77 lines · Thomas Petazzoni
Hello,
Quoted 4 lines · Jan Heylen
extend the toolchain wrapper to also wrap the ld linker.
Tested with gnu ld and gnu 'gold' BR2_BINUTILS_EXTRA_CONFIG_OPTIONS="--enable-gold=default
--enable-plugins"
Quoted 11 lines
make host-binutils result in: (ld and ld.gold are equal) <ARCH>-buildroot-linux-uclibc-ld -> toolchain-wrapper <ARCH>-buildroot-linux-uclibc-ld.bfd <ARCH>-buildroot-linux-uclibc-ld.br_real <ARCH>-buildroot-linux-uclibc-ld.gold -> toolchain-wrapper <ARCH>-buildroot-linux-uclibc-ld.gold.br_real <ARCH>-linux-ld -> toolchain-wrapper <ARCH>-linux-ld.br_real -> <ARCH>-buildroot-linux-uclibc-ld.br_real <ARCH>-linux-ld.gold -> toolchain-wrapper <ARCH>-linux-ld.gold.br_real -> <ARCH>-buildroot-linux-uclibc-
ld.gold.br_real
Quoted 7 lines
toolchain-wrapper
after host-gcc-initial, toolchain-wrapper will be rebuild, but the ld symlinks remain
Based upon patch from Thomas Petazzoni:
http://thread.gmane.org/gmane.comp.lib.uclibc.buildroot/60942We had a discussion at the Buildroot Developers meeting today about this patch series. After discussion, we concluded that there should be no need to wrap ld. ld should not be used directly, except in very specific cases, where the caller knows what it is doing and should pass the right arguments.
As far as we know, the only case that was broken was the libiscsi package, but such a package should definitely *not* use ld directly. So the fix should be done in libiscsi, not in the wrapper.
However, your patch series triggered a very useful discussion about reworking how flags are handled by the wrapper, and we took the following notes of things to do:
- We want to refactor how the CFLAGS are handled by the wrapper:
- Combine
BR2_TARGET_OPTIMIZATIONandBR2_TARGET_LDFLAGSinto a singleBR2_TARGET_EXTRA_FLAGS- Have a make variable called
TARGET_WRAPPER_FLAGSthat includes all flags we want to include in the wrapper:* $(TARGET_ABI)
* $(TARGET_CPPFLAGS)
* $(BR2_TARGET_EXTRA_FLAGS)
* Custom flags added by package/Makefile.in$(TARGET_OPTIMIZATION) and $(TARGET_DEBUGGING) are *NOT* in the wrapper.
-
TARGET_CFLAGS= $(TARGET_WRAPPER_CFLAGS) $(TARGET_OPTIMIZATION)
$(TARGET_DEBUGGING)TARGET_CXXFLAGS = $(TARGET_CFLAGS) TARGET_LDFLAGS = $(TARGET_CFLAGS) TARGET_FCFLAGS = $(TARGET_CFLAGS)- The wrapper, instead of having special cases for different flags, just receives (at build time), the list of hardcoded flag. A special logic needs to be put in place to handle precious flags (mcpu, march, mtune, mfloat-abi, etc.), for which the command-line passed flag must be preserved if passed.
- Define LD to "false" in $(TARGET_CONFIGURE_OPTS) so that we detect the crappy packages that use LD directly. Individual packages can still pass LD=$(TARGET_LD) or LD=$(TARGET_CC) if really needed.
We're of course not asking you to work on those topics. Arnout has volunteered to do it already.
Quoted 8 lines
Best regards,
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20161016/4cd466f6/attachment.html>
PATCH v2 1/4 toolchain: wrap 'ld' with toolchain-wrapper
Hello,
Quoted 1 line · Jan Heylen
So we should fix libdmalloc as well?
Vicente is working on this. Do you have references to autobuilder failures on libdmalloc caused by this problem ?
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
PATCH v2 1/4 toolchain: wrap 'ld' with toolchain-wrapper
Hello Jan,
have you recently seen the dmalloc package failing because of using the wrong emulation in ld? Or because using ld instead of gcc for linking, in general?
Indeed it uses ld instead of gcc, and that's something that could be improved upstream. However, since it's not failing to build for us I think there is nothing we need to fix in Buildroot.
Regards,
Vincent.
Quoted 12 lines · Thomas Petazzoni
Hello,
Quoted 1 line · Jan Heylen
So we should fix libdmalloc as well?
Vicente is working on this. Do you have references to autobuilder failures on libdmalloc caused by this problem ?
Thanks!
Thomas
PATCH v2 1/4 toolchain: wrap 'ld' with toolchain-wrapper
For our platform (mips octeon 64 bit but with 32bit userspace:
-mabi=n32), and indeed because of the usage of LD, the compilation does fail, that is why I added the patches.
br,
Jan
Quoted 27 lines · Vicente Olivert Riera
Hello Jan,
have you recently seen the dmalloc package failing because of using the wrong emulation in ld? Or because using ld instead of gcc for linking, in general?
Indeed it uses ld instead of gcc, and that's something that could be improved upstream. However, since it's not failing to build for us I think there is nothing we need to fix in Buildroot.
Regards,
Vincent.
Quoted 12 lines · Thomas Petazzoni
Hello,
Quoted 1 line · Jan Heylen
So we should fix libdmalloc as well?
Vicente is working on this. Do you have references to autobuilder failures on libdmalloc caused by this problem ?
Thanks!
Thomas
PATCH v2 1/4 toolchain: wrap 'ld' with toolchain-wrapper
Hello Jan,
I have just built the dmalloc package for mips64r2 n32 little-endian and big-endian without any issue. I have used the "Codescape MTI" external toolchain. Are you using a different toolchain? Please let me know so I can reproduce the problem.
Regards,
Vincent.
Quoted 37 lines · Jan Heylen
For our platform (mips octeon 64 bit but with 32bit userspace:
-mabi=n32), and indeed because of the usage of LD, the compilation does fail, that is why I added the patches.br,
Jan
Quoted 27 lines · Vicente Olivert Riera
Hello Jan,
have you recently seen the dmalloc package failing because of using the wrong emulation in ld? Or because using ld instead of gcc for linking, in general?
Indeed it uses ld instead of gcc, and that's something that could be improved upstream. However, since it's not failing to build for us I think there is nothing we need to fix in Buildroot.
Regards,
Vincent.
Quoted 12 lines · Thomas Petazzoni
Hello,
Quoted 1 line · Jan Heylen
So we should fix libdmalloc as well?
Vicente is working on this. Do you have references to autobuilder failures on libdmalloc caused by this problem ?
Thanks!
Thomas
PATCH v2 1/4 toolchain: wrap 'ld' with toolchain-wrapper
I'm using a toolchain coming from Cavium, so you're saying that either the toolchain is the issue or it is no longer an issue? It's been some time ago that I tested this, let me come back to you later this week.
br,
Jan
Quoted 49 lines · Vicente Olivert Riera
Hello Jan,
I have just built the dmalloc package for mips64r2 n32 little-endian and big-endian without any issue. I have used the "Codescape MTI" external toolchain. Are you using a different toolchain? Please let me know so I can reproduce the problem.
Regards,
Vincent.
Quoted 37 lines · Jan Heylen
For our platform (mips octeon 64 bit but with 32bit userspace:
-mabi=n32), and indeed because of the usage of LD, the compilation does fail, that is why I added the patches.br,
Jan
Quoted 27 lines · Vicente Olivert Riera
Hello Jan,
have you recently seen the dmalloc package failing because of using the wrong emulation in ld? Or because using ld instead of gcc for linking, in general?
Indeed it uses ld instead of gcc, and that's something that could be improved upstream. However, since it's not failing to build for us I think there is nothing we need to fix in Buildroot.
Regards,
Vincent.
Quoted 12 lines · Thomas Petazzoni
Hello,
Quoted 1 line · Jan Heylen
So we should fix libdmalloc as well?
Vicente is working on this. Do you have references to autobuilder failures on libdmalloc caused by this problem ?
Thanks!
Thomas
PATCH v2 1/4 toolchain: wrap 'ld' with toolchain-wrapper
Quoted 3 lines · Jan Heylen
I'm using a toolchain coming from Cavium, so you're saying that either the toolchain is the issue or it is no longer an issue? It's been some time ago that I tested this, let me come back to you later this week.
Ok. Just for the record, no problem with the buildroot internal toolchain either. dmalloc built for mips64r2 n32 little-endian uclibc-ng.
Regards,
Vincent.
Quoted 55 lines
br,
Jan
Quoted 49 lines · Vicente Olivert Riera
Hello Jan,
I have just built the dmalloc package for mips64r2 n32 little-endian and big-endian without any issue. I have used the "Codescape MTI" external toolchain. Are you using a different toolchain? Please let me know so I can reproduce the problem.
Regards,
Vincent.
Quoted 37 lines · Jan Heylen
For our platform (mips octeon 64 bit but with 32bit userspace:
-mabi=n32), and indeed because of the usage of LD, the compilation does fail, that is why I added the patches.br,
Jan
Quoted 27 lines · Vicente Olivert Riera
Hello Jan,
have you recently seen the dmalloc package failing because of using the wrong emulation in ld? Or because using ld instead of gcc for linking, in general?
Indeed it uses ld instead of gcc, and that's something that could be improved upstream. However, since it's not failing to build for us I think there is nothing we need to fix in Buildroot.
Regards,
Vincent.
Quoted 12 lines · Thomas Petazzoni
Hello,
Quoted 1 line · Jan Heylen
So we should fix libdmalloc as well?
Vicente is working on this. Do you have references to autobuilder failures on libdmalloc caused by this problem ?
Thanks!
Thomas
PATCH v2 1/4 toolchain: wrap 'ld' with toolchain-wrapper
Hi,
ok, I just realized I won't have time 'later this week', so I had a look at this again right away (#GTD it is called in hipster language). Did you check the output of the build for dmalloc? I just verified the issue with our toolchain, and the result is indeed that dmalloc 'builds', but if you look at the .so file:
-rw-r--r-- 1 jheylen we2 849476 16 okt 19:04 libdmalloc.a
-rwxr-xr-x 1 jheylen we2 593 16 okt 19:04 libdmalloc.so
-rwxr-xr-x 1 jheylen we2 593 16 okt 19:05 libdmalloc.so.t
-rw-r--r-- 1 jheylen we2 858132 16 okt 19:04 libdmallocth.a -rw-r--r-- 1 jheylen we2 915054 16 okt 19:04 libdmallocthcxx.a
-rwxr-xr-x 1 jheylen we2 593 16 okt 19:04 libdmallocthcxx.so
-rwxr-xr-x 1 jheylen we2 593 16 okt 19:04 libdmallocth.so
-rw-r--r-- 1 jheylen we2 906398 16 okt 19:04 libdmallocxx.a
-rwxr-xr-x 1 jheylen we2 593 16 okt 19:04 libdmallocxx.so
The sizes look suspicious ;-), if I try them on target, it doesn't work, and readelf -a libdmalloc.so:
----------------------------
ELF Header:
Magic: 7f 45 4c 46 02 02 01 00 00 00 00 00 00 00 00 00
Class: ELF64 Data: 2's complement, big endian Version: 1 (current) OS/ABI: UNIX - System V ABI Version: 0 Type: DYN (Shared object file) Machine: MIPS R3000 Version: 0x1 Entry point address: 0x40 Start of program headers: 0 (bytes into file) Start of section headers: 96 (bytes into file) Flags: 0x0 Size of this header: 64 (bytes) Size of program headers: 0 (bytes) Number of program headers: 0 Size of section headers: 64 (bytes) Number of section headers: 4
Section header string table index: 1
Section Headers:
[Nr] Name Type Address Offset
Size EntSize Flags Link Info Align
[ 0] NULL 0000000000000000 00000000
0000000000000000 0000000000000000 0 0 0
[ 1] .shstrtab STRTAB 0000000000000000 00000040
000000000000001b 0000000000000000 0 0 1
[ 2] .symtab SYMTAB 0000000000000000 00000160
00000000000000c0 0000000000000018 3 2 8
[ 3] .strtab STRTAB 0000000000000000 00000220
0000000000000031 0000000000000000 0 0 1Key to Flags:
W (write), A (alloc), X (execute), M (merge), S (strings)
I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown) O (extra OS processing required) o (OS specific), p (processor specific)
There are no section groups in this file.
There are no program headers in this file.
There are no relocations in this file.
The decoding of unwind sections for machine type MIPS R3000 is not currently supported.
Symbol table '.symtab' contains 8 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
1: 0000000000018030 0 NOTYPE LOCAL DEFAULT ABS _gp
2: 0000000000010040 0 NOTYPE GLOBAL DEFAULT ABS _fdata
3: 0000000000000040 0 NOTYPE GLOBAL DEFAULT ABS _ftext
4: 0000000000010040 0 NOTYPE GLOBAL DEFAULT ABS __bss_start
5: 0000000000010040 0 NOTYPE GLOBAL DEFAULT ABS _edata
6: 0000000000010040 0 NOTYPE GLOBAL DEFAULT ABS _end
7: 0000000000010040 0 NOTYPE GLOBAL DEFAULT ABS _fbssNo version information found in this file.
----------------------------
from configure log and config.log, you see why dmalloc decides to link with -G -o:
checking shared library link args... <buildroot>/output/host/usr/bin/mips64-octeon-linux-gnu-ld -G -o [email protected] checking shared library extension... so
<buildroot>/output/host/usr/bin/mips64-octeon-linux-gnu-ld:conftest.a(conftest.o): ABI is incompatible with that of the selected
emulation: "elf32-ntradbigmips" != "elf64- tradbigmips"
<buildroot>/output/host/usr/bin/mips64-octeon-linux-gnu-ld: failed to
merge target specific data of file conftest.a(conftest.o)
<buildroot>/output/host/usr/bin/mips64-octeon-linux-gnu-ld: unrecognized
option '-all'
<buildroot>/output/host/usr/bin/mips64-octeon-linux-gnu-ld: use the
--help option for usage information
444 configure:4475:
result: <buildroot>/output/host/usr/bin/mips64-octeon-linux-gnu-ld -G -o [email protected]
from an earlier conversation on the subject:
If I patch dmalloc.mk: (to test the underlying issue):
-DMALLOC_CONF_ENV = CFLAGS="$(DMALLOC_CFLAGS)"
+DMALLOC_CONF_ENV = CFLAGS="$(DMALLOC_CFLAGS)"
TARGET_LD="$(TARGET_LD) -m elf32btsmipn32 "
define DMALLOC_POST_PATCH
$(SED) 's/^ac_cv_page_size=0$$/ac_cv_page_size=12/' $(@D)/configure
- $(SED) 's/(ld -/($${LD-ld} -/' $(@D)/configure
- $(SED) 's/'\''ld -/"$${LD-ld}"'\'' -/' $(@D)/configure
+ $(SED) 's/(ld -/($${TARGET_LD-ld} -/' $(@D)/configure
+ $(SED) 's/'\''ld -/"$${TARGET_LD-ld}"'\'' -/' $(@D)/configure
$(SED) 's/ar cr/$$(AR) cr/' $(@D)/Makefile.inendef
I found in the config.log:
configure:4475: result:
/repo/buildroot-ngsw/output/host/usr/bin/mips64-octeon-linux-gnu-ld -m elf32btsmipn32 -shared --whole-archive -soname $@ -o [email protected]
which is what was expected.
Can you verify this in your referred toolchains and dmalloc builds?
thx,
Jan
Quoted 36 lines · Vicente Olivert Riera
Quoted 3 lines · Jan Heylen
I'm using a toolchain coming from Cavium, so you're saying that either the toolchain is the issue or it is no longer an issue? It's been some time ago that I tested this, let me come back to you later this week.
Ok. Just for the record, no problem with the buildroot internal toolchain either. dmalloc built for mips64r2 n32 little-endian uclibc-ng.
Regards,
Vincent.
Quoted 24 lines
br,
Jan
Quoted 18 lines · Vicente Olivert Riera
Hello Jan,
I have just built the dmalloc package for mips64r2 n32 little-endian and big-endian without any issue. I have used the "Codescape MTI" external toolchain. Are you using a different toolchain? Please let me know so I can reproduce the problem.
Regards,
Vincent.
Quoted 6 lines · Jan Heylen
For our platform (mips octeon 64 bit but with 32bit userspace:
-mabi=n32), and indeed because of the usage of LD, the compilation does fail, that is why I added the patches.br,
Quoted 33 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Jan
Quoted 3 lines · Vicente Olivert Riera
Hello Jan,
have you recently seen the dmalloc package failing because of using
the
Quoted 24 lines
Quoted 24 lines
Quoted 24 lines
Quoted 24 lines
wrong emulation in ld? Or because using ld instead of gcc for linking, in general?
Indeed it uses ld instead of gcc, and that's something that could be improved upstream. However, since it's not failing to build for us I think there is nothing we need to fix in Buildroot.
Regards,
Vincent.
Quoted 12 lines · Thomas Petazzoni
Hello,
Quoted 1 line · Jan Heylen
So we should fix libdmalloc as well?
Vicente is working on this. Do you have references to autobuilder failures on libdmalloc caused by this problem ?
Thanks!
Thomas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20161016/48ed5b5d/attachment.html>
PATCH v2 1/4 toolchain: wrap 'ld' with toolchain-wrapper
Hi Vincent,
any update on the libdmalloc issue we observe when building for MIPS (because of no ld wrapper) ? Do you see the same?
br,
Jan
Quoted 128 lines · Jan Heylen
Hi,
ok, I just realized I won't have time 'later this week', so I had a look at this again right away (#GTD it is called in hipster language). Did you check the output of the build for dmalloc? I just verified the issue with our toolchain, and the result is indeed that dmalloc 'builds', but if you look at the .so file:
(quoted diff) +0
-9-rw-r--r-- 1 jheylen we2 849476 16 okt 19:04 libdmalloc.a -rwxr-xr-x 1 jheylen we2 593 16 okt 19:04 libdmalloc.so -rwxr-xr-x 1 jheylen we2 593 16 okt 19:05 libdmalloc.so.t -rw-r--r-- 1 jheylen we2 858132 16 okt 19:04 libdmallocth.a -rw-r--r-- 1 jheylen we2 915054 16 okt 19:04 libdmallocthcxx.a -rwxr-xr-x 1 jheylen we2 593 16 okt 19:04 libdmallocthcxx.so -rwxr-xr-x 1 jheylen we2 593 16 okt 19:04 libdmallocth.so -rw-r--r-- 1 jheylen we2 906398 16 okt 19:04 libdmallocxx.a -rwxr-xr-x 1 jheylen we2 593 16 okt 19:04 libdmallocxx.soThe sizes look suspicious ;-), if I try them on target, it doesn't work, and readelf -a libdmalloc.so:
----------------------------
ELF Header:
Magic: 7f 45 4c 46 02 02 01 00 00 00 00 00 00 00 00 00Class: ELF64 Data: 2's complement, big endian Version: 1 (current) OS/ABI: UNIX - System V ABI Version: 0 Type: DYN (Shared object file) Machine: MIPS R3000 Version: 0x1 Entry point address: 0x40 Start of program headers: 0 (bytes into file) Start of section headers: 96 (bytes into file) Flags: 0x0 Size of this header: 64 (bytes) Size of program headers: 0 (bytes) Number of program headers: 0 Size of section headers: 64 (bytes) Number of section headers: 4Section header string table index: 1
Section Headers:
[Nr] Name Type Address Offset Size EntSize Flags Link Info Align [ 0] NULL 0000000000000000 00000000 0000000000000000 0000000000000000 0 0 0 [ 1] .shstrtab STRTAB 0000000000000000 00000040 000000000000001b 0000000000000000 0 0 1 [ 2] .symtab SYMTAB 0000000000000000 00000160 00000000000000c0 0000000000000018 3 2 8 [ 3] .strtab STRTAB 0000000000000000 00000220 0000000000000031 0000000000000000 0 0 1Key to Flags:
W (write), A (alloc), X (execute), M (merge), S (strings)
I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown) O (extra OS processing required) o (OS specific), p (processor specific)There are no section groups in this file.
There are no program headers in this file.
There are no relocations in this file.
The decoding of unwind sections for machine type MIPS R3000 is not currently supported.
Symbol table '.symtab' contains 8 entries:
Num: Value Size Type Bind Vis Ndx Name 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND 1: 0000000000018030 0 NOTYPE LOCAL DEFAULT ABS _gp 2: 0000000000010040 0 NOTYPE GLOBAL DEFAULT ABS _fdata 3: 0000000000000040 0 NOTYPE GLOBAL DEFAULT ABS _ftext 4: 0000000000010040 0 NOTYPE GLOBAL DEFAULT ABS __bss_start 5: 0000000000010040 0 NOTYPE GLOBAL DEFAULT ABS _edata 6: 0000000000010040 0 NOTYPE GLOBAL DEFAULT ABS _end 7: 0000000000010040 0 NOTYPE GLOBAL DEFAULT ABS _fbssNo version information found in this file.
----------------------------from configure log and config.log, you see why dmalloc decides to link with -G -o:
checking shared library link args... <buildroot>/output/host/usr/bin/mips64-octeon-linux-gnu-ld -G -o [email protected]
checking shared library extension... so<buildroot>/output/host/usr/bin/mips64-octeon-linux-gnu-ld:
conftest.a(conftest.o): ABI is incompatible with that of the selected
emulation: "elf32-ntradbigmips" != "elf64- tradbigmips"
<buildroot>/output/host/usr/bin/mips64-octeon-linux-gnu-ld: failed to
merge target specific data of fileconftest.a(conftest.o)
<buildroot>/output/host/usr/bin/mips64-octeon-linux-gnu-ld: unrecognized
option '-all'
<buildroot>/output/host/usr/bin/mips64-octeon-linux-gnu-ld: use the
--help option for usage information
444 configure:4475: result: <buildroot>/output/
host/usr/bin/mips64-octeon-linux-gnu-ld -G -o [email protected]from an earlier conversation on the subject:
If I patch dmalloc.mk: (to test the underlying issue):
(quoted diff) +1
-1-DMALLOC_CONF_ENV = CFLAGS="$(DMALLOC_CFLAGS)" +DMALLOC_CONF_ENV = CFLAGS="$(DMALLOC_CFLAGS)"TARGET_LD="$(TARGET_LD) -m elf32btsmipn32 "
define
DMALLOC_POST_PATCH$(SED) 's/^ac_cv_page_size=0$$/ac_cv_page_size=12/'$(@D)/configure
(quoted diff) +2
-2- $(SED) 's/(ld -/($${LD-ld} -/' $(@D)/configure - $(SED) 's/'\''ld -/"$${LD-ld}"'\'' -/' $(@D)/configure + $(SED) 's/(ld -/($${TARGET_LD-ld} -/' $(@D)/configure + $(SED) 's/'\''ld -/"$${TARGET_LD-ld}"'\'' -/' $(@D)/configure $(SED) 's/ar cr/$$(AR) cr/' $(@D)/Makefile.in endefI found in the config.log:
configure:4475: result:
/repo/buildroot-ngsw/output/host/usr/bin/mips64-octeon-linux-gnu-ld -m elf32btsmipn32 -shared --whole-archive -soname $@ -o [email protected]which is what was expected.
Quoted 82 lines
Can you verify this in your referred toolchains and dmalloc builds?
thx,
Jan
Quoted 71 lines · Vicente Olivert Riera
Quoted 3 lines · Jan Heylen
I'm using a toolchain coming from Cavium, so you're saying that either the toolchain is the issue or it is no longer an issue? It's been some time ago that I tested this, let me come back to you later this week.
Ok. Just for the record, no problem with the buildroot internal toolchain either. dmalloc built for mips64r2 n32 little-endian uclibc-ng.
Regards,
Vincent.
Quoted 9 lines
br,
Jan
Quoted 3 lines · Vicente Olivert Riera
Hello Jan,
I have just built the dmalloc package for mips64r2 n32 little-endian
and
Quoted 15 lines
Quoted 15 lines
big-endian without any issue. I have used the "Codescape MTI" external toolchain. Are you using a different toolchain? Please let me know so I can reproduce the problem.
Regards,
Vincent.
Quoted 6 lines · Jan Heylen
For our platform (mips octeon 64 bit but with 32bit userspace:
-mabi=n32), and indeed because of the usage of LD, the compilation does fail, that is why I added the patches.br,
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Jan
Quoted 3 lines · Vicente Olivert Riera
Hello Jan,
have you recently seen the dmalloc package failing because of using
the
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
wrong emulation in ld? Or because using ld instead of gcc for
linking,
Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
in general?
Indeed it uses ld instead of gcc, and that's something that could be improved upstream. However, since it's not failing to build for us I think there is nothing we need to fix in Buildroot.
Regards,
Vincent.
Quoted 12 lines · Thomas Petazzoni
Hello,
Quoted 1 line · Jan Heylen
So we should fix libdmalloc as well?
Vicente is working on this. Do you have references to autobuilder failures on libdmalloc caused by this problem ?
Thanks!
Thomas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20161024/66cc098d/attachment.html>