My project used and modified some code from project A licensed under GPLv2 written in C. Now I was wondering that if I release my compiled binary with its reverse-compiled assembly, is it GPLv2-conforming? It seems that reverse-compiled assembly is machine-readable and the definition of source code, "the preferred form of the work for making modifications", appears a little bit vague here.
-
1What are you trying to achieve by doing this? If you are trying to obfuscate the source code, then that is not allowed. "Preferred form of the work" is a general description of source code, since sometimes one source file can be used to generate another. So this makes it clear that you must provide the original one (the preferred form), not a generated file. Output from a decompiler is a sort of generated file, so no, it is not the preferred form.– BrandinJul 12, 2018 at 12:13
-
3Related QA here: Must source code released under GPL be human-readable?.– BrandinJul 12, 2018 at 12:25
2 Answers
If you were making modifications, would you prefer to work on the original source code, with proper structure, variable names, comments etc or on the decompiled version which may well be missing all of those? I know which I'd prefer, which I think answers this question.
Reverse-compiled assembly, made from object code compiled from C code that had been licensed under the GPLv2 and modified, is not source code under any reasonable definition. Distribution of such reverse-compiled assembly would not satisfy GPL terms that require distribution of source code.
-
Let me give you an (extreme edge case) counter-example: the ROM code for the ZX Spectrum was released in 1982 as proprietary code. 30 years later, the original authors agreed to release it under the GPL. Of course, by this stage the source code was long gone, so what was released was a disassembly of the binary as this was "the preferred form of the work for making modifications to it". Jul 13, 2018 at 7:38
-
There may be cases where decompilation output could be the preferred form for editing. If you own the copyright on software for which the source is not available, in principle you could release that binary as GPL with the output of a decompiler as "source code." At this point the decompiled output would become the preferred form for editing, satisfying the GPL's definition of source code. Over time, this 'source' would ideally get more readable, automatically generated names would be replaced with symbols that describe what they are for, comments would be added, and so on.– BrandinJul 13, 2018 at 7:39
-
@Brandin I suspect you were writing your comment at the same time as mine ;-) Jul 13, 2018 at 7:43
-
Look at the word source in source-code. It is like the word source as in the source of a river (where the river comes from, though I don't see how such a big river comes from such a small source). This is not a coincidence. It is the same word, same meaning. It is where it comes from (not where it is going), therefore a disassembly is not the source. (The ZX spectrum guys were free to do what ever they wanted, as they were not bound by the licence, as they were copyright holders. They then did the best they could.) Jul 13, 2018 at 15:22
-