[mips] Add support for .option pic2.
Details
Diff Detail
Event Timeline
LGTM
lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp | ||
---|---|---|
306 | In the world we live in now, CPIC means that the object observes PIC calling conventions so it can communicate with PIC dsos. PIC means the code is truly position independent. |
Comment inline.
lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp | ||
---|---|---|
306 | Yes, that's is also my understanding. Note however that the SysV ABI states that: "EF_MIPS_CPIC This bit is asserted when the file contains code And this is not happening... |
Matheus,
I am tainted. At MIPS/SGI the 2 were incompatible. GCC decided to go another way for whatever reason and we (MIPS) have to live with it. It is good/necessary to note the discrepancy, but it is not a fixme.
CPIC is our default mode, at least on LLVM. Thus, it does not need to be explicitly stated in a directive. That said, if GCC sets CPIC when you set PIC then go for it. But you will need a way to have non-PIC code marked in the ehdr flags for CPIC.
I say this with so much confidence, but after the Rafael wars, I don't know what to think. I ended up getting the directive vs. commandline wrong when it came to ISA and EISA markings of the ehdr flags. Only the commandline and defaults can mark them. I believe this is also an GCC ism, but it may be older.
Jack
"CPIC is our default mode, at least on LLVM. Thus, it does not need to be explicitly stated in a directive. That said, if GCC sets CPIC when you set PIC then go for it. But you will need a way to have non-PIC code marked in the ehdr flags for CPIC."
The way to achieve that in GCC and LLVM using assembly directives is by having:
.abicalls.
.option pic0
(because .abicalls set PIC and CPIC ehdr bits...).
The command-line option in the GCC world is -call_nonpic or similar (-non_pic ?).
And thus my abi wiki declaration ;-)
Follow what you see in gcc/gas and if possible state you findings to binutils@sourceware.org. If you are not a member of that list, become one. Once you have the behavior accepted by the binutils folks and reality, document that information at a minimum to our wiki.
You will be da man!
Oh yeah, it would be nice to point to what CPIC really means in calling conventions, but that is for extra credit. Our ABI wiki was suppose to have pages for the various calling conventions too.
Jack
In the world we live in now, CPIC means that the object observes PIC calling conventions so it can communicate with PIC dsos. PIC means the code is truly position independent.