When building with ia16-elf-gcc -mcmodel=small t.c this works as intended, producing no output. However, when I use -mcmodel=medium, I get the following:
error: Bad file number (6)
Reading the file still works fine in the medium model (e.g. getc(fp) returns the first byte of the file). It's just that seeking doesn't work. I've tried lseek() and fseeko() as well, so it appears to be an issue with the underlying seeking functonality, not just the standard C fseek().
My apologies. Yes, this is a bug in newlib-ia16 --- the function was getting its parameters from the wrong places in the stack. I will work on fixing this soon.
I'm using version 20201106 of build-ia16; I'm not sure if this is a newlib problem or otherwise, but I had to pick somewhere for the issue.
Consider the following:
When building with
ia16-elf-gcc -mcmodel=small t.c
this works as intended, producing no output. However, when I use-mcmodel=medium
, I get the following:Reading the file still works fine in the medium model (e.g.
getc(fp)
returns the first byte of the file). It's just that seeking doesn't work. I've triedlseek()
andfseeko()
as well, so it appears to be an issue with the underlying seeking functonality, not just the standard Cfseek()
.