--- gcc/config/sparc/sysv4.h 2018/04/24 18:10:25 1.1.1.1 +++ gcc/config/sparc/sysv4.h 2018/04/24 18:21:31 1.1.1.3 @@ -1,7 +1,7 @@ /* Target definitions for GNU compiler for Sparc running System V.4 Copyright (C) 1991, 1992 Free Software Foundation, Inc. - Written by Ron Guilmette (rfg@ncd.com). + Written by Ron Guilmette (rfg@netcom.com). This file is part of GNU CC. @@ -24,8 +24,8 @@ the Free Software Foundation, 675 Mass A /* Undefine some symbols which are defined in "sparc.h" but which are appropriate only for SunOS 4.x, and not for svr4. */ -#undef DBX_DEBUGGING_INFO #undef WORD_SWITCH_TAKES_ARG +#undef ASM_OUTPUT_SOURCE_LINE #undef SELECT_SECTION #undef ASM_DECLARE_FUNCTION_NAME #undef TEXT_SECTION_ASM_OP @@ -52,9 +52,31 @@ the Free Software Foundation, 675 Mass A the Sparc running svr4. __svr4__ is our extension. */ #define CPP_PREDEFINES \ - "-Dsparc -Dunix -D__svr4__ -Asystem(unix) -Acpu(sparc) -Amachine(sparc) \ + "-Dsparc -Dunix -D__svr4__ \ + -Asystem(unix) -Asystem(svr4) -Acpu(sparc) -Amachine(sparc) \ -D__GCC_NEW_VARARGS__" +/* The native assembler can't compute differences between symbols in different + sections when generating pic code, so we must put jump tables in the + text section. */ +#define JUMP_TABLES_IN_TEXT_SECTION 1 + +/* Pass -K to the assembler when PIC. */ +#undef ASM_SPEC +#define ASM_SPEC \ + "%{V} %{v:%{!V:-V}} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*} \ + %{fpic:-K PIC} %{fPIC:-K PIC}" + +/* Must use data section for relocatable constants when pic. */ +#undef SELECT_RTX_SECTION +#define SELECT_RTX_SECTION(MODE,RTX) \ +{ \ + if (flag_pic && symbolic_operand (RTX)) \ + data_section (); \ + else \ + const_section (); \ +} + /* The specialized code which needs to appear in the .init section prior to the prologue code for `__do_global_ctors' (see crtstuff.c). @@ -104,7 +126,7 @@ the Free Software Foundation, 675 Mass A #undef ASM_OUTPUT_CASE_LABEL #define ASM_OUTPUT_CASE_LABEL(FILE, PREFIX, NUM, JUMPTABLE) \ -do { ASM_OUTPUT_ALIGN ((FILE), 2); \ +do { ASM_OUTPUT_ALIGN ((FILE), Pmode == SImode ? 2 : 3); \ ASM_OUTPUT_INTERNAL_LABEL ((FILE), PREFIX, NUM); \ } while (0) @@ -149,9 +171,15 @@ do { ASM_OUTPUT_ALIGN ((FILE), 2); \ #define DATA_SECTION_ASM_OP ".section\t\".data\"" #define BSS_SECTION_ASM_OP ".section\t\".bss\"" #define CONST_SECTION_ASM_OP ".section\t\".rodata\"" -#define INIT_SECTION_ASM_OP ".section\t\".init\",#alloc" -#define CTORS_SECTION_ASM_OP ".section\t\".ctors\",#alloc" -#define DTORS_SECTION_ASM_OP ".section\t\".dtors\",#alloc" +#define INIT_SECTION_ASM_OP ".section\t\".init\"" +#define CTORS_SECTION_ASM_OP ".section\t\".ctors\",#alloc,#execinstr" +#define DTORS_SECTION_ASM_OP ".section\t\".dtors\",#alloc,#execinstr" + +/* Assemble generic sections. + This is currently only used to support section attributes. */ + +#define ASM_OUTPUT_SECTION_NAME(FILE, NAME) \ + fprintf (FILE, ".section\t\"%s\",#alloc\n", NAME) /* If the host and target formats match, output the floats as hex. */ #if HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT @@ -197,3 +225,34 @@ do { long value[4]; \ fprintf((FILE), "\t.long\t0x%x\n", value[2]); \ fprintf((FILE), "\t.long\t0x%x\n", value[3]); \ } while (0) + +/* Output assembler code to FILE to initialize this source file's + basic block profiling info, if that has not already been done. */ + +#undef FUNCTION_BLOCK_PROFILER +#define FUNCTION_BLOCK_PROFILER(FILE, LABELNO) \ + do { \ + if (TARGET_MEDANY) \ + fprintf (FILE, "\tsethi %%hi(.LLPBX0),%%o0\n\tor %%0,%%lo(.LLPBX0),%%o0\n\tld [%s+%%o0],%%o1\n\ttst %%o1\n\tbne .LLPY%d\n\tadd %%o0,%s,%%o0\n\tcall __bb_init_func\n\tnop\nLPY%d:\n", \ + MEDANY_BASE_REG, (LABELNO), MEDANY_BASE_REG, (LABELNO)); \ + else \ + fprintf (FILE, "\tsethi %%hi(.LLPBX0),%%o0\n\tld [%%lo(.LLPBX0)+%%o0],%%o1\n\ttst %%o1\n\tbne LPY%d\n\tadd %%o0,%%lo(.LLPBX0),%%o0\n\tcall __bb_init_func\n\tnop\nLPY%d:\n", \ + (LABELNO), (LABELNO)); \ + } while (0) + +/* Output assembler code to FILE to increment the entry-count for + the BLOCKNO'th basic block in this source file. */ + +#undef BLOCK_PROFILER +#define BLOCK_PROFILER(FILE, BLOCKNO) \ +{ \ + int blockn = (BLOCKNO); \ + if (TARGET_MEDANY) \ + fprintf (FILE, "\tsethi %%hi(.LLPBX2+%d),%%g1\n\tor %%g1,%%lo(.LLPBX2+%d),%%g1\n\tld [%%g1+%s],%%g2\n\tadd %%g2,1,%%g2\n\tst %%g2,[%%g1+%s]\n", \ + 4 * blockn, 4 * blockn, MEDANY_BASE_REG, MEDANY_BASE_REG); \ + else \ + fprintf (FILE, "\tsethi %%hi(.LLPBX2+%d),%%g1\n\tld [%%lo(.LLPBX2+%d)+%%g1],%%g2\n\ +\tadd %%g2,1,%%g2\n\tst %%g2,[%%lo(.LLPBX2+%d)+%%g1]\n", \ + 4 * blockn, 4 * blockn, 4 * blockn); \ +} +