This is the mail archive of the crossgcc@cygnus.com mailing list for the crossgcc project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Hello! It seems like Stephen Williams had the right answer: > This can be fixed by declaring ASM_OUTPUT_SECTION_NAME somewhere in > the config header file for your target. The COFF file format can handle > the names fine Yes! With the patch (appended below) m68k-coff-gcc happily accepts the section attribute. I have not tried it on the target-HW yet but the asm-output looks good: $ cat test.c char foobar __attribute__ ((section ("bar"))) = {0}; $ m68k-coff-gcc -S test.c ; cat test.s .file "test.c" gcc2_compiled.: __gnu_compiled_c: .globl foobar .section bar foobar: .byte 0 $ > it's just that noone has added the support in gcc. What are the steps to add such patches into the official versions? It is not a big deal, but it should go the official way, I assume. Should it be a cygnus-specific thing or should it be added into original gcc from FSF? > Another alternative is to place all your "bar" section variables in a > file and use a linker script to direct them to the desired output section. > The disadvantage of this is that it is file granularity. And it forces you to: - have _many_ global variables - split your modules into separate files by the storage-class instead of the logical structure. Both are Bad Things when you want to write good SW. OK, here's the patch. It is based on gcc-2.7.2.1: *** /athome/config/m68k/coff.h.orig Mon Apr 6 23:49:18 1998 --- ./config/m68k/coff.h Mon Apr 6 23:52:35 1998 *************** *** 56,61 **** --- 56,69 ---- #undef REGISTER_PREFIX_MD #define REGISTER_PREFIX_MD "%%" + /* A C statement to output something to the assembler file to switch to secti\on + NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or + NULL_TREE. Some target formats do not support arbitrary sections. Do not + define this macro in such cases. */ + + #define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME) \ + do { fprintf (FILE, ".section\t%s\n", NAME); } while (0) + /* config/m68k.md has an explicit reference to the program counter, prefix this by the register prefix. */