http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50313
Bug #: 50313 Summary: ARM: PIC code references a non-existant label Classification: Unclassified Product: gcc Version: 4.6.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target AssignedTo: unassig...@gcc.gnu.org ReportedBy: michael.h...@linaro.org Created attachment 25211 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25211 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.