[Gambas-user] Gambas binary to ELF?

Tobias Boege taboege at ...626...
Thu May 4 12:11:48 CEST 2017


On Thu, 04 May 2017, alexchernoff wrote:
> Good day all,
> 
> anyone know of a way to make an ELF format file from Gambas executable?
> 
> I try a "software protection" system (WIBU KEY), to protect a Gambas project
> from unwanted copying, but it can only protect ELF binaries and doesn't
> recognize a Gambas executable.
> 
> Cheers!
> 

The, AFAIK, only Gambas compiler, gbc3, produces Gambas bytecode files which
are not ELF, as you know. There is a gb.jit component with an LLVM-based JIT
compiler. Maybe this contains all the necessary gears already to compile a
Gambas project's instructions to host system opcodes. But then you would
still have to take care of linking, especially interfacing with components
written in Gambas. It sounds like some work.

This may look like a trivial answer, but if you can protect absolutely every
ELF file as long as it's in the ELF format, just pack an archive of the
Gambas bytecode together with a copy of the interpreter executable inside
an ELF executable. That outer executable works like a self-extracting
archive: it extracts the Gambas bytecode and the interpreter and runs the
interpreter on the bytecode. Voila, the working Gambas program inside ELF.

You can easily achieve this by writing some template code for the self-
extracting archive and then embedding the compiler and the archive into
its .data section.

Regards,
Tobi

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk




More information about the User mailing list