mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
Add support to the X86 backend for emitting ELF files. To use this, we
currently use: llc t.bc --filetype=obj This will produce a t.o file which is dumpable with readelf. Currently the file produced is empty, but the scaffolding to do more is now in place. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22292 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
34
lib/Target/X86/X86ELFWriter.cpp
Normal file
34
lib/Target/X86/X86ELFWriter.cpp
Normal file
@@ -0,0 +1,34 @@
|
||||
//===-- X86ELFWriter.cpp - Emit an ELF file for the X86 backend -----------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file implements an ELF writer for the X86 backend. The public interface
|
||||
// to this file is the createX86ELFObjectWriterPass function.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "X86.h"
|
||||
#include "llvm/CodeGen/ELFWriter.h"
|
||||
using namespace llvm;
|
||||
|
||||
namespace {
|
||||
class X86ELFWriter : public ELFWriter {
|
||||
public:
|
||||
X86ELFWriter(std::ostream &O, TargetMachine &TM) : ELFWriter(O, TM) {
|
||||
e_machine = 3; // EM_386
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/// createX86ELFObjectWriterPass - Returns a pass that outputs the generated
|
||||
/// code as an ELF object file.
|
||||
///
|
||||
FunctionPass *llvm::createX86ELFObjectWriterPass(std::ostream &O,
|
||||
TargetMachine &TM) {
|
||||
return new X86ELFWriter(O, TM);
|
||||
}
|
Reference in New Issue
Block a user