prelink --reloc-only versus ld -Ttext-segment

Tijl Coosemans tijl at
Thu Feb 21 07:16:38 CST 2013


I'm looking into supporting winegcc -Wl,--image-base on FreeBSD. On Linux
prelink --reloc-only is used for that but rather than porting prelink it
seems easier to pass -Wl,-Ttext-segment to the compiler instead. Is there
anything obviously wrong with that?

Winedbg shows kernel32 and ntdll are loaded at their respective addresses:

ELF	7b800000-7ba41000	Dwarf           kernel32<elf>
  \-PE	7b820000-7ba41000	\               kernel32
ELF	7bc00000-7bccd000	Dwarf           ntdll<elf>
  \-PE	7bc10000-7bccd000	\               ntdll

The output of readelf -l looks good too:

Elf file type is DYN (Shared object file)
Entry point 0x7bc20200
There are 5 program headers, starting at offset 52

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  LOAD           0x000000 0x7bc00000 0x7bc00000 0xafce4 0xafce4 R E 0x1000
  LOAD           0x0afce4 0x7bcb0ce4 0x7bcb0ce4 0x0941c 0x1c2b4 RW  0x1000
  DYNAMIC        0x0b0000 0x7bcb1000 0x7bcb1000 0x000e8 0x000e8 RW  0x4
  GNU_EH_FRAME   0x0960bc 0x7bc960bc 0x7bc960bc 0x04144 0x04144 R   0x4
  GNU_STACK      0x000000 0x00000000 0x00000000 0x00000 0x00000 RW  0x4

More information about the wine-devel mailing list