Bug 5035 - x86_64-pc-mingw32-as.exe failed to work
Summary: x86_64-pc-mingw32-as.exe failed to work
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: gas (show other bugs)
Version: 2.19
: P2 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-09-14 15:31 UTC by drangon
Modified: 2007-09-18 00:37 UTC (History)
2 users (show)

See Also:
Host: x86_64-pc-mingw32
Target: x86_64-pc-mingw32
Build: x86_64-redhat-linux-gnu
Last reconfirmed:


Attachments
source code of c testcase (111 bytes, text/plain)
2007-09-16 06:34 UTC, drangon
Details
result of asm code by x86_64-pc-mingw32-gcc.exe -S (402 bytes, text/plain)
2007-09-16 06:35 UTC, drangon
Details
cpp file of hello world (111 bytes, text/plain)
2007-09-16 06:36 UTC, drangon
Details
asm code by x86_64-pc-mingw32-g++.exe -S (496 bytes, text/plain)
2007-09-16 06:36 UTC, drangon
Details
asm code by cross compiler under linux, x86_64-pc-mingw32-g++ -S (455 bytes, text/plain)
2007-09-16 08:31 UTC, drangon
Details

Note You need to log in before you can comment on or make changes to this bug.
Description drangon 2007-09-14 15:31:18 UTC
I compile a cross compiler --host=x86_64-redhat-linux-gnu
--target=x86_64-pc-mingw32,
Then use this cross compiler to compile a native binutils and gcc,
Then I run the native x86_64-pc-mingw32-g++.exe which call native
as.exe under winxp x64.

It produce such error :

$ /c/tools/target/bin/x86_64-pc-mingw32-g++.exe -v -Wall hello.cpp
Using built-in specs.
Target: x86_64-pc-mingw32
Configured with: ../gcc/configure --host=x86_64-pc-mingw32
--enable-languages=c,c++ --disable-nls --disable-multilib
--disable-libstdcxx-pch --enable-long-long
--with-gmp=/home/drangon/mingw/target/forgcc
--prefix=/home/drangon/mingw/target
Thread model: win32
gcc version 4.3.0 20070914 (experimental) (GCC)
COLLECT_GCC_OPTIONS='-v' '-Wall' '-mtune=generic'
 c:/tools/target/bin/../libexec/gcc/x86_64-pc-mingw32/4.3.0/cc1plus.exe
-quiet -v -iprefix
c:\tools\target\bin\../lib/gcc/x86_64-pc-mingw32/4.3.0/ hello.cpp
-quiet -dumpbase hello.cpp -mtune=generic -auxbase hello -Wall
-version -o C:/DOCUME~1/drangon/LOCALS~1/Temp/ccMHaaaa.s
ignoring nonexistent directory
"c:\tools\target\bin\../lib/gcc/x86_64-pc-mingw32/4.3.0/../../../../include/c++/4.3.0"
ignoring nonexistent directory
"c:\tools\target\bin\../lib/gcc/x86_64-pc-mingw32/4.3.0/../../../../include/c++/4.3.0/x86_64-pc-mingw32"
ignoring nonexistent directory
"c:\tools\target\bin\../lib/gcc/x86_64-pc-mingw32/4.3.0/../../../../include/c++/4.3.0/backward"
ignoring nonexistent directory
"c:/tools/target/lib/gcc/../../lib/gcc/x86_64-pc-mingw32/4.3.0/../../../../include/c++/4.3.0"
ignoring nonexistent directory
"c:/tools/target/lib/gcc/../../lib/gcc/x86_64-pc-mingw32/4.3.0/../../../../include/c++/4.3.0/x86_64-pc-mingw32"
ignoring nonexistent directory
"c:/tools/target/lib/gcc/../../lib/gcc/x86_64-pc-mingw32/4.3.0/../../../../include/c++/4.3.0/backward"
ignoring nonexistent directory "/home/drangon/mingw/target/include"
ignoring nonexistent directory "/mingw/include64"
#include "..." search starts here:
#include <...> search starts here:
 c:\tools\target\bin\../lib/gcc/x86_64-pc-mingw32/4.3.0/../../../../include
 c:\tools\target\bin\../lib/gcc/x86_64-pc-mingw32/4.3.0/include
 c:\tools\target\bin\../lib/gcc/x86_64-pc-mingw32/4.3.0/include-fixed
 c:\tools\target\bin\../lib/gcc/x86_64-pc-mingw32/4.3.0/../../../../x86_64-pc-mingw32/include
 c:/tools/target/lib/gcc/../../include
 c:/tools/target/lib/gcc/../../lib/gcc/x86_64-pc-mingw32/4.3.0/include
 c:/tools/target/lib/gcc/../../lib/gcc/x86_64-pc-mingw32/4.3.0/include-fixed
 c:/tools/target/lib/gcc/../../lib/gcc/x86_64-pc-mingw32/4.3.0/../../../../x86_64-pc-mingw32/include
End of search list.
GNU C++ (GCC) version 4.3.0 20070914 (experimental) (x86_64-pc-mingw32)
       compiled by GNU C version 4.3.0 20070914 (experimental), GMP
version 4.2.2, MPFR version 2.3.0.
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: 952c5c349b801e679ce084d69ae4e018
hello.cpp: In function 'int main(int, char**)':
hello.cpp:9: warning: format '%d' expects type 'int', but argument 2
has type 'long long unsigned int'
hello.cpp:9: warning: format '%d' expects type 'int', but argument 3
has type 'long long unsigned int'
hello.cpp:9: warning: format '%d' expects type 'int', but argument 4
has type 'long long unsigned int'
COLLECT_GCC_OPTIONS='-v' '-Wall' '-mtune=generic'
 c:/tools/target/bin/../lib/gcc/x86_64-pc-mingw32/4.3.0/../../../../x86_64-pc-mingw32/bin/as.exe
-o C:/DOCUME~1/drangon/LOCALS~1/Temp/ccofbaaa.o
C:/DOCUME~1/drangon/LOCALS~1/Temp/ccMHaaaa.s
C:/DOCUME~1/drangon/LOCALS~1/Temp/ccMHaaaa.s: Assembler messages:
C:/DOCUME~1/drangon/LOCALS~1/Temp/ccMHaaaa.s:2: Internal error!
Assertion failure in obj_coff_endef at
../../binutils/gas/config/obj-coff.c line 780.
Please report this bug.

=================================

I read the source code binutils/gas/config/obj-coff.c 780 line it is :

 778   if (SF_GET_FUNCTION (def_symbol_in_progress))
 779     {
 780       know (sizeof (def_symbol_in_progress) <= sizeof (long));
 781       set_function (def_symbol_in_progress);
 782       SF_SET_PROCESS (def_symbol_in_progress);

x86_64-pc-mingw32 has a ABI that pointer is 8 bytes and int / long is 4 bytes,
so maybe sizeof( pointer ) <= sizeof(long) is not true.

I remove this line and compile a new as.exe, then run g++, it print
out this log :

$ /c/tools/target/bin/x86_64-pc-mingw32-g++.exe -v -Wall hello.cpp
Using built-in specs.
Target: x86_64-pc-mingw32
Configured with: ../gcc/configure --host=x86_64-pc-mingw32
--enable-languages=c,c++ --disable-nls --disable-multilib
--disable-libstdcxx-pch --enable-long-long
--with-gmp=/home/drangon/mingw/target/forgcc
--prefix=/home/drangon/mingw/target
Thread model: win32
gcc version 4.3.0 20070914 (experimental) (GCC)
COLLECT_GCC_OPTIONS='-v' '-Wall' '-mtune=generic'
 c:/tools/target/bin/../libexec/gcc/x86_64-pc-mingw32/4.3.0/cc1plus.exe
-quiet -v -iprefix
c:\tools\target\bin\../lib/gcc/x86_64-pc-mingw32/4.3.0/ hello.cpp
-quiet -dumpbase hello.cpp -mtune=generic -auxbase hello -Wall
-version -o C:/DOCUME~1/drangon/LOCALS~1/Temp/ccQLaaaa.s
ignoring nonexistent directory
"c:\tools\target\bin\../lib/gcc/x86_64-pc-mingw32/4.3.0/../../../../include/c++/4.3.0"
ignoring nonexistent directory
"c:\tools\target\bin\../lib/gcc/x86_64-pc-mingw32/4.3.0/../../../../include/c++/4.3.0/x86_64-pc-mingw32"
ignoring nonexistent directory
"c:\tools\target\bin\../lib/gcc/x86_64-pc-mingw32/4.3.0/../../../../include/c++/4.3.0/backward"
ignoring nonexistent directory
"c:/tools/target/lib/gcc/../../lib/gcc/x86_64-pc-mingw32/4.3.0/../../../../include/c++/4.3.0"
ignoring nonexistent directory
"c:/tools/target/lib/gcc/../../lib/gcc/x86_64-pc-mingw32/4.3.0/../../../../include/c++/4.3.0/x86_64-pc-mingw32"
ignoring nonexistent directory
"c:/tools/target/lib/gcc/../../lib/gcc/x86_64-pc-mingw32/4.3.0/../../../../include/c++/4.3.0/backward"
ignoring nonexistent directory "/home/drangon/mingw/target/include"
ignoring nonexistent directory "/mingw/include64"
#include "..." search starts here:
#include <...> search starts here:
 c:\tools\target\bin\../lib/gcc/x86_64-pc-mingw32/4.3.0/../../../../include
 c:\tools\target\bin\../lib/gcc/x86_64-pc-mingw32/4.3.0/include
 c:\tools\target\bin\../lib/gcc/x86_64-pc-mingw32/4.3.0/include-fixed
 c:\tools\target\bin\../lib/gcc/x86_64-pc-mingw32/4.3.0/../../../../x86_64-pc-mingw32/include
 c:/tools/target/lib/gcc/../../include
 c:/tools/target/lib/gcc/../../lib/gcc/x86_64-pc-mingw32/4.3.0/include
 c:/tools/target/lib/gcc/../../lib/gcc/x86_64-pc-mingw32/4.3.0/include-fixed
 c:/tools/target/lib/gcc/../../lib/gcc/x86_64-pc-mingw32/4.3.0/../../../../x86_64-pc-mingw32/include
End of search list.
GNU C++ (GCC) version 4.3.0 20070914 (experimental) (x86_64-pc-mingw32)
       compiled by GNU C version 4.3.0 20070914 (experimental), GMP
version 4.2.2, MPFR version 2.3.0.
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: 952c5c349b801e679ce084d69ae4e018
hello.cpp: In function 'int main(int, char**)':
hello.cpp:9: warning: format '%d' expects type 'int', but argument 2
has type 'long long unsigned int'
hello.cpp:9: warning: format '%d' expects type 'int', but argument 3
has type 'long long unsigned int'
hello.cpp:9: warning: format '%d' expects type 'int', but argument 4
has type 'long long unsigned int'
COLLECT_GCC_OPTIONS='-v' '-Wall' '-mtune=generic'
 c:/tools/target/bin/../lib/gcc/x86_64-pc-mingw32/4.3.0/../../../../x86_64-pc-mingw32/bin/as.exe
-o C:/DOCUME~1/drangon/LOCALS~1/Temp/ccwnbaaa.o
C:/DOCUME~1/drangon/LOCALS~1/Temp/ccQLaaaa.s
C:/DOCUME~1/drangon/LOCALS~1/Temp/ccQLaaaa.s: Assembler messages:
C:/DOCUME~1/drangon/LOCALS~1/Temp/ccQLaaaa.s:107: Error: unknown
pseudo-op: `.hidden'
Comment 1 H.J. Lu 2007-09-15 20:37:45 UTC
(In reply to comment #0)
> I compile a cross compiler --host=x86_64-redhat-linux-gnu
> --target=x86_64-pc-mingw32,
> Then use this cross compiler to compile a native binutils and gcc,
> Then I run the native x86_64-pc-mingw32-g++.exe which call native
> as.exe under winxp x64.
> 
> It produce such error :
>
> C:/DOCUME~1/drangon/LOCALS~1/Temp/ccMHaaaa.s
> C:/DOCUME~1/drangon/LOCALS~1/Temp/ccMHaaaa.s: Assembler messages:
> C:/DOCUME~1/drangon/LOCALS~1/Temp/ccMHaaaa.s:2: Internal error!
> Assertion failure in obj_coff_endef at
> ../../binutils/gas/config/obj-coff.c line 780.
> Please report this bug.

Please provide an assembly code to reproduce the problem. You can use
"gcc -S" to generate the .s file.


> C:/DOCUME~1/drangon/LOCALS~1/Temp/ccQLaaaa.s
> C:/DOCUME~1/drangon/LOCALS~1/Temp/ccQLaaaa.s: Assembler messages:
> C:/DOCUME~1/drangon/LOCALS~1/Temp/ccQLaaaa.s:107: Error: unknown
> pseudo-op: `.hidden'

I don't think .hidden works work on Windows. Why does your gcc generate
it?
Comment 2 drangon 2007-09-16 06:34:27 UTC
Created attachment 2005 [details]
source code of c testcase
Comment 3 drangon 2007-09-16 06:35:44 UTC
Created attachment 2006 [details]
result of asm code by x86_64-pc-mingw32-gcc.exe -S
Comment 4 drangon 2007-09-16 06:36:10 UTC
Created attachment 2007 [details]
cpp file of hello world
Comment 5 drangon 2007-09-16 06:36:34 UTC
Created attachment 2008 [details]
asm code by x86_64-pc-mingw32-g++.exe -S
Comment 6 drangon 2007-09-16 06:47:12 UTC
the testcase t1.c t2.s t2.cpp t2.s has upload as attachment
/c/tools/target.old/bin/as.exe is the native x86_64-pc-mingw32 execute file
compile from CVS head by cross compiler.
/c/tools/target/bin/as.exe is like the above, but comment out the line 780,
remove the "know( xxxx < sizeof(long) );" code.

the running result is :

drangon@DGN64 /c/temp/tmingw
$ /c/tools/target/bin/x86_64-pc-mingw32-gcc.exe -S t1.c 

drangon@DGN64 /c/temp/tmingw
$ /c/tools/target.old/bin/as.exe t1.s -o t1.o
t1.s: Assembler messages:
t1.s:2: Internal error!
Assertion failure in obj_coff_endef at ../../src/gas/config/obj-coff.c line 780.
Please report this bug.

drangon@DGN64 /c/temp/tmingw
$ /c/tools/target/bin/as.exe t1.s -o t1.o

drangon@DGN64 /c/temp/tmingw
$ /c/tools/target/bin/x86_64-pc-mingw32-g++.exe -S t2.cpp   

drangon@DGN64 /c/temp/tmingw
$ /c/tools/target.old/bin/as.exe t2.s -o t2.o
t2.s: Assembler messages:
t2.s:2: Internal error!
Assertion failure in obj_coff_endef at ../../src/gas/config/obj-coff.c line 780.
Please report this bug.

drangon@DGN64 /c/temp/tmingw
$ /c/tools/target/bin/as.exe t2.s -o t2.o                
t2.s: Assembler messages:
t2.s:67: Error: unknown pseudo-op: `.hidden'


"../../src/gas/config/obj-coff.c line 780" seems to be binutils's bug.
but for "unknown pseudo-op: `.hidden'", it seems that g++ generate wrong asm,

Comment 7 drangon 2007-09-16 08:31:20 UTC
Created attachment 2009 [details]
asm code by cross compiler under linux, x86_64-pc-mingw32-g++ -S
Comment 8 drangon 2007-09-16 08:37:38 UTC
the same t2.cpp, if compiled by the cross compiler, doesn't has the ".hidden"
section.
see cross-t2.s , it seems cross g++ has some difference with native g++ for
x86_64-pc-mingw32 target.

cross-t2.s was generate by following command under linux :

-bash-3.1$ ../cross/bin/x86_64-pc-mingw32-g++ -S t2.cpp
-bash-3.1$ mv t2.s cross-t2.s

Comment 9 H.J. Lu 2007-09-16 22:14:13 UTC
A patch is posted at

http://sourceware.org/ml/binutils/2007-09/msg00209.html
Comment 10 H.J. Lu 2007-09-16 22:15:28 UTC
(In reply to comment #6)
>
> drangon@DGN64 /c/temp/tmingw
> $ /c/tools/target/bin/as.exe t2.s -o t2.o                
> t2.s: Assembler messages:
> t2.s:67: Error: unknown pseudo-op: `.hidden'
> 
> 
> "../../src/gas/config/obj-coff.c line 780" seems to be binutils's bug.
> but for "unknown pseudo-op: `.hidden'", it seems that g++ generate wrong asm,
> 

This is a gcc problem, not a gas problem.

Comment 11 H.J. Lu 2007-09-18 00:37:23 UTC
Fixed.