Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ELF/PE to Mach-O #9

Open
drummachineshavenosoul opened this issue May 8, 2020 · 1 comment
Open

ELF/PE to Mach-O #9

drummachineshavenosoul opened this issue May 8, 2020 · 1 comment

Comments

@drummachineshavenosoul
Copy link

Trying to convert elf file to macho and always get the following error. Any assistance would be awesome, using on macOS Mojave.

/Users/sam/Downloads/objconv/source/objconv -fmacho64 /Users/sam/Desktop/CPotion. /Users/sam/Desktop/CPotion

Error 2022: Cannot convert executable file
@MarSoft
Copy link

MarSoft commented Sep 4, 2023

According to the source code, this tool can convert only object files, and executable (=linked) files can only be dumped or converted to MASM format. Alas...
See here:

objconv/src/main.cpp

Lines 457 to 495 in 42c6656

if (cmd.OutputType == CMDL_OUTPUT_DUMP) {
// File dump requested
if (cmd.Verbose > 0) {
// Tell what we are doing:
printf("\nDump of file: %s, type: %s%i", FileName, GetFileFormatName(FileType), WordSize);
}
switch(FileType) {
case FILETYPE_ELF:
DumpELF(); break;
case FILETYPE_COFF:
DumpCOF(); break;
case FILETYPE_MACHO_LE:
DumpMACHO(); break;
case FILETYPE_OMF:
DumpOMF(); break;
case FILETYPE_MAC_UNIVBIN:
ParseMACUnivBin(); break;
default:
err.submit(2010, GetFileFormatName(FileType)); // Dump of this file type not supported
}
printf("\n"); // New line
}
else {
// File conversion requested
if (cmd.DesiredWordSize == 0) cmd.DesiredWordSize = WordSize;
if (WordSize && WordSize != cmd.DesiredWordSize) {
err.submit(2012, WordSize, cmd.DesiredWordSize); // Cannot convert word size
return;
}
if (Executable && cmd.OutputType != CMDL_OUTPUT_MASM) {
// Attempt to convert executable file
err.submit(2022);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants