Re: ld bug

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>
>Although this is not the right list for this, it seems that the start
>pointer in your program is 0, and since this page is not mapped, you
>get a segfault. How to fix this I don't know, but this definitely is
>not a kernel bug.

"ld" usually wants a .start symbol (or something...) - and it looks like
nasm does not put some into the object file.

>> compilation command:
>> sh# nasm -f elf -o new.o new.asm
>> sh# ld -e main -o new new.o
>> sh# strace ./new
>> execve("./new", ["./new"], [/* 78 vars */]) = 0
>> --- SIGSEGV (Segmentation fault) @ 0 (0) ---
>> +++ killed by SIGSEGV +++
>> i compiled the whole shit with gcc and it worked... .-/

Well, I did the same with GCC (GNU AS):

.intel_syntax noprefix;
.section .rodata;
.L_LC0:
	.string "och bin";
.text;
	pusha;
	mov eax, 4;
	mov ebx, 1;
	mov ecx, offset flat:.L_LC0;
	mov edx, 8;
	int 0x80;

18:43 eax:../hxtools/examples # cc x.S -c
18:43 eax:../hxtools/examples # ld x.o -o x.aout
ld: warning: cannot find entry symbol _start; defaulting to 0000000008048074
18:43 eax:../hxtools/examples # ./x.aout 
och binSegmentation fault

- The segfault is due to the abrupt end after int 0x80,
  so let's not consider it.

- "och bin" is printed

- As you can see, there is said _start symbol which I presume NASM
  fails to generate.



Jan Engelhardt                                                               
--                                                                            
| Gesellschaft fuer Wissenschaftliche Datenverarbeitung Goettingen,
| Am Fassberg, 37077 Goettingen, www.gwdg.de
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux