This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
[PATCH/RFC] Fix compile time warning when building ld
- From: Kaz Kojima <kkojima at rr dot iij4u dot or dot jp>
- To: binutils at sources dot redhat dot com
- Date: Wed, 16 Feb 2005 13:27:03 +0900 (JST)
- Subject: [PATCH/RFC] Fix compile time warning when building ld
Hi,
I've got a compile time warning when building ld with
--target=sh4-unknown-linux-gnu --with-sysroot=/foo --enable-build-warnings=-Werror,-Wall,-Wstrict-prototypes,-Wmissing-prototypes
eshlelf_linux.c: In function `gldshlelf_linux_after_open':
eshlelf_linux.c:768: warning: unused variable `lib_path'
make[3]: *** [eshlelf_linux.o] Error 1
on i686-linux. The variable lib_path is used only for NATIVE case
in gld${EMULATION_NAME}_after_open but defined for USE_LIBPATH case.
When --with-sysroot is used for cross building, only USE_LIBPATH is
yes and then we get the above warning.
The patch below is to fix this warning. Regtested with no regressions
both on i686-linux cross sh4-unknown-linux-gnu and native i686-linux.
Regards,
kaz
--
[ld/ChangeLog]
2005-02-16 Kaz Kojima <kkojima@rr.iij4u.or.jp>
* emultempl/elf32.em (gld${EMULATION_NAME}_after_open): Define
lib_path if NATIVE is yes.
diff -uprN ORIG/src/ld/emultempl/elf32.em LOCAL/src/ld/emultempl/elf32.em
--- ORIG/src/ld/emultempl/elf32.em 2005-02-12 18:17:11.000000000 +0900
+++ LOCAL/src/ld/emultempl/elf32.em 2005-02-15 08:20:07.000000000 +0900
@@ -836,9 +836,13 @@ gld${EMULATION_NAME}_after_open (void)
size_t len;
search_dirs_type *search;
EOF
-if [ "x${USE_LIBPATH}" = xyes ] ; then
+if [ "x${NATIVE}" = xyes ] ; then
cat >>e${EMULATION_NAME}.c <<EOF
const char *lib_path;
+EOF
+fi
+if [ "x${USE_LIBPATH}" = xyes ] ; then
+cat >>e${EMULATION_NAME}.c <<EOF
struct bfd_link_needed_list *rp;
int found;
EOF