mirror of
https://github.com/autc04/Retro68.git
synced 2024-06-13 08:29:53 +00:00
m68k: uppercase pascal functions for linking
This commit is contained in:
parent
fe6f08fd7f
commit
4d0f9e202c
|
@ -65,6 +65,7 @@ along with GCC; see the file COPYING3. If not see
|
|||
#include "optabs.h"
|
||||
#include "builtins.h"
|
||||
#include "rtl-iter.h"
|
||||
#include "stringpool.h"
|
||||
|
||||
/* This file should be included last. */
|
||||
#include "target-def.h"
|
||||
|
@ -191,6 +192,7 @@ static bool m68k_cannot_force_const_mem (machine_mode mode, rtx x);
|
|||
static bool m68k_output_addr_const_extra (FILE *, rtx);
|
||||
static void m68k_init_sync_libfuncs (void) ATTRIBUTE_UNUSED;
|
||||
|
||||
static tree m68k_mangle_decl_assembler_name (tree decl, tree id);
|
||||
|
||||
/* Initialize the GCC target structure. */
|
||||
|
||||
|
@ -335,6 +337,9 @@ static void m68k_init_sync_libfuncs (void) ATTRIBUTE_UNUSED;
|
|||
#undef TARGET_FUNCTION_VALUE
|
||||
#define TARGET_FUNCTION_VALUE m68k_function_value
|
||||
|
||||
#undef TARGET_MANGLE_DECL_ASSEMBLER_NAME
|
||||
#define TARGET_MANGLE_DECL_ASSEMBLER_NAME m68k_mangle_decl_assembler_name
|
||||
|
||||
static const struct attribute_spec m68k_attribute_table[] =
|
||||
{
|
||||
/* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler,
|
||||
|
@ -6732,6 +6737,34 @@ m68k_write_macsbug_name(FILE *file, const char *name)
|
|||
fprintf(file, "\t.align 2,0\n\t.short 0\n");
|
||||
}
|
||||
|
||||
static tree
|
||||
m68k_mangle_decl_assembler_name (tree decl, tree id)
|
||||
{
|
||||
tree new_id = NULL_TREE;
|
||||
|
||||
if (TREE_CODE (decl) == FUNCTION_DECL)
|
||||
{
|
||||
tree attrs = TYPE_ATTRIBUTES ( TREE_TYPE(decl) );
|
||||
if (attrs != NULL_TREE)
|
||||
{
|
||||
if (lookup_attribute ("pascal", attrs))
|
||||
{
|
||||
const char *old_str = IDENTIFIER_POINTER (id != NULL_TREE ? id : DECL_NAME (decl));
|
||||
char *new_str, *p;
|
||||
int len = strlen(old_str);
|
||||
new_str = XALLOCAVEC (char, 1 + len);
|
||||
for(int i = 0; i < len; i++)
|
||||
new_str[i] = TOUPPER(old_str[i]);
|
||||
new_str[len] = 0;
|
||||
|
||||
return get_identifier (new_str);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user