For arm-none-linux-gnueabi ld/configure.host (from CVS HEAD as of 23 March 2010) executes the following sequence of commands to set HOSTING_CRT0 to the correct value: HOSTING_CRT0='-p -dynamic-linker `${CC} --help --verbose 2>&1 | egrep "ld[^ ]*\.so" | sed -e "s,.*-dynamic-linker[ ][ ]*\(.*/ld[^ ]*\.so..\).*,\1,"` `${CC} --print-file-name=crt1.o` `${CC} --print-file-name=crti.o` `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} --print-file-name=crtbegin.o; fi`' HOSTING_CRT0=`echo "$HOSTING_CRT0" | sed -e "s,ld\[^ \]\*,ld-linux,g"` When executed in bash HOSTING_CRT0 is now equal to: -p -dynamic-linker `${CC} --help --verbose 2>&1 | egrep "ld-linux\.so" | sed -e "s,.*-dynamic-linker[ ][ ]*\(.*/ld-linux\.so..\).*,\1,"` `${CC} --print-file-name=crt1.o` `${CC} --print-file-name=crti.o` `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} --print-file-name=crtbegin.o; fi` But with dash it is equal to: -p -dynamic-linker `${CC} --help --verbose 2>&1 | egrep "ld-linux\.so" | sed -e "s,.*-dynamic-linker[ ][ ]*\(.*/ld-linux\.so..\).*,^A,"` `${CC} --print-file-name=crt1.o` `${CC} --print-file-name=crti.o` `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} --print-file-name=crtbegin.o; fi` (Where ^A is the character with value 1). This then causes many ld tests to fail if /bin/sh is linked to dash instead of bash (as is the case for Ubuntu). My reading of POSIX says that the output of: echo "\1" is implementation defined and so dash's behaviour is acceptable, (as is in this case bash's). I believe this issue also affects other targets including x86_64 and mips. A workaround for these issues is to make the first "exec sh ..." in get_link_files in ld/testsuite/config/default.exp be "exec bash ..." instead. ld tests that fail if sh is dash instead of bash are: Running /home/mgretton/binutils/src/ld/testsuite/ld-bootstrap/bootstrap.exp ... FAIL: bootstrap FAIL: bootstrap with strip FAIL: bootstrap with --traditional-format FAIL: bootstrap with --no-keep-memory FAIL: bootstrap with --relax Running /home/mgretton/binutils/src/ld/testsuite/ld-cdtest/cdtest.exp ... FAIL: cdtest FAIL: cdtest with -Ur Running /home/mgretton/binutils/src/ld/testsuite/ld-elf/dwarf.exp ... FAIL: Run with libdwarf1.so first FAIL: Run with libdwarf1.so last Running /home/mgretton/binutils/src/ld/testsuite/ld-elf/elf.exp ... FAIL: preinit array FAIL: init array FAIL: fini array Running /home/mgretton/binutils/src/ld/testsuite/ld-elf/shared.exp ... FAIL: Run normal with libfoo.so FAIL: Run protected with libfoo.so FAIL: Run hidden with libfoo.so FAIL: Run normal with versioned libfoo.so FAIL: Run warn with versioned libfoo.so FAIL: Run protected with versioned libfoo.so FAIL: Run hidden with versioned libfoo.so FAIL: Run normal libbar.so with libfoo.so FAIL: Run protected libbar.so with libfoo.so FAIL: Run hidden libbar.so with libfoo.so FAIL: Run normal libbar.so with versioned libfoo.so FAIL: Run protected libbar.so with versioned libfoo.so FAIL: Run hidden libbar.so with versioned libfoo.so FAIL: Run dl1a with --dynamic-list=dl1.list and dlopen on libdl1.so FAIL: Run dl1b with --dynamic-list-data and dlopen on libdl1.so FAIL: Run with libdl2a.so FAIL: Run with libdl2b.so FAIL: Run with libdl2c.so FAIL: Run with libdl4a.so FAIL: Run with libdl4b.so FAIL: Run with libdl4c.so FAIL: Run with libdl4d.so FAIL: Run with libdl4e.so FAIL: Run with libdl4f.so FAIL: Run dl6a1 with --dynamic-list-data and dlopen on libdl6a.so FAIL: Run dl6a2 with -Bsymbolic-functions and dlopen on libdl6a.so FAIL: Run dl6a3 with -Bsymbolic and dlopen on libdl6a.so FAIL: Run dl6a4 with -Bsymbolic --dynamic-list-data and dlopen on libdl6a.so FAIL: Run dl6a5 with -Bsymbolic-functions --dynamic-list-cpp-new and dlopen on libdl6a.so FAIL: Run dl6a6 with --dynamic-list-cpp-new -Bsymbolic-functions and dlopen on libdl6a.so FAIL: Run dl6a7 with --dynamic-list-data -Bsymbolic and dlopen on libdl6a.so FAIL: Run dl6b1 with --dynamic-list-data and dlopen on libdl6b.so FAIL: Run dl6b2 with dlopen on libdl6b.so FAIL: Run dl6c1 with --dynamic-list-data and dlopen on libdl6c.so FAIL: Run dl6d1 with --dynamic-list-data and dlopen on libdl6d.so FAIL: Run with libdata1.so FAIL: Run with libfunc1.so comm1.o FAIL: Run with comm1.o libfunc1.so FAIL: Run with pr11138-2.c libpr11138-1.so FAIL: Run with libpr11138-1.so pr11138-2.c
Created attachment 4676 [details] Patch I think a more reliable patch would be something like this, which changes \1 to \\1.
Trying to get backslashes through echo is bound to fail. <http://opengroup.org/onlinepubs/9699919799/utilities/echo.html#tag_20_37_05>: "If any of the operands contain a <backslash> character, the results are implementation-defined."
Proposed patch http://sourceware.org/ml/binutils/2010-03/msg00373.html
Subject: Bug 11426 CVSROOT: /cvs/src Module name: src Changes by: amodra@sourceware.org 2010-03-25 22:49:45 Modified files: ld : ChangeLog configure.host Log message: PR ld/11426 * configure.host (many linux targets <HOSTING_CRT0>): Remove edits. (m68*-motorola-sysv <HOSTING_LIBS>): Use here doc, not echo. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/ChangeLog.diff?cvsroot=src&r1=1.2128&r2=1.2129 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/configure.host.diff?cvsroot=src&r1=1.47&r2=1.48
.