C (gcc) -zexecstack
-Wl,-eA
-nostartfiles
on Linux x86-64, 876 bytes, score 798
A[]={1111+1111+1111+111+111-11-11-11-11+1+1+1,1111111111+111111111-11111111+1111111+1111111-111111+1111+1111+111+111+111+111+111-11-11-11-11+1+1+1+1+1,111111+111111-11111-1111+111+111+111-11-1-1-1-1-1,111111111+111111111+11111111+11111111+11111111+1111111+1111111+111111-1111-1111-1111-1111-111-111-111+11+11+11+11+1+1+1+1+1,1111111111+1111111111-111111111-111111111-111111111-111111111+11111111+11111111+11111111+11111111-1111111-1111111-1111111-111111-111111-111111+11111+11111-1111+111+111+11+1,111111111+111111111+111111111+111111111+111111111-11111111-1111111-1111111-1111111-1111111-111111-111111+1111+1111+1111+1111+1111-111-111-111+11+11-1-1,1111111111+1111111111-111111111-111111111-111111111-111111111+11111111+11111111+11111111+11111111-1111111-1111111-111111-111111-111111-111111-111111-1111-1111-1111-1111-1111+11+11+11+11+1,11111-1111-1111-111-111-111-11+1+1+1};
Charset: A[]={+,-1};
Same method as the previous answer, with even more hacking to supply a custom entry point named A
(which has the smallest ASCII value among a-zA-Z_
. Credit to this SO answer.
Assembly: (NASM syntax)
bits 64
global _start
_start:
mov edx, 13
pop rax
push rax
lea rsi, [rel s]
pop rdi
syscall
s: db "Hello, World!"
Uses the argc=1
set up on the stack to load the value 1 to rax
and rdi
. The instructions are slightly mixed up in order to get the minimal code length in C.
Here is the Python script that generates the "ones decomposition" from the xxd -i
output (C include-style hex output) of the compiled binary.
C (gcc) -zexecstack
on Linux x86-64, 891 bytes, score 1154
main[]={1111+1111+1111+111+111-11-11-11-11+1+1+1,1111111111-111111111-111111111+11111111-1111111-111111-111111-111111-111111+11111-1111-1111-1111-1111+111+111+111+11,1+1+1+1,111111111-11111111-11111111-1111111-1111111-1111111-1111111+111111+111111+111111+111111+11111+11111+11111+11111-111-111-111-111-111-11-11-11,1111111111+1111111111-111111111-111111111-111111111-111111111+11111111+11111111+11111111+11111111-1111111-1111111-1111111+111111+11111+11111+11111+11111-1111-111-111+11+11+11,1111111111+111111111+111111111+111111111+11111111+11111111-1111111-1111111-1111111-1111111-111111-111111-111111-111111-11111-11111-11111-11111-11111+1111+1111+1111+1111-111-111-111-11-1-1-1-1,1111111111+111111111+111111111+111111111+111111111+111111111+11111111+11111111-1111111-1111111-1111111-1111111+111111+111111+111111+11111+11111+11111+11111+11111-1111-1111-1111-1111-111+11-1-1-1-1-1,11+11+11};
Uses ceilingcat's minimal Turing-complete charset main[]={1+,};
, plus -
to meet the code length limit.
Assembly: (NASM syntax)
bits 64
global _start
_start:
mov edx, 13
lea rsi, [rel s]
mov eax, edi
syscall
s: db "Hello, World!"
Essentially calls write
syscall once, and goes into arbitrary instructions formed by the string literal, causing segfault.