[LLVMbugs] [Bug 3813] New: MachO and ELF Writers/ MachineCodeEmitters are hard-coded into LLVMTargetMachine
bugzilla-daemon at cs.uiuc.edu
bugzilla-daemon at cs.uiuc.edu
Sun Mar 15 04:34:28 PDT 2009
http://llvm.org/bugs/show_bug.cgi?id=3813
Summary: MachO and ELF Writers/MachineCodeEmitters are hard-coded
into LLVMTargetMachine
Product: libraries
Version: 2.5
Platform: PC
OS/Version: All
Status: NEW
Severity: enhancement
Priority: P2
Component: Common Code Generator Code
AssignedTo: unassignedbugs at nondot.org
ReportedBy: just.s0m3.guy+llvmbugzilla at gmail.com
CC: llvmbugs at cs.uiuc.edu
Currently, the MachO and ELF Writers and MachineCodeEmitters are hard-coded
into LLVMTargetMachine and llc.
In other words, the 'object file generation' capabilities of the Common Code
Generator are not generic.
LLVMTargetMachine::addPassesToEmitFile explicitly checks whether the derived
backend TargetMachine implements one of getMachOWriterInfo or getELFWriterInfo,
and returns a corresponding FileModel enum value.
llc's main function uses the resulting FileModel value to determine which of
the {AddMachOWriter,AddELFWriter} functions to call.
This is limiting for a number of reasons:
1. If a given platform (e.g. x86) may support both MachO and ELF, MachO will be
selected, as it is checked first. This is bad behaviour, it should be up to the
user to decide which object format he wants.
2. Extension of the object file generation capabilities to include new object
file formats is difficult, and requires modifications to LLVM code (not just a
plugin).
I suggest transforming the {getMachOWriterInfo, getELFWriterInfo} functions (on
TargetMachine) into a single (templated?) getObjectFileWriterInfo function.
Additionally a addObjectFileWriter member should be added to TargetMachine,
taking the place of the static {AddMachOWriter, AddELFWriter} functions.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list