[Bug c/41644] New: -minimal-toc not helping for toc section exceeding 64k

2009-10-09 Thread sathishpy at gmail dot com
I have an in-house debugger which uses some auto generated files having too
many string constants. Compiling this (with gcc 4.3) always fails with the
error 

/tmp/ccrzE6fi.s: Assembler messages:
/tmp/ccrzE6fi.s:95429: Warning: TOC section size exceeds 64k
/tmp/ccCSriww.o:(.text+0x22672): relocation truncated to fit: R_PPC64_TOC16_DS
against `.toc'+1
/tmp/ccCSriww.o:(.text+0x2267e): relocation truncated to fit: R_PPC64_TOC16_DS
against `.toc'+10008
/tmp/ccCSriww.o:(.text+0x2268a): relocation truncated to fit: R_PPC64_TOC16_DS
against `.toc'+10010
/tmp/ccCSriww.o:(.text+0x22696): relocation truncated to fit: R_PPC64_TOC16_DS
against `.toc'+10018
/tmp/ccCSriww.o:(.text+0x226a2): relocation truncated to fit: R_PPC64_TOC16_DS
against `.toc'+10020
/tmp/ccCSriww.o:(.text+0x226ae): relocation truncated to fit: R_PPC64_TOC16_DS
against `.toc'+10028
/tmp/ccCSriww.o:(.text+0x226ba): relocation truncated to fit: R_PPC64_TOC16_DS
against `.toc'+10030
/tmp/ccCSriww.o:(.text+0x226c6): relocation truncated to fit: R_PPC64_TOC16_DS
against `.toc'+10038
/tmp/ccCSriww.o:(.text+0x22706): relocation truncated to fit: R_PPC64_TOC16_DS
against `.toc'+10040
/tmp/ccCSriww.o:(.text+0x22712): relocation truncated to fit: R_PPC64_TOC16_DS
against `.toc'+10048
/tmp/ccCSriww.o:(.text+0x2271e): additional relocation overflows omitted from
the output
collect2: ld returned 1 exit status

I have tried using -mminimal-toc and other options, but –minimal-toc is giving
a different set of errors like

/tmp/cc4SUbmt.s:97184: Error: operand out of range (0x9918 is not
between 0x8000 and 0x7ffc)
/tmp/cc4SUbmt.s:97187: Error: operand out of range (0x9920 is not
between 0x8000 and 0x7ffc)
/tmp/cc4SUbmt.s:97190: Error: operand out of range (0x9928 is not
between 0x8000 and 0x7ffc)
/tmp/cc4SUbmt.s:97193: Error: operand out of range (0x9930 is not
between 0x8000 and 0x7ffc)
/tmp/cc4SUbmt.s:97196: Error: operand out of range (0x9938 is not
between 0x8000 and 0x7ffc)

A similar issue was reported in gcc bugzilla bug 34708 (for gcc 4.3), for which
the resolution says fixed in mainstream. I have tried the same with gcc 4.4.1,
but that didn’t help either. 

I have attached a test program similar to my application to reproduce
this[compiled as: gcc -m64 -o toctest [-mno-fp-in-toc -mno-sum-in-toc
|-mminimal-toc]  toctest.c]


-- 
   Summary: -minimal-toc not helping for toc section exceeding 64k
   Product: gcc
   Version: 4.3.3
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: sathishpy at gmail dot com


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



[Bug c/41644] -minimal-toc not helping for toc section exceeding 64k

2009-10-09 Thread sathishpy at gmail dot com


--- Comment #1 from sathishpy at gmail dot com  2009-10-09 10:51 ---
Created an attachment (id=18760)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18760&action=view)
Test program


-- 


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



[Bug target/41644] -minimal-toc not helping for toc section exceeding 64k

2009-10-09 Thread sathishpy at gmail dot com


--- Comment #3 from sathishpy at gmail dot com  2009-10-09 11:22 ---
I tried the same program with -m32 and it works fine. I have also tried it for
10 times bigger time file (10 string constants and 1 functions) without
using -mminimal-toc, so it looks like some issue with gcc only when using -m64. 


-- 


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



[Bug target/41644] -minimal-toc not helping for toc section exceeding 64k

2009-10-12 Thread sathishpy at gmail dot com


--- Comment #6 from sathishpy at gmail dot com  2009-10-12 09:17 ---
Thanks, I will look at changing our generator to create smaller translation
unit. Meanwhile could you please confirm that -mminimal-toc option is broken
and will be fixed in one of the future releases?


-- 


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



[Bug target/41644] -minimal-toc not helping for toc section exceeding 64k

2009-10-12 Thread sathishpy at gmail dot com


--- Comment #8 from sathishpy at gmail dot com  2009-10-12 09:46 ---
gcc man page for minimal-toc:
>>This option causes GCC to make 'only one TOC entry' for every file.  When you 
>>>>specify this option, GCC will produce code that is slower and larger but 
>>which 
>>uses extremely little TOC space. 
This is giving the impression that large number of string constants are not
stored in toc with -minimal-toc. If not, could you please met me know how this
option helps in reducing the toc size? 

thanks


-- 


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



[Bug target/41644] -minimal-toc not helping for toc section exceeding 64k

2009-10-12 Thread sathishpy at gmail dot com


--- Comment #10 from sathishpy at gmail dot com  2009-10-12 11:02 ---
Thanks Jakub, this is very useful information.


-- 


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