On x86_64-apple-darwin10 gcc.target/i386/pr49866.c fails with [macbook] f90/bug% gcc47 -O2 -mcmodel=large /opt/gcc/work/gcc/testsuite/gcc.target/i386/pr49866.c /var/folders/LW/LW1oufkMGIqlLpjYn45fBU+++TI/-Tmp-//ccCXYFLc.s:10:junk `@PLTOFF' after expression /var/folders/LW/LW1oufkMGIqlLpjYn45fBU+++TI/-Tmp-//ccCXYFLc.s:32:junk `@PLTOFF' after expression /var/folders/LW/LW1oufkMGIqlLpjYn45fBU+++TI/-Tmp-//ccCXYFLc.s:34:junk `@PLTOFF' after expression /var/folders/LW/LW1oufkMGIqlLpjYn45fBU+++TI/-Tmp-//ccCXYFLc.s:48:junk `@PLTOFF' after expression The test has been introduced at revision 176842, but fails for all the gcc versions I have tried from 4.4.6 to trunk.
I have tested the -mcmodel=large option on some simple C tests and I got the same kind of failures. So -mcmodel=large seems broken on x86_64-apple-darwin10 (gcc 4.4.6, 4.5.3, and 4.6.2). gcc version 4.2.1 (Apple Inc. build 5666) (dot 3) gives for [macbook] f90/bug% cat sin.c #include <stdio.h> #include <math.h> unsigned int ta; main () { double result; for (ta = 1; ta <= 8000000; ta++) { result = sin(ta * 3.14159); } printf("result = \t%.13e\n", result); } sin.c:1: sorry, unimplemented: code model large not supported in PIC mode sin.c:1: error: code model 'large' not supported in the 64 bit mode
Fails at m64 on i686-darwin9 too. the code below is obviously incorrect for m64 x86 Darwin; so, we just don't handle the large model. movabsq $_GLOBAL_OFFSET_TABLE_-L7, %r11 pushq %r15 LCFI0: movq %rcx, %r15 movabsq $_baz@PLTOFF, %rax pushq %r14 LCFI1: movabsq $_fn2@PLTOFF, %r14 pushq %r13 LCFI2: movabsq $_fn@PLTOFF, %r13 pushq %r12 ------ clang seems to support -mcmodel=large - at least at 3.1 - so any necessary ld64/dyld support is available. This is not likely to get fixed in the short term (certainly not in stage 4) - so we'll have to decide between XFAIL/tolerate the noise in the error logs.
> clang seems to support -mcmodel=large - at least at 3.1 - so any necessary > ld64/dyld support is available. The test compiles (using -c) with Apple clang version 1.7 (tags/Apple/clang-77) (based on LLVM 2.9svn) > This is not likely to get fixed in the short term (certainly not in stage 4) - > so we'll have to decide between XFAIL/tolerate the noise in the error logs. When XFAILed, this kind of bug disappears from the radar scopes and tends to rot forever (see pr10901) until it resurfaces in a nasty way. I'ld prefer to change the summary to something such as "large model is broken on *86*-apple-darwin*" to point to the real problem.
Also seen on x86_64-apple-darwin14.
(In reply to Dominique d'Humieres from comment #3) > > clang seems to support -mcmodel=large - at least at 3.1 - so any necessary > > ld64/dyld support is available. > > The test compiles (using -c) with > > Apple clang version 1.7 (tags/Apple/clang-77) (based on LLVM 2.9svn) > > > This is not likely to get fixed in the short term (certainly not in stage 4) - > > so we'll have to decide between XFAIL/tolerate the noise in the error logs. > > When XFAILed, this kind of bug disappears from the radar scopes and tends to > rot forever (see pr10901) until it resurfaces in a nasty way. I'ld prefer to > change the summary to something such as "large model is broken on > *86*-apple-darwin*" to point to the real problem. OK, retitling.
(In reply to Iain Sandoe from comment #2) > clang seems to support -mcmodel=large - at least at 3.1 - so any necessary > ld64/dyld support is available. That's an incorrect assumption on my part, although clang produces object files without error. (for -c) it seems that the static linker cannot consume them. On Darwin16 (and Dominique reports similar on D17): For -mcmodel=medium and -mcmodel=large we get relocation fails at link time. So, it seems that we should; (a) disable tests using -mcmodel={medium,large} for current darwin (b) possibly modify the darwin-specific option parsing to warn that these are unsupported and reset the value to "small".
this is currently unimplemented for Darwin - posting an enhancement bug *** This bug has been marked as a duplicate of bug 90698 ***