Add code to print rs6000 specific info in .s file; make eabi.asm assemble on Solaris

From-SVN: r12123
This commit is contained in:
Michael Meissner 1996-05-29 21:20:36 +00:00
parent 802a0058bd
commit 3cfa490985
5 changed files with 78 additions and 19 deletions

View File

@ -105,10 +105,18 @@
.long 0
.text
#ifdef _RELOCATABLE
.Lptr:
.long .LCTOC1-.Laddr /* PC relative pointer to .got2 */
#endif
FUNC_START(__eabi)
/* Eliminate -mrelocatable code if not -mrelocatable, so that this file can
be assembled with other assemblers than GAS, such as the Solaris PowerPC
assembler. */
#ifdef _RELOCATABLE
mflr 0
bl .Laddr /* get current address */
.Laddr:
@ -120,6 +128,13 @@ FUNC_START(__eabi)
subf. 12,12,11 /* calculate difference */
mtlr 0 /* restore link register */
lwzx 9,10,12 /* done flag */
#else /* !-mrelocatable */
addis 11,0,.LCTOC1@ha /* load address of .LCTOC1 */
addi 11,11,.LCTOC1@l
lwz 10,.Linit(11) /* init flag */
#endif /* !-mrelocatable */
cmplwi 2,9,0 /* init flag != 0? */
bnelr 2 /* return now, if we've been called already */
stwx 1,10,12 /* store a non-zero value in the done flag */
@ -145,9 +160,11 @@ FUNC_START(__eabi)
lwz 2,.Lsda2(11) /* load r2 with _SDA2_BASE address */
b FUNC_NAME(__do_global_ctors) /* do any C++ global constructors (which returns to caller) */
.Lreloc:
#ifdef _RELOCATABLE
/* We need to relocate the .got2 pointers. Don't load registers 2 or 13 */
.Lreloc:
lwz 3,.Lgot2s(11) /* GOT pointers start */
lwz 4,.Lgot2e(11) /* GOT pointers end */
add 3,12,3 /* adjust pointers */
@ -237,6 +254,7 @@ FUNC_START(__eabi)
addi 3,3,4 /* bump to next word */
cmpw 1,3,4 /* more pointers to adjust? */
bc 4,6,.Lfloop
#endif /* _RELOCATABLE */
/* Done adjusting pointers, return */

View File

@ -295,6 +295,55 @@ rs6000_override_options (default_cpu)
SUBTARGET_OVERRIDE_OPTIONS;
#endif
}
/* Do anything needed at the start of the asm file. */
void
rs6000_file_start (file, default_cpu)
FILE *file;
char *default_cpu;
{
int i;
char buffer[80];
char *start = buffer;
struct rs6000_cpu_select *ptr;
if (flag_verbose_asm)
{
sprintf (buffer, "\n%s rs6000/powerpc options:", ASM_COMMENT_START);
rs6000_select[0].string = default_cpu;
for (i = 0; i < sizeof (rs6000_select) / sizeof (rs6000_select[0]); i++)
{
ptr = &rs6000_select[i];
if (ptr->string != (char *)0 && ptr->string[0] != '\0')
{
fprintf (file, "%s %s%s", start, ptr->name, ptr->string);
start = "";
}
}
#ifdef USING_SVR4_H
switch (rs6000_sdata)
{
case SDATA_NONE: fprintf (file, "%s -msdata=none", start); start = ""; break;
case SDATA_DATA: fprintf (file, "%s -msdata=data", start); start = ""; break;
case SDATA_SYSV: fprintf (file, "%s -msdata=sysv", start); start = ""; break;
case SDATA_EABI: fprintf (file, "%s -msdata=eabi", start); start = ""; break;
}
if (rs6000_sdata && g_switch_value)
{
fprintf (file, "%s -G %d", start, g_switch_value);
start = "";
}
#endif
if (*start == '\0')
fputs ("\n", file);
}
}
/* Create a CONST_DOUBLE from a string. */

View File

@ -2244,6 +2244,7 @@ extern int rs6000_trunc_used;
text_section (); \
if (profile_flag) \
fputs ("\t.extern .mcount\n", FILE); \
rs6000_file_start (FILE, TARGET_CPU_DEFAULT); \
}
/* Output at end of assembler file.
@ -3012,6 +3013,7 @@ extern int flag_expensive_optimizations;
/* Declare functions in rs6000.c */
extern void output_options ();
extern void rs6000_override_options ();
extern void rs6000_file_start ();
extern struct rtx_def *rs6000_float_const ();
extern struct rtx_def *rs6000_immed_double_const ();
extern int direct_return ();

View File

@ -691,6 +691,7 @@ do { \
#define ASM_FILE_START(FILE) \
do { \
output_file_directive ((FILE), main_input_filename); \
rs6000_file_start (FILE, TARGET_CPU_DEFAULT); \
} while (0)
@ -919,7 +920,7 @@ do { \
#undef CPP_SYSV_SPEC
#define CPP_SYSV_SPEC \
"%{mrelocatable: -D_RELOCATABLE} \
"%{mrelocatable*: -D_RELOCATABLE} \
%{mcall-sysv: -D_CALL_SYSV} %{mcall-nt: -D_CALL_NT} \
%{mcall-aix: -D_CALL_AIX} %{mcall-aixdesc: -D_CALL_AIX -D_CALL_AIXDESC} \
%{!mcall-sysv: %{!mcall-aix: %{!mcall-aixdesc: %{!mcall-nt: %(cpp_sysv_default) }}}} \

View File

@ -177,23 +177,12 @@ do { \
/* Stuff to force fit us into the Motorola PPC assembler */
#if 0
#undef ASM_FILE_START
#define ASM_FILE_START(FILE) \
{ \
output_file_directive (FILE, main_input_filename); \
fprintf (FILE, "\n#\tDirective section\n"); \
fprintf (FILE, "\t.section\t.drectve,\"iR\"\n"); \
fprintf (FILE, "\t.byte\t\"-defaultlib:LIBC\" \n"); \
fprintf (FILE, "\t.previous\n\n"); \
}
#endif
#undef ASM_FILE_START
#define ASM_FILE_START(FILE) \
do { \
output_file_directive ((FILE), main_input_filename); \
data_section (); \
#undef ASM_FILE_START \
#define ASM_FILE_START(FILE) \
do { \
output_file_directive ((FILE), main_input_filename); \
rs6000_file_start (FILE, TARGET_CPU_DEFAULT); \
data_section (); \
} while (0)
#undef ASM_FILE_END