ld flag --warn-common
RFC PATCH 1/1 ld flag --warn-common
Hi,
These trivial patches enable linker flag --warn-common and fix the warnings caused by enabling the flag.
I think on some platforms (Solaris?) the linker used by gcc is not GNU ld. If this is true, the patch would break compilation on those hosts and logic in configure would need to be more complex. Please confirm.
configure +1 -1
@@ -347,7 +347,7 @@ # default flags for all hosts CFLAGS="$CFLAGS -Wall -Wundef -Wwrite-strings -O2 -g -fno-strict-aliasing" -LDFLAGS="$LDFLAGS -g" +LDFLAGS="$LDFLAGS -g -Wl,--warn-common" if test "$werror" = "yes" ; then CFLAGS="$CFLAGS -Werror" fi
block_int.h +1 -1
@@ -145,6 +145,6 @@ void *opaque);void qemu_aio_release (void *p); -BlockDriverState *bdrv_first; +extern BlockDriverState *bdrv_first;#endif /* BLOCK_INT_H */
hw/arm-misc.h +1 -1
@@ -37,7 +37,7 @@/* Multiplication factor to convert from system clock ticks to qemu timer ticks. */ -int system_clock_scale; +extern int system_clock_scale;qemu_irq *armv7m_nvic_init (CPUState *env);/* stellaris_enent.c */
block.c +2 -0
@@ -56,6 +56,8 @@static int bdrv_write_em (BlockDriverState *bs,int64_t sector_num,const uint8_t *buf,int nb_sectors); +BlockDriverState *bdrv_first; +static BlockDriver *first_drv;int path_is_absolute (const char *path)
hw/armv7m_nvic.c +2 -0
@@ -50,6 +50,8 @@#define SYSTICK_CLKSOURCE (1 << 2)#define SYSTICK_COUNTFLAG (1 << 16) +int system_clock_scale; +/* Conversion factor from qemu timer to SysTick frequencies. */ static inline int64_t systick_scale (nvic_state *s) {
Quoted 8 lines · Blue Swirl
Hi,
These trivial patches enable linker flag --warn-common and fix the warnings caused by enabling the flag.
I think on some platforms (Solaris?) the linker used by gcc is not GNU ld. If this is true, the patch would break compilation on those hosts and logic in configure would need to be more complex. Please confirm.
yes, Solaris does not use gnu ld, it uses it's own linker.
Ben
Quoted 6 lines · Ben Taylor
Quoted 5 lines · Blue Swirl
Hi,
These trivial patches enable linker flag --warn-common and fix the warnings caused by enabling the flag.
Quoted 6 lines
Quoted 3 lines
I think on some platforms (Solaris?) the linker used by gcc is not GNU ld. If this is true, the patch would break compilation on those hosts and logic in configure would need to be more complex. Please confirm.
yes, Solaris does not use gnu ld, it uses it's own linker.
Could you test if with this patch applied, "other ld" is printed when configuring?
configure +7 -0
@@ -352,6 +352,13 @@ CFLAGS="$CFLAGS -Werror" fi +if ld --version | grep -q "GNU ld" 2>/dev/null ; then + LDFLAGS="$LDFLAGS -Wl,--warn-common" + echo got GNU ld +else + echo other ld +fi + # # If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right # ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
Quoted 12 lines · Blue Swirl
Quoted 11 lines · Ben Taylor
Quoted 8 lines · Blue Swirl
Hi,
These trivial patches enable linker flag --warn-common and fix the warnings caused by enabling the flag.
I think on some platforms (Solaris?) the linker used by gcc is not GNU ld. If this is true, the patch would break compilation on those hosts and logic in configure would need to be more complex. Please confirm.
Quoted 4 lines
Quoted 1 line
yes, Solaris does not use gnu ld, it uses it's own linker.
Could you test if with this patch applied, "other ld" is printed when configuring?
Confirmed that it prints "other ld" on Solaris.
Ben
Quoted 13 lines · Ben Taylor
Quoted 12 lines · Blue Swirl
Quoted 11 lines · Ben Taylor
Quoted 8 lines · Blue Swirl
Hi,
These trivial patches enable linker flag --warn-common and fix the warnings caused by enabling the flag.
I think on some platforms (Solaris?) the linker used by gcc is not GNU ld. If this is true, the patch would break compilation on those hosts and logic in configure would need to be more complex. Please confirm.
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
yes, Solaris does not use gnu ld, it uses it's own linker.
Could you test if with this patch applied, "other ld" is printed when configuring?
Confirmed that it prints "other ld" on Solaris.
Thanks for testing, I'll prepare an updated version.
Quoted 16 lines · Blue Swirl
Quoted 15 lines · Ben Taylor
Quoted 14 lines · Blue Swirl
Quoted 12 lines · Ben Taylor
Quoted 8 lines · Blue Swirl
Hi,
These trivial patches enable linker flag --warn-common and fix the warnings caused by enabling the flag.
I think on some platforms (Solaris?) the linker used by gcc is not GNU ld. If this is true, the patch would break compilation on those hosts and logic in configure would need to be more complex. Please confirm.
yes, Solaris does not use gnu ld, it uses it's own linker.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Could you test if with this patch applied, "other ld" is printed when configuring?
Confirmed that it prints "other ld" on Solaris.
Thanks for testing, I'll prepare an updated version.
Here they are. I think I'll commit them in a few days unless there are objections.
configure +4 -0
@@ -352,6 +352,10 @@ CFLAGS="$CFLAGS -Werror" fi +if ld --version 2>/dev/null | grep -q "GNU ld" ; then + LDFLAGS="$LDFLAGS -Wl,--warn-common" +fi + # # If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right # ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
block_int.h +1 -1
@@ -145,6 +145,6 @@ void *opaque);void qemu_aio_release (void *p); -BlockDriverState *bdrv_first; +extern BlockDriverState *bdrv_first;#endif /* BLOCK_INT_H */
hw/arm-misc.h +1 -1
@@ -37,7 +37,7 @@/* Multiplication factor to convert from system clock ticks to qemu timer ticks. */ -int system_clock_scale; +extern int system_clock_scale;qemu_irq *armv7m_nvic_init (CPUState *env);/* stellaris_enent.c */
block.c +2 -0
@@ -56,6 +56,8 @@static int bdrv_write_em (BlockDriverState *bs,int64_t sector_num,const uint8_t *buf,int nb_sectors); +BlockDriverState *bdrv_first; +static BlockDriver *first_drv;int path_is_absolute (const char *path)
hw/armv7m_nvic.c +2 -0
@@ -50,6 +50,8 @@#define SYSTICK_CLKSOURCE (1 << 2)#define SYSTICK_COUNTFLAG (1 << 16) +int system_clock_scale; +/* Conversion factor from qemu timer to SysTick frequencies. */ static inline int64_t systick_scale (nvic_state *s) {
Quoted 4 lines · Blue Swirl
Hi,
These trivial patches enable linker flag --warn-common and fix the warnings caused by enabling the flag.
This flag cause a lot of warning on my machine, even with trivial program.
$ cat 1.c #include <stdio.h>
int main()
{
printf("test\n");
return 0;
}
$ gcc -Wl,--warn-common -static 1.c
/usr/lib64/gcc/x86_64-alt-linux/4.1.2/../../../../lib64/libc.a(strtoul.o): warning: multiple common of `_nl_category_name_idxs'
/usr/lib64/gcc/x86_64-alt-linux/4.1.2/../../../../lib64/libc.a(strtol.o): warning: previous common is here
/usr/lib64/gcc/x86_64-alt-linux/4.1.2/../../../../lib64/libc.a(strtol_l.o): warning: multiple common of `_nl_category_name_idxs'
/usr/lib64/gcc/x86_64-alt-linux/4.1.2/../../../../lib64/libc.a(strtol.o): warning: previous common is here
/usr/lib64/gcc/x86_64-alt-linux/4.1.2/../../../../lib64/libc.a(strtoul_l.o): warning: multiple common of `_nl_category_name_idxs'
/usr/lib64/gcc/x86_64-alt-linux/4.1.2/../../../../lib64/libc.a(strtol.o): warning: previous common is here
/usr/lib64/gcc/x86_64-alt-linux/4.1.2/../../../../lib64/libc.a(vfprintf.o): warning: multiple common of `_nl_category_name_idxs'
/usr/lib64/gcc/x86_64-alt-linux/4.1.2/../../../../lib64/libc.a(strtol.o): warning: previous common is here...and so on.
Is it problem with my toolchain? What is your testing environment?
Signature · 3 lines
Regards, Kirill A. Shutemov + Belarus, Minsk + ALT Linux Team, http://www.altlinux.com/
Quoted 27 lines · Kirill A. Shutemov
Quoted 4 lines · Blue Swirl
Hi,
These trivial patches enable linker flag --warn-common and fix the warnings caused by enabling the flag.
This flag cause a lot of warning on my machine, even with trivial program.
$ cat 1.c #include <stdio.h>int
main(){ printf("test\n"); return 0; } $ gcc -Wl,--warn-common -static 1.c /usr/lib64/gcc/x86_64-alt-linux/4.1.2/../../../../lib64/libc.a(strtoul.o): warning: multiple common of `_nl_category_name_idxs' /usr/lib64/gcc/x86_64-alt-linux/4.1.2/../../../../lib64/libc.a(strtol.o): warning: previous common is here /usr/lib64/gcc/x86_64-alt-linux/4.1.2/../../../../lib64/libc.a(strtol_l.o): warning: multiple common of `_nl_category_name_idxs' /usr/lib64/gcc/x86_64-alt-linux/4.1.2/../../../../lib64/libc.a(strtol.o): warning: previous common is here /usr/lib64/gcc/x86_64-alt-linux/4.1.2/../../../../lib64/libc.a(strtoul_l.o): warning: multiple common of `_nl_category_name_idxs' /usr/lib64/gcc/x86_64-alt-linux/4.1.2/../../../../lib64/libc.a(strtol.o): warning: previous common is here /usr/lib64/gcc/x86_64-alt-linux/4.1.2/../../../../lib64/libc.a(vfprintf.o): warning: multiple common of `_nl_category_name_idxs' /usr/lib64/gcc/x86_64-alt-linux/4.1.2/../../../../lib64/libc.a(strtol.o): warning: previous common is here
Quoted 4 lines
...and so on.
Is it problem with my toolchain? What is your testing environment?
I get no warnings for Qemu build on Debian i386, amd64 (stable/unstable), Sparc32, Sparc64 or on OpenBSD/Sparc64. Your program produces one warning on Debian stable (all hosts except no warnings on arm), no warnings on Debian amd64 unstable or OpenBSD.
Quoted 31 lines · Blue Swirl
Quoted 30 lines · Kirill A. Shutemov
Quoted 4 lines · Blue Swirl
Hi,
These trivial patches enable linker flag --warn-common and fix the warnings caused by enabling the flag.
This flag cause a lot of warning on my machine, even with trivial program.
$ cat 1.c #include <stdio.h>int
main(){ printf("test\n"); return 0; } $ gcc -Wl,--warn-common -static 1.c /usr/lib64/gcc/x86_64-alt-linux/4.1.2/../../../../lib64/libc.a(strtoul.o): warning: multiple common of `_nl_category_name_idxs' /usr/lib64/gcc/x86_64-alt-linux/4.1.2/../../../../lib64/libc.a(strtol.o): warning: previous common is here /usr/lib64/gcc/x86_64-alt-linux/4.1.2/../../../../lib64/libc.a(strtol_l.o): warning: multiple common of `_nl_category_name_idxs' /usr/lib64/gcc/x86_64-alt-linux/4.1.2/../../../../lib64/libc.a(strtol.o): warning: previous common is here /usr/lib64/gcc/x86_64-alt-linux/4.1.2/../../../../lib64/libc.a(strtoul_l.o): warning: multiple common of `_nl_category_name_idxs' /usr/lib64/gcc/x86_64-alt-linux/4.1.2/../../../../lib64/libc.a(strtol.o): warning: previous common is here /usr/lib64/gcc/x86_64-alt-linux/4.1.2/../../../../lib64/libc.a(vfprintf.o): warning: multiple common of `_nl_category_name_idxs' /usr/lib64/gcc/x86_64-alt-linux/4.1.2/../../../../lib64/libc.a(strtol.o): warning: previous common is here...and so on.
Quoted 6 lines
Quoted 1 line
Is it problem with my toolchain? What is your testing environment?
I get no warnings for Qemu build on Debian i386, amd64 (stable/unstable), Sparc32, Sparc64 or on OpenBSD/Sparc64. Your program produces one warning on Debian stable (all hosts except no warnings on arm), no warnings on Debian amd64 unstable or OpenBSD.
I've got a lot of warnings on ALT Linux x86_64 and Ubuntu x86_64. Both with gcc 4.1.2. Are you sure that you test static build?
Signature · 3 lines
Regards, Kirill A. Shutemov + Belarus, Minsk + ALT Linux Team, http://www.altlinux.com/
Quoted 34 lines · Kirill A. Shutemov
Quoted 33 lines · Blue Swirl
Quoted 31 lines · Kirill A. Shutemov
Quoted 4 lines · Blue Swirl
Hi,
These trivial patches enable linker flag --warn-common and fix the warnings caused by enabling the flag.
This flag cause a lot of warning on my machine, even with trivial program.
$ cat 1.c #include <stdio.h>int
main(){ printf("test\n"); return 0; } $ gcc -Wl,--warn-common -static 1.c /usr/lib64/gcc/x86_64-alt-linux/4.1.2/../../../../lib64/libc.a(strtoul.o): warning: multiple common of `_nl_category_name_idxs' /usr/lib64/gcc/x86_64-alt-linux/4.1.2/../../../../lib64/libc.a(strtol.o): warning: previous common is here /usr/lib64/gcc/x86_64-alt-linux/4.1.2/../../../../lib64/libc.a(strtol_l.o): warning: multiple common of `_nl_category_name_idxs' /usr/lib64/gcc/x86_64-alt-linux/4.1.2/../../../../lib64/libc.a(strtol.o): warning: previous common is here /usr/lib64/gcc/x86_64-alt-linux/4.1.2/../../../../lib64/libc.a(strtoul_l.o): warning: multiple common of `_nl_category_name_idxs' /usr/lib64/gcc/x86_64-alt-linux/4.1.2/../../../../lib64/libc.a(strtol.o): warning: previous common is here /usr/lib64/gcc/x86_64-alt-linux/4.1.2/../../../../lib64/libc.a(vfprintf.o): warning: multiple common of `_nl_category_name_idxs' /usr/lib64/gcc/x86_64-alt-linux/4.1.2/../../../../lib64/libc.a(strtol.o): warning: previous common is here...and so on.
Is it problem with my toolchain? What is your testing environment?
Quoted 8 lines
Quoted 4 lines
I get no warnings for Qemu build on Debian i386, amd64 (stable/unstable), Sparc32, Sparc64 or on OpenBSD/Sparc64. Your program produces one warning on Debian stable (all hosts except no warnings on arm), no warnings on Debian amd64 unstable or OpenBSD.
I've got a lot of warnings on ALT Linux
x86_64and Ubuntux86_64. Both
with gcc 4.1.2. Are you sure that you test static build?
$ gcc -Wl,--warn-common -static main.c /usr/lib/gcc/x86_64-linux-gnu/4.1.2/../../../../lib64/libc.a(dl-open.o): warning: definition of `_dl_tls_static_size' overriding common /usr/lib/gcc/x86_64-linux-gnu/4.1.2/../../../../lib64/libc.a(libc-tls.o): warning: common is here $ cat main.c #include <stdio.h>
int main()
{
printf("test\n");
return 0;
}Quoted 52 lines · Blue Swirl
Quoted 34 lines · Kirill A. Shutemov
Quoted 33 lines · Blue Swirl
Quoted 31 lines · Kirill A. Shutemov
Quoted 4 lines · Blue Swirl
Hi,
These trivial patches enable linker flag --warn-common and fix the warnings caused by enabling the flag.
This flag cause a lot of warning on my machine, even with trivial program.
$ cat 1.c #include <stdio.h>int
main(){ printf("test\n"); return 0; } $ gcc -Wl,--warn-common -static 1.c /usr/lib64/gcc/x86_64-alt-linux/4.1.2/../../../../lib64/libc.a(strtoul.o): warning: multiple common of `_nl_category_name_idxs' /usr/lib64/gcc/x86_64-alt-linux/4.1.2/../../../../lib64/libc.a(strtol.o): warning: previous common is here /usr/lib64/gcc/x86_64-alt-linux/4.1.2/../../../../lib64/libc.a(strtol_l.o): warning: multiple common of `_nl_category_name_idxs' /usr/lib64/gcc/x86_64-alt-linux/4.1.2/../../../../lib64/libc.a(strtol.o): warning: previous common is here /usr/lib64/gcc/x86_64-alt-linux/4.1.2/../../../../lib64/libc.a(strtoul_l.o): warning: multiple common of `_nl_category_name_idxs' /usr/lib64/gcc/x86_64-alt-linux/4.1.2/../../../../lib64/libc.a(strtol.o): warning: previous common is here /usr/lib64/gcc/x86_64-alt-linux/4.1.2/../../../../lib64/libc.a(vfprintf.o): warning: multiple common of `_nl_category_name_idxs' /usr/lib64/gcc/x86_64-alt-linux/4.1.2/../../../../lib64/libc.a(strtol.o): warning: previous common is here...and so on.
Is it problem with my toolchain? What is your testing environment?
Quoted 8 lines
Quoted 4 lines
I get no warnings for Qemu build on Debian i386, amd64 (stable/unstable), Sparc32, Sparc64 or on OpenBSD/Sparc64. Your program produces one warning on Debian stable (all hosts except no warnings on arm), no warnings on Debian amd64 unstable or OpenBSD.
I've got a lot of warnings on ALT Linux
x86_64and Ubuntux86_64. Both
with gcc 4.1.2. Are you sure that you test static build?$ gcc -Wl,--warn-common -static main.c /usr/lib/gcc/x86_64-linux-gnu/4.1.2/../../../../lib64/libc.a(dl-open.o): warning: definition of `_dl_tls_static_size' overriding common /usr/lib/gcc/x86_64-linux-gnu/4.1.2/../../../../lib64/libc.a(libc-tls.o): warning: common is here $ cat main.c #include <stdio.h>
Quoted 5 lines
int
main(){ printf("test\n"); return 0; }
I think --warn-common shouldn't be added to LDFLAGS, when we build static qemu.
Signature · 3 lines
Regards, Kirill A. Shutemov + Belarus, Minsk + ALT Linux Team, http://www.altlinux.com/
Quoted 60 lines · Kirill A. Shutemov
Quoted 52 lines · Blue Swirl
Quoted 34 lines · Kirill A. Shutemov
Quoted 33 lines · Blue Swirl
Quoted 31 lines · Kirill A. Shutemov
Quoted 4 lines · Blue Swirl
Hi,
These trivial patches enable linker flag --warn-common and fix the warnings caused by enabling the flag.
This flag cause a lot of warning on my machine, even with trivial program.
$ cat 1.c #include <stdio.h>int
main(){ printf("test\n"); return 0; } $ gcc -Wl,--warn-common -static 1.c /usr/lib64/gcc/x86_64-alt-linux/4.1.2/../../../../lib64/libc.a(strtoul.o): warning: multiple common of `_nl_category_name_idxs' /usr/lib64/gcc/x86_64-alt-linux/4.1.2/../../../../lib64/libc.a(strtol.o): warning: previous common is here /usr/lib64/gcc/x86_64-alt-linux/4.1.2/../../../../lib64/libc.a(strtol_l.o): warning: multiple common of `_nl_category_name_idxs' /usr/lib64/gcc/x86_64-alt-linux/4.1.2/../../../../lib64/libc.a(strtol.o): warning: previous common is here /usr/lib64/gcc/x86_64-alt-linux/4.1.2/../../../../lib64/libc.a(strtoul_l.o): warning: multiple common of `_nl_category_name_idxs' /usr/lib64/gcc/x86_64-alt-linux/4.1.2/../../../../lib64/libc.a(strtol.o): warning: previous common is here /usr/lib64/gcc/x86_64-alt-linux/4.1.2/../../../../lib64/libc.a(vfprintf.o): warning: multiple common of `_nl_category_name_idxs' /usr/lib64/gcc/x86_64-alt-linux/4.1.2/../../../../lib64/libc.a(strtol.o): warning: previous common is here...and so on.
Is it problem with my toolchain? What is your testing environment?
Quoted 8 lines
Quoted 4 lines
I get no warnings for Qemu build on Debian i386, amd64 (stable/unstable), Sparc32, Sparc64 or on OpenBSD/Sparc64. Your program produces one warning on Debian stable (all hosts except no warnings on arm), no warnings on Debian amd64 unstable or OpenBSD.
I've got a lot of warnings on ALT Linux
x86_64and Ubuntux86_64. Both
with gcc 4.1.2. Are you sure that you test static build?$ gcc -Wl,--warn-common -static main.c /usr/lib/gcc/x86_64-linux-gnu/4.1.2/../../../../lib64/libc.a(dl-open.o): warning: definition of `_dl_tls_static_size' overriding common /usr/lib/gcc/x86_64-linux-gnu/4.1.2/../../../../lib64/libc.a(libc-tls.o): warning: common is here $ cat main.c #include <stdio.h>Quoted 5 lines
int
main(){ printf("test\n"); return 0; }
Quoted 2 lines
I think --warn-common shouldn't be added to LDFLAGS, when we build static
qemu.
Another solution would be to add a configure time check if the system libraries suck or not. Though these are only warnings and you seem to be the only person complaining.