On Feb 13, 2006, at 7:28 PM, Eric Fisher wrote:
Suppose I have only pc-relative branch instructions such as 'b offset'
and don't have pc-region branch instructions such as 'j target'. So what the function call should be translated? Do I have to always use two instructions such as 'la reg, func' and 'b reg'? Especially when call a shared pic object file. The problem I've got is that when I link with a shared pic object file, there is a 'relocation truncated to fit' error.
If you're a user, gcc-help is the appropriate list. If not, then usually naming the chip, the options used, the rtl generated and assembly used and so on would make the question easier to answer and make the answer more accurate.
The general answer is that -fPIC and -mlong-call should generate code that uses the full width of a pointer without overflowing any fields, getting relocation errors and so on. A port maintainer then can choose _when_ to flip from medium code to large code, and that will then drive what size objects one can link without -mlong-call. How many bits can you go in medium mode on your port? How far did the linker want to go? If less then the first, then, it's an as or linker bug, if farther and you're not compiling with -mlong-call, then, you'll need to. If you are, then you have a bug in -mlong-call mode, you have to generate instructions that operate on the full width of a pointer.