Sun 20 Dec 2009 03:49:17 PM UTC, comment #2:
No, this patch does not fix the problem I reported, configure stops with the same error (see below).
I believe that this error is triggered in the macro grub_PROG_OBJCOPY_ABSOLUTE, which is called before the line that is changed in the proposed patch. This macro is defined in acinclude.m4. The following patch works on my system.
--- acinclude.m4.orig 2009-12-20 16:41:28.000000000 +0100
+++ acinclude.m4
@@ -93,7 +93,7 @@ else
fi
grub_cv_prog_objcopy_absolute=yes
for link_addr in 0x2000 0x8000 0x7C00; do
- if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} -nostdlib ${TARGET_IMG_LDFLAGS_AC} -Wl,-Ttext -Wl,$link_addr conftest.o -o conftest.exec]); then :
+ if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} -nostdlib ${TARGET_IMG_LDFLAGS_AC}$link_addr conftest.o -o conftest.exec]); then :
else
AC_MSG_ERROR([${CC-cc} cannot link at address $link_addr])
fi
-------------------------------------------------------------
End of configure:
checking whether objcopy works for absolute addresses... configure: error: cc cannot link at address 0x2000
In config.log:
configure:10662: checking whether objcopy works for absolute addresses
configure:10676: cc -c -DGRUB_MACHINE_PCBIOS=1 -m32 -fno-stack-protector -mno-stack-arg-probe -Werror -nostdlib -Wl,--defsym,___main=0x8100 conftest.c >&5
configure:10679: $? = 0
configure:10687: cc -DGRUB_MACHINE_PCBIOS=1 -m32 -fno-stack-protector -mno-stack-arg-probe -Werror -nostdlib -Wl,--defsym,___main=0x8100 -nostdlib -Wl,-N -Wl,-Ttext, -Wl,-Ttext -Wl,0x2000 conftest.o -o conftest.exec
/usr/bin/ld: invalid hex number `-Ttext'
collect2: ld returned 1 exit status
|
Sat 19 Dec 2009 08:35:59 PM UTC, comment #1:
Does following fixes problem:
=== modified file 'configure.ac'
--- configure.ac 2009-12-11 21:12:57 +0000
+++ configure.ac 2009-12-19 20:34:59 +0000
@@ -456,7 +456,7 @@
if test "x$target_cpu" = xi386; then
if test ! -z "$TARGET_IMG_LDSCRIPT"; then
# Check symbols provided by linker script.
- CFLAGS="$TARGET_CFLAGS -nostdlib $TARGET_IMG_LDFLAGS_AC -Wl,-Ttext,8000,--defsym,___main=0x8100"
+ CFLAGS="$TARGET_CFLAGS -nostdlib ${TARGET_IMG_LDFLAGS_AC}8000,--defsym,___main=0x8100"
fi
if test "x$TARGET_APPLE_CC" != x1 ; then
grub_CHECK_BSS_START_SYMBOL
|
Fri 18 Dec 2009 01:22:21 PM UTC, original submission:
Hi,
In configure.ac, the definition TARGET_IMG_LDFLAGS_AC='-Wl,-N -Wl,-Ttext,' leads to an error when configure is run within the pkgsrc framework (http://www.pkgsrc.org/).
The following patch solves this problem (at least in my environment):
--- configure.ac.orig 2009-12-18 02:59:13.000000000 +0100
+++ configure.ac
@@ -325,7 +325,7 @@ if test -f "${srcdir}/conf/${target_cpu}
else
TARGET_IMG_LDSCRIPT=
TARGET_IMG_LDFLAGS='-Wl,-N -Wl,-Ttext,'
- TARGET_IMG_LDFLAGS_AC='-Wl,-N -Wl,-Ttext,'
+ TARGET_IMG_LDFLAGS_AC='-Wl,-N'
fi
TARGET_IMG_CFLAGS=
fi
Some details about the problem: the variable TARGET_IMG_LDFLAGS_AC is used in the check that objcopy works for absolute addresses, and the following command is issued by configure:
gcc [...] ${TARGET_IMG_LDFLAGS_AC} -Wl,-Ttext -Wl,$link_addr conftest.o -o conftest.exec
which is expanded to:
gcc [...] -Wl,-N -Wl,-Ttext, -Wl,-Ttext -Wl,$link_addr conftest.o -o conftest.exec
which, within pkgsrc, gets normalized to:
gcc [...] -Wl,-N -Wl,-Ttext -Wl,-Ttext -Wl,$link_addr conftest.o -o conftest.exec
which gives the error:
ld: invalid hex number `-Ttext'
According to the pkgsrc mailing list [1], and this is consistent with gcc's man page,
-Wl,-Ttext, -Wl,-Ttext
is semantically equivalent to
-Wl,-Text -Wl -Wl,-Text
and, indeed, gcc with the latter gives the same error (invalid hex number `-Ttext').
[1] http://mail-index.netbsd.org/tech-pkg/2009/12/16/msg004521.html
|