toolchain icon indicating copy to clipboard operation
toolchain copied to clipboard

[ARC64] Unable to build 403.gcc benchmark

Open VVIsaev opened this issue 3 years ago • 1 comments

Got an error:

emit-rtl.o: in function `gen_rtx_REG':
emit-rtl.c:(.text+0x692): relocation truncated to fit: R_ARC_32_ME against symbol `fixed_regs' defined in .bss section in regclass.o
collect2: error: ld returned 1 exit status
make[1]: *** [../../../Makefile.defaults:316: gcc] Error 1

Simplified example: defaults.h:

#ifndef GCC_DEFAULTS_H
#define GCC_DEFAULTS_H

#define FIXED_REG_SIZE 10
#define INVALID_REG (~(unsigned int) 0)

#endif  /* ! GCC_DEFAULTS_H */

hard-reg-set.h:

#ifndef GCC_HARD_REG_SET_H
#define GCC_HARD_REG_SET_H

#include "defaults.h"

extern char fixed_regs[FIXED_REG_SIZE];

#endif /* ! GCC_HARD_REG_SET_H */

regclass.c:

#include "defaults.h"

char fixed_regs[FIXED_REG_SIZE];

main.c:

#include <stdio.h>

#include "hard-reg-set.h"

int use_fixed_regs (int regno)
{
  if (regno == INVALID_REG &&
        fixed_regs[INVALID_REG])
    return 1;

  return 0;
}

int main ()
{
  printf ("%d\n", use_fixed_regs (0));
}

Attempt to build:

$ arc64-linux-gcc -save-temps -c regclass.c -o regclass.o
$ arc64-linux-gcc -save-temps -c main.c -o main.o
$ arc64-linux-gcc -save-temps regclass.o main.o -o main
main.o: in function `use_fixed_regs':
main.c:(.text+0x18): relocation truncated to fit: R_ARC_32_ME against symbol `fixed_regs' defined in .bss section in regclass.o
collect2: error: ld returned 1 exit status
make: *** [Makefile:2: main] Error 1

Same example builds fine for native gcc or ARCv2.

Archive with sources and gcc temp files: example.tar.gz.

gcc version: arc64-linux-gcc (ARCv3 ISA GNU/Linux glibc toolchain - build 608) 10.1.1 20200701

VVIsaev avatar May 26 '21 14:05 VVIsaev

The INVALID_REGS define is a very large number, you need to use an appropriate memory model:-mcmodel=large .

claziss avatar Jun 30 '21 14:06 claziss

No activity on this one, closing it down

claziss avatar Nov 15 '22 13:11 claziss