[Bug target/101823] GCC generates the wrong string in the assembly code.

2023-01-19 Thread bootmgr at 163 dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101823

--- Comment #5 from bootmgr at 163 dot com  ---
(In reply to niXman from comment #4)
> please provide the step-by-step instruction you used.
1. Extract binutils gcc mingw-w64 files to any where
Extract gmp mpfr mpc isl to gcc source directory
note: please make sure no subdirectories are included under
gcc-x.x.x/{gmp,mpfr,mpc,isl}.
these file can be found here
http://ftp.gnu.org/gnu/binutils/
http://ftp.gnu.org/gnu/gcc/
https://sourceforge.net/projects/mingw-w64/files/mingw-w64/mingw-w64-release/
https://gmplib.org/#DOWNLOAD
https://www.mpfr.org/mpfr-current/#download
https://www.multiprecision.org/mpc/download.html
https://libisl.sourceforge.io/

2. Clone the windows default manifest
(git://cygwin.com/git/cygwin-apps/windows-default-manifest.git)

3. These instructions are used to build cross toolchain and install to /mingw
(can be changed to other directory).
note: use "make -j$(nproc)" instead "make" to use more CPU cores.

1) Set PREFIX and PATH variables

export PREFIX=/mingw
export PATH=$PATH:$PREFIX/bin
note: if you are not root, please run "sudo mkdir /mingw && sudo chmod 777
/mingw"

2) chdir to gcc source directory and run "sed -i
's/${prefix}\/mingw\//${prefix}\//g' configure"
see also
https://github.com/msys2/MINGW-packages/blob/master/mingw-w64-gcc/PKGBUILD#L155

3) Build binutils
../binutils-2.40/configure --disable-nls --disable-rpath --enable-64-bit-bfd
--enable-deterministic-archives --enable-install-libiberty
--target=x86_64-w64-mingw32 --prefix=$PREFIX
make && make install-strip

4) Install mingw-w64 headers
../mingw-w64-v10.0.0/mingw-w64-headers/configure --host=x86_64-w64-mingw32
--prefix=$PREFIX/x86_64-w64-mingw32
make && make install -j16

5) Build GCC core compiler
../gcc-12.2.0/configure --disable-multilib --disable-nls --disable-rpath
--disable-symvers --enable-languages=c,c++,lto --enable-mingw-wildcard
--enable-threads=posix --enable-libgomp --disable-libstdcxx-verbose
--enable-fully-dynamic-string --target=x86_64-w64-mingw32 --prefix=$PREFIX
make all-gcc && make install-strip-gcc

6) Build mingw-w64
../mingw-w64-v10.0.0/configure --enable-experimental --disable-lib32
--host=x86_64-w64-mingw32 --prefix=$PREFIX/x86_64-w64-mingw32
make && make install-strip

7) Build winpthreads (pthread support for windows)
../mingw-w64-v10.0.0/mingw-w64-libraries/winpthreads/configure
--host=x86_64-w64-mingw32 --prefix=$PREFIX/x86_64-w64-mingw32

8) Build windows default manifest
x86_64-w64-mingw32-windres -F pe-x86-64
./windows-default-manifest/default-manifest.rc -o
$PREFIX/x86_64-w64-mingw32/lib/default-manifest.o
note: this has the same effect as the following command
../windows-default-manifest/configure --host=x86_64-w64-mingw32
--prefix=$PREFIX/x86_64-w64-mingw32
make && make install

9) Build GCC compiler
chdir to build gcc directory and run "make && make install-strip"

4.Now we have a mingw-w64 cross toolchain (without zstd libiconv support)
So we can build canadian toolchain easily

1) Build binutils
../binutils-2.40/configure --disable-nls --disable-rpath --enable-64-bit-bfd
--enable-deterministic-archives --enable-install-libiberty
--host=x86_64-w64-mingw32 --prefix=$PREFIX

2) Build GCC
../gcc-12.2.0/configure --disable-multilib --disable-nls --disable-rpath
--disable-symvers --disable-win32-registry --enable-languages=c,c++,lto
--enable-mingw-wildcard --enable-threads=posix --enable-libgomp
--disable-libstdcxx-verbose --enable-fully-dynamic-string
--host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --prefix=$PREFIX

3) Build mingw-w64, winpthreads and windows default manifest
../mingw-w64-v10.0.0/configure --enable-experimental --disable-lib32
--host=x86_64-w64-mingw32 --prefix=$PREFIX
../mingw-w64-v10.0.0/mingw-w64-libraries/winpthreads/configure
--host=x86_64-w64-mingw32 --prefix=$PREFIX
x86_64-w64-mingw32-windres -F pe-x86-64
./windows-default-manifest/default-manifest.rc -o
install_dir/lib/default-manifest.o

[Bug target/101823] GCC generates the wrong string in the assembly code.

2023-01-19 Thread bootmgr at 163 dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101823

--- Comment #6 from bootmgr at 163 dot com  ---
(In reply to niXman from comment #3) 
> what GCC version was used on the host?
$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu
11.3.0-1ubuntu1~22.04' --with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs
--enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix=/usr
--with-gcc-major-version-only --program-suffix=-11
--program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes
--with-default-libstdcxx-abi=new --enable-gnu-unique-object
--disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib
--enable-libphobos-checking=release --with-target-system-zlib=auto
--enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet
--with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32
--enable-multilib --with-tune=generic
--enable-offload-targets=nvptx-none=/build/gcc-11-xKiWfi/gcc-11-11.3.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-11-xKiWfi/gcc-11-11.3.0/debian/tmp-gcn/usr
--without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
--with-build-config=bootstrap-lto-lean --enable-link-serialization=2
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.3.0 (Ubuntu 11.3.0-1ubuntu1~22.04)

[Bug target/101823] GCC generates the wrong string in the assembly code.

2023-01-19 Thread bootmgr at 163 dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101823

--- Comment #7 from bootmgr at 163 dot com  ---
(In reply to boot...@163.com from comment #5)
> (In reply to niXman from comment #4)
> > please provide the step-by-step instruction you used.
> 1. Extract binutils gcc mingw-w64 files to any where
> Extract gmp mpfr mpc isl to gcc source directory
> note: please make sure no subdirectories are included under
> gcc-x.x.x/{gmp,mpfr,mpc,isl}.
> these file can be found here
> http://ftp.gnu.org/gnu/binutils/
> http://ftp.gnu.org/gnu/gcc/
> https://sourceforge.net/projects/mingw-w64/files/mingw-w64/mingw-w64-release/
> https://gmplib.org/#DOWNLOAD
> https://www.mpfr.org/mpfr-current/#download
> https://www.multiprecision.org/mpc/download.html
> https://libisl.sourceforge.io/
> 
> 2. Clone the windows default manifest
> (git://cygwin.com/git/cygwin-apps/windows-default-manifest.git)
> 
> 3. These instructions are used to build cross toolchain and install to
> /mingw (can be changed to other directory).
> note: use "make -j$(nproc)" instead "make" to use more CPU cores.
> 
> 1) Set PREFIX and PATH variables
> 
> export PREFIX=/mingw
> export PATH=$PATH:$PREFIX/bin
> note: if you are not root, please run "sudo mkdir /mingw && sudo chmod 777
> /mingw"
> 
> 2) chdir to gcc source directory and run "sed -i
> 's/${prefix}\/mingw\//${prefix}\//g' configure"
> see also
> https://github.com/msys2/MINGW-packages/blob/master/mingw-w64-gcc/
> PKGBUILD#L155
> 
> 3) Build binutils
> ../binutils-2.40/configure --disable-nls --disable-rpath --enable-64-bit-bfd
> --enable-deterministic-archives --enable-install-libiberty
> --target=x86_64-w64-mingw32 --prefix=$PREFIX
> make && make install-strip
> 
> 4) Install mingw-w64 headers
> ../mingw-w64-v10.0.0/mingw-w64-headers/configure --host=x86_64-w64-mingw32
> --prefix=$PREFIX/x86_64-w64-mingw32
> make && make install -j16
> 
> 5) Build GCC core compiler
> ../gcc-12.2.0/configure --disable-multilib --disable-nls --disable-rpath
> --disable-symvers --enable-languages=c,c++,lto --enable-mingw-wildcard
> --enable-threads=posix --enable-libgomp --disable-libstdcxx-verbose
> --enable-fully-dynamic-string --target=x86_64-w64-mingw32 --prefix=$PREFIX
> make all-gcc && make install-strip-gcc
> 
> 6) Build mingw-w64
> ../mingw-w64-v10.0.0/configure --enable-experimental --disable-lib32
> --host=x86_64-w64-mingw32 --prefix=$PREFIX/x86_64-w64-mingw32
> make && make install-strip
> 
> 7) Build winpthreads (pthread support for windows)
> ../mingw-w64-v10.0.0/mingw-w64-libraries/winpthreads/configure
> --host=x86_64-w64-mingw32 --prefix=$PREFIX/x86_64-w64-mingw32
> 
> 8) Build windows default manifest
> x86_64-w64-mingw32-windres -F pe-x86-64
> ./windows-default-manifest/default-manifest.rc -o
> $PREFIX/x86_64-w64-mingw32/lib/default-manifest.o
> note: this has the same effect as the following command
> ../windows-default-manifest/configure --host=x86_64-w64-mingw32
> --prefix=$PREFIX/x86_64-w64-mingw32
> make && make install
> 
> 9) Build GCC compiler
> chdir to build gcc directory and run "make && make install-strip"
> 
> 4.Now we have a mingw-w64 cross toolchain (without zstd libiconv support)
> So we can build canadian toolchain easily
> 
> 1) Build binutils
> ../binutils-2.40/configure --disable-nls --disable-rpath --enable-64-bit-bfd
> --enable-deterministic-archives --enable-install-libiberty
> --host=x86_64-w64-mingw32 --prefix=$PREFIX
> 
> 2) Build GCC
> ../gcc-12.2.0/configure --disable-multilib --disable-nls --disable-rpath
> --disable-symvers --disable-win32-registry --enable-languages=c,c++,lto
> --enable-mingw-wildcard --enable-threads=posix --enable-libgomp
> --disable-libstdcxx-verbose --enable-fully-dynamic-string
> --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --prefix=$PREFIX
> 
> 3) Build mingw-w64, winpthreads and windows default manifest
> ../mingw-w64-v10.0.0/configure --enable-experimental --disable-lib32
> --host=x86_64-w64-mingw32 --prefix=$PREFIX
> ../mingw-w64-v10.0.0/mingw-w64-libraries/winpthreads/configure
> --host=x86_64-w64-mingw32 --prefix=$PREFIX
> x86_64-w64-mingw32-windres -F pe-x86-64
> ./windows-default-manifest/default-manifest.rc -o
> install_dir/lib/default-manifest.o
After a lg compile, I get the same error on my Ubuntu WSL. but I think it
might be a problem with the WSL VM.

[Bug other/101711] Error when gcc cross compile libvtv

2021-09-10 Thread bootmgr at 163 dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101711

--- Comment #11 from bootmgr at 163 dot com  ---
(In reply to ctice from comment #10)
> I have been trying off-and-on  for the last 3 weeks to build a ming64 GCC
> cross-compiler, on my x86_64 linux ELF system, and I have not been able to
> do it.  This is without enabling libvtv.  The instructions referenced on
> https://sourceforge.net/p/mingw-w64/wiki2/
> Cross%20Win32%20and%20Win64%20compiler/ are at least 8 years out of date,
> and I have not been able to make them work.
> 
> Until I can get a set of instructions that works, I cannot reproduce the
> problem, and without reproducing it I cannot debug/fix it.  I am sorry about
> this, but I really have tried.

Can you give me your error messages?

[Bug libgcc/101655] canadian compile of libgcc uses native cc as the compiler instead of the target cross compiler

2021-07-29 Thread bootmgr at 163 dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101655

--- Comment #11 from bootmgr at 163 dot com  ---
(In reply to Andreas Schwab from comment #10)
> In a canadian cross, you don't compile the target libraries.  They are
> already built while building the cross compiler.

Isn't this a bug?
I manually reconfigured libgcc, and it can detect x86_46-w64-mingw32-{gcc,g++}.
But I did not continue to build it.
Why can't the target library be used for Canadian cross?
I have another question. Why can't libgcc,libquadmath,libvtv and libstdc++
detect the CFLAGS,CXXFLAGS or CPPFALGS environment variable when I build cross
compiler?

[Bug other/101711] New: Error when gcc cross compile libvtv

2021-07-31 Thread bootmgr at 163 dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101711

Bug ID: 101711
   Summary: Error when gcc cross compile libvtv
   Product: gcc
   Version: 11.2.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: other
  Assignee: unassigned at gcc dot gnu.org
  Reporter: bootmgr at 163 dot com
  Target Milestone: ---

Created attachment 51233
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51233&action=edit
output

[Bug other/101711] Error when gcc cross compile libvtv

2021-07-31 Thread bootmgr at 163 dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101711

--- Comment #1 from bootmgr at 163 dot com  ---
Created attachment 51234
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51234&action=edit
config.log

[Bug other/101711] Error when gcc cross compile libvtv

2021-08-05 Thread bootmgr at 163 dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101711

--- Comment #5 from bootmgr at 163 dot com  ---
(In reply to ctice from comment #4)
> Is there something special I need to download, set up, or build in order to
> do mingw32 cross-compiles?
> 
> I'm getting configure/build failures even when I omit enabling vtable
> verify; I also don't know where/how to get the mcf thread libraries?
> 
> [Instructions for both of these are necessary if I am to debug the libvtv
> issue].
> 
> Just to see if this was related to libvtv or not, I tried:
> 
> $ ../configure --disable-multilib --disable-nls --enable-languag
> es=c,c++,lto --enable-version-specific-runtime-libs
> --enable-fully-dynamic-strin
> g --enable-large-address-aware --enable-mingw-wildcard
> --target=x86_64-w64-mingw
> 32 --with-local-prefix=/usr/local/x86_64-w64-mingw32
> $ make
> 
> (Notice that I omitted the --enable-threads=mcf and the
> --enable-vtable-verify flags).
> 
> I got:
> 
> ...
> make[2]: Leaving directory
> '/usr/local/google3/cmtice/gcc-fsf.clean.novtv.obj/libcc1'
> Checking multilib configuration for libgcc...
> Configuring in x86_64-w64-mingw32/libgcc
> configure: loading cache ./config.cache
> checking build system type... x86_64-pc-linux-gnu
> checking host system type... x86_64-w64-mingw32
> checking for --enable-version-specific-runtime-libs... yes
> checking for a BSD-compatible install... /usr/bin/install -c
> checking for gawk... gawk
> checking for x86_64-w64-mingw32-ar... x86_64-w64-mingw32-ar
> checking for x86_64-w64-mingw32-lipo... x86_64-w64-mingw32-lipo
> checking for x86_64-w64-mingw32-nm...
> /usr/local/google3/cmtice/gcc-fsf.clean.novtv.obj/./gcc/nm
> checking for x86_64-w64-mingw32-ranlib... x86_64-w64-mingw32-ranlib
> checking for x86_64-w64-mingw32-strip... x86_64-w64-mingw32-strip
> checking whether ln -s works... yes
> checking for x86_64-w64-mingw32-gcc...
> /usr/local/google3/cmtice/gcc-fsf.clean.novtv.obj/./gcc/xgcc
> -B/usr/local/google3/cmtice/gcc-fsf.clean.novtv.obj/./gcc/
> -L/usr/local/x86_64-w64-mingw32/lib -L/usr/local/mingw/lib -isystem
> /usr/local/x86_64-w64-mingw32/include -isystem /usr/local/mingw/include
> -B/usr/local/x86_64-w64-mingw32/bin/ -B/usr/local/x86_64-w64-mingw32/lib/
> -isystem /usr/local/x86_64-w64-mingw32/include -isystem
> /usr/local/x86_64-w64-mingw32/sys-include   
> checking for suffix of object files... configure: error: in
> `/usr/local/google3/cmtice/gcc-fsf.clean.novtv.obj/x86_64-w64-mingw32/
> libgcc':
> configure: error: cannot compute suffix of object files: cannot compile
> See `config.log' for more details
> make[1]: *** [Makefile:13771: configure-target-libgcc] Error 1
> make[1]: Leaving directory
> '/usr/local/google3/cmtice/gcc-fsf.clean.novtv.obj'
> make: *** [Makefile:968: all] Error 2
> 
> 
> Please update this bug with further instructions. Thank you.

You can download the mcfgthread library at
https://github.com/lhmouse/mcfgthread.
And apply this patch for gcc to support mcf thread model.
https://github.com/lhmouse/MINGW-packages-dev/blob/master/mingw-w64-gcc-git/9000-gcc-10-branch-Added-mcf-thread-model-support-from-mcfgthread.patch
I tried to use --enable-vtable-verify and --with-sysroot=/usr/local, and then
gcc compiled successfully. 
Can you give me your config.log file?

[Bug other/101711] Error when gcc cross compile libvtv

2021-08-05 Thread bootmgr at 163 dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101711

--- Comment #8 from bootmgr at 163 dot com  ---
(In reply to ctice from comment #6)
> I applied the patch supplied in comment 5.  I added
> --with-sysroot=/usr/local to my configure command (still not using
> --enable-threads=mcf or --enable-vtable-verify).  Now it configures, but the
> make command fails while building gcc, complaining that:
> 
> The directory that should contain system headers does not exist:
>   /usr/local/mingw/include
> 
> Which is completely true.  I'm working on an elf/linux machine (x86_64) and
> I have no mingw headers.  Where can I get the appropriate headers (and
> anything else I will need) in order to make this cross compile work?

Compiling a cross toolchain can be a bit complicated.
The mingw-w64 wiki has documentation on how to compile the mingw cross
toolchain.
https://sourceforge.net/p/mingw-w64/wiki2/Cross%20Win32%20and%20Win64%20compiler/
If you want other thread models (other than win32), you can compile the
winpthreads library (--enable-threads=posix) or copy release/mingw64/*
(--enable-threads) from the mcfgthread repository to
/path/to/install/x86_64-w64-mingw32/ after compiling crt.

[Bug c++/101823] New: GCC generates the wrong string in the assembly code.

2021-08-08 Thread bootmgr at 163 dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101823

Bug ID: 101823
   Summary: GCC generates the wrong string in the assembly code.
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: bootmgr at 163 dot com
  Target Milestone: ---

Created attachment 51275
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51275&action=edit
test.s

The gcc I compiled generated wrong assembly code on Windows.
This gcc is Canadian compiled from Ubuntu.

Error Messages:
H:\cxx>g++ test.cc
C:\Users\ADMINI~1\AppData\Local\Temp\ccxMVKI1.s: Assembler messages:
C:\Users\ADMINI~1\AppData\Local\Temp\ccxMVKI1.s:43: Warning: missing closing
`"'
C:\Users\ADMINI~1\AppData\Local\Temp\ccxMVKI1.s:43: Error: invalid character
(0xa in mnemonic

Configured with: ../gcc/configure --disable-multilib --disable-nls
--disable-rpath --disable-win32-registry --enable-graphite
--enable-languages=c,c++,jit,lto --enable-mingw-wildcard --enable-threads=posix
--disable-libstdcxx-pch --disable-
libstdcxx-verbose --enable-fully-dynamic-string --enable-large-address-aware
--host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --prefix=/mingw64

[Bug c++/101823] GCC generates the wrong string in the assembly code.

2021-08-08 Thread bootmgr at 163 dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101823

--- Comment #1 from bootmgr at 163 dot com  ---
Created attachment 51276
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51276&action=edit
test.cc

[Bug target/101823] GCC generates the wrong string in the assembly code.

2021-08-12 Thread bootmgr at 163 dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101823

--- Comment #2 from bootmgr at 163 dot com  ---
I reconfigured gcc with --enable-threads=win32 (not --enable-threads=posix) and
this gcc can compile the program correctly.The posix thread model cannot.