dev86 icon indicating copy to clipboard operation
dev86 copied to clipboard

Linker alignment in 16bit mode

Open anchorz opened this issue 8 years ago • 1 comments

The symbols in .bss segment are ALWAYS 4 byte aligned. That is probably a mistake. Only 'LONG' should be aligned to 4 bytes (in 16 or 32 bit code that does not matter, by that way we will keep the memory layout independent from compiler options.)

tempoffset = symptr->value; symptr->value = ld_roundup(comsz[seg = symptr->flags & SEGM_MASK],tempoffset,bin_off_t); comsz[seg] = symptr->value+tempoffset;

The program

int i1=5; long l=1; long bss_l; char c3='3'; int i2=0x7fff; char c2='3';

int bss_i1; char bss_c3; int bss_i2; char bss_c2;

int main() { } ld86 -i -d -T 0x100 -D 0x0000 -H 0xf000 -M produces the following linker output test _i1 3 00000000 R test _l 3 00000002 R test _c3 3 00000006 R test _i2 3 00000008 R test _c2 3 0000000a R test _bss_i1 3 0000000c R C test _bss_i2 3 00000010 R C test _bss_c2 3 00000014 R C test _bss_c3 3 00000018 R C test _bss_l 3 0000001c R C test _main 0 00000100 R

anchorz avatar Nov 28 '15 07:11 anchorz

Sorry for the mixing of the issues, latest commit actually related to mfld-fr#7, not this one.

mfld-fr avatar Feb 10 '17 11:02 mfld-fr