http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54584

--- Comment #1 from Larry Baker <baker at usgs dot gov> 2012-09-15 00:39:14 UTC 
---
I found that the -msep-data link would succeed if program section
.tm_clone_table has a non-zero length.

I changed __JCR_LIST__[] and __TMC_LIST__[] to __JCR_LIST__[1] and
__TMC_LIST__[1], respectively, in
gcc-4.7-20120908/libgcc/crtstuff.c.

The program sections in the original crtbegin.o have 0 length for program
section .tm_clone_table:

# freescale-coldfire-2011.09/bin/m68k-uclinux-objdump -h
cross-gcc-4.7-20120908/gcc/msep-data/crtbegin.o

cross-gcc-4.7-20120908/gcc/msep-data/crtbegin.o:     file format elf32-m68k

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .text         00000136  00000000  00000000  00000034  2**2
                  CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
  1 .data         00000004  00000000  00000000  0000016c  2**2
                  CONTENTS, ALLOC, LOAD, DATA
  2 .bss          0000001e  00000000  00000000  00000170  2**2
                  ALLOC
  3 .ctors        00000004  00000000  00000000  00000170  2**2
                  CONTENTS, ALLOC, LOAD, DATA
  4 .dtors        00000004  00000000  00000000  00000174  2**2
                  CONTENTS, ALLOC, LOAD, DATA
  5 .eh_frame     00000000  00000000  00000000  00000178  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  6 .jcr          00000000  00000000  00000000  00000178  2**2
                  CONTENTS, ALLOC, LOAD, DATA
  7 .tm_clone_table 00000000  00000000  00000000  00000178  2**2
                  CONTENTS, ALLOC, LOAD, DATA
  8 .fini         00000006  00000000  00000000  00000178  2**0
                  CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
  9 .init         00000006  00000000  00000000  0000017e  2**0
                  CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
 10 .comment      00000028  00000000  00000000  00000184  2**0
                  CONTENTS, READONLY
 11 .note.GNU-stack 00000000  00000000  00000000  000001ac  2**0
                  CONTENTS, READONLY

The new one has length 4:

# freescale-coldfire-2011.09/bin/m68k-uclinux-objdump -h
cross-gcc-4.7-20120908/gcc/msep-data/crtbegin.o

cross-gcc-4.7-20120908/gcc/msep-data/crtbegin.o:     file format elf32-m68k

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .text         00000136  00000000  00000000  00000034  2**2
                  CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
  1 .data         00000004  00000000  00000000  0000016c  2**2
                  CONTENTS, ALLOC, LOAD, DATA
  2 .bss          0000001e  00000000  00000000  00000170  2**2
                  ALLOC
  3 .ctors        00000004  00000000  00000000  00000170  2**2
                  CONTENTS, ALLOC, LOAD, DATA
  4 .dtors        00000004  00000000  00000000  00000174  2**2
                  CONTENTS, ALLOC, LOAD, DATA
  5 .eh_frame     00000000  00000000  00000000  00000178  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  6 .jcr          00000004  00000000  00000000  00000178  2**2
                  CONTENTS, ALLOC, LOAD, DATA
  7 .tm_clone_table 00000004  00000000  00000000  0000017c  2**2
                  CONTENTS, ALLOC, LOAD, DATA
  8 .fini         00000006  00000000  00000000  00000180  2**0
                  CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
  9 .init         00000006  00000000  00000000  00000186  2**0
                  CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
 10 .comment      00000028  00000000  00000000  0000018c  2**0
                  CONTENTS, READONLY
 11 .note.GNU-stack 00000000  00000000  00000000  000001b4  2**0
                  CONTENTS, READONLY

I do not know if this results in a correctly allocated or populated
.tm_clone_table.  All I know is that the zero length allocation caused the link
failure.  Is this due to the ALLOC attribute with 0 length?  Is this a
consequence of __attribute__((used))?

Reply via email to