case 'i':
return 1;
case 'd':
return 2;
case 'o':
return 3;
case 'x':
return 4;
}
return -1;
} / bug_demo () /
</pre></ul> <p> Compile this with: </p> <ul><pre> or32-elf-gcc -fPIC -c bug-demo.c </pre></ul> <p> The resulting output is: <ul><pre> or32-elf-gcc -fPIC -c bug-demo.c /tmp/ccqWzGPc.s: Assembler messages: /tmp/ccqWzGPc.s:45: Error: can't resolve `.text' {.text section} - `.L8' {.rodata section} /tmp/ccqWzGPc.s:46: Error: can't resolve `.text' {.text section} - `.L8' {.rodata section} ... /tmp/ccqWzGPc.s:65: Error: can't resolve `.text' {.text section} - `.L8' {.rodata section} /tmp/ccqWzGPc.s:66: Error: can't resolve `.text' {.text section} - `.L8' {.rodata section} </pre></ul> <p> Analysis of the assembler code shows the compiler attempting to construct a jump-table by subtracting labels in the read only data section from labels in the text section. </p> <p> Jeremy </p> p> -- <br /> Tel: +44 (1590) 610184<br /> Cell: +44 (7970) 676050<br /> SkypeID: jeremybennett<br /> Email: <a href="mailto:jeremy.bennett@embecosm.com">jeremy.bennett@embecosm.com</a><br /> Web: <a href="http://www.embecosm.com">www.embecosm.com</a> </p>