jkmcnk / sx-gcc

The GNU Compiler Collection port to NEC SX CPU architecture.
GNU General Public License v2.0
0 stars 2 forks source link

struct layout tests failing #104

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
the gcc.dg-struct-layout-1_generate family of tests (generated test
sources) in gcc.dg testsuite fails execution.

t001 testcase fails for the following testcases:

fail 33.1
fail 77.1
fail 81.1
fail 86.1
fail 102.1
fail 145.1
fail 170.1
fail 180.1
fail 196.1
fail 202.1
fail 225.1
fail 244.1
fail 255.1
fail 259.1
fail 263.1

Original issue reported on code.google.com by jmoc...@gmail.com on 9 Feb 2009 at 10:01

GoogleCodeExporter commented 8 years ago
the test runs if built with -fno-common (which is also required on 
hppa*-*-hpux* and
*-*-darwin* targets). however, should probably investigate why ...

Original comment by jmoc...@gmail.com on 9 Feb 2009 at 10:30

GoogleCodeExporter commented 8 years ago
problem was wrong definition with ASM_OUTPUT_ALIGNED_COMMON, which failed to 
align
common symbols required by these testcases. removed in favour of 
ASM_OUTPUT_COMMON,
since SX assembler syntax does not really allow for aligned comm symbols.

fixed with r222.

Original comment by jmoc...@gmail.com on 9 Feb 2009 at 2:33

GoogleCodeExporter commented 8 years ago
note that you will also need r187 of binutils, which provides an updated linker
script that aligns BSS to 16 bytes (previously 8 bytes).

namely: if the linker aligns BSS start to 8 bytes, it is beyond the power of the
compiler to align any symbol therein to a larger boundary, no matter how it
rearranges the symbols inside a single object file's BSS.

Original comment by jmoc...@gmail.com on 9 Feb 2009 at 2:38

GoogleCodeExporter commented 8 years ago
this seems to have resurfaced with r257/r193. works with -fno-common, fails 
otherwise.

Original comment by jmoc...@gmail.com on 9 Mar 2009 at 11:34

GoogleCodeExporter commented 8 years ago
this was caused by r251:

----
Index: sx.h
===================================================================
--- sx.h        (revision 250)
+++ sx.h        (revision 251)
@@ -108,6 +108,7 @@
    right after the prologue. The default is __main (glibc alike),
    for SuperUX compatibility we change this to _main */
 #define NAME__MAIN "_main"
+#define SYMBOL__MAIN _main

 #define CPP_SPEC \
   "%{.c: -D_FLOAT0 -D_LONG64}"
----

the problem is that we should call superux initializer function (i.e. _main from
superux startup files) in main. #defining SYMBOL__MAIN redirects this call to 
libgcc2.

otoh, call to libgcc2 startup routine is also needed, as it will run global
contructors. so we need to run both and thus need to find a way how to run them 
both.

Original comment by jmoc...@gmail.com on 9 Mar 2009 at 1:39

GoogleCodeExporter commented 8 years ago
fixed with binutils r194 aligning subsections of data and bss sections to 16 
bytes.
gcc r251 just exposed the bug due to a bit different memory layout.

Original comment by jmoc...@gmail.com on 9 Mar 2009 at 3:10