Skip to content

Big endian baremetal toolchain for HS38 generates invalid code #526

Open
@kolerov

Description

@kolerov

This bug appears in snps-arceb-multilib-elf32 configuration for crosstool-ng. It's presented if you use both arc-2022.09 and arc-2023.03 branches for newlib, gcc and binutils.

Consider this example:

#include <stdio.h>

int main()
{
    puts("hello");
    return 0;
}

Then build and run it using nSIM:

arceb-elf32-gcc -mcpu=hs38 -specs=nsim.specs main.c -o main.elf
nsimdrv -tcf $NSIM_HOME/etc/tcf/templates/hs38_full.tcf -on nsim_isa_big_endian -on nsim_emt main.elf

Then nsimdrv shows nothing. I've found that such behavior may be observed only for -mcpu targets with -mmpy-option=9 (with support of all MPY instructions): -mcpu=hs38 and -mcpu=hs38_linux.

The example works well with -specs=nano.specs. Bug doesn't appear if the toolchain is built with -O0 flag. I suspect that the toolchain generates invalid optimized code for Newlib.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions