Month: October 2015

newlib linker script summary for you own executable

After i build my newlib by “../newlib-2.1.0/configure –target=$TARGET –prefix=$PREFIX”, except the libc.a and crt0.o, i got these linker scripts. I am still thinking which one i should use for my own executables in my OS.

elf_i386.x Default linker script, for normal executables
elf_i386.xbn Script for -N: mix text and data on same page; don’t align data
elf_i386.xc Script for -z combreloc: combine and sort reloc sections
elf_i386.xd Script for ld -pie: link position independent executable
elf_i386.xdc Script for -pie -z combreloc: position independent executable, combine & sort relocs
elf_i386.xdw Script for -pie -z combreloc -z now -z relro: position independent executable, combine & sort relocs
elf_i386.xn Script for -n: mix text and data on same page
elf_i386.xr Script for ld -r: link without relocation
elf_i386.xs Script for ld –shared: link shared library
elf_i386.xsc Script for –shared -z combreloc: shared library, combine & sort relocs
elf_i386.xsw Script for –shared -z combreloc -z now -z relro: shared library, combine & sort relocs
elf_i386.xu Script for ld -Ur: link w/out relocation, do create constructors
elf_i386.xw Script for -z combreloc -z now -z relro: combine and sort reloc sections

 

read count : 64

YEAH, page tables is ok now

After 100 times of failure, i finally loaded a exe into an independent address space (independent page tables and LDT). I meet all kind of failures: wrong page directory, wrong page table, wrong virtual address mapping, wrong code selector, wrong LDT, etc…

螢幕快照 2015-10-22 上午1.20.39

read count : 135