Chris Lattner | 07a9144 | 2005-06-27 06:30:12 +0000 | [diff] [blame^] | 1 | //===-- X86ELFWriter.cpp - Emit an ELF file for the X86 backend -----------===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file was developed by the LLVM research group and is distributed under |
| 6 | // the University of Illinois Open Source License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file implements an ELF writer for the X86 backend. The public interface |
| 11 | // to this file is the createX86ELFObjectWriterPass function. |
| 12 | // |
| 13 | //===----------------------------------------------------------------------===// |
| 14 | |
| 15 | #include "X86.h" |
| 16 | #include "llvm/CodeGen/ELFWriter.h" |
| 17 | using namespace llvm; |
| 18 | |
| 19 | namespace { |
| 20 | class X86ELFWriter : public ELFWriter { |
| 21 | public: |
| 22 | X86ELFWriter(std::ostream &O, TargetMachine &TM) : ELFWriter(O, TM) { |
| 23 | e_machine = 3; // EM_386 |
| 24 | } |
| 25 | }; |
| 26 | } |
| 27 | |
| 28 | /// createX86ELFObjectWriterPass - Returns a pass that outputs the generated |
| 29 | /// code as an ELF object file. |
| 30 | /// |
| 31 | FunctionPass *llvm::createX86ELFObjectWriterPass(std::ostream &O, |
| 32 | TargetMachine &TM) { |
| 33 | return new X86ELFWriter(O, TM); |
| 34 | } |