@R add target 'amigaosvasm' from https://github.com/alpine9000/gcc

This commit is contained in:
bebbo 2017-04-25 12:42:11 +02:00
parent ee7031d5d1
commit e550db50f0
6 changed files with 185 additions and 11 deletions

6
config.sub vendored
View File

@ -2,7 +2,7 @@
# Configuration validation subroutine script.
# Copyright 1992-2016 Free Software Foundation, Inc.
timestamp='2016-01-01'
timestamp='2017-04-21'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@ -500,7 +500,7 @@ case $basic_machine in
amiga | amiga-*)
basic_machine=m68k-unknown
;;
amigaos | amigados)
amigaos | amigaosvasm | amigados)
basic_machine=m68k-unknown
os=-amigaos
;;
@ -1380,7 +1380,7 @@ case $os in
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
| -aos* | -aros* | -cloudabi* | -sortix* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -clix* | -riscos* | -uniplus* | -iris* | -rt* | -xenix* \
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
| -bitrig* | -openbsd* | -solidbsd* \
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \

View File

@ -1936,6 +1936,16 @@ m68k-*-elf* | fido-*-elf*)
;;
esac
;;
m68k*-*-amigaosvasm*)
default_m68k_cpu=68000
tm_file="${tm_file} dbx.h newlib-stdint.h m68k/m68kamigaos.h"
tm_defines="${tm_defines} MOTOROLA=1 TARGET_AMIGAOS TARGET_AMIGAOS_VASM TARGET_CPU_DEFAULT=0"
tmake_file="m68k/t-floatlib m68k/t-m68kbare m68k/t-amigaos"
tm_p_file="${tm_p_file} m68k/amigaos-protos.h"
extra_objs=amigaos.o
extra_options="${extra_options} m68k/amigaos.opt"
gnu_ld=yes
;;
m68k*-*-amigaos*)
default_m68k_cpu=68000
tm_file="${tm_file} dbx.h newlib-stdint.h m68k/m68kamigaos.h"

View File

@ -50,6 +50,7 @@
//int amiga_declare_object;
#if 0
static int amigaos_put_in_text (tree);
static rtx gen_stack_management_call (rtx, rtx, const char *);
@ -783,7 +784,7 @@ amigaos_rtx_costs (rtx x, machine_mode mode, int outer_code, int opno, int *tota
}
/* Output assembly to switch to section NAME with attribute FLAGS. */
#ifndef TARGET_AMIGAOS_VASM
extern void
amiga_named_section (const char *name, unsigned int flags, tree decl ATTRIBUTE_UNUSED)
{
@ -791,6 +792,22 @@ amiga_named_section (const char *name, unsigned int flags, tree decl ATTRIBUTE_U
name = ".text";
fprintf (asm_out_file, "\t%s\n", name);
}
#else
extern void
amiga_named_section (const char *name, unsigned int flags, tree decl ATTRIBUTE_UNUSED)
{
if (0 == strncmp(".text", name, 5))
name = ".text";
if (0 == strncmp("section ", name, 8)) {
// fprintf (asm_out_file, "\t.section\t%s\n", name);
fprintf (asm_out_file, "\t%s\n", name);
} else {
fprintf (asm_out_file, "\tsection %s\n", name);
}
}
#endif
/* Baserel support. */

View File

@ -191,7 +191,11 @@ static void m68k_init_sync_libfuncs (void) ATTRIBUTE_UNUSED;
#if INT_OP_GROUP == INT_OP_DOT_WORD
#undef TARGET_ASM_ALIGNED_HI_OP
#ifndef TARGET_AMIGAOS_VASM
#define TARGET_ASM_ALIGNED_HI_OP "\t.word\t"
#else
#define TARGET_ASM_ALIGNED_HI_OP "\tdc.w\t"
#endif
#endif
#if INT_OP_GROUP == INT_OP_NO_DOT
@ -595,8 +599,11 @@ m68k_option_override (void)
if (!flag_pic || flag_pic > 2)
{
m68k_symbolic_call_var = M68K_SYMBOLIC_CALL_JSR;
#ifndef TARGET_AMIGAOS_VASM
m68k_symbolic_jump = "jra %a0";
#else
m68k_symbolic_jump = "jmp %a0";
#endif
}
else if (TARGET_ID_SHARED_LIBRARY)
/* All addresses must be loaded from the GOT. */
@ -1831,13 +1838,21 @@ output_btst (rtx *operands, rtx countop, rtx dataop, rtx_insn *insn, int signpos
&& next_insn_tests_no_inequality (insn))
{
cc_status.flags = CC_NOT_NEGATIVE | CC_Z_IN_NOT_N | CC_NO_OVERFLOW;
#ifndef TARGET_AMIGAOS_VASM
return "move%.w %1,%%ccr";
#else
return "move%.w %1,ccr";
#endif
}
if (count == 2 && DATA_REG_P (operands[1])
&& next_insn_tests_no_inequality (insn))
{
cc_status.flags = CC_NOT_NEGATIVE | CC_INVERTED | CC_NO_OVERFLOW;
#ifndef TARGET_AMIGAOS_VASM
return "move%.w %1,%%ccr";
#else
return "move%.w %1,ccr";
#endif
}
/* count == 1 followed by bvc/bvs and
count == 0 followed by bcc/bcs are also possible, but need

View File

@ -204,7 +204,11 @@ along with GCC; see the file COPYING3. If not see
#define INT_OP_DC 3 /* dc.b, dc.w, dc.l */
/* Set the default. */
#ifndef TARGET_AMIGAOS_VASM
#define INT_OP_GROUP INT_OP_DOT_WORD
#else
#define INT_OP_GROUP INT_OP_DC
#endif
/* Bit values used by m68k-devices.def to identify processor capabilities. */
#define FL_BITFIELD (1 << 0) /* Support bitfield instructions. */
@ -729,9 +733,49 @@ do { if (cc_prev_status.flags & CC_IN_68881) \
if (cc_prev_status.flags & CC_NO_OVERFLOW) \
return NO_OV; \
return NORMAL; } while (0)
#ifdef TARGET_AMIGAOS_VASM
#define ASM_OUTPUT_ASCII(MYFILE, MYSTRING, MYLENGTH) \
do { \
FILE *_hide_asm_out_file = (MYFILE); \
const unsigned char *_hide_p = (const unsigned char *) (MYSTRING); \
int _hide_thissize = (MYLENGTH); \
{ \
FILE *asm_out_file = _hide_asm_out_file; \
const unsigned char *p = _hide_p; \
int thissize = _hide_thissize; \
int i; \
fprintf (asm_out_file, "\tdc.b \""); \
\
for (i = 0; i < thissize; i++) \
{ \
int c = p[i]; \
if (c == '\"' || c == '\\') \
putc ('\\', asm_out_file); \
if (ISPRINT (c)) \
putc (c, asm_out_file); \
else \
{ \
fprintf (asm_out_file, "\\%o", c); \
/* After an octal-escape, if a digit follows, \
terminate one string constant and start another. \
The VAX assembler fails to stop reading the escape \
after three digits, so this is the only way we \
can get it to parse the data properly. */ \
if (i < thissize - 1 && ISDIGIT (p[i + 1])) \
fprintf (asm_out_file, "\"\n\tdc.b \""); \
} \
} \
fprintf (asm_out_file, "\"\n"); \
} \
} \
while (0)
#endif
/* Control the assembler format that we output. */
#ifndef TARGET_AMIGAOS_VASM
#define ASM_APP_ON "#APP\n"
#define ASM_APP_OFF "#NO_APP\n"
#define TEXT_SECTION_ASM_OP "\t.text"
@ -741,6 +785,17 @@ do { if (cc_prev_status.flags & CC_IN_68881) \
#define LOCAL_LABEL_PREFIX ""
#define USER_LABEL_PREFIX "_"
#define IMMEDIATE_PREFIX "#"
#else
#define ASM_APP_ON ""
#define ASM_APP_OFF ""
#define TEXT_SECTION_ASM_OP "\tsection .text"
#define DATA_SECTION_ASM_OP "\tsection .data"
#define GLOBAL_ASM_OP "\txdef\t"
#define REGISTER_PREFIX ""
#define LOCAL_LABEL_PREFIX "_."
#define USER_LABEL_PREFIX "_"
#define IMMEDIATE_PREFIX "#"
#endif
#define REGISTER_NAMES \
{REGISTER_PREFIX"d0", REGISTER_PREFIX"d1", REGISTER_PREFIX"d2", \
@ -860,11 +915,17 @@ do { if (cc_prev_status.flags & CC_IN_68881) \
/* The m68k does not use absolute case-vectors, but we must define this macro
anyway. */
#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
#ifndef TARGET_AMIGAOS_VASM
#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
asm_fprintf (FILE, "\t.long %LL%d\n", VALUE)
#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
asm_fprintf (FILE, "\t.word %LL%d-%LL%d\n", VALUE, REL)
#else
#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
asm_fprintf (FILE, "\tdc.l %LL%d\n", VALUE)
#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
asm_fprintf (FILE, "\tdc.w %LL%d-%LL%d\n", VALUE, REL)
#endif
/* We don't have a way to align to more than a two-byte boundary, so do the
best we can and don't complain. */
@ -874,13 +935,24 @@ do { if (cc_prev_status.flags & CC_IN_68881) \
#ifdef HAVE_GAS_BALIGN_AND_P2ALIGN
/* Use "move.l %a4,%a4" to advance within code. */
#ifndef TARGET_AMIGAOS_VASM
#define ASM_OUTPUT_ALIGN_WITH_NOP(FILE,LOG) \
if ((LOG) > 0) \
fprintf ((FILE), "\t.balignw %u,0x284c\n", 1 << (LOG));
#endif
#else
#define ASM_OUTPUT_ALIGN_WITH_NOP(FILE,LOG) \
if ((LOG) > 0) \
fprintf ((FILE), "\tcnop 0,%u\n", 1 << (LOG));
#endif
#ifndef TARGET_AMIGAOS_VASM
#define ASM_OUTPUT_SKIP(FILE,SIZE) \
fprintf (FILE, "\t.skip %u\n", (int)(SIZE))
#else
#define ASM_OUTPUT_SKIP(FILE,SIZE) \
fprintf (FILE, "\tds.b %u\n", (int)(SIZE))
#endif
#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
( fputs (".comm ", (FILE)), \

View File

@ -61,7 +61,11 @@ along with GCC; see the file COPYING3. If not see
These labels will not appear in the symbol table. */
#undef LOCAL_LABEL_PREFIX
#ifndef TARGET_AMIGAOS_VASM
#define LOCAL_LABEL_PREFIX "."
#else
#define LOCAL_LABEL_PREFIX "_."
#endif
/* The prefix to add to user-visible assembler symbols. */
@ -71,24 +75,43 @@ along with GCC; see the file COPYING3. If not see
/* config/m68k.md has an explicit reference to the program counter,
prefix this by the register prefix. */
#ifndef TARGET_AMIGAOS_VASM
#define ASM_RETURN_CASE_JUMP \
do { \
return "jmp %%pc@(2,%0:w)"; \
} while (0)
#else
#define ASM_RETURN_CASE_JUMP \
do { \
return "jmp (2,pc,%0.w)"; \
} while (0)
#endif
/* This is how to output an assembler line that says to advance the
location counter to a multiple of 2**LOG bytes. */
#ifndef TARGET_AMIGAOS_VASM
#ifndef ALIGN_ASM_OP
#define ALIGN_ASM_OP "\t.align\t"
#endif
#else
#define ALIGN_ASM_OP "\talign\t"
#endif
#undef ASM_OUTPUT_ALIGN
#ifndef TARGET_AMIGAOS_VASM
#define ASM_OUTPUT_ALIGN(FILE,LOG) \
do { \
if ((LOG) > 0) \
fprintf ((FILE), "%s%u\n", ALIGN_ASM_OP, 1 << (LOG)); \
} while (0)
#else
#define ASM_OUTPUT_ALIGN(FILE,LOG) \
do { \
if ((LOG) > 0) \
fprintf ((FILE), "%s%u\n", ALIGN_ASM_OP, (LOG)); \
} while (0)
#endif
#if 0
extern int amiga_declare_object;
@ -126,7 +149,11 @@ amiga_declare_object = 0
#undef M68K_STATIC_CHAIN_REG_NAME
#define M68K_STATIC_CHAIN_REG_NAME REGISTER_PREFIX "a1"
#ifndef TARGET_AMIGAOS_VASM
#define ASM_COMMENT_START "|"
#else
#define ASM_COMMENT_START "|"
#endif
/* Define how the m68k registers should be numbered for Dwarf output.
The numbering provided here should be compatible with the native
@ -147,15 +174,34 @@ amiga_declare_object = 0
#undef ASM_OUTPUT_COMMON
#undef ASM_OUTPUT_LOCAL
#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
#ifndef TARGET_AMIGAOS_VASM
#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
( fputs (".comm ", (FILE)), \
assemble_name ((FILE), (NAME)), \
fprintf ((FILE), ",%u\n", (int)(SIZE)))
#else
#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
( switch_to_section (bss_section), \
fputs ("|.comm\n\tcnop 0,4\n", (FILE)), \
assemble_name ((FILE), (NAME)), \
fprintf ((FILE), ":\n\tds.b %u\n", (int)(SIZE)), \
fputs ("\txdef ", (FILE)), \
assemble_name ((FILE), (NAME)), \
fprintf ((FILE), "\n"))
#endif
#ifndef TARGET_AMIGAOS_VASM
#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
( fputs (".lcomm ", (FILE)), \
assemble_name ((FILE), (NAME)), \
fprintf ((FILE), ",%u\n", (int)(SIZE)))
#else
#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
( switch_to_section (bss_section), \
fputs ("|.lcomm\n\tcnop 0,4\n", (FILE)), \
assemble_name ((FILE), (NAME)), \
fprintf ((FILE), ":\n\tds.b %u\n", (int)(SIZE)))
#endif
/* Currently, JUMP_TABLES_IN_TEXT_SECTION must be defined in order to
keep switch tables in the text section. */
@ -169,9 +215,13 @@ amiga_declare_object = 0
fprintf ((FILE), "%s&%d\n", SWBEG_ASM_OP, XVECLEN (PATTERN (TABLE), 1));
/* end of stuff from m68kv4.h */
#ifndef TARGET_AMIGAOS_VASM
#ifndef BSS_SECTION_ASM_OP
#define BSS_SECTION_ASM_OP "\t.bss"
#endif
#else
#define BSS_SECTION_ASM_OP "\tsection\tbss"
#endif
#ifndef ASM_OUTPUT_ALIGNED_BSS
#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
@ -294,8 +344,13 @@ if (target_flags & (MASK_RESTORE_A4|MASK_ALWAYS_RESTORE_A4)) \
/* Various -m flags require special flags to the assembler. */
#undef ASM_SPEC
#ifndef TARGET_AMIGAOS_VASM
#define ASM_SPEC \
"%(asm_cpu) %(asm_cpu_default) %{msmall-code:-sc}"
"%(asm_cpu) %(asm_cpu_default) %{msmall-code:-sc}"
#else
#define ASM_SPEC \
"-gas -esc -ldots -Fhunk -quiet %(asm_cpu) %(asm_cpu_default) %{msmall-code:-sc}"
#endif
#undef ASM_CPU_SPEC
#define ASM_CPU_SPEC \
@ -305,8 +360,13 @@ if (target_flags & (MASK_RESTORE_A4|MASK_ALWAYS_RESTORE_A4)) \
"%{m68040} " \
"%{m68060}"
#ifndef TARGET_AMIGAOS_VASM
#define ASM_CPU_DEFAULT_SPEC \
"%{!m680*:%{!mc680*:-m68040}}"
"%{!m680*:%{!mc680*:-m68040}}"
#else
#define ASM_CPU_DEFAULT_SPEC \
"%{!m680*:%{!mc680*:-m68000}}"
#endif
/* Choose the right startup file, depending on whether we use base relative
code, base relative code with automatic relocation (-resident), their