bebbo/binutils-gdb

__chip has no effect

Closed this issue · 7 comments

It seems that the __chip keyword has no effect and is silently ignored.

#include <stdio.h>

__chip char ChipArray[]="I should be in Chip-Ram";
       char FastArray[]="I should be in Fast-Ram";

int main(void)
{
	printf("Chip is 0 ... 0x1fffff\n");
	printf("ChipArray     %08x <%s>\n",(unsigned int) ChipArray,ChipArray);
	printf("FastArray     %08x <%s>\n",(unsigned int) FastArray,FastArray);
	return 0;
}

compile with
m68k-amigaos-gcc chip_fast.c -Wall --pedantic -noixemul -O2 -o chip_fast

When compiled with SAS/C it works correctly.

Btw: Did you remove SAS/C from your Compiler Explorer page?

bebbo commented

Btw: Did you remove SAS/C from your Compiler Explorer page?

switch to C - SAS/C does not support C++

Btw: Did you remove SAS/C from your Compiler Explorer page?

switch to C - SAS/C does not support C++

Ah, I see.

bebbo commented

there's an underscore missing: .datachip should be .data_chip

The old documentation http://cahirwpz.users.sourceforge.net/gcc-amigaos/chip.html#chip says

Note: For compatibility with other AmigaOS ‘C’ compilers, a preprocessor symbol ‘__chip’ is available, which expands to __attribute__((chip)) (see Keyword macros).

All the ‘chip’ attribute does is specifying that data should go to a section called ‘.datachip’. Therefore, the standard ‘GCC’ feature __attribute__((section(".datachip"))) can be used instead. 

There is no underscore?

bebbo commented

then it's a binutil issue

bebbo commented
#NO_APP
        .globl  _ChipArray
        .section .datachip
_ChipArray:

and

hunkdump test
reading test
hunk 000003f3,      HUNK_HEADER,          0
4 sections, 0 - 3 
sizes: 10252, 408, 140, 24(c)
...

note the (c) which indicates the chip attribute

Yes, that issue is fixed. __chip works now. Thank you!