CyberWarriorX
Established Member
Quick question for someone in the know.
I'm trying to setup some code that can be run from either hwram or lwram depending on the situation. From what I can tell, the gnu c compiler supports a function called position independent code or PIC. I've tried playing around with the option using the kpit compiler and it definitely is generating code that would be position independent, however when I get to the linking stage it complains about _GLOBAL_OFFSET_TABLE_ being missing. That's when I'm using my own linker script and crt0.s file. If I use the default script, I get the typical errors associated with the using default scripts, however the error about _GLOBAL_OFFSET_TABLE_ being missing stops. Does anyone have any experience using PIC or have a working example for SH2?
I'm trying to setup some code that can be run from either hwram or lwram depending on the situation. From what I can tell, the gnu c compiler supports a function called position independent code or PIC. I've tried playing around with the option using the kpit compiler and it definitely is generating code that would be position independent, however when I get to the linking stage it complains about _GLOBAL_OFFSET_TABLE_ being missing. That's when I'm using my own linker script and crt0.s file. If I use the default script, I get the typical errors associated with the using default scripts, however the error about _GLOBAL_OFFSET_TABLE_ being missing stops. Does anyone have any experience using PIC or have a working example for SH2?