mirror of
https://github.com/LIV2/bebbo-gcc.git
synced 2025-12-06 00:23:32 +00:00
change handling to emit baserel offsets based on sections
This commit is contained in:
parent
d129e0d61a
commit
efc9376c56
@ -101,10 +101,7 @@ namespace
|
||||
if (!decl)
|
||||
return 0;
|
||||
// only handle VAR non CONST
|
||||
if (decl->base.code != VAR_DECL || decl->base.code == CONST_DECL)
|
||||
return 0;
|
||||
|
||||
if (decl->base.constant_flag || decl->base.readonly_flag)
|
||||
if (decl->base.code != VAR_DECL)
|
||||
return 0;
|
||||
|
||||
// a section means: a4 unless the section is ".datachip" ".datafast" ".datafar"
|
||||
@ -115,10 +112,31 @@ namespace
|
||||
|| 0 == strcmp(secname, ".datafar")))
|
||||
return 0;
|
||||
|
||||
// normal constants end up in text.
|
||||
section * sec = get_variable_section(decl, false);
|
||||
if ( (sec->common.flags & SECTION_WRITE) == 0)
|
||||
return 0;
|
||||
if (secname == 0)
|
||||
{
|
||||
if (decl->base.constant_flag || decl->base.readonly_flag)
|
||||
return 0;
|
||||
|
||||
// normal constants end up in text.
|
||||
if (TREE_READONLY (decl))
|
||||
return 0;
|
||||
|
||||
tree type = decl->decl_minimal.common.typed.type;
|
||||
if (type->base.code == ARRAY_TYPE)
|
||||
type = type->typed.type;
|
||||
if (type->base.readonly_flag)
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
if (0 == strcmp(".text", secname))
|
||||
return 0;
|
||||
|
||||
if (secname == 0 || strcmp(".data", secname))
|
||||
{
|
||||
section * sec = get_variable_section(decl, false);
|
||||
if ( (sec->common.flags & SECTION_WRITE) == 0)
|
||||
return 0;
|
||||
}
|
||||
|
||||
// if (decl)
|
||||
// printf("%s: %8x %d\n", decl->decl_minimal.name->identifier.id.str, sec ? sec->common.flags : 0, ispic);
|
||||
|
||||
@ -7694,33 +7694,20 @@ m68k_select_section (tree decl, int reloc ATTRIBUTE_UNUSED,
|
||||
{
|
||||
if (decl->base.code == VAR_DECL)
|
||||
{
|
||||
// extern void debug_generic_expr(tree);
|
||||
// debug_generic_expr(decl);
|
||||
// fprintf(stderr, "%d: c=%d ", decl->base.code, decl->base.constant_flag || decl->base.readonly_flag);
|
||||
|
||||
if (decl->base.constant_flag || decl->base.readonly_flag)
|
||||
{
|
||||
// fprintf(stderr, "->text1\n");
|
||||
return text_section;
|
||||
}
|
||||
return text_section;
|
||||
|
||||
// char const * secname = DECL_SECTION_NAME(decl);
|
||||
// if (secname == 0
|
||||
// && ((decl->decl_minimal.common.typed.type->base.code == ARRAY_TYPE &&
|
||||
// (
|
||||
//// decl->decl_minimal.common.typed.type->typed.type->base.readonly_flag
|
||||
//// ||
|
||||
// decl->decl_minimal.common.typed.type->typed.type->base.constant_flag
|
||||
// ))
|
||||
// || (decl->decl_minimal.common.typed.type->base.code == RECORD_TYPE &&
|
||||
// (decl->decl_minimal.common.typed.type->base.readonly_flag
|
||||
// || decl->decl_minimal.common.typed.type->base.constant_flag))))
|
||||
// {
|
||||
// fprintf(stderr, "->text\n");
|
||||
// return text_section;
|
||||
// }
|
||||
// fprintf(stderr, "->data\n");
|
||||
return data_section;
|
||||
char const * secname = DECL_SECTION_NAME(decl);
|
||||
if (secname == 0)
|
||||
{
|
||||
tree type = decl->decl_minimal.common.typed.type;
|
||||
if (type->base.code == ARRAY_TYPE)
|
||||
type = type->typed.type;
|
||||
if (type->base.readonly_flag)
|
||||
return text_section;
|
||||
|
||||
return data_section;
|
||||
}
|
||||
}
|
||||
|
||||
return default_select_section (decl, reloc, align);
|
||||
|
||||
@ -262,6 +262,7 @@ amiga_declare_object = 0
|
||||
builtin_define ("__chip=__attribute__((__chip__))"); \
|
||||
builtin_define ("__fast=__attribute__((__fast__))"); \
|
||||
builtin_define ("__far=__attribute__((__far__))"); \
|
||||
builtin_define ("__near=__attribute__((section(\".data\")))"); \
|
||||
builtin_define ("__saveds=__attribute__((__saveds__))"); \
|
||||
builtin_define ("__interrupt=__attribute__((__interrupt__))"); \
|
||||
builtin_define ("__stackext=__attribute__((__stackext__))"); \
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user