[Bug ld/12721] New: (as or ld) produce a bad jump on mips eabi

2011-05-02 Thread wesley at terpstra dot ca
http://sourceware.org/bugzilla/show_bug.cgi?id=12721

   Summary: (as or ld) produce a bad jump on mips eabi
   Product: binutils
   Version: 2.18
Status: NEW
  Severity: normal
  Priority: P2
 Component: ld
AssignedTo: unassig...@sources.redhat.com
ReportedBy: wes...@terpstra.ca


I've been bitten by a miscompilation of 'goto' on the mips target. I have
isolated it into a single test-case referenced below. I believe this bug to be
at least 6 years old and it is still present in version 2.18.1~cvs20080103-7
(as used in debian/sid).

The problem boils down to these assembler constructs which SHOULD behave the
same as I understand it:
  sw $3,%lo(nextFun)($2)
- lw $1,%got($L894)($28)
+ lui $1,%hi($L894)
  nop
  addiu $1,$1,%lo($L894)
  jr $1
The '%got' variant which is used by default on EABI will lead to a segmentation
fault. 

I attached a tarball with the assembler to be (mis)compiled, the original C
file, and a library sufficient to link the final program.

If you want to blame gcc (though i think the assembler it generated is valid)
here is how to rebuild the assembler:
gcc -std=gnu99 -O0 -g -w -fno-strict-aliasing mlyacc.6.preprocessed.c -S -o
mlyacc.6.preprocessed.s

To link the two alternatives:
gcc -o ok mlyacc.6.preprocessed.ok.s link.a -lgmp -lm
gcc -o bad mlyacc.6.preprocessed.bad.s link.a -lgmp -lm
... the gmp version used here is 5.0.1+dfsg-7 from debian sid.
... the glibc version is 2.11.2-11 (again from debian sid)

To observe the bad jump:
gdb ./bad
break mlyacc.6.preprocessed.c:2915
run
Breakpoint 1, Chunk6 () at mlyacc.6.preprocessed.c:2915
2915 *(Word8*)(stackTop + (60)) = (Word8)(Word8)0x0;
(gdb) s
2916 *(CPointer*)(stackTop + (56)) = 25;
(gdb)
2917 do { if (0) fprintf (stderr, "%s:%d: Push (%d)\n", "mlyacc.6.c",
912, 60); stackTop += (60); } while (0);
(gdb)
2919 cont.nextChunk = (void*)Chunk0;
(gdb)
2920 nextFun = 2736; }
(gdb)
2922 goto leaveChunk; /* !!! This jump goes the wrong way !!! */
(gdb)

Program received signal SIGSEGV, Segmentation fault.
0x2aabead0 in _dl_check_caller (caller=0x0, mask=0) at dl-caller.c:39
39 dl-caller.c: No such file or directory.
in dl-caller.c

If you run the same sequence on 'gdb ./ok' the program will proceed past the
bad jump and die at the next bad jump. (Yes, in this file there are multiple
jumps which get miscompiled. mlyacc.6.preprocessed.ok.s only has the first
jump corrected.

-- 
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/12633] Crash with dlltool geneated import *.libs in MSVC++ Release target (Debug OK)

2011-05-02 Thread martin at martin dot st
http://sourceware.org/bugzilla/show_bug.cgi?id=12633

--- Comment #2 from Martin Storsjö  2011-05-02 
11:26:59 UTC ---
Created attachment 5700
  --> http://sourceware.org/bugzilla/attachment.cgi?id=5700
Minimal test case

Here's an attached quite minimal testcase for this issue.

The makefile builds a tiny DLL using mingw/gcc, and generates an import
library, both using --out-implib with ld and using dlltool. Then the makefile
builds two test exes that links to the created import libraries - both exes run
just fine on windows.

The batch script msvc.bat builds the same test exes using the MSVC command line
tools, both with and without the /OPT:REF flag, against both of the created
import libraries. The ones built with /OPT:NOREF work fine, while the ones
built with /OPT:REF fail.

For comparison, it also creates an import library from the .def file using
lib.exe, and links against it. For the exes built against this import library,
both versions work.

-- 
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/12720] [regression] ar d segfaults

2011-05-02 Thread cvs-commit at gcc dot gnu.org
http://sourceware.org/bugzilla/show_bug.cgi?id=12720

--- Comment #3 from cvs-commit at gcc dot gnu.org  2011-05-02 12:47:50 UTC ---
CVSROOT:/cvs/src
Module name:src
Changes by:h...@sourceware.org2011-05-02 12:47:47

Modified files:
binutils/testsuite: ChangeLog 
binutils/testsuite/binutils-all: ar.exp 

Log message:
Add testcases for "ar -d" and "ar -m".

2011-05-02  H.J. Lu  

PR binutils/12720
* binutils-all/ar.exp (delete_an_element): New.
(move_an_element): Likewise.
Run delete_an_element and move_an_element.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/binutils/testsuite/ChangeLog.diff?cvsroot=src&r1=1.234&r2=1.235
http://sourceware.org/cgi-bin/cvsweb.cgi/src/binutils/testsuite/binutils-all/ar.exp.diff?cvsroot=src&r1=1.15&r2=1.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 ld/12721] (as or ld) produce a bad jump on mips eabi

2011-05-02 Thread wesley at terpstra dot ca
http://sourceware.org/bugzilla/show_bug.cgi?id=12721

--- Comment #1 from Wesley W. Terpstra  2011-05-02 
12:58:47 UTC ---
Created attachment 5701
  --> http://sourceware.org/bugzilla/attachment.cgi?id=5701
Testcase for bad linking

-- 
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