Control: tags 1012935 confirmed

Hi there!

This week I've been working on this bug and I've come to some conclusions that
might help in your solution.

1. I confirmed the existence of the bug
 This bug occurs during "dh_auto_test" when gcc-12 is used in the "gf-complete"
compilation process. I used gcc-11 and verified that "dh_auto_test" ran without
errors. Switching to gcc-12 had the same problem reported here.

2. I compiled the package "qemu-user-static" with gcc-12
 After compiling, the problem persisted.

3. I compiled "qemu" using your latest version of git with gcc-12
 Using the development version of qemu also did not solve the problem.

4. I compiled each file that forms the library "libgf_complete.so.1.0.0" 
separately
 I created a script and used the gcc-11 compiler as default and performed the
compilation of each .c file in the "./src" directory. After that I tested with
the following command the existence of runtime errors:

LD_LIBRARY_PATH=/tests/gf-complete/src/.libs qemu-x86_64-static \
    -cpu qemu64,-sse3,-ssse3,-sse4.1,-sse4.2 ./test/.libs/gf_unit 64 A -1 -

 Having no errors in the execution, I changed the compiler of each file to 
gcc-12,
until I found the files that had problems when gcc-12 was used. Finished the
process, I located the following files: gf.c, gf_w64.c, and gf_rand.c.

5. I checked the difference between the objects generated by gcc-11 and gcc-12
 Before checking the difference, I had already read the documents [1], [2], and
[3], and I had not found anything to justify the problem that was happening.

[1] https://gcc.gnu.org/gcc-12/porting_to.html
[2] https://gcc.gnu.org/gcc-12/changes.html
[3] https://salsa.debian.org/toolchain-team/gcc/-/blob/master/debian/NEWS.gcc

 Rereading the qemu error message: "Illegal instruction", I decided to check if
there were any significant differences between the instructions generated by
the gcc-11 and gcc-12 compilers. To do this I used the "elfx86exts" software.
Taking object "libgf_complete_la-gf.o" as an example:

# wget 
https://github.com/pkgw/elfx86exts/archive/refs/tags/elfx86e...@0.5.0.tar.gz
# tar xvf elfx86exts\@0.5.0.tar.gz
# cd elfx86exts-elfx86exts-0.5.0
# cargo build

# cargo run -- /tmp/gcc-11/libgf_complete_la-gf.o
    Finished dev [unoptimized + debuginfo] target(s) in 0.02s
     Running `target/debug/elfx86exts /tmp/gcc-11/libgf_complete_la-gf.o`
MODE64 (push)
CMOV (cmovns)
SSE2 (movdqu)
SSE1 (movups)
CPU Generation: Intel Core

# cargo run -- /tmp/gcc-12/libgf_complete_la-gf.o
    Finished dev [unoptimized + debuginfo] target(s) in 0.02s
     Running `target/debug/elfx86exts /tmp/gcc-12/libgf_complete_la-gf.o`
MODE64 (push)
CMOV (cmovns)
SSE2 (movd)
SSE41 (pminsd)
SSE1 (movups)
CPU Generation: Penryn

 Comparing the instructions presented above, generated by the gcc-11 and gcc-12
compilers, it can be seen that gcc-12 generated instructions that gcc-11 does
not. That's why qemu gives the error of "Illegal instruction" when using gcc-12
with the options "-cpu qemu64,-sse3,-ssse3,-sse4.1,-sse4.2".


Best Regards,
mt

Attachment: signature.asc
Description: PGP signature

Reply via email to