[LLVMdev] Sparc assembly syntax

Richard Pennington rich at pennware.com
Fri Aug 1 04:10:33 PDT 2008


OK, so the next thing I found in Sparc world is that sparc-elf-as 
doesn't understand .bss as a directive for some reason.

I modified the Sparc code generator to output .section ".bss" and that 
works just fine. My (temporary) solution is a hack, however:

==================================================================
--- SparcAsmPrinter.cpp (revision 720)
+++ SparcAsmPrinter.cpp (working copy)
@@ -263,7 +263,7 @@
            // FALL THROUGH
          case GlobalValue::InternalLinkage:
            if (C->isNullValue())
-            SwitchToDataSection(".bss", I);
+            SwitchToDataSection("\t.section\t\".bss\"", I);
            else
              SwitchToDataSection(".data", I);
            break;

My question is: What is the "right" way to do this? I looked at the Mips 
code generator a little bit and it feels a little more modern. Is that 
correct?

Which code generator(s) are the best to look at for a template to do 
asm/ELF output?

I've started work on a Nios2 code generator, which I originally based on 
Mips because its architecture is similar. Is there a better starting point?

Thanks for any suggestions.

-Rich




More information about the llvm-dev mailing list