Find the answer to your Linux question:
Results 1 to 4 of 4
main.c is exactly: Code: _start{} compiled it with: Code: cc -c main.c ld main.o -lc problem when running: Code: ./a.out output to stderr: Code: bash: ./a.out: No such file or ...
  1. #1
    heh
    heh is offline
    Just Joined!
    Join Date
    Nov 2008
    Posts
    5

    [SOLVED] elf linking the plain stupid way

    main.c is exactly:
    Code:
    _start{}
    compiled it with:
    Code:
    cc -c main.c
    ld main.o -lc
    problem when running:
    Code:
    ./a.out
    output to stderr:
    Code:
    bash: ./a.out: No such file or directory
    What do I do to make it without crt objects?

    Heh
    Last edited by heh; 12-01-2008 at 05:07 PM. Reason: formatting

  2. #2
    Linux Engineer wje_lf's Avatar
    Join Date
    Sep 2007
    Location
    Mariposa
    Posts
    1,192
    When I created a file main.c that contained exactly this:
    Code:
    _start{}
    and did this:
    Code:
    cc -c main.c
    I got this stderr output:
    Code:
    main.c:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    You won't get anywhere until you fix that.

    Hope this helps.
    --
    Bill

    Old age and treachery will overcome youth and skill.

  3. #3
    heh
    heh is offline
    Just Joined!
    Join Date
    Nov 2008
    Posts
    5
    try using this:
    main.s content:
    Code:
    	.text
    .globl _start
    _start:
    	movl	$1, %eax
    	movl	$0, %ebx
    	int		$0x80
    make with:
    Code:
    as main.s -o main.o
    ld main.o -lc
    run:
    Code:
    ./a.out
    Still produces this stderr output
    Code:
    bash: ./a.out: No such file or directory
    Heh
    Last edited by heh; 12-01-2008 at 05:57 PM. Reason: bad code

  4. #4
    heh
    heh is offline
    Just Joined!
    Join Date
    Nov 2008
    Posts
    5
    SOLUTION:

    People, don't link libc without ctr0.o. It bad for you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...