[Bug ld/14773] New: ld --as-needed reports undefined reference in the wrong library

2012-10-27 Thread ats-sourceware at offog dot org
http://sourceware.org/bugzilla/show_bug.cgi?id=14773

 Bug #: 14773
   Summary: ld --as-needed reports undefined reference in the
wrong library
   Product: binutils
   Version: 2.23
Status: NEW
  Severity: minor
  Priority: P2
 Component: ld
AssignedTo: unassig...@sourceware.org
ReportedBy: ats-sourcew...@offog.org
Classification: Unclassified
  Host: x86_64-unknown-linux-gnu
Target: x86_64-unknown-linux-gnu
 Build: x86_64-unknown-linux-gnu


Created attachment 6702
  --> http://sourceware.org/bugzilla/attachment.cgi?id=6702
Script to reproduce the problem

If I have:

- libshared.so linked with -lX11, containing func which calls XFillRectangle
- libstatic.a, containing func2 which calls XFillRectangle
- main.o, containing main which calls func and func2

... and I do:

gcc -Wl,--as-needed -o main main.o libshared.so -lX11 libstatic.a

... then I get an error like this:

/gar/bin/ld: libshared.so: undefined reference to symbol 'XFillRectangle'
/gar/bin/ld: note: 'XFillRectangle' is defined in DSO /lib64/libX11.so so try
adding it to the linker command line
/lib64/libX11.so: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status

The "undefined reference" report is misleading -- XFillRectangle isn't an
undefined symbol in libshared.so, because libshared.so was correctly linked
against -lX11. It's an undefined symbol in libstatic.a.

This happens for me with binutils 2.23 and 2.22 built from source, and with
Debian wheezy's 2.22. I'll attach the output from all three of these, but it's
effectively the same, just with different paths.

I actually ran into this problem while building motif 2.3.4, where the static
library was libExm.a, the shared library was libXm.so, and the executable being
linked was simple_app.

Interestingly, if you remove the -lX11 from the ld invocation, then it links
quite happily -- which I didn't expect with --as-needed...

Let me know if you need any more details -- thanks!

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/14773] ld --as-needed reports undefined reference in the wrong library

2012-10-27 Thread ats-sourceware at offog dot org
http://sourceware.org/bugzilla/show_bug.cgi?id=14773

--- Comment #1 from Adam Sampson  2012-10-27 
14:43:02 UTC ---
Created attachment 6703
  --> http://sourceware.org/bugzilla/attachment.cgi?id=6703
Output from that script on homebrew 2.22 and 2.23, and Debian's 2.22

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug gas/14775] New: [2.23] gas build failure for aarch64-linux: set but not used variable in tc-aarch64.c:first_error_fmt

2012-10-27 Thread mikpe at it dot uu.se
http://sourceware.org/bugzilla/show_bug.cgi?id=14775

 Bug #: 14775
   Summary: [2.23] gas build failure for aarch64-linux: set but
not used variable in tc-aarch64.c:first_error_fmt
   Product: binutils
   Version: 2.23
Status: NEW
  Severity: normal
  Priority: P2
 Component: gas
AssignedTo: unassig...@sourceware.org
ReportedBy: mi...@it.uu.se
Classification: Unclassified


I've previously built cvs head snapshots for aarch64-linux.  Attempting to do
so with the binutils-2.23 release fails as follows:

gcc -DHAVE_CONFIG_H -I. -I/tmp/binutils-2.23/gas  -I. -I/tmp/binutils-2.23/gas
-I../bfd -I/tmp/binutils-2.23/gas/config -I/tmp/binutils-2.23/gas/../include
-I/tmp/binutils-2.23/gas/.. -I/tmp/binutils-2.23/gas/../bfd
-DLOCALEDIR="\"/tmp/install/share/locale\""  -W -Wall -Wstrict-prototypes
-Wmissing-prototypes -Wshadow -Werror -g -O2 -MT tc-aarch64.o -MD -MP -MF
.deps/tc-aarch64.Tpo -c -o tc-aarch64.o `test -f 'config/tc-aarch64.c' || echo
'/tmp/binutils-2.23/gas/'`config/tc-aarch64.c
/tmp/binutils-2.23/gas/config/tc-aarch64.c: In function 'first_error_fmt':
/tmp/binutils-2.23/gas/config/tc-aarch64.c:646:11: error: variable 'ret' set
but not used [-Werror=unused-but-set-variable]

The code in question is:

{
  int ret;
  va_start (args, format);
  ret = vsnprintf (buffer, size, format, args);
  know (ret <= size - 1 && ret >= 0);
  va_end (args);
  set_syntax_error (buffer);
}

That is, the variable ret is only used in the assert-like know call.  However,
know is a macro that expands to a dummy statement (do{}while(0)), so the actual
parameter expression disappears and ret is unused-but-set.

This doesn't happen when building from cvs head, presumably because know then
expands to gas_assert which does evaluate the expression.

I don't want to use --disable-werror by default.  Is there a reason why know(p)
can't use the standard technique of expanding to (void)(p)?  That change fixes
the problem for me.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug gas/14775] [2.23] gas build failure for aarch64-linux: set but not used variable in tc-aarch64.c:first_error_fmt

2012-10-27 Thread mikpe at it dot uu.se
http://sourceware.org/bugzilla/show_bug.cgi?id=14775

Mikael Pettersson  changed:

   What|Removed |Added

 Target||aarch64-linux

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/14776] New: Typos in the manual

2012-10-27 Thread dilyan.palauzov at aegee dot org
http://sourceware.org/bugzilla/show_bug.cgi?id=14776



 Bug #: 14776

   Summary: Typos in the manual

   Product: binutils

   Version: 2.23

Status: NEW

  Severity: minor

  Priority: P2

 Component: ld

AssignedTo: unassig...@sourceware.org

ReportedBy: dilyan.palau...@aegee.org

Classification: Unclassified





Hello,



Please update in ld.texinfo:



Node ARM:

1.

  ... so may cause incorrect progrm behavior in rare cases

progrm -> progrAm



2.

  ... , increasing the code sizw.

sizw -> size



Със здраве

  Дилян



-- 

Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email

--- You are receiving this mail because: ---

You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/14778] New: ld testsuite failure: FAIL: Common symbol override ifunc test 1b

2012-10-27 Thread timo.gurr at gmail dot com
http://sourceware.org/bugzilla/show_bug.cgi?id=14778

 Bug #: 14778
   Summary: ld testsuite failure: FAIL: Common symbol override
ifunc test 1b
   Product: binutils
   Version: 2.23
Status: NEW
  Severity: normal
  Priority: P2
 Component: ld
AssignedTo: unassig...@sourceware.org
ReportedBy: timo.g...@gmail.com
Classification: Unclassified


To reproduce:
tar xf binutils-2.23.tar.bz2
cd binutils-2.23
./configure
make -j4
cd ld
make check

Running binutils-2.23/ld/testsuite/ld-ifunc/ifunc.exp ...
FAIL: Common symbol override ifunc test 1b

=== ld Summary ===

# of expected passes784
# of unexpected failures1
# of expected failures  61
# of untested testcases 1

I'm using gcc-4.7.2 and glibc-2.16 on x86_64.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/14778] ld testsuite failure: FAIL: Common symbol override ifunc test 1b

2012-10-27 Thread allan at archlinux dot org
http://sourceware.org/bugzilla/show_bug.cgi?id=14778

Allan McRae  changed:

   What|Removed |Added

 CC||allan at archlinux dot org

--- Comment #1 from Allan McRae  2012-10-27 
22:03:45 UTC ---
I see this on both i686 and x86_64 using gcc-4.7.2 and glibc-2.16.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug binutils/14779] New: readelf.c:403:3: error: unknown type name 'mbstate_t'

2012-10-27 Thread danglin at gcc dot gnu.org
http://sourceware.org/bugzilla/show_bug.cgi?id=14779

 Bug #: 14779
   Summary: readelf.c:403:3: error: unknown type name 'mbstate_t'
   Product: binutils
   Version: 2.24 (HEAD)
Status: NEW
  Severity: normal
  Priority: P2
 Component: binutils
AssignedTo: unassig...@sourceware.org
ReportedBy: dang...@gcc.gnu.org
CC: ni...@redhat.com
Classification: Unclassified
  Host: hppa1.1-hp-hp10.20
Target: hppa1.1-hp-hp10.20
 Build: hppa1.1-hp-hp10.20


gcc -DHAVE_CONFIG_H -I. -I../../src/binutils  -I. -I../../src/binutils -I../bfd
-I../../src/binutils/../bfd -I../../src/binutils/../include -DHOST_HPPAHPUX
-D_LARGEFILE64_SOURCE -DLOCALEDIR="\"/usr/local/share/locale\""
-Dbin_dummy_emulation=bin_vanilla_emulation -D_LARGEFILE_SOURCE
-D_LARGEFILE64_SOURCE -I/usr/local/include -W -Wall -Wstrict-prototypes
-Wmissing-prototypes -Wshadow -g -O2 -MT readelf.o -MD -MP -MF
.deps/readelf.Tpo -c -o readelf.o ../../src/binutils/readelf.c
../../src/binutils/readelf.c: In function 'print_symbol':
../../src/binutils/readelf.c:403:3: error: unknown type name 'mbstate_t'
../../src/binutils/readelf.c:460:4: warning: implicit declaration of function
'mbrtowc' [-Wimplicit-function-declaration]
make[4]: *** [readelf.o] Error 1

'mbstate_t' and 'mbrtowc' are not supported.

Have:
 extern int mblen(const char *, size_t);
 extern int mbtowc(wchar_t *, const char *, size_t);
 extern int wctomb(char *, wchar_t);
 extern size_t mbstowcs(wchar_t *, const char *, size_t);
 extern size_t wcstombs(char *, const wchar_t *, size_t);

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils