http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53853
Uros Bizjak <ubizjak at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #2 from Uros Bizjak <ubizjak at gmail dot com> 2012-07-05 12:07:31 UTC --- It turned out that -mcmodel -fPIC also ICEd on x86_64-pc-linux-gnu. We need additional part to handle CM_LARGE_PIC, basically: --cut here-- @@ -33057,6 +33059,10 @@ x86_output_mi_thunk (FILE *file, emit_jump_insn (gen_indirect_jump (fnaddr)); else { + if (ix86_cmodel == CM_LARGE_PIC + && GET_CODE (fnaddr) == SYMBOL_REF) + fnaddr = construct_plt_address (fnaddr, + gen_rtx_REG (Pmode, tmp_regno)); if (!sibcall_insn_operand (fnaddr, word_mode)) { tmp = gen_rtx_REG (word_mode, tmp_regno); --cut here-- to create: .size _ZN12ScriptString12CreateStringEPKc, .-_ZN12ScriptString12CreateStringEPKc .set .LTHUNK0,_ZN12ScriptString12CreateStringEPKc .p2align 4,,15 .globl _ZThn8_N12ScriptString12CreateStringEPKc .type _ZThn8_N12ScriptString12CreateStringEPKc, @function _ZThn8_N12ScriptString12CreateStringEPKc: .LFB1: .cfi_startproc subq $8, %rdi movabsq $.LTHUNK0@PLTOFF, %r10 addq %rbx, %r10 jmp *%r10 .cfi_endproc I'd like to ask Jakub fo opinion here. The generated code otherwise works OK for a couple of tests (g++.dg/inherit/thunk*.C) when compiled with -mcmodel=large -fPIC.