xcoff.h revision 102780
190075Sobrien/* Definitions of target machine for GNU compiler,
290075Sobrien   for some generic XCOFF file format
396263Sobrien   Copyright (C) 2001, 2002 Free Software Foundation, Inc.
490075Sobrien
590075SobrienThis file is part of GNU CC.
690075Sobrien
790075SobrienGNU CC is free software; you can redistribute it and/or modify
890075Sobrienit under the terms of the GNU General Public License as published by
990075Sobrienthe Free Software Foundation; either version 2, or (at your option)
1090075Sobrienany later version.
1190075Sobrien
1290075SobrienGNU CC is distributed in the hope that it will be useful,
1390075Sobrienbut WITHOUT ANY WARRANTY; without even the implied warranty of
1490075SobrienMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1590075SobrienGNU General Public License for more details.
1690075Sobrien
1790075SobrienYou should have received a copy of the GNU General Public License
1890075Sobrienalong with GNU CC; see the file COPYING.  If not, write to
1990075Sobrienthe Free Software Foundation, 59 Temple Place - Suite 330,
2090075SobrienBoston, MA 02111-1307, USA.  */
2190075Sobrien
2290075Sobrien
2390075Sobrien#define TARGET_OBJECT_FORMAT OBJECT_XCOFF
2490075Sobrien
2590075Sobrien/* The RS/6000 uses the XCOFF format.  */
2690075Sobrien#define XCOFF_DEBUGGING_INFO
2790075Sobrien
2890075Sobrien/* Define if the object format being used is COFF or a superset.  */
2990075Sobrien#define OBJECT_FORMAT_COFF
3090075Sobrien
3190075Sobrien/* Define the magic numbers that we recognize as COFF.
3290075Sobrien
3390075Sobrien    AIX 4.3 adds U803XTOCMAGIC (0757) for 64-bit objects and AIX V5 adds
3490075Sobrien    U64_TOCMAGIC (0767), but collect2.c does not include files in the
3590075Sobrien    correct order to conditionally define the symbolic name in this macro.
3690075Sobrien
3790075Sobrien    The AIX linker accepts import/export files as object files,
3890075Sobrien    so accept "#!" (0x2321) magic number.  */
3990075Sobrien#define MY_ISCOFF(magic) \
4090075Sobrien  ((magic) == U802WRMAGIC || (magic) == U802ROMAGIC \
4190075Sobrien   || (magic) == U802TOCMAGIC || (magic) == 0757 || (magic) == 0767 \
4290075Sobrien   || (magic) == 0x2321)
4390075Sobrien
4490075Sobrien/* We don't have GAS for the RS/6000 yet, so don't write out special
4590075Sobrien    .stabs in cc1plus.  */
4690075Sobrien
4790075Sobrien#define FASCIST_ASSEMBLER
4890075Sobrien
4990075Sobrien/* We define this to prevent the name mangler from putting dollar signs into
5090075Sobrien   function names.  */
5190075Sobrien
5290075Sobrien#define NO_DOLLAR_IN_LABEL
5390075Sobrien
5490075Sobrien/* We define this to 0 so that gcc will never accept a dollar sign in a
5590075Sobrien   variable name.  This is needed because the AIX assembler will not accept
5690075Sobrien   dollar signs.  */
5790075Sobrien
5890075Sobrien#define DOLLARS_IN_IDENTIFIERS 0
5990075Sobrien
6090075Sobrien/* Define the extra sections we need.  We define three: one is the read-only
6190075Sobrien   data section which is used for constants.  This is a csect whose name is
6290075Sobrien   derived from the name of the input file.  The second is for initialized
6390075Sobrien   global variables.  This is a csect whose name is that of the variable.
6490075Sobrien   The third is the TOC.  */
6590075Sobrien
6690075Sobrien#define EXTRA_SECTIONS \
6790075Sobrien   read_only_data, private_data, read_only_private_data, toc, bss
6890075Sobrien
6990075Sobrien/* Define the routines to implement these extra sections.
7090075Sobrien   BIGGEST_ALIGNMENT is 64, so align the sections that much.  */
7190075Sobrien
7290075Sobrien#define EXTRA_SECTION_FUNCTIONS				\
7390075Sobrien							\
7490075Sobrienvoid							\
7590075Sobrienread_only_data_section ()				\
7690075Sobrien{							\
7790075Sobrien  if (in_section != read_only_data)			\
7890075Sobrien    {							\
7990075Sobrien      fprintf (asm_out_file, "\t.csect %s[RO],3\n",	\
8090075Sobrien	       xcoff_read_only_section_name);		\
8190075Sobrien      in_section = read_only_data;			\
8290075Sobrien    }							\
8390075Sobrien}							\
8490075Sobrien							\
8590075Sobrienvoid							\
8690075Sobrienprivate_data_section ()					\
8790075Sobrien{							\
8890075Sobrien  if (in_section != private_data)			\
8990075Sobrien    {							\
9090075Sobrien      fprintf (asm_out_file, "\t.csect %s[RW],3\n",	\
9190075Sobrien	       xcoff_private_data_section_name);	\
9290075Sobrien      in_section = private_data;			\
9390075Sobrien    }							\
9490075Sobrien}							\
9590075Sobrien							\
9690075Sobrienvoid							\
9790075Sobrienread_only_private_data_section ()			\
9890075Sobrien{							\
9990075Sobrien  if (in_section != read_only_private_data)		\
10090075Sobrien    {							\
10190075Sobrien      fprintf (asm_out_file, "\t.csect %s[RO],3\n",	\
10290075Sobrien	       xcoff_private_data_section_name);	\
10390075Sobrien      in_section = read_only_private_data;		\
10490075Sobrien    }							\
10590075Sobrien}							\
10690075Sobrien							\
10790075Sobrienvoid							\
10890075Sobrientoc_section ()						\
10990075Sobrien{							\
11090075Sobrien  if (TARGET_MINIMAL_TOC)				\
11190075Sobrien    {							\
11290075Sobrien      /* toc_section is always called at least once from ASM_FILE_START, \
11390075Sobrien	 so this is guaranteed to always be defined once and only once   \
11490075Sobrien	 in each file.  */						 \
11590075Sobrien      if (! toc_initialized)				\
11690075Sobrien	{						\
11790075Sobrien	  fputs ("\t.toc\nLCTOC..1:\n", asm_out_file);	\
11890075Sobrien	  fputs ("\t.tc toc_table[TC],toc_table[RW]\n", asm_out_file); \
11990075Sobrien	  toc_initialized = 1;				\
12090075Sobrien	}						\
12190075Sobrien							\
12290075Sobrien      if (in_section != toc)				\
12390075Sobrien	fprintf (asm_out_file, "\t.csect toc_table[RW]%s\n",	\
12490075Sobrien		 (TARGET_32BIT ? "" : ",3"));		\
12590075Sobrien    }							\
12690075Sobrien  else							\
12790075Sobrien    {							\
12890075Sobrien      if (in_section != toc)				\
12990075Sobrien        fputs ("\t.toc\n", asm_out_file);		\
13090075Sobrien    }							\
13190075Sobrien  in_section = toc;					\
13290075Sobrien}
13390075Sobrien
13490075Sobrien/* Define the name of our readonly data section.  */
13590075Sobrien
13690075Sobrien#define READONLY_DATA_SECTION read_only_data_section
13790075Sobrien
13890075Sobrien/* Select the section for an initialized data object.
13990075Sobrien
14090075Sobrien   On the RS/6000, we have a special section for all variables except those
14190075Sobrien   that are static.  */
14290075Sobrien
14390075Sobrien#define SELECT_SECTION(EXP,RELOC,ALIGN)			\
14490075Sobrien{							\
14590075Sobrien  if ((TREE_CODE (EXP) == STRING_CST			\
14690075Sobrien       && ! flag_writable_strings)			\
14790075Sobrien      || (TREE_CODE_CLASS (TREE_CODE (EXP)) == 'd'	\
14890075Sobrien	  && TREE_READONLY (EXP) && ! TREE_THIS_VOLATILE (EXP) \
14990075Sobrien	  && DECL_INITIAL (EXP)				\
15090075Sobrien	  && (DECL_INITIAL (EXP) == error_mark_node	\
15190075Sobrien	      || TREE_CONSTANT (DECL_INITIAL (EXP)))	\
15290075Sobrien	  && ! (RELOC)))				\
15390075Sobrien    {							\
15490075Sobrien      if (TREE_PUBLIC (EXP))				\
15590075Sobrien        read_only_data_section ();			\
15690075Sobrien      else						\
15790075Sobrien        read_only_private_data_section ();		\
15890075Sobrien    }							\
15990075Sobrien  else							\
16090075Sobrien    {							\
16190075Sobrien      if (TREE_PUBLIC (EXP))				\
16290075Sobrien        data_section ();				\
16390075Sobrien      else						\
16490075Sobrien        private_data_section ();			\
16590075Sobrien    }							\
16690075Sobrien}
16790075Sobrien
16890075Sobrien/* Return non-zero if this entry is to be written into the constant
16990075Sobrien   pool in a special way.  We do so if this is a SYMBOL_REF, LABEL_REF
17090075Sobrien   or a CONST containing one of them.  If -mfp-in-toc (the default),
17190075Sobrien   we also do this for floating-point constants.  We actually can only
17290075Sobrien   do this if the FP formats of the target and host machines are the
17390075Sobrien   same, but we can't check that since not every file that uses
17490075Sobrien   GO_IF_LEGITIMATE_ADDRESS_P includes real.h.  We also do this when
17590075Sobrien   we can write the entry into the TOC and the entry is not larger
17690075Sobrien   than a TOC entry.  */
17790075Sobrien
17890075Sobrien#define ASM_OUTPUT_SPECIAL_POOL_ENTRY_P(X, MODE)			\
17990075Sobrien  (TARGET_TOC								\
18090075Sobrien   && (GET_CODE (X) == SYMBOL_REF					\
18190075Sobrien       || (GET_CODE (X) == CONST && GET_CODE (XEXP (X, 0)) == PLUS	\
18290075Sobrien	   && GET_CODE (XEXP (XEXP (X, 0), 0)) == SYMBOL_REF)		\
18390075Sobrien       || GET_CODE (X) == LABEL_REF					\
18490075Sobrien       || (GET_CODE (X) == CONST_INT 					\
18590075Sobrien	   && GET_MODE_BITSIZE (MODE) <= GET_MODE_BITSIZE (Pmode))	\
18690075Sobrien       || (GET_CODE (X) == CONST_DOUBLE					\
18790075Sobrien	   && (TARGET_POWERPC64						\
18890075Sobrien	       || TARGET_MINIMAL_TOC					\
18990075Sobrien	       || (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT		\
19090075Sobrien		   && ! TARGET_NO_FP_IN_TOC)))))
19190075Sobrien
19290075Sobrien/* Select section for constant in constant pool.
19390075Sobrien
19490075Sobrien   On RS/6000, all constants are in the private read-only data area.
19590075Sobrien   However, if this is being placed in the TOC it must be output as a
19690075Sobrien   toc entry.  */
19790075Sobrien
19890075Sobrien#define SELECT_RTX_SECTION(MODE, X, ALIGN)		\
19990075Sobrien{ if (ASM_OUTPUT_SPECIAL_POOL_ENTRY_P (X, MODE))	\
20090075Sobrien    toc_section ();					\
20190075Sobrien  else							\
20290075Sobrien    read_only_private_data_section ();			\
20390075Sobrien}
20490075Sobrien
20590075Sobrien/* If we are referencing a function that is static or is known to be
20690075Sobrien   in this file, make the SYMBOL_REF special.  We can use this to indicate
20790075Sobrien   that we can branch to this function without emitting a no-op after the
20890075Sobrien   call.  Do not set this flag if the function is weakly defined.  */
20990075Sobrien
21090075Sobrien#define ENCODE_SECTION_INFO(DECL)			\
21190075Sobrien  if (TREE_CODE (DECL) == FUNCTION_DECL			\
21290075Sobrien      && !TREE_PUBLIC (DECL)				\
21390075Sobrien      && !DECL_WEAK (DECL))				\
21490075Sobrien    SYMBOL_REF_FLAG (XEXP (DECL_RTL (DECL), 0)) = 1;
21590075Sobrien
21690075Sobrien/* FP save and restore routines.  */
21790075Sobrien#define	SAVE_FP_PREFIX "._savef"
21890075Sobrien#define SAVE_FP_SUFFIX ""
21990075Sobrien#define	RESTORE_FP_PREFIX "._restf"
22090075Sobrien#define RESTORE_FP_SUFFIX ""
22190075Sobrien
22290075Sobrien/* Function name to call to do profiling.  */
22390075Sobrien#undef RS6000_MCOUNT
22490075Sobrien#define RS6000_MCOUNT ".__mcount"
22590075Sobrien
22690075Sobrien/* Function names to call to do floating point truncation.  */
22790075Sobrien
22890075Sobrien#undef RS6000_ITRUNC
22990075Sobrien#define RS6000_ITRUNC "__itrunc"
23090075Sobrien#undef RS6000_UITRUNC
23190075Sobrien#define RS6000_UITRUNC "__uitrunc"
23290075Sobrien
23390075Sobrien/* This outputs NAME to FILE up to the first null or '['.  */
23490075Sobrien
23590075Sobrien#define RS6000_OUTPUT_BASENAME(FILE, NAME)	\
23690075Sobrien  {						\
23790075Sobrien    const char *_p;				\
23890075Sobrien						\
23990075Sobrien    STRIP_NAME_ENCODING (_p, (NAME));		\
24090075Sobrien    assemble_name ((FILE), _p);			\
24190075Sobrien  }
24290075Sobrien
24390075Sobrien/* This is how to output the definition of a user-level label named NAME,
24490075Sobrien   such as the label on a static function or variable NAME.  */
24590075Sobrien
24690075Sobrien#define ASM_OUTPUT_LABEL(FILE,NAME)	\
24790075Sobrien  do { RS6000_OUTPUT_BASENAME (FILE, NAME); fputs (":\n", FILE); } while (0)
24890075Sobrien
24990075Sobrien/* This is how to output a command to make the user-level label named NAME
25090075Sobrien   defined for reference from other files.  */
25190075Sobrien
25290075Sobrien#define ASM_GLOBALIZE_LABEL(FILE,NAME)	\
25390075Sobrien  do { fputs ("\t.globl ", FILE);	\
25490075Sobrien       RS6000_OUTPUT_BASENAME (FILE, NAME); putc ('\n', FILE);} while (0)
25590075Sobrien
25690075Sobrien/* Remove any trailing [DS] or the like from the symbol name.  */
25790075Sobrien
25890075Sobrien#define STRIP_NAME_ENCODING(VAR,NAME)			\
25990075Sobrien  do							\
26090075Sobrien    {							\
26190075Sobrien      const char *_name = (NAME);			\
26290075Sobrien      size_t _len;					\
26390075Sobrien      if (*_name == '*')				\
26490075Sobrien        _name++;					\
26590075Sobrien      _len = strlen (_name);				\
26690075Sobrien      if (_name[_len - 1] != ']')			\
26790075Sobrien	(VAR) = _name;					\
26890075Sobrien      else						\
26990075Sobrien	{						\
27090075Sobrien	  char *_new_name = (char *) alloca (_len + 1);	\
27190075Sobrien	  strcpy (_new_name, _name);			\
27290075Sobrien	  _new_name[_len - 4] = '\0';			\
27390075Sobrien	  (VAR) = _new_name;				\
27490075Sobrien	}						\
27590075Sobrien    }							\
27690075Sobrien  while (0)
27790075Sobrien
27890075Sobrien/* Output at beginning of assembler file.
27990075Sobrien
28090075Sobrien   Initialize the section names for the RS/6000 at this point.
28190075Sobrien
28290075Sobrien   Specify filename, including full path, to assembler.
28390075Sobrien
28490075Sobrien   We want to go into the TOC section so at least one .toc will be emitted.
28590075Sobrien   Also, in order to output proper .bs/.es pairs, we need at least one static
28690075Sobrien   [RW] section emitted.
28790075Sobrien
28890075Sobrien   Finally, declare mcount when profiling to make the assembler happy.  */
28990075Sobrien
29090075Sobrien#define ASM_FILE_START(FILE)					\
29190075Sobrien{								\
29290075Sobrien  rs6000_gen_section_name (&xcoff_bss_section_name,		\
29390075Sobrien			   main_input_filename, ".bss_");	\
29490075Sobrien  rs6000_gen_section_name (&xcoff_private_data_section_name,	\
29590075Sobrien			   main_input_filename, ".rw_");	\
29690075Sobrien  rs6000_gen_section_name (&xcoff_read_only_section_name,	\
29790075Sobrien			   main_input_filename, ".ro_");	\
29890075Sobrien								\
29990075Sobrien  fprintf (FILE, "\t.file\t\"%s\"\n", main_input_filename);	\
30090075Sobrien  if (TARGET_64BIT)						\
30190075Sobrien    fputs ("\t.machine\t\"ppc64\"\n", FILE);			\
30290075Sobrien  toc_section ();						\
30390075Sobrien  if (write_symbols != NO_DEBUG)				\
30490075Sobrien    private_data_section ();					\
30590075Sobrien  text_section ();						\
30690075Sobrien  if (profile_flag)						\
30790075Sobrien    fprintf (FILE, "\t.extern %s\n", RS6000_MCOUNT);		\
30890075Sobrien  rs6000_file_start (FILE, TARGET_CPU_DEFAULT);			\
30990075Sobrien}
31090075Sobrien
31190075Sobrien/* Output at end of assembler file.
31290075Sobrien
31390075Sobrien   On the RS/6000, referencing data should automatically pull in text.  */
31490075Sobrien
31590075Sobrien#define ASM_FILE_END(FILE)					\
31690075Sobrien{								\
31790075Sobrien  text_section ();						\
31890075Sobrien  fputs ("_section_.text:\n", FILE);				\
31990075Sobrien  data_section ();						\
32090075Sobrien  fputs (TARGET_32BIT						\
32190075Sobrien	 ? "\t.long _section_.text\n" : "\t.llong _section_.text\n", FILE); \
32290075Sobrien}
32390075Sobrien
32490075Sobrien/* This macro produces the initial definition of a function name.
32590075Sobrien   On the RS/6000, we need to place an extra '.' in the function name and
32690075Sobrien   output the function descriptor.
32790075Sobrien
32890075Sobrien   The csect for the function will have already been created by the
32990075Sobrien   `text_section' call previously done.  We do have to go back to that
33090075Sobrien   csect, however.
33190075Sobrien
33290075Sobrien   We also record that the function exists in the current compilation
33390075Sobrien   unit, reachable by short branch, by setting SYMBOL_REF_FLAG.
33490075Sobrien
33590075Sobrien   The third and fourth parameters to the .function pseudo-op (16 and 044)
33690075Sobrien   are placeholders which no longer have any use.  */
33790075Sobrien
33890075Sobrien#define ASM_DECLARE_FUNCTION_NAME(FILE,NAME,DECL)		\
33990075Sobrien{ rtx sym_ref = XEXP (DECL_RTL (DECL), 0);			\
34090075Sobrien  if (!DECL_WEAK (DECL))					\
34190075Sobrien    SYMBOL_REF_FLAG (sym_ref) = 1;				\
34290075Sobrien  if (TREE_PUBLIC (DECL))					\
34390075Sobrien    {								\
34496263Sobrien      if (!RS6000_WEAK || !DECL_WEAK (decl))			\
34590075Sobrien	{							\
34690075Sobrien	  fputs ("\t.globl .", FILE);				\
34790075Sobrien	  RS6000_OUTPUT_BASENAME (FILE, NAME);			\
34890075Sobrien	  putc ('\n', FILE);					\
34990075Sobrien	}							\
35090075Sobrien    }								\
35190075Sobrien  else								\
35290075Sobrien    {								\
35390075Sobrien      fputs ("\t.lglobl .", FILE);				\
35490075Sobrien      RS6000_OUTPUT_BASENAME (FILE, NAME);			\
35590075Sobrien      putc ('\n', FILE);					\
35690075Sobrien    }								\
35790075Sobrien  fputs ("\t.csect ", FILE);					\
35890075Sobrien  RS6000_OUTPUT_BASENAME (FILE, NAME);				\
35990075Sobrien  fputs (TARGET_32BIT ? "[DS]\n" : "[DS],3\n", FILE);		\
36090075Sobrien  RS6000_OUTPUT_BASENAME (FILE, NAME);				\
36190075Sobrien  fputs (":\n", FILE);						\
36290075Sobrien  fputs (TARGET_32BIT ? "\t.long ." : "\t.llong .", FILE);	\
36390075Sobrien  RS6000_OUTPUT_BASENAME (FILE, NAME);				\
36490075Sobrien  fputs (", TOC[tc0], 0\n", FILE);				\
36590075Sobrien  in_section = no_section;					\
36690075Sobrien  function_section(DECL);					\
36790075Sobrien  putc ('.', FILE);						\
36890075Sobrien  RS6000_OUTPUT_BASENAME (FILE, NAME);				\
36990075Sobrien  fputs (":\n", FILE);						\
37090075Sobrien  if (write_symbols == XCOFF_DEBUG)				\
37190075Sobrien    xcoffout_declare_function (FILE, DECL, NAME);		\
37290075Sobrien}
37390075Sobrien
37490075Sobrien/* Output a reference to SYM on FILE.  */
37590075Sobrien
37690075Sobrien#define ASM_OUTPUT_SYMBOL_REF(FILE, SYM) \
37790075Sobrien  rs6000_output_symbol_ref (FILE, SYM)
37890075Sobrien
37990075Sobrien/* This says how to output an external.  */
38090075Sobrien
38190075Sobrien#undef ASM_OUTPUT_EXTERNAL
38290075Sobrien#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME)	\
38390075Sobrien{ rtx _symref = XEXP (DECL_RTL (DECL), 0);	\
38490075Sobrien  if ((TREE_CODE (DECL) == VAR_DECL		\
38590075Sobrien       || TREE_CODE (DECL) == FUNCTION_DECL)	\
38690075Sobrien      && (NAME)[strlen (NAME) - 1] != ']')	\
38790075Sobrien    {						\
38890075Sobrien      char *_name = (char *) permalloc (strlen (XSTR (_symref, 0)) + 5); \
38990075Sobrien      strcpy (_name, XSTR (_symref, 0));	\
39090075Sobrien      strcat (_name, TREE_CODE (DECL) == FUNCTION_DECL ? "[DS]" : "[RW]"); \
39190075Sobrien      XSTR (_symref, 0) = _name;		\
39290075Sobrien    }						\
39390075Sobrien}
39490075Sobrien
39590075Sobrien/* This is how to output an internal numbered label where
39690075Sobrien   PREFIX is the class of label and NUM is the number within the class.  */
39790075Sobrien
39890075Sobrien#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM)	\
39990075Sobrien  fprintf (FILE, "%s..%u:\n", (PREFIX), (unsigned) (NUM))
40090075Sobrien
40190075Sobrien/* This is how to output an internal label prefix.  rs6000.c uses this
40290075Sobrien   when generating traceback tables.  */
40390075Sobrien
40490075Sobrien#define ASM_OUTPUT_INTERNAL_LABEL_PREFIX(FILE,PREFIX)   \
40590075Sobrien  fprintf (FILE, "%s..", PREFIX)
40690075Sobrien
40790075Sobrien/* This is how to output a label for a jump table.  Arguments are the same as
40890075Sobrien   for ASM_OUTPUT_INTERNAL_LABEL, except the insn for the jump table is
40990075Sobrien   passed.  */
41090075Sobrien
41190075Sobrien#define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,TABLEINSN)	\
41290075Sobrien{ ASM_OUTPUT_ALIGN (FILE, 2); ASM_OUTPUT_INTERNAL_LABEL (FILE, PREFIX, NUM); }
41390075Sobrien
41490075Sobrien/* This is how to store into the string LABEL
41590075Sobrien   the symbol_ref name of an internal numbered label where
41690075Sobrien   PREFIX is the class of label and NUM is the number within the class.
41790075Sobrien   This is suitable for output with `assemble_name'.  */
41890075Sobrien
41990075Sobrien#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM)	\
42090075Sobrien  sprintf (LABEL, "*%s..%u", (PREFIX), (unsigned) (NUM))
42190075Sobrien
42290075Sobrien/* This is how to output an assembler line to define N characters starting
42390075Sobrien   at P to FILE.  */
42490075Sobrien
42590075Sobrien#define ASM_OUTPUT_ASCII(FILE, P, N)  output_ascii ((FILE), (P), (N))
42690075Sobrien
42790075Sobrien/* This is how to advance the location counter by SIZE bytes.  */
42890075Sobrien
42990075Sobrien#define ASM_OUTPUT_SKIP(FILE,SIZE)  \
43090075Sobrien  fprintf (FILE, "\t.space %d\n", (SIZE))
43190075Sobrien
43290075Sobrien/* This says how to output an assembler line
43390075Sobrien   to define a global common symbol.  */
43490075Sobrien
43590075Sobrien#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGNMENT)	\
43690075Sobrien  do { fputs ("\t.comm ", (FILE));			\
43790075Sobrien       RS6000_OUTPUT_BASENAME ((FILE), (NAME));		\
43890075Sobrien       if ( (SIZE) > 4)					\
43990075Sobrien         fprintf ((FILE), ",%d,3\n", (SIZE));		\
44090075Sobrien       else						\
44190075Sobrien	 fprintf ((FILE), ",%d\n", (SIZE));		\
44290075Sobrien  } while (0)
44390075Sobrien
44490075Sobrien/* This says how to output an assembler line
44590075Sobrien   to define a local common symbol.
44690075Sobrien   Alignment cannot be specified, but we can try to maintain
44790075Sobrien   alignment after preceding TOC section if it was aligned
44890075Sobrien   for 64-bit mode.  */
44990075Sobrien
45090075Sobrien#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED)	\
45190075Sobrien  do { fputs ("\t.lcomm ", (FILE));			\
45290075Sobrien       RS6000_OUTPUT_BASENAME ((FILE), (NAME));		\
45390075Sobrien       fprintf ((FILE), ",%d,%s\n", (TARGET_32BIT ? (SIZE) : (ROUNDED)), \
45490075Sobrien		xcoff_bss_section_name);		\
45590075Sobrien     } while (0)
45690075Sobrien
45790075Sobrien/* This is how we tell the assembler that two symbols have the same value.  */
45890075Sobrien#define SET_ASM_OP "\t.set "
45990075Sobrien
460102780Skan/* This is how we tell the assembler to equate two values.  */
461102780Skan#define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2)				\
462102780Skan do {	fprintf ((FILE), "%s", SET_ASM_OP);				\
463102780Skan	RS6000_OUTPUT_BASENAME (FILE, LABEL1);				\
464102780Skan	fprintf (FILE, ",");						\
465102780Skan	RS6000_OUTPUT_BASENAME (FILE, LABEL2);				\
466102780Skan	fprintf (FILE, "\n");						\
467102780Skan  } while (0)
468102780Skan
46990075Sobrien/* Used by rs6000_assemble_integer, among others.  */
47090075Sobrien#define DOUBLE_INT_ASM_OP "\t.llong\t"
47190075Sobrien
47290075Sobrien/* Output before instructions.  */
47390075Sobrien#define TEXT_SECTION_ASM_OP "\t.csect .text[PR]"
47490075Sobrien
47590075Sobrien/* Output before writable data.
47690075Sobrien   Align entire section to BIGGEST_ALIGNMENT.  */
47790075Sobrien#define DATA_SECTION_ASM_OP "\t.csect .data[RW],3"
47890075Sobrien
47990075Sobrien/* Define unique section name -- functions only.  */
48090075Sobrien#define UNIQUE_SECTION(DECL,RELOC)			\
48190075Sobrien  do {							\
48290075Sobrien    int len;						\
48390075Sobrien    const char *name;					\
48490075Sobrien    char *string;					\
48590075Sobrien							\
48690075Sobrien    if (TREE_CODE (DECL) == FUNCTION_DECL) {		\
48790075Sobrien      name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (DECL)); \
48890075Sobrien      len = strlen (name) + 5;				\
48990075Sobrien      string = alloca (len + 1);			\
49090075Sobrien      sprintf (string, ".%s[PR]", name);		\
49190075Sobrien      DECL_SECTION_NAME (DECL) = build_string (len, string); \
49290075Sobrien    }							\
49390075Sobrien  } while (0)
49490075Sobrien
49590075Sobrien/* Switch into a generic section.  */
49690075Sobrien#define TARGET_ASM_NAMED_SECTION  xcoff_asm_named_section
49790075Sobrien
49890075Sobrien/* Define the name of the section to use for the EH language specific
49990075Sobrien   data areas (.gcc_except_table on most other systems).  */
50090075Sobrien#define TARGET_ASM_EXCEPTION_SECTION data_section
50190075Sobrien
50290075Sobrien/* Define to prevent DWARF2 unwind info in the data section rather
50390075Sobrien   than in the .eh_frame section.  We do this because the AIX linker
50490075Sobrien   would otherwise garbage collect these sections.  */
50590075Sobrien#define EH_FRAME_IN_DATA_SECTION 1
506