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

--- Comment #2 from Larry Baker <baker at usgs dot gov> 2012-09-18 02:44:43 UTC 
---
The Sourcery (Mentor Graphics) ColdFire uClinux SDK I use uses binutils-1.21. 
I installed binutils-2.22 and the latest uClinux elf2flt (downloaded 20120730).

$ /usr/local/gcc-4.7.1/bin/m68k-uclinux-ld -V -v
GNU ld (GNU Binutils) 2.22
  Supported emulations:
   m68kelf
GNU ld (GNU Binutils) 2.22

The error message is the same (Nonrepresentable section on output).

I am able to issue the failing command (collect2) outside of make gcc:

$
COMPILER_PATH=/tmp/freescale-coldfile-xgcc/cross-gcc-4.7.1/gcc/:/usr/local/gcc-4.7.1/m68k-uclinux/bin/:/usr/local/gcc-4.7.1/m68k-uclinux/lib/
\
/tmp/freescale-coldfile-xgcc/cross-gcc-4.7.1/gcc/collect2
--sysroot=/tmp/freescale-coldfile-xgcc/freescale-coldfire-2011.09/m68k-uclinux/libc/msep-data
--eh-frame-hdr -elf2flt -o conftest -t
/tmp/freescale-coldfile-xgcc/freescale-coldfire-2011.09/m68k-uclinux/libc/msep-data/usr/lib/crt1.o
/tmp/freescale-coldfile-xgcc/freescale-coldfire-2011.09/m68k-uclinux/libc/msep-data/usr/lib/crti.o
/tmp/freescale-coldfile-xgcc/cross-gcc-4.7.1/gcc/msep-data/crtbegin.o
-L/tmp/freescale-coldfile-xgcc/cross-gcc-4.7.1/gcc/msep-data
-L/usr/local/gcc-4.7.1/m68k-uclinux/lib/msep-data
-L/tmp/freescale-coldfile-xgcc/cross-gcc-4.7.1/gcc
-L/usr/local/gcc-4.7.1/m68k-uclinux/bin -L/usr/local/gcc-4.7.1/m68k-uclinux/lib
-L/tmp/freescale-coldfile-xgcc/freescale-coldfire-2011.09/m68k-uclinux/libc/msep-data/usr/lib
conftest.o -lgcc -lc -lgcc
/tmp/freescale-coldfile-xgcc/cross-gcc-4.7.1/gcc/msep-data/crtend.o
/tmp/freescale-coldfile-xgcc/freescale-coldfire-2011.09/m68k-uclinux/libc/msep-data/usr/lib/crtn.o
/usr/local/gcc-4.7.1/m68k-uclinux/bin/ld.real: mode m68kelf
/tmp/freescale-coldfile-xgcc/freescale-coldfire-2011.09/m68k-uclinux/libc/msep-data/usr/lib/crt1.o
/tmp/freescale-coldfile-xgcc/freescale-coldfire-2011.09/m68k-uclinux/libc/msep-data/usr/lib/crti.o
/tmp/freescale-coldfile-xgcc/cross-gcc-4.7.1/gcc/msep-data/crtbegin.o
conftest.o
(/tmp/freescale-coldfile-xgcc/freescale-coldfire-2011.09/m68k-uclinux/libc/msep-data/usr/lib/libc.a)__uClibc_main.o
(/tmp/freescale-coldfile-xgcc/freescale-coldfire-2011.09/m68k-uclinux/libc/msep-data/usr/lib/libc.a)strrchr.o
(/tmp/freescale-coldfile-xgcc/freescale-coldfire-2011.09/m68k-uclinux/libc/msep-data/usr/lib/libc.a)exit.o
(/tmp/freescale-coldfile-xgcc/freescale-coldfire-2011.09/m68k-uclinux/libc/msep-data/usr/lib/libc.a)_exit.o
(/tmp/freescale-coldfile-xgcc/freescale-coldfire-2011.09/m68k-uclinux/libc/msep-data/usr/lib/libc.a)__errno_location.o
(/tmp/freescale-coldfile-xgcc/freescale-coldfire-2011.09/m68k-uclinux/libc/msep-data/usr/lib/libc.a)strchr.o
(/tmp/freescale-coldfile-xgcc/freescale-coldfire-2011.09/m68k-uclinux/libc/msep-data/usr/lib/libc.a)errno.o
/tmp/freescale-coldfile-xgcc/cross-gcc-4.7.1/gcc/msep-data/crtend.o
/tmp/freescale-coldfile-xgcc/freescale-coldfire-2011.09/m68k-uclinux/libc/msep-data/usr/lib/crtn.o
/usr/local/gcc-4.7.1/m68k-uclinux/bin/ld.real: final link failed:
Nonrepresentable section on output
collect2: error: ld returned 1 exit status

If I remove the -elf2flt option, the error goes away:

$
COMPILER_PATH=/tmp/freescale-coldfile-xgcc/cross-gcc-4.7.1/gcc/:/usr/local/gcc-4.7.1/m68k-uclinux/bin/:/usr/local/gcc-4.7.1/m68k-uclinux/lib/
\
/tmp/freescale-coldfile-xgcc/cross-gcc-4.7.1/gcc/collect2
--sysroot=/tmp/freescale-coldfile-xgcc/freescale-coldfire-2011.09/m68k-uclinux/libc/msep-data
--eh-frame-hdr -o conftest -t
/tmp/freescale-coldfile-xgcc/freescale-coldfire-2011.09/m68k-uclinux/libc/msep-data/usr/lib/crt1.o
/tmp/freescale-coldfile-xgcc/freescale-coldfire-2011.09/m68k-uclinux/libc/msep-data/usr/lib/crti.o
/tmp/freescale-coldfile-xgcc/cross-gcc-4.7.1/gcc/msep-data/crtbegin.o
-L/tmp/freescale-coldfile-xgcc/cross-gcc-4.7.1/gcc/msep-data
-L/usr/local/gcc-4.7.1/m68k-uclinux/lib/msep-data
-L/tmp/freescale-coldfile-xgcc/cross-gcc-4.7.1/gcc
-L/usr/local/gcc-4.7.1/m68k-uclinux/bin -L/usr/local/gcc-4.7.1/m68k-uclinux/lib
-L/tmp/freescale-coldfile-xgcc/freescale-coldfire-2011.09/m68k-uclinux/libc/msep-data/usr/lib
conftest.o -lgcc -lc -lgcc
/tmp/freescale-coldfile-xgcc/cross-gcc-4.7.1/gcc/msep-data/crtend.o
/tmp/freescale-coldfile-xgcc/freescale-coldfire-2011.09/m68k-uclinux/libc/msep-data/usr/lib/crtn.o
/usr/local/gcc-4.7.1/m68k-uclinux/bin/ld.real: mode m68kelf
/tmp/freescale-coldfile-xgcc/freescale-coldfire-2011.09/m68k-uclinux/libc/msep-data/usr/lib/crt1.o
/tmp/freescale-coldfile-xgcc/freescale-coldfire-2011.09/m68k-uclinux/libc/msep-data/usr/lib/crti.o
/tmp/freescale-coldfile-xgcc/cross-gcc-4.7.1/gcc/msep-data/crtbegin.o
conftest.o
(/tmp/freescale-coldfile-xgcc/freescale-coldfire-2011.09/m68k-uclinux/libc/msep-data/usr/lib/libc.a)__uClibc_main.o
(/tmp/freescale-coldfile-xgcc/freescale-coldfire-2011.09/m68k-uclinux/libc/msep-data/usr/lib/libc.a)strrchr.o
(/tmp/freescale-coldfile-xgcc/freescale-coldfire-2011.09/m68k-uclinux/libc/msep-data/usr/lib/libc.a)exit.o
(/tmp/freescale-coldfile-xgcc/freescale-coldfire-2011.09/m68k-uclinux/libc/msep-data/usr/lib/libc.a)_exit.o
(/tmp/freescale-coldfile-xgcc/freescale-coldfire-2011.09/m68k-uclinux/libc/msep-data/usr/lib/libc.a)__errno_location.o
(/tmp/freescale-coldfile-xgcc/freescale-coldfire-2011.09/m68k-uclinux/libc/msep-data/usr/lib/libc.a)strchr.o
(/tmp/freescale-coldfile-xgcc/freescale-coldfire-2011.09/m68k-uclinux/libc/msep-data/usr/lib/libc.a)errno.o
/tmp/freescale-coldfile-xgcc/cross-gcc-4.7.1/gcc/msep-data/crtend.o
/tmp/freescale-coldfile-xgcc/freescale-coldfire-2011.09/m68k-uclinux/libc/msep-data/usr/lib/crtn.o

We can see that the size 0 .tm_clone_table section from crtbegin.o/crtend.o
does not appear in the elf32-m68k executable (conftest):

$ /usr/local/gcc-4.7.1/bin/m68k-uclinux-objdump -h
cross-gcc-4.7.1/gcc/msep-data/crtbegin.o

cross-gcc-4.7.1/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      00000012  00000000  00000000  00000184  2**0
                  CONTENTS, READONLY
 11 .note.GNU-stack 00000000  00000000  00000000  00000196  2**0
                  CONTENTS, READONLY

$ /usr/local/gcc-4.7.1/bin/m68k-uclinux-objdump -h conftest

conftest:     file format elf32-m68k

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .init         00000014  80000094  80000094  00000094  2**1
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  1 .text         000004f8  800000a8  800000a8  000000a8  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  2 .fini         0000000e  800005a0  800005a0  000005a0  2**1
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  3 .rodata       00000001  800005ae  800005ae  000005ae  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  4 .eh_frame     00000004  800005b0  800005b0  000005b0  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  5 .ctors        00000008  800025b4  800025b4  000005b4  2**2
                  CONTENTS, ALLOC, LOAD, DATA
  6 .dtors        00000008  800025bc  800025bc  000005bc  2**2
                  CONTENTS, ALLOC, LOAD, DATA
  7 .jcr          00000004  800025c4  800025c4  000005c4  2**2
                  CONTENTS, ALLOC, LOAD, DATA
  8 .got          000000e0  800025c8  800025c8  000005c8  2**2
                  CONTENTS, ALLOC, LOAD, DATA
  9 .data         0000002c  800026a8  800026a8  000006a8  2**2
                  CONTENTS, ALLOC, LOAD, DATA
 10 .bss          00000044  800026d4  800026d4  000006d4  2**2
                  ALLOC
 11 .comment      00000011  00000000  00000000  000006d4  2**0
                  CONTENTS, READONLY

The Nonrepresentable... error message comes from the binutils bfd library:

$ find . -type f -exec grep Nonrepresentable {} ';' -ls
  N_("Nonrepresentable section on output"),
2461573630      104 -rw-r--r--    1 baker    wheel       49841 Jul 11  2011
./binutils-2.22/bfd/bfd.c

I don't know where in bfd the error occurs -- there are many bfd_set_error
(bfd_error_nonrepresentable_section) calls.

I assume that "normal" ld uses bfd.  So, what is it about Flat Binary
-msep-data (-fPIC) code that is causing the problem?

I will raise the issue on the uClinux user forum as well.

Reply via email to