toolchain icon indicating copy to clipboard operation
toolchain copied to clipboard

Small-data doesn't work well with multiple GCC's DejaGnu tests

Open abrodkin opened this issue 4 years ago • 2 comments

With arc-2020.09 used as a source of tests as well as pre-built compiler (at least for -mcpu=archs) the following tests fail due to use of "small data" section:

FAIL: gcc.dg/compat/struct-by-value-2 c_compat_x_tst.o-c_compat_y_tst.o link
FAIL: gcc.dg/compat/struct-by-value-3 c_compat_x_tst.o-c_compat_y_tst.o link
FAIL: gcc.dg/compat/struct-by-value-4 c_compat_x_tst.o-c_compat_y_tst.o link
FAIL: gcc.dg/compat/struct-return-2 c_compat_x_tst.o-c_compat_y_tst.o link
FAIL: gcc.dg/compat/struct-return-3 c_compat_x_tst.o-c_compat_y_tst.o link
FAIL: tmpdir-gcc.dg-struct-layout-1/t001 c_compat_x_tst.o-c_compat_y_tst.o link
FAIL: tmpdir-gcc.dg-struct-layout-1/t002 c_compat_x_tst.o-c_compat_y_tst.o link
FAIL: gcc.dg/torture/pr60115.c   -O0  (test for excess errors)
FAIL: gcc.dg/torture/pr60115.c   -Os  (test for excess errors)

Here's what might be found in gcc.log:

$ cat ../gcc.log | grep R_ARC_SDA_LDST
struct-by-value-2_x.c:(.text+0x25a8): relocation truncated to fit: R_ARC_SDA_LDST against symbol `g16suc8' defined in .sbss section in c_compat_x_tst.o
struct-by-value-2_x.c:(.text+0x25a8): relocation truncated to fit: R_ARC_SDA_LDST against symbol `g16suc8' defined in .sbss section in c_compat_x_tst.o
struct-by-value-3_x.c:(.text+0x6b64): relocation truncated to fit: R_ARC_SDA_LDST2 against symbol `g16sSics' defined in .sbss section in c_compat_x_tst.o
struct-by-value-3_x.c:(.text+0x6b64): relocation truncated to fit: R_ARC_SDA_LDST2 against symbol `g16sSics' defined in .sbss section in c_compat_x_tst.o
struct-by-value-4_x.c:(.text+0x2a20): relocation truncated to fit: R_ARC_SDA_LDST against symbol `g16sSc8' defined in .sbss section in c_compat_x_tst.o
struct-by-value-4_x.c:(.text+0x2a20): relocation truncated to fit: R_ARC_SDA_LDST against symbol `g16sSc8' defined in .sbss section in c_compat_x_tst.o
struct-return-2_x.c:(.text+0x21f2): relocation truncated to fit: R_ARC_SDA_LDST against symbol `g9suc8' defined in .sbss section in c_compat_x_tst.o
struct-return-2_x.c:(.text+0x21f2): relocation truncated to fit: R_ARC_SDA_LDST against symbol `g9suc8' defined in .sbss section in c_compat_x_tst.o
struct-return-3_x.c:(.text+0x2a88): relocation truncated to fit: R_ARC_SDA_LDST2 against symbol `g16Sics' defined in .sbss section in c_compat_x_tst.o
struct-return-3_x.c:(.text+0x2a88): relocation truncated to fit: R_ARC_SDA_LDST2 against symbol `g16Sics' defined in .sbss section in c_compat_x_tst.o
t001_x.c:(.text+0x47e): relocation truncated to fit: R_ARC_SDA_LDST against symbol `a2' defined in .sbss section in c_compat_y_tst.o
t001_x.c:(.text+0x47e): relocation truncated to fit: R_ARC_SDA_LDST against symbol `a2' defined in .sbss section in c_compat_y_tst.o
t002_x.c:(.text+0x4c7c): relocation truncated to fit: R_ARC_SDA_LDST against symbol `a333' defined in .sbss section in c_compat_y_tst.o
t002_x.c:(.text+0x4c7c): relocation truncated to fit: R_ARC_SDA_LDST against symbol `a333' defined in .sbss section in c_compat_y_tst.o
pr60115.c:(.text+0xc): relocation truncated to fit: R_ARC_SDA_LDST2 against symbol `b' defined in .sbss section in /tmp/ccn0oKf4.o
pr60115.c:(.text+0xc): relocation truncated to fit: R_ARC_SDA_LDST2 against symbol `b' defined in .sbss section in /tmp/ccn0oKf4.o
pr60115.c:(.text+0xc): relocation truncated to fit: R_ARC_SDA_LDST2 against symbol `b' defined in .sbss section in /tmp/ccn0oKf4.o
pr60115.c:(.text.startup+0x10): relocation truncated to fit: R_ARC_SDA_LDST2 against symbol `b' defined in .sbss section in /tmp/ccuKOxYF.o
pr60115.c:(.text.startup+0x10): relocation truncated to fit: R_ARC_SDA_LDST2 against symbol `b' defined in .sbss section in /tmp/ccuKOxYF.o
pr60115.c:(.text.startup+0x10): relocation truncated to fit: R_ARC_SDA_LDST2 against symbol `b' defined in .sbss section in /tmp/ccuKOxYF.o

And addition of -mno-sdata solves that problem, not sure though if that's reasonable enough fix or we really want small data to be used here.

abrodkin avatar Dec 21 '20 16:12 abrodkin

SDA access is done using short offsets which will lead, sometimes, to such errors. The practical approach is to turn off the SDA feature using -mno-sdata option.

claziss avatar Jan 26 '21 10:01 claziss

This should be filtered out once we integrate the counting/filtering scripts in verification. This is more of an issue to the verification then to the toolchain.

@abrodkin Can you move this somewhere else ?

cupertinomiranda avatar Jan 26 '21 11:01 cupertinomiranda