MIPS does not yet have relaxation support in binutils. Instead, in line with MIPS's own compiler, there is support for small data/bss sections, with appropriate shorter relocations. What size of data goes in those sections is determined with the MIPS target specific command line option -G.
However libstdc++ and libsupc++ are built with the default -G value of 8. This means that if a sufficiently large application is built which requires the user to use a smaller value of -G, they are stuck. When brought up on the gcc mailing list around 2005-04-18, three solutions were suggested: a) multilibbing with -G 0. However this adds to multilib hell, and doesn't allow users to have some sdata support with e.g. -G 4. b) providing a configure time option to set the default -G option. However the choice of whether that is needed or not is application specific, not compiler specific. Completely separate compiler builds should not be needed for different applications. c) A new -m option to allow the MIPS backend to generate relocations that assume data is not in the small data section, but still output data into the small data sections. Then libstdc++ / libsupc++ would be built with this new option. Some other ports have this option such as PowerPC where this is the default method of operation (-msdata-data). This would admittedly result in some relocations within the libraries being larger than necessary. However application references to the libraries would be unaffected. No conclusion was reached, but it seemed to me and Zack Weinberg that the latter seemed a reasonable compromise. The PowerPC precedent is compelling. However I have looked at the MIPS backend and it requires someone more familiar with this code than I am to implement this option. My thoughts now are that I believe the easiest approach is to introduce a new mips_section_reloc_threshold variable that would default to the same value as mips_section_threshold (the present -G value). On supplying the new -mno-sdata-relocs option, mips_section_reloc_threshold would be set to 0. Almost all existing uses of mips_section_threshold in mips.c would be renamed to mips_section_reloc_threshold. But the rest is a bit fuzzier to me: sdata appears easy to handle in mips_select_rtx_section(), but sbss would require a change to mips_in_small_data_p, which is also used for TARGET_IN_SMALL_DATA_P. I would appreciate someone helping fill in the last blank. -- Summary: MIPS libsupc++ built with small data Product: gcc Version: 3.4.4 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: target AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: jifl-bugzilla at jifvik dot org CC: gcc-bugs at gcc dot gnu dot org GCC target triplet: mipsisa32-elf http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21738