Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

murrpurr

Name: Anonymous 2011-02-22 8:49


/*
 * Copyright (C) 1904-2011 by Anon Y. Mous.
 *
 * Permission to use, copy, modify, and distribute this software and its
 * documentation under the terms of the GNU General Public License is hereby
 * granted. No representations are made about the suitability of this software
 * for any purpose. It is provided "as is" without express or implied warranty.
 * See the GNU General Public License for more details.
 *
 * Documents produced by Doxygen are derivative works derived from the
 * input used in their production; they are not affected by this license.
*/
#include <stdio.h>

int main()
{
    /* this is a highly complex algorithm and you are
       not expected to understand it */
    fprintf(stderr, "Segmentation fault\n");
    return 139;
}

Name: Anonymous 2011-12-05 3:27

>>25
Let me tell you why it won't link (though it will assemble, since it's perfectly valid syntax):

+ You're declaring the label '_start' as global, yet you only define 'start', instead of '_start'.

Also


section .text
    global _start

_start:



$ nasm -f elf proggles.asm 
$ ld proggles.o -o proggles
$ file proggles
proggles: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), corrupted program header size, not stripped
$ ./proggles
bash: ./proggles: cannot execute binary file


Solution (PROTIP: you have to return to the kernel):

section .text
    global _start

_start:
    ret 0x80

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List