Created attachment 25211 [details] Preprocessed source Building gmime with GCC 4.6.1 for ARM gives the following error: michaelh@ursa1:~/linaro/bugs$ gcc -c -O2 -fPIC -save-temps gmime2.i gmime2.s: Assembler messages: gmime2.s:1007: Error: can't resolve `.rodata' {.rodata section} - `.LPIC18' {*UND* section} The assembler is correct - the code references a label which doesn't exist. The suspicious code is around: bl g_hash_table_new(PLT) mov sl, r0 add r0, sp, #32 bl g_mime_decode_lwsp(PLT) ldr r3, .L146+24 ldr r1, [sp, #4] str r3, [sp, #16] ldr r3, [sp, #32] ... .L146: ... .word .LANCHOR0-(.LPIC18+4) The 'ldr r3, .L146+24' references the offset. The value is spilt to the stack before the normal `add r3, pc` and doesn't seem to be used afterwards. The work-around is to compile at -O1 or -O3. The fault also exists in gcc-4.6.1. It does not exist in gcc-4.5.3 or trunk r178025. This is in a Cortex-A9+NEON+Thumb-2 configuration.
I suspect this is a dupe of PR48308.
Looks like a DUP of PR48308. *** This bug has been marked as a duplicate of bug 48308 ***
reopening this as the proposed fix for 48308 doesn't appear to fix the issue and the same problem in combine doesn't seem to happen in this case. Ramana
Created attachment 26314 [details] smaller testcase Better reduced testcase. Fails on trunk with -Os -fPIC -mcpu=arm9tdmi or -Os -fPIC -mthumb -mcpu=cortex-a9
Author: ramana Date: Fri Jan 20 09:22:14 2012 New Revision: 183328 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=183328 Log: Fix PR target/50313 Modified: trunk/gcc/ChangeLog trunk/gcc/config/arm/arm.c trunk/gcc/config/arm/arm.md
Author: ramana Date: Mon Jan 30 14:35:05 2012 New Revision: 183727 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=183727 Log: Fix PR target/50313 2012-01-30 Ramana Radhakrishnan <ramana.radhakrishnan@linaro.org> Backport from mainline. 2012-01-20 Ramana Radhakrishnan <ramana.radhakrishnan@linaro.org> PR target/50313 * config/arm/arm.c (arm_load_pic_register): Use gen_pic_load_addr_unified. Delete calls to gen_pic_load_addr_32bit , gen_pic_add_dot_plus_eight and gen_pic_add_dot_plus_four. (arm_pic_static_addr): Likewise. (arm_rtx_costs_1): Adjust cost for UNSPEC_PIC_UNIFIED. (arm_note_pic_base): Handle UNSPEC_PIC_UNIFIED. * config/arm/arm.md (UNSPEC_PIC_UNIFIED): Define. (pic_load_addr_unified): New. Modified: branches/gcc-4_6-branch/gcc/ChangeLog branches/gcc-4_6-branch/gcc/config/arm/arm.c branches/gcc-4_6-branch/gcc/config/arm/arm.md
Backported now to GCC 4.6 branch. Ramana