@# Quotes DB     useful, funny, interesting





Google
 
Web www.quotesdb.info
Undernet  |  EFnet  |  Quakenet  |  Freenode  |  Dalnet  |  Ircnet  |  Galaxynet
Page: 1 2 3



Comments:

<0> its on intel's site. The IA-32 Intel architecture software developer's manual. They will even send you a free hardcopy if you call them
<1> probably a 4 byte quantity located somewhere in memory or in a cpu register
<2> billfur : cant you just link me?
<0> I don't have a link. I have the hardcopy =p
<1> you have to call 'em now? ew
<0> wcstok, thats what I've heard.
<2> billfur : can you scan it and send me?
<0> I did too.
<0> [aG]Sociopath, theres a pdf version too
<2> do they send copies to israel?
<2> I dont think I can handle reading it on the screen
<0> ooh, not sure if they do outside the US.
<2> their foreign policy ****s then
<2> I cant find the link anyhow
<0> http://www.intel.com/design/pentium4/manuals/index_new.htm



<2> they dont say how I can get a hard copy
<0> read the page again.
<2> sure they do
<0> =)
<2> they wont say if they are working in the US solo
<0> ah, call them
<2> I cant
<2> what if I dont have a company?
<0> make one up
<0> if they care
<0> your name inc or something
<2> I dont have a name either
<0> make up a name? =p
<3> how tell ld (linker) to link in printf from stdlib?
<3> undefined reference to `printf'
<3> :(
<3> why when i try to run executable i get command not found?
<4> because its there and the OS's AI wants you to go nuts?
<3> nopealicious: if i make executable w/ gcc i'm good...if i try to use ld i get problem
<4> are we talking about C or asm??
<3> asm
<3> nopealicious: maybe ld needs more options i'm missing?
<4> well i dunno
<5> seb: hm... try -lc
<3> undesktop: thanks..yes that fixed one problem
<5> that just links to libc
<3> undesktop: i wanted to be macho and link w/ ld instead of gcc but that seems trickier
<3> undesktop: apparently gcc does a lot of stuff for you we don't know about that ld does not for ***embly code
<5> "we"?
<3> undesktop: do you know why gcc linking is better than ld linking?
<5> gcc calls the linker with these flags
<5> gcc knows that it wants to link C code, so it adds i.e. -lc to the linker flags to include libc
<3> we went over that already...that isn't the only diff
<5> maybe
<5> depends
<0> seb-, just tell gcc to output what flags its p***ing to the linker, and use those?
<6> !seen elfpancake
<3> billfur: ok, how do tell gcc to do that?
<0> seb-, er, hm. thats harder then it sounds. try -v?
<3> billfur: just did..that gave some verbose stuff but nothing that looked like ld line
<3> billfur: see this...
<3> % ld -o toy toy.o -lc
<3> % ls toy
<3> toy
<3> % ./toy
<3> ./toy: Command not found.
<7> what os?
<7> It's probably not finding the dynamic linker for some reason
<3> spk-: thank you very much...debian linux laptop...
<7> Maybe -static will help
<7> I don't know if I believe what I told you though :-)
<7> That looks like a message from the shell which doesn't know anything about ld.so
<7> Does 'strace ./toy' give you any clues?
<3> spk-: well -static got it farther than before!
<3> spk-: -static almost solved problem but i don't know why it worked
<7> I think it is something about ld.so
<3> spk-: doing ld -static worked and i was able to run executables....they gave correct output but seg faulted after!
<7> I think you need to link in crt0 or something too
<3> spk-: what is crt0?
<7> It's the startup code, the first code that runs in userland (after the dynamic linker)
<7> It calls main(), it defines _start which you're probaby seeing a warning about not being defined



<3> spk-: you're reading my mind! yes i am having messages about _start
<3> spk-: i was gonna ask you about _start shortly :)
<7> I'm trying the same experiment as you
<8> seb-, maybe you can try to run: /lib/ld-linux.so.2 toy (issue /lib/ld-linux.so.2 if you want to know about switches, also man ld.so gives some info).
<7> Hmm, mine still crashes when I rename main() to _start()
<7> I'm emerging gdb to find out why. I just reinstalled so I don't have gdb installed yet
<3> spk_: indeed ld works perfectly now if you use -static and specify a ton of crt*.o files
<7> I'm trying to run this:
<7> int
<7> _start()
<7> {
<7> }
<7> and it segfaults
<7> Even though the dis***embly and elf header look right
<0> might I recommend looking at
<0> err, what does the dis***embly look like?
<7> 080480b4 <.text>:
<7> 80480b4: 55 push %ebp
<7> 80480b5: 89 e5 mov %esp,%ebp
<7> 80480b7: 5d pop %ebp
<7> 80480b8: c3 ret
<7> 080480b4 <.text>:
<7> 80480b4: 55 push %ebp
<7> 80480b5: 89 e5 mov %esp,%ebp
<7> 80480b7: 5d pop %ebp
<7> 80480b8: c3 ret
<7> oops
<7> and:
<7> Entry point address: 0x80480b4
<7> from readelf -h
<8> shouldn't a linux prog be terminated by using a syscall ?
<0> yes
<7> good point
<7> maybe that's what's happening, it's running off the stack
<0> i'd place good money that it isatleast one of the problems
<3> How else do you end a program besides a ret?
<7> No, that was the only problem :)
<3> spk-: please tell what you added
<7> seb-: Just call your main function _start() instead of main and remember to call exit() and everything works (for me)
<7> $ ld -o hi hi.o -static -lc
<0> I thought exit wasn't right
<7> I linked like that ^^
<8> _start isn't reached by a call: the stack content is well known.
<3> spk-: ret isn't good enough?...you called 'call _exit' ?
<0> you want _exit()
<7> Yeah, you can't return from _start because it is at the top of the stack
<7> It will try and jump to 0
<3> spk-: is there no way to avoid the -static switch? i'm not sure what that does
<8> should be something like: argc argv[0]...argv[N-1] NULL env[0]...env[M-1] NULL
<0> seb: don't link anything in, and directly use the syscall (mov 1 to eax, return to ebx, int 80)
<3> billfur: in C you want _exit() but what about in ***embler?...call _exit?
<0> http://www.muppetlabs.com/~breadbox/software/tiny/teensy.html
<7> Yeah, that's fun to work through :)
<3> billfur: thanks...i will *definitely* read that
<7> The crazy overlapping the ELF header part is optional but cool
<7> The first half is very instructional though
<0> you will never fully hate elf until you have to write a elf parser
<7> oh hey I solved your mystery seb-
<7> at least on my box
<3> spk-: oh?
<7> INTERP 0x000114 0x08048114 0x08048114 0x00013 0x00013 R 0x1
<7> [Requesting program interpreter: /usr/lib/libc.so.1]
<0> seb-, btw, iirc -static tells it to staticly link libc, as opposed to dynamically, which wouldn't work as your overriding start.
<7> That's the path to the dynamic linker that ld puts in the binary, but on my box it doesn't exist at that path
<3> spk-: did you do an strace to get that?
<7> So the kernel can't find it in execve() and returns ENOENT
<3> bilfur:k, thanks again
<3> billfur: i mean, thanks to you
<7> No, that's from 'readelf -e'
<3> spk-: ok
<3> spk-: wow fancy....analyzing executable itself
<7> There must be some ld option to set that
<9> Is this a correct result ? cmp dword [edi + 0x1c], 0 => \x67\x66\x83\x7f\x1c\x00
<0> gimme a sec


Name:

Comments:

Please enter the result of the sum 63 + 46 (to avoid spam):






Return to #asm
or
Go to some related logs:

#php
#linux
#gentoo
#oe
#debian
#css
#lgp
#osdev
Intel 855GME xgl ubuntu
#css



Home  |  disclaimer  |  contact  |  submit quotes