Re: Tough asm challenge for "REAL MAN PROGRAMMER" Feeb

Liste des GroupesRevenir à col advocacy 
Sujet : Re: Tough asm challenge for "REAL MAN PROGRAMMER" Feeb
De : vallor (at) *nospam* cultnix.org (vallor)
Groupes : comp.os.linux.advocacy
Date : 16. Oct 2024, 18:52:51
Autres entêtes
Message-ID : <lnacrjFt8jeU2@mid.individual.net>
References : 1
User-Agent : Pan/0.160 (Hmmm; fa1e6970; Linux-6.11.3)
On Wed, 16 Oct 2024 12:48:35 -0400, DFS <nospam@dfs.com> wrote in
<veoqp3$2a45g$1@dont-email.me>:

This challenge should be right up your alley, given your claims:
 
-------------------------------------------------------------------
_I_ am a REAL MAN PROGRAMMER
 
C programmer extraordinaire
 
Assembly language genius
 
I am a FOSS person.  I can do anything and everything and I can do it
all extremely well.
-------------------------------------------------------------------
 
Challenge:
Use nasm to deliver the assembly for the smallest possible working Linux
ELF x86 executable that does what this C program does:
 
int main(void) { return 61; }
 
That's it.  Return 61 to the OS.  That's the whole challenge.
 
It goes without saying you can't plagiarize from the Internet or
anywhere else (which is where your fraudulent mind went first of
course).
 
If you do it right, your solution should be approx 1/50th the size of
the smallest tcc (not bloated gcc) executable you could create with the
C code.
 
------------------------------------
$ dir tiny.c
 
$ cat tiny.c int main(void) { return 61; }
 
$ tcc -v tcc version 0.9.27 (x86_64 Linux)
 
$ tcc -Wall tiny.c -o t.out
 
$ dir t.out  tiny.c
 
$ ./t.out; echo $?
61
 
$ nm t.out nm: t.out: no symbols
 
$ wc -c t.out 2736 t.out ------------------------------------
 
I can't hear the crickets yet... but I know they're coming soon.

$ wc -c return_61
248 return_61

I had to look at some example programs to write the
asm file, then poured over the ld(1) documentation
for linker options.

I guess I'm not a "REAL MAN PROGRAMMER", can't figure out
how to get it any smaller.

However, THIS!  IS!  LINUX!  So:

$ wc -c return_61
8 return_61
$ ./return_61 ; echo $?
61

--
-v System76 Thelio Mega v1.1 x86_64 NVIDIA RTX 3090 Ti
   OS: Linux 6.11.3 Release: Mint 21.3 Mem: 258G
   "Are dog biscuits made from collie flour?"

Date Sujet#  Auteur
16 Oct 24 * Tough asm challenge for "REAL MAN PROGRAMMER" Feeb6DFS
16 Oct 24 `* Re: Tough asm challenge for "REAL MAN PROGRAMMER" Feeb5vallor
16 Oct 24  `* Re: Tough asm challenge for "REAL MAN PROGRAMMER" Feeb4DFS
16 Oct 24   +- Re: Tough asm challenge for "REAL MAN PROGRAMMER" Feeb1DFS
16 Oct 24   `* Re: Tough asm challenge for "REAL MAN PROGRAMMER" Feeb2vallor
16 Oct 24    `- Re: Tough asm challenge for "REAL MAN PROGRAMMER" Feeb1DFS

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal