Compiling gcc with -mcmodel=large fails

Adrian Smith adrian.m.smith@gmail.com
Tue Jul 3 12:53:00 GMT 2012


On 3 July 2012 12:43, Tim Prince <n8tm@aol.com> wrote:
>
> On 07/03/2012 04:28 AM, Adrian Smith wrote:
>>
>> When I try to compile gcc using "-mcmodel=large" it fails with:
>>
>>     configure: error: cannot compute suffix of object files:
>>     cannot compile. See `config.log' for more details.
>>
>> I have, however, successfully downloaded and compiled gcc without
>> using the "-mcmodel=large" option. gcc compiles, and the resulting
>> compiler compiles a simple "hello world" and the program runs
>> successfully.
>>
>> Introducing the "-mcmodel=large" parameters into the CFLAGS_FOR_TARGET
>> parameter in following command, however, causes it to fail:
>>
>>     make \
>>        BOOT_CFLAGS='-g -O2 -mcmodel=large' \
>>        CFLAGS_FOR_TARGET='-g -O2 -mcmodel=large' \
>>        bootstrap
>>
>> The "config.log" is identical between the successful and
>> non-successful runs (attached). The stdout and stderr from the "make"
>> command which fails is also attached.
>>
>> I am compiling gcc 4.7.1 on Ubuntu 10.10 x86-64.
>>
>> I would appreciate your help.
>>
>> The reason I am compiling gcc like this is I wish to use the
>> "-mcmodel=large" option, as I have a (generated) program whose
>> executable would be larger than 2GB. When I use the standard gcc
>> supplied with my system, and use this option, the linker fails with
>> errors like the following; I understand this means I need to recompile
>> gcc itself using the option, please correct me if I am wrong about
>> this.
>>
>>     crtstuff.c:(.text+0x20): relocation truncated to fit:
>>     R_X86_64_32S against `.dtors'
>>
>> Thanks,
>> Adrian
>> ---
>> Adrian Smith B.Sc.
>> adrian.m.smith@gmail.com
>> http://www.databasesandlife.com/
>
> What happens if you use a normal (64-bit) gcc with option -mcmodel=medium ?
>
> --
> Tim Prince

Hi Tim,

The same thing happens. After "make distclean" and "configure":

   make \
      BOOT_CFLAGS='-g -O2 -mcmodel=medium' \
      CFLAGS_FOR_TARGET='-g -O2 -mcmodel=medium' \
      bootstrap

   ...
   checking for suffix of object files... configure:
      error: in
`/home/asmith/gcc-4.7.1-build/objdir/x86_64-unknown-linux-gnu/32/libgcc':
   configure: error: cannot compute suffix of object files: cannot compile
   See `config.log' for more details.

And "config.log" is still identical to the version which worked (and
the -mcmodel=large version which didn't work).

Thanks in advance,
Adrian

P.S. I'm sort-of worried by the "/32/" in that path there. Do I have
to specify something to make sure I'm building a 64-bit compiler? I
assume not, as my OS is 64-bit, the installed gcc which will be used
to build the first phase of bootstrapping is 64-bit, and the compiler
I built which worked outputted a 64-bit executable (at least according
to "file").



More information about the Gcc-help mailing list