flat assembler
Message board for the users of flat assembler.
Index
> Linux > elf executable with dynamic linker... from scratch Goto page Previous 1, 2 |
Author |
|
nocona 16 Oct 2007, 04:07
change line
Code: addr DT_RELA, reloc_table addr DT_RELASZ, reloc_table.SIZE to Code: addr DT_REL, reloc_table addr DT_RELSZ, reloc_table.SIZE as i said before, x86 use DT_REL type. |
|||
16 Oct 2007, 04:07 |
|
snify 16 Oct 2007, 07:55
now it gives Segmentation Fault. whatever, thanks
|
|||
16 Oct 2007, 07:55 |
|
nocona 27 Oct 2007, 03:37
could u please provide some info on where it segfault? it's in ld.so code or the program itself? i ran it on my system with glibc-2.4 installed and it execute fine.
|
|||
27 Oct 2007, 03:37 |
|
Raedwulf 06 Nov 2007, 21:24
<Ooops post deleted> found your shared library sample .
Edit: Maybe show an example using a proper hash table for exported symbols? Last edited by Raedwulf on 07 Nov 2007, 14:18; edited 2 times in total |
|||
06 Nov 2007, 21:24 |
|
vid 07 Nov 2007, 06:48
nocona: wow, OOP called from assembly, this is pretty cool hack.
by the way, you could assign nicer local names to decorated method names, like "QWidget.setVisible" etc... |
|||
07 Nov 2007, 06:48 |
|
Raedwulf 07 Nov 2007, 07:55
Yea that would be even cooler All I can say is once Tomasz wakes up, he should take a look at this elf from scratch .
|
|||
07 Nov 2007, 07:55 |
|
nocona 08 Nov 2007, 06:13
Quote:
i didn't really quite understand ur question. that was a proper hash table, otherwise linker couldn't find any symbols from the shared library. maybe you means a macro that create hash table automatically? thanks vid..i actually don't have any needs to use these libraries and that time I want to know how it is possible to call C++ libraries (e.g qt) from asm source.. it is strictly for my learning purpose so i just leave the name that way . btw.. i tested the 32-bit example in my PCBSD installation and it run without modification (no need for brandelf -f linux!). it seems the loader knows about linux binary just by looking the interpreter name.. also if we want to use bsd dynamic linker, we need to change the interpreter name to /libexec/ld-elf.so.1.. not just that, we need to define 2 symbols ( i think) "environ" and "__progname" because libc imported it and it seems every bsd program define them.. so we need proper hash table here also.. next time i will put the example source for BSD.. but not here of course |
|||
08 Nov 2007, 06:13 |
|
Raedwulf 08 Nov 2007, 08:43
Yea I meant a hash table with some macro magic .
Oh yea just to note: define interpreter64 "/lib/ld-linux-x86-64.so.2" There's sometimes no link between that and "/lib64/ld-linux-x86-64.so.2" so it may not run on some systems - as I've discovered . Better use lib64. There's also an extra DT_RPATH which is useful for specifying library paths. e.g. Code: rpath fix rpath64 ; or rpath32 define rpath64 ".:/lib64:/usr/lib64:/usr/local/lib64" define rpath32 ".:/lib:/usr/lib:/usr/local/lib" _dynamic_ : addr DT_RPATH, strtab@rpath ..... ..... addr 0, 0 ;terminator .SIZE=$-_dynamic_ .MEMSIZE=.SIZE string_table string strtab@null string strtab@rpath, rpath ; HERE .... .... end_string_table Otherwise the binary can't find a linked .so in the same path as the file (or so i've discovered on my test system (University of York Slackware 12.0)). _________________ Raedwulf |
|||
08 Nov 2007, 08:43 |
|
Goto page Previous 1, 2 < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.