Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RF16: Unable to build test program with -Os #327

Closed
VVIsaev opened this issue Feb 8, 2021 · 1 comment
Closed

RF16: Unable to build test program with -Os #327

VVIsaev opened this issue Feb 8, 2021 · 1 comment
Assignees
Milestone

Comments

@VVIsaev
Copy link
Contributor

VVIsaev commented Feb 8, 2021

Faced an issue with -mcpu=em_mini while testing #231. Without -Os or with -mcpu=em program builds fine.

$ module load arc_gnu/2020.09-elf32
$ arc-elf32-gcc --version
arc-elf32-gcc (ARCompact/ARCv2 ISA elf32 toolchain 2020.09) 10.2.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ cat bug.c
#include <stddef.h>
#include <string.h>

int test_newlib_argv(int argc, char **argv)
{
        int i;

        const char *test_argv[] = {"a", "b", NULL};
        const int test_argc = sizeof(test_argv) / sizeof(char *);

        for (i = 0; i < argc; i++) {
                if (strcmp(argv[i], test_argv[i]) == 0)
                        return 1;
        }

        return 0;
}


int main()
{
        char *argv[] = {"a", "b", NULL};
        int argc = sizeof(argv) / sizeof(char *);

        return test_newlib_argv(argc, argv);
}
$ arc-elf32-gcc -mcpu=em_mini -Os bug.c  -o bug
/global/freeware/Linux/2.X/arc_gnu_2020.09-elf32/bin/../lib/gcc/arc-elf32/10.2.0/../../../../arc-elf32/bin/ld: /tmp/ccl8riw1.o: in function `test_newlib_argv':
bug.c:(.text+0x4): undefined reference to `__st_r13_to_r15'
/global/freeware/Linux/2.X/arc_gnu_2020.09-elf32/bin/../lib/gcc/arc-elf32/10.2.0/../../../../arc-elf32/bin/ld: bug.c:(.text+0x4): undefined reference to `__st_r13_to_r15'
/global/freeware/Linux/2.X/arc_gnu_2020.09-elf32/bin/../lib/gcc/arc-elf32/10.2.0/../../../../arc-elf32/bin/ld: bug.c:(.text+0x32): undefined reference to `__ld_r13_to_r15_ret'
/global/freeware/Linux/2.X/arc_gnu_2020.09-elf32/bin/../lib/gcc/arc-elf32/10.2.0/../../../../arc-elf32/bin/ld: bug.c:(.text+0x32): undefined reference to `__ld_r13_to_r15_ret'
collect2: error: ld returned 1 exit status
$ ls bug
ls: cannot access bug: No such file or directory
$ arc-elf32-gcc -mcpu=em -Os bug.c  -o bug
$ ls bug
bug
$ rm bug
$ arc-elf32-gcc -mcpu=em_mini bug.c -o bug
$ ls bug
bug
@claziss claziss self-assigned this Feb 8, 2021
@claziss claziss added this to the 2021.03 milestone Feb 8, 2021
@claziss
Copy link
Contributor

claziss commented Mar 19, 2021

Fixed with foss-for-synopsys-dwc-arc-processors/gcc@2c3a3e1 "arc: Don't allow millicode thunks with reduced register set CPUs."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants