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

z88dk: compiles defining org -1 for bss section not generating a separate bss bin for unknown reason #270

Closed
aralbrec opened this issue Jun 28, 2017 · 6 comments
Assignees

Comments

@aralbrec
Copy link
Member

Test code:

zzz.asm

SECTION CODE
org 0


SECTION DATA
org 0x8000


SECTION BSS
org -1

yyy.asm

SECTION CODE
defb 1,2,3,4,5

SECTION DATA
defb 10,11,12,13

SECTION BSS
defs 3

First a compile that goes straight to binary:

z80asm -b -o=zzz zzz.asm yyy.asm

Everything is good, three files are generated: zzz_CODE.bin, zzz_DATA.bin, zzz_BSS.bin

Next try doing the same but build object files first:

z80asm zzz.asm
z80asm yyy.asm
z80asm -b -o=zzz zzz.o yyy.o

Only two files are generated: zzz_CODE.bin and zzz_DATA.bin. The BSS section has been appended to DATA as if the "org -1" was ignored.

If you put everything into one file and go through object file, again the correct result.

@aralbrec
Copy link
Member Author

aralbrec commented Jul 1, 2017

Paulo is there any chance you could have a look at this sooner rather than later? I hadn't realized that this is a critical bug for all rom compiles - nothing will work that is destined for rom.

http://www.smspower.org/forums/16691-AnotherZ88DKSDCCDifference#98643

The issue has cropped up before see #65.

@pauloscustodio pauloscustodio self-assigned this Jul 1, 2017
@pauloscustodio
Copy link
Member

Done. Thanks for reporting.

@aralbrec aralbrec reopened this Jul 2, 2017
@aralbrec aralbrec changed the title z80asm: ignoring org -1 for sections when data is in object file separate from memory map file z80asm: compiles defining org -1 for bss section not generating a separate bss bin for unknown reason Jul 2, 2017
@aralbrec
Copy link
Member Author

aralbrec commented Jul 2, 2017

Thanks Paulo, the example given now works but the problem still exists in compiles for a reason I haven't been able to determine yet.

aaa.c

// zcc +z80 -v -clib=sdcc_iy aaa.c -o aaa -m

// DATA

unsigned char data[] = "Hello";

// BSS

unsigned buffer[100];

// CODE

int main(void)
{
	return 1;
}

After the compile a separate bss binary is not generated.

The memory map used is this one, excerpt here:

SECTION BSS

IF __crt_org_bss

   org __crt_org_bss

ELSE

   IF __crt_model

      org -1

   ENDIF

ENDIF

section bss_align_256
section bss_align_128
...

From the map file generated by the compile:

TAR__clib_malloc_heap_size      = $FFFFFFFF ; L z80_crt
TAR__crt_interrupt_mode         = $FFFFFFFF ; L z80_crt
TAR__crt_org_bss                = $FFFFFFFF ; L z80_crt
__clib_malloc_heap_size         = $FFFFFFFF ; L z80_crt
__crt_interrupt_mode            = $FFFFFFFF ; L z80_crt
__crt_org_bss                   = $FFFFFFFF ; L z80_crt
DEF__crt_enable_trap            = $0000 ; L z80_crt
IOCTL_RESET                     = $0000 ; G z80_crt
...

@aralbrec aralbrec changed the title z80asm: compiles defining org -1 for bss section not generating a separate bss bin for unknown reason z88dk: compiles defining org -1 for bss section not generating a separate bss bin for unknown reason Jul 2, 2017
@pauloscustodio
Copy link
Member

I found and fixed another problem for the given C code. Please let me know of any further problems.

@pauloscustodio
Copy link
Member

pauloscustodio commented Jul 2, 2017 via email

@aralbrec
Copy link
Member Author

aralbrec commented Jul 2, 2017

Thanks Paulo. Everything looks good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants