Sujet : Re: Tough asm challenge for "REAL MAN PROGRAMMER" Feeb
De : vallor (at) *nospam* cultnix.org (vallor)
Groupes : comp.os.linux.advocacyDate : 16. Oct 2024, 23:13:34
Autres entêtes
Message-ID : <lnas4eFt8jeU6@mid.individual.net>
References : 1 2 3
User-Agent : Pan/0.160 (Hmmm; fa1e6970; Linux-6.11.3)
On Wed, 16 Oct 2024 14:43:22 -0400, DFS <
nospam@dfs.com> wrote in
<
vep1g9$2bq2t$1@dont-email.me>:
On 10/16/2024 1:52 PM, vallor wrote:
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,
Whilst the Cola Committee for Coding Challenges (CCCC) appreciates your
efforts, we must inform you that your faux submission is rejected for
admittance of violation of the no-plagiarism directive.
I didn't plagiarize.
I learned how to terminate a program in Linux.
I also examined the 32-bit syscall table, intending to
write a "hello world" that didn't contain that string...then
decided it wasn't worth the bother.
But since you have been rude:
then poured over the ld(1) documentation for linker options.
pored
(I stand corrected)...
I guess I'm not a "REAL MAN PROGRAMMER", can't figure out how to get it
any smaller.
REAL MAN PROGRAMMERS can get it down to 45 bytes (seriously).
However, THIS! IS! LINUX! So:
$ wc -c return_61 8 return_61 $ ./return_61 ; echo $?
61
From 248 to 8? huh?
Refer to Figure 1.1 in the following manual for a hint.
https://notes.shichao.io/apue/ch1/And...Sigmonster got my back!
-- -v System76 Thelio Mega v1.1 x86_64 NVIDIA RTX 3090 Ti OS: Linux 6.11.3 Release: Mint 21.3 Mem: 258G "I didn't cheat, I just changed the Rules!"