Carter, Jack
2012-Dec-06 22:49 UTC
[LLVMdev] [MC] [llvm-mc] Getting target specific information to <target>ELFObjectWriter
Older targets like Mips had/have assemblers and ABIs that carry a lot of baggage. The small bit of baggage that is giving me fits is that MipsELFObjectWriter needs to know the relocation model (static,pic,cpic), whether we are using xgot (-mgot), which abi (old,new), which architecture (32r[123],64[123]), which if any coprocessor or extention instructions are used (mips16,micromips,etc.). I shouldn't have to muck with base classes to handle esoteric target specific issues such as these. <target>ELFObjectWriteris used for direct object output whether directly from the codegen or from the llvm-mc assembler. The grand idea was to use MipsSubtarget because it has almost everything I need, but the big glitch is that is only used by llc and when used directly by llvm-mc, we only get the base class MCSubtargetInfo. AsmPrinter has access to the codegen variation (<target>Subtarget) and thus doesn't have this issue. Is the answer for every create<target>MCSubtargetInfo() call to mimic <target>TargetMachine and create a <target>Subtarget? This would give a target a common class object to work from. The mechanism for filling the information doesn't need to be the same, but the subclass does. This seems a bit heavy handed. I am also looking at Features to see if that could be abused into passing the information. The Features string is stored in the MCSubtarget base class. I believe a clean solution to this could lead to much simpler parameter lists for creating other MC class objects as well, but currently I just want my e_header hurt to go away. Feedback please Jack -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121206/ea48b97f/attachment.html>
Rafael EspĂndola
2012-Dec-07 21:52 UTC
[LLVMdev] [MC] [llvm-mc] Getting target specific information to <target>ELFObjectWriter
On 6 December 2012 17:49, Carter, Jack <jcarter at mips.com> wrote:> Older targets like Mips had/have assemblers and ABIs that carry a lot of > baggage. > > The small bit of baggage that is giving me fits is that MipsELFObjectWriter > needs to know the relocation model (static,pic,cpic), whether we are using > xgot (-mgot), which abi (old,new), which architecture (32r[123],64[123]), > which if any coprocessor or extention instructions are used > (mips16,micromips,etc.).So the mips assembler has command line options like -fPIC? Cheers, Rafael
Carter, Jack
2012-Dec-07 23:57 UTC
[LLVMdev] [MC] [llvm-mc] Getting target specific information to <target>ELFObjectWriter
Hi Rafael, There are a lot of flags. Here are the ones you ask about: -KPIC, -call_shared generate SVR4 position independent code -call_nonpic generate non-PIC code that can operate with DSOs -mvxworks-pic generate VxWorks position independent code -non_shared do not generate code that can operate with DSOs -xgot assume a 32 bit GOT Just to make things fun, the SGI notion of cpic (call pic) fits gnu's -call_nonpic. Remember, this issue is not whether the direct or standalone assembler can deal with it in their code. The problem is how to convey it to the <target>ELFObjectWriter in a clean manor because both use it. Some flags are picked by being the default, some from the commandline and others from the run of play. It is not a difficult issue except we require the ELF portion to work from the same sketch book for the 2 assemblers. I am experimenting putting in a std::set into the MCSubtargetInfo base class that is for target use and see if I can end my ordeal ;-) Probably only useful for the older targets which have a lot of baggage to support. If that works I can convert it to work with Feature, but that is a bit of overkill at this point. Cheers, Jack ________________________________________ From: Rafael EspĂndola [rafael.espindola at gmail.com] Sent: Friday, December 07, 2012 1:52 PM To: Carter, Jack Cc: List Subject: Re: [LLVMdev] [MC] [llvm-mc] Getting target specific information to <target>ELFObjectWriter On 6 December 2012 17:49, Carter, Jack <jcarter at mips.com> wrote:> Older targets like Mips had/have assemblers and ABIs that carry a lot of > baggage. > > The small bit of baggage that is giving me fits is that MipsELFObjectWriter > needs to know the relocation model (static,pic,cpic), whether we are using > xgot (-mgot), which abi (old,new), which architecture (32r[123],64[123]), > which if any coprocessor or extention instructions are used > (mips16,micromips,etc.).So the mips assembler has command line options like -fPIC? Cheers, Rafael
Maybe Matching Threads
- [LLVMdev] [MC] [llvm-mc] Getting target specific information to <target>ELFObjectWriter
- [LLVMdev] [MC] [llvm-mc] Getting target specific information to <target>ELFObjectWriter
- [LLVMdev] [MC] [llvm-mc] Getting target specific information to <target>ELFObjectWriter
- [LLVMdev] [MC] [llvm-mc] Getting target specific information to <target>ELFObjectWriter
- [LLVMdev] [MC] [llvm-mc] Getting target specific information to <target>ELFObjectWriter