foss-for-synopsys-dwc-arc-processors / qemu

QEMU port for ARCv2 Processors
Other
12 stars 9 forks source link

Testing hs gcc linux full system fails #88

Open luismgsilva opened 2 years ago

luismgsilva commented 2 years ago

Im having a issue when testing the hs gcc linux on full system. This problem doesn't happen every time. Yesterday with the same configuration i managed to execute the tests, but later on i was not able to. The issue is the following:

qemu-system-arc: ../../sources/qemu/target/arc/translate.c:378: arc_map_opcode: Assertion `"This should not happen" == 0' failed.

To build the toolchain i used the following command.

I module loaded the the toolchain build. I executed qemu with a linux image with the following command.

To execute the test I used the following command to make the connection and run the test itself

The JSON Format bellow represents all the versions used in the current execution.

{
    "hs-gcc-linux-qemu": {
        "arc_gcc_linux": {
            "build_date": "2022-10-24 18:05:01",
            "hs-gnu-toolchain": {
                "repo": "https://github.com/foss-for-synopsys-dwc-arc-processors/arc-gnu-toolchain",
                "branch": "hs_testing",
                "hash": "3d2e8b8dc03c7358b029f3f357dc3895e97a6a25"
            },
            "gcc": {
                "branch": "arc64",
                "hash": "94ee2463f3e984d8358c07239a454ad04fc8a9af"
            },
            "binutils-gdb": {
                "branch": "arc64",
                "hash": "aee19ba3712d69584a72171173e2311c17602074"
            },
            "glibc": {
                "hash": "c804cd1c00adde061ca51711f63068c103e94eef"
            }
        },
        "qemu": {
            "build_date": "2022-10-25 11:39:09",
            "qemu": {
                "repo": "https://github.com/foss-for-synopsys-dwc-arc-processors/qemu",
                "branch": "master",
                "hash": "7e8b35790946799be6884852377373c179434a5a"
            }
        },
        "gcc": {
            "build_date": "2022-10-25 11:47:39",
            "gcc": {
                "repo": "https://github.com/foss-for-synopsys-dwc-arc-processors/gcc.git",
                "branch": "arc64",
                "hash": "94ee2463f3e984d8358c07239a454ad04fc8a9af"
            }
        },
        "toolchain": {
            "build_date": "2022-10-25 11:47:39",
            "toolchain": {
                "repo": "https://github.com/foss-for-synopsys-dwc-arc-processors/toolchain.git",
                "branch": "arc-dev",
                "hash": "5d003ee694dc8df69361243cc14434cf897c3b8e"
            }
        }
    }
}
pavelvkozlov commented 2 years ago

Hi @luiss-synopsys,

I also faced this issue when I configured toolchain without the option--with-cpu=archs.

cupertinomiranda commented 2 years ago

This is no QEMU issue. So far, QEMU does not implement hs38 instructions, which is the default cpu on hs toolchain.

If there is something to be done from QEMU on this front is to better verify elf headers to properly bail out.

@luiss-synopsys I already mentioned that the problem here is the ARC_MULTILIB_OPTIONS='cpu=archs' which is not properly setting multilib to compile with archs cpu. If I am not mistaken, it should be ARC_MULTILIB_OPTIONS='-mcpu=archs'. The alternative is to change the default when building the toolchain to archs, like @pavelvkozlov suggests. However, IMO it makes more sense to use the default untouched and properly set the cpu in DejaGNU environment. This will allow you to switch the cpu target in the testing environment without recompiling the toolchain.

claziss commented 2 years ago

The error due to unsupported instructions. ARC QEMU is qualified to work for next CPU configurations:

Now, when you work with a full system simulation you need to make sure that:

  1. the GNU toolchain is targeted for one of the above CPUs
  2. the Linux image is compiled for one of the above CPUs
  3. the tests are using one of the above CPUs

Most probably, one of the above doesn't match.