1 //===-- X86ELFWriter.cpp - Emit an ELF file for the X86 backend -----------===//
3 // The LLVM Compiler Infrastructure
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.
8 //===----------------------------------------------------------------------===//
10 // This file implements an ELF writer for the X86 backend. The public interface
11 // to this file is the createX86ELFObjectWriterPass function.
13 //===----------------------------------------------------------------------===//
16 #include "X86TargetMachine.h"
17 #include "llvm/PassManager.h"
18 #include "llvm/CodeGen/ELFWriter.h"
22 class X86ELFWriter : public ELFWriter {
24 X86ELFWriter(std::ostream &O, X86TargetMachine &TM) : ELFWriter(O, TM) {
25 e_machine = 3; // EM_386
30 /// addX86ELFObjectWriterPass - Returns a pass that outputs the generated code
31 /// as an ELF object file.
33 void llvm::addX86ELFObjectWriterPass(PassManager &FPM,
34 std::ostream &O, X86TargetMachine &TM) {
35 X86ELFWriter *EW = new X86ELFWriter(O, TM);
37 FPM.add(createX86CodeEmitterPass(EW->getMachineCodeEmitter()));