Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linker alignment in 16bit mode #7

Open
anchorz opened this issue Nov 28, 2015 · 1 comment
Open

Linker alignment in 16bit mode #7

anchorz opened this issue Nov 28, 2015 · 1 comment

Comments

@anchorz
Copy link

anchorz commented Nov 28, 2015

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

@mfld-fr
Copy link

mfld-fr commented Feb 10, 2017

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

rdebath pushed a commit to rdebath/dev86 that referenced this issue Apr 20, 2018
DIS88 move back & EMU86 cosmetics
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants