xcoff.h revision 102780
161452Sdfr/* Definitions of target machine for GNU compiler,
261452Sdfr   for some generic XCOFF file format
361452Sdfr   Copyright (C) 2001, 2002 Free Software Foundation, Inc.
461452Sdfr
561452SdfrThis file is part of GNU CC.
661452Sdfr
761452SdfrGNU CC is free software; you can redistribute it and/or modify
861452Sdfrit under the terms of the GNU General Public License as published by
961452Sdfrthe Free Software Foundation; either version 2, or (at your option)
1061452Sdfrany later version.
1161452Sdfr
1261452SdfrGNU CC is distributed in the hope that it will be useful,
1361452Sdfrbut WITHOUT ANY WARRANTY; without even the implied warranty of
1461452SdfrMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1561452SdfrGNU General Public License for more details.
1661452Sdfr
1761452SdfrYou should have received a copy of the GNU General Public License
1861452Sdfralong with GNU CC; see the file COPYING.  If not, write to
1961452Sdfrthe Free Software Foundation, 59 Temple Place - Suite 330,
2061452SdfrBoston, MA 02111-1307, USA.  */
2161452Sdfr
2261452Sdfr
2361452Sdfr#define TARGET_OBJECT_FORMAT OBJECT_XCOFF
2461452Sdfr
2561452Sdfr/* The RS/6000 uses the XCOFF format.  */
2661452Sdfr#define XCOFF_DEBUGGING_INFO
2761452Sdfr
2861452Sdfr/* Define if the object format being used is COFF or a superset.  */
2961452Sdfr#define OBJECT_FORMAT_COFF
3061452Sdfr
3161452Sdfr/* Define the magic numbers that we recognize as COFF.
3261452Sdfr
3361452Sdfr    AIX 4.3 adds U803XTOCMAGIC (0757) for 64-bit objects and AIX V5 adds
3461452Sdfr    U64_TOCMAGIC (0767), but collect2.c does not include files in the
3561452Sdfr    correct order to conditionally define the symbolic name in this macro.
3661452Sdfr
3761452Sdfr    The AIX linker accepts import/export files as object files,
3876827Salfred    so accept "#!" (0x2321) magic number.  */
3979339Sjhb#define MY_ISCOFF(magic) \
4061452Sdfr  ((magic) == U802WRMAGIC || (magic) == U802ROMAGIC \
4161452Sdfr   || (magic) == U802TOCMAGIC || (magic) == 0757 || (magic) == 0767 \
4261452Sdfr   || (magic) == 0x2321)
4361452Sdfr
4461452Sdfr/* We don't have GAS for the RS/6000 yet, so don't write out special
4561452Sdfr    .stabs in cc1plus.  */
4661452Sdfr
4761452Sdfr#define FASCIST_ASSEMBLER
4861452Sdfr
4961452Sdfr/* We define this to prevent the name mangler from putting dollar signs into
5061452Sdfr   function names.  */
5161452Sdfr
5261452Sdfr#define NO_DOLLAR_IN_LABEL
5361501Sdfr
5461501Sdfr/* We define this to 0 so that gcc will never accept a dollar sign in a
5561452Sdfr   variable name.  This is needed because the AIX assembler will not accept
5661452Sdfr   dollar signs.  */
5761452Sdfr
5861452Sdfr#define DOLLARS_IN_IDENTIFIERS 0
5961452Sdfr
6061501Sdfr/* Define the extra sections we need.  We define three: one is the read-only
6161501Sdfr   data section which is used for constants.  This is a csect whose name is
6287479Scokane   derived from the name of the input file.  The second is for initialized
6387479Scokane   global variables.  This is a csect whose name is that of the variable.
6461501Sdfr   The third is the TOC.  */
6561501Sdfr
6661501Sdfr#define EXTRA_SECTIONS \
6761501Sdfr   read_only_data, private_data, read_only_private_data, toc, bss
6861452Sdfr
6961452Sdfr/* Define the routines to implement these extra sections.
7061452Sdfr   BIGGEST_ALIGNMENT is 64, so align the sections that much.  */
7161452Sdfr
7261452Sdfr#define EXTRA_SECTION_FUNCTIONS				\
7361452Sdfr							\
7461501Sdfrvoid							\
7561452Sdfrread_only_data_section ()				\
7661452Sdfr{							\
7761501Sdfr  if (in_section != read_only_data)			\
7861501Sdfr    {							\
7961501Sdfr      fprintf (asm_out_file, "\t.csect %s[RO],3\n",	\
8061501Sdfr	       xcoff_read_only_section_name);		\
8161501Sdfr      in_section = read_only_data;			\
8261501Sdfr    }							\
8387479Scokane}							\
8461501Sdfr							\
8561501Sdfrvoid							\
8661501Sdfrprivate_data_section ()					\
8761501Sdfr{							\
8861501Sdfr  if (in_section != private_data)			\
8961501Sdfr    {							\
9061501Sdfr      fprintf (asm_out_file, "\t.csect %s[RW],3\n",	\
9161501Sdfr	       xcoff_private_data_section_name);	\
9261501Sdfr      in_section = private_data;			\
9361501Sdfr    }							\
9461501Sdfr}							\
9561501Sdfr							\
9661501Sdfrvoid							\
9787479Scokaneread_only_private_data_section ()			\
9887479Scokane{							\
9961501Sdfr  if (in_section != read_only_private_data)		\
10061501Sdfr    {							\
10161501Sdfr      fprintf (asm_out_file, "\t.csect %s[RO],3\n",	\
10261501Sdfr	       xcoff_private_data_section_name);	\
10361501Sdfr      in_section = read_only_private_data;		\
10461501Sdfr    }							\
10561501Sdfr}							\
10661501Sdfr							\
10761501Sdfrvoid							\
10861501Sdfrtoc_section ()						\
10961501Sdfr{							\
11061501Sdfr  if (TARGET_MINIMAL_TOC)				\
11161501Sdfr    {							\
11261501Sdfr      /* toc_section is always called at least once from ASM_FILE_START, \
11361501Sdfr	 so this is guaranteed to always be defined once and only once   \
11461501Sdfr	 in each file.  */						 \
11561501Sdfr      if (! toc_initialized)				\
11661501Sdfr	{						\
11761501Sdfr	  fputs ("\t.toc\nLCTOC..1:\n", asm_out_file);	\
11861501Sdfr	  fputs ("\t.tc toc_table[TC],toc_table[RW]\n", asm_out_file); \
11961501Sdfr	  toc_initialized = 1;				\
12061501Sdfr	}						\
12161501Sdfr							\
12261501Sdfr      if (in_section != toc)				\
12394790Scokane	fprintf (asm_out_file, "\t.csect toc_table[RW]%s\n",	\
12494790Scokane		 (TARGET_32BIT ? "" : ",3"));		\
12561501Sdfr    }							\
12687479Scokane  else							\
12787479Scokane    {							\
12887479Scokane      if (in_section != toc)				\
12987479Scokane        fputs ("\t.toc\n", asm_out_file);		\
13087479Scokane    }							\
13187479Scokane  in_section = toc;					\
13287479Scokane}
13387479Scokane
13487479Scokane/* Define the name of our readonly data section.  */
13587479Scokane
13694790Scokane#define READONLY_DATA_SECTION read_only_data_section
13787479Scokane
13861501Sdfr/* Select the section for an initialized data object.
13961501Sdfr
14061501Sdfr   On the RS/6000, we have a special section for all variables except those
14187479Scokane   that are static.  */
14287479Scokane
14387479Scokane#define SELECT_SECTION(EXP,RELOC,ALIGN)			\
14487479Scokane{							\
14587479Scokane  if ((TREE_CODE (EXP) == STRING_CST			\
14661501Sdfr       && ! flag_writable_strings)			\
14787479Scokane      || (TREE_CODE_CLASS (TREE_CODE (EXP)) == 'd'	\
14887479Scokane	  && TREE_READONLY (EXP) && ! TREE_THIS_VOLATILE (EXP) \
14987479Scokane	  && DECL_INITIAL (EXP)				\
15061501Sdfr	  && (DECL_INITIAL (EXP) == error_mark_node	\
15161501Sdfr	      || TREE_CONSTANT (DECL_INITIAL (EXP)))	\
15287479Scokane	  && ! (RELOC)))				\
15361501Sdfr    {							\
15461501Sdfr      if (TREE_PUBLIC (EXP))				\
15561501Sdfr        read_only_data_section ();			\
15661501Sdfr      else						\
15761501Sdfr        read_only_private_data_section ();		\
15861501Sdfr    }							\
15987479Scokane  else							\
16061501Sdfr    {							\
16161501Sdfr      if (TREE_PUBLIC (EXP))				\
16261501Sdfr        data_section ();				\
16361501Sdfr      else						\
16461501Sdfr        private_data_section ();			\
16561501Sdfr    }							\
16661501Sdfr}
16761501Sdfr
16861501Sdfr/* Return non-zero if this entry is to be written into the constant
16961501Sdfr   pool in a special way.  We do so if this is a SYMBOL_REF, LABEL_REF
17061501Sdfr   or a CONST containing one of them.  If -mfp-in-toc (the default),
17161501Sdfr   we also do this for floating-point constants.  We actually can only
17261501Sdfr   do this if the FP formats of the target and host machines are the
17361501Sdfr   same, but we can't check that since not every file that uses
17461501Sdfr   GO_IF_LEGITIMATE_ADDRESS_P includes real.h.  We also do this when
17561501Sdfr   we can write the entry into the TOC and the entry is not larger
17661501Sdfr   than a TOC entry.  */
17761501Sdfr
17861452Sdfr#define ASM_OUTPUT_SPECIAL_POOL_ENTRY_P(X, MODE)			\
17961452Sdfr  (TARGET_TOC								\
18061452Sdfr   && (GET_CODE (X) == SYMBOL_REF					\
18161452Sdfr       || (GET_CODE (X) == CONST && GET_CODE (XEXP (X, 0)) == PLUS	\
18261452Sdfr	   && GET_CODE (XEXP (XEXP (X, 0), 0)) == SYMBOL_REF)		\
18361452Sdfr       || GET_CODE (X) == LABEL_REF					\
18461452Sdfr       || (GET_CODE (X) == CONST_INT 					\
18561452Sdfr	   && GET_MODE_BITSIZE (MODE) <= GET_MODE_BITSIZE (Pmode))	\
18661452Sdfr       || (GET_CODE (X) == CONST_DOUBLE					\
18761452Sdfr	   && (TARGET_POWERPC64						\
18861452Sdfr	       || TARGET_MINIMAL_TOC					\
18987479Scokane	       || (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT		\
19083699Scokane		   && ! TARGET_NO_FP_IN_TOC)))))
19183699Scokane
19287479Scokane/* Select section for constant in constant pool.
19361452Sdfr
19461452Sdfr   On RS/6000, all constants are in the private read-only data area.
19587479Scokane   However, if this is being placed in the TOC it must be output as a
19687479Scokane   toc entry.  */
19787479Scokane
19887479Scokane#define SELECT_RTX_SECTION(MODE, X, ALIGN)		\
19961452Sdfr{ if (ASM_OUTPUT_SPECIAL_POOL_ENTRY_P (X, MODE))	\
20061452Sdfr    toc_section ();					\
20161452Sdfr  else							\
20261452Sdfr    read_only_private_data_section ();			\
20361452Sdfr}
20461452Sdfr
20561452Sdfr/* If we are referencing a function that is static or is known to be
20661452Sdfr   in this file, make the SYMBOL_REF special.  We can use this to indicate
20761452Sdfr   that we can branch to this function without emitting a no-op after the
20861452Sdfr   call.  Do not set this flag if the function is weakly defined.  */
20961452Sdfr
21061452Sdfr#define ENCODE_SECTION_INFO(DECL)			\
21161452Sdfr  if (TREE_CODE (DECL) == FUNCTION_DECL			\
21261452Sdfr      && !TREE_PUBLIC (DECL)				\
21361452Sdfr      && !DECL_WEAK (DECL))				\
21461452Sdfr    SYMBOL_REF_FLAG (XEXP (DECL_RTL (DECL), 0)) = 1;
21561452Sdfr
21661452Sdfr/* FP save and restore routines.  */
21761452Sdfr#define	SAVE_FP_PREFIX "._savef"
21861452Sdfr#define SAVE_FP_SUFFIX ""
21961452Sdfr#define	RESTORE_FP_PREFIX "._restf"
22061452Sdfr#define RESTORE_FP_SUFFIX ""
22161452Sdfr
22261452Sdfr/* Function name to call to do profiling.  */
22361501Sdfr#undef RS6000_MCOUNT
22461452Sdfr#define RS6000_MCOUNT ".__mcount"
22561452Sdfr
22661452Sdfr/* Function names to call to do floating point truncation.  */
22761452Sdfr
22861452Sdfr#undef RS6000_ITRUNC
22961452Sdfr#define RS6000_ITRUNC "__itrunc"
23061452Sdfr#undef RS6000_UITRUNC
23161452Sdfr#define RS6000_UITRUNC "__uitrunc"
23261452Sdfr
23361452Sdfr/* This outputs NAME to FILE up to the first null or '['.  */
23461452Sdfr
23561452Sdfr#define RS6000_OUTPUT_BASENAME(FILE, NAME)	\
23661452Sdfr  {						\
23761452Sdfr    const char *_p;				\
23861452Sdfr						\
23961452Sdfr    STRIP_NAME_ENCODING (_p, (NAME));		\
24061452Sdfr    assemble_name ((FILE), _p);			\
24161452Sdfr  }
24261452Sdfr
24361452Sdfr/* This is how to output the definition of a user-level label named NAME,
24461501Sdfr   such as the label on a static function or variable NAME.  */
24561452Sdfr
24661452Sdfr#define ASM_OUTPUT_LABEL(FILE,NAME)	\
24761452Sdfr  do { RS6000_OUTPUT_BASENAME (FILE, NAME); fputs (":\n", FILE); } while (0)
24861452Sdfr
24961452Sdfr/* This is how to output a command to make the user-level label named NAME
25061452Sdfr   defined for reference from other files.  */
25161452Sdfr
25261452Sdfr#define ASM_GLOBALIZE_LABEL(FILE,NAME)	\
25361452Sdfr  do { fputs ("\t.globl ", FILE);	\
25461452Sdfr       RS6000_OUTPUT_BASENAME (FILE, NAME); putc ('\n', FILE);} while (0)
25561452Sdfr
25661452Sdfr/* Remove any trailing [DS] or the like from the symbol name.  */
25761452Sdfr
25861501Sdfr#define STRIP_NAME_ENCODING(VAR,NAME)			\
25961452Sdfr  do							\
26061452Sdfr    {							\
26161501Sdfr      const char *_name = (NAME);			\
26261501Sdfr      size_t _len;					\
26361501Sdfr      if (*_name == '*')				\
26461452Sdfr        _name++;					\
26561501Sdfr      _len = strlen (_name);				\
26661501Sdfr      if (_name[_len - 1] != ']')			\
26761501Sdfr	(VAR) = _name;					\
26861501Sdfr      else						\
26961501Sdfr	{						\
27061452Sdfr	  char *_new_name = (char *) alloca (_len + 1);	\
27161452Sdfr	  strcpy (_new_name, _name);			\
27261452Sdfr	  _new_name[_len - 4] = '\0';			\
27361452Sdfr	  (VAR) = _new_name;				\
27461452Sdfr	}						\
27561501Sdfr    }							\
27661452Sdfr  while (0)
27761452Sdfr
27861452Sdfr/* Output at beginning of assembler file.
27961452Sdfr
28061452Sdfr   Initialize the section names for the RS/6000 at this point.
28161452Sdfr
28261503Sdfr   Specify filename, including full path, to assembler.
28361452Sdfr
28461503Sdfr   We want to go into the TOC section so at least one .toc will be emitted.
28561503Sdfr   Also, in order to output proper .bs/.es pairs, we need at least one static
28661503Sdfr   [RW] section emitted.
28761503Sdfr
28861452Sdfr   Finally, declare mcount when profiling to make the assembler happy.  */
28961452Sdfr
29061452Sdfr#define ASM_FILE_START(FILE)					\
29161452Sdfr{								\
29261452Sdfr  rs6000_gen_section_name (&xcoff_bss_section_name,		\
29361452Sdfr			   main_input_filename, ".bss_");	\
29461452Sdfr  rs6000_gen_section_name (&xcoff_private_data_section_name,	\
29561452Sdfr			   main_input_filename, ".rw_");	\
29661452Sdfr  rs6000_gen_section_name (&xcoff_read_only_section_name,	\
29761452Sdfr			   main_input_filename, ".ro_");	\
29861452Sdfr								\
29961452Sdfr  fprintf (FILE, "\t.file\t\"%s\"\n", main_input_filename);	\
30061452Sdfr  if (TARGET_64BIT)						\
30161501Sdfr    fputs ("\t.machine\t\"ppc64\"\n", FILE);			\
30261503Sdfr  toc_section ();						\
30361503Sdfr  if (write_symbols != NO_DEBUG)				\
30461503Sdfr    private_data_section ();					\
30561503Sdfr  text_section ();						\
30661452Sdfr  if (profile_flag)						\
30761452Sdfr    fprintf (FILE, "\t.extern %s\n", RS6000_MCOUNT);		\
30861452Sdfr  rs6000_file_start (FILE, TARGET_CPU_DEFAULT);			\
30961452Sdfr}
31061452Sdfr
31161452Sdfr/* Output at end of assembler file.
31261452Sdfr
31361452Sdfr   On the RS/6000, referencing data should automatically pull in text.  */
31461452Sdfr
31561452Sdfr#define ASM_FILE_END(FILE)					\
31661452Sdfr{								\
31761452Sdfr  text_section ();						\
31861452Sdfr  fputs ("_section_.text:\n", FILE);				\
31961452Sdfr  data_section ();						\
32061452Sdfr  fputs (TARGET_32BIT						\
32161452Sdfr	 ? "\t.long _section_.text\n" : "\t.llong _section_.text\n", FILE); \
32261452Sdfr}
32361452Sdfr
32461452Sdfr/* This macro produces the initial definition of a function name.
32561452Sdfr   On the RS/6000, we need to place an extra '.' in the function name and
32661452Sdfr   output the function descriptor.
32761452Sdfr
32861452Sdfr   The csect for the function will have already been created by the
32961452Sdfr   `text_section' call previously done.  We do have to go back to that
33061452Sdfr   csect, however.
33161452Sdfr
33261452Sdfr   We also record that the function exists in the current compilation
33361452Sdfr   unit, reachable by short branch, by setting SYMBOL_REF_FLAG.
33461452Sdfr
33561452Sdfr   The third and fourth parameters to the .function pseudo-op (16 and 044)
33661452Sdfr   are placeholders which no longer have any use.  */
33787479Scokane
33887479Scokane#define ASM_DECLARE_FUNCTION_NAME(FILE,NAME,DECL)		\
33987479Scokane{ rtx sym_ref = XEXP (DECL_RTL (DECL), 0);			\
34087479Scokane  if (!DECL_WEAK (DECL))					\
34161452Sdfr    SYMBOL_REF_FLAG (sym_ref) = 1;				\
34287479Scokane  if (TREE_PUBLIC (DECL))					\
34387479Scokane    {								\
34461452Sdfr      if (!RS6000_WEAK || !DECL_WEAK (decl))			\
34561452Sdfr	{							\
34661452Sdfr	  fputs ("\t.globl .", FILE);				\
34761452Sdfr	  RS6000_OUTPUT_BASENAME (FILE, NAME);			\
34861452Sdfr	  putc ('\n', FILE);					\
34961452Sdfr	}							\
35061452Sdfr    }								\
35161452Sdfr  else								\
35261452Sdfr    {								\
35361452Sdfr      fputs ("\t.lglobl .", FILE);				\
35461452Sdfr      RS6000_OUTPUT_BASENAME (FILE, NAME);			\
35561452Sdfr      putc ('\n', FILE);					\
35661452Sdfr    }								\
35787479Scokane  fputs ("\t.csect ", FILE);					\
35887479Scokane  RS6000_OUTPUT_BASENAME (FILE, NAME);				\
35987479Scokane  fputs (TARGET_32BIT ? "[DS]\n" : "[DS],3\n", FILE);		\
36061452Sdfr  RS6000_OUTPUT_BASENAME (FILE, NAME);				\
36161452Sdfr  fputs (":\n", FILE);						\
36261452Sdfr  fputs (TARGET_32BIT ? "\t.long ." : "\t.llong .", FILE);	\
36361452Sdfr  RS6000_OUTPUT_BASENAME (FILE, NAME);				\
36461452Sdfr  fputs (", TOC[tc0], 0\n", FILE);				\
36561452Sdfr  in_section = no_section;					\
36661452Sdfr  function_section(DECL);					\
36761452Sdfr  putc ('.', FILE);						\
36861452Sdfr  RS6000_OUTPUT_BASENAME (FILE, NAME);				\
36961452Sdfr  fputs (":\n", FILE);						\
37061452Sdfr  if (write_symbols == XCOFF_DEBUG)				\
37161452Sdfr    xcoffout_declare_function (FILE, DECL, NAME);		\
37261452Sdfr}
37361452Sdfr
37461452Sdfr/* Output a reference to SYM on FILE.  */
37561452Sdfr
37661452Sdfr#define ASM_OUTPUT_SYMBOL_REF(FILE, SYM) \
37761452Sdfr  rs6000_output_symbol_ref (FILE, SYM)
37861452Sdfr
37961452Sdfr/* This says how to output an external.  */
38061452Sdfr
38161452Sdfr#undef ASM_OUTPUT_EXTERNAL
38261452Sdfr#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME)	\
38361452Sdfr{ rtx _symref = XEXP (DECL_RTL (DECL), 0);	\
38461452Sdfr  if ((TREE_CODE (DECL) == VAR_DECL		\
38561452Sdfr       || TREE_CODE (DECL) == FUNCTION_DECL)	\
38661452Sdfr      && (NAME)[strlen (NAME) - 1] != ']')	\
38761452Sdfr    {						\
38861452Sdfr      char *_name = (char *) permalloc (strlen (XSTR (_symref, 0)) + 5); \
38961452Sdfr      strcpy (_name, XSTR (_symref, 0));	\
39061452Sdfr      strcat (_name, TREE_CODE (DECL) == FUNCTION_DECL ? "[DS]" : "[RW]"); \
39161452Sdfr      XSTR (_symref, 0) = _name;		\
39261452Sdfr    }						\
39361452Sdfr}
39461452Sdfr
39561452Sdfr/* This is how to output an internal numbered label where
39661452Sdfr   PREFIX is the class of label and NUM is the number within the class.  */
39761452Sdfr
39861452Sdfr#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM)	\
39961452Sdfr  fprintf (FILE, "%s..%u:\n", (PREFIX), (unsigned) (NUM))
40061452Sdfr
40161452Sdfr/* This is how to output an internal label prefix.  rs6000.c uses this
40261452Sdfr   when generating traceback tables.  */
40361452Sdfr
40461452Sdfr#define ASM_OUTPUT_INTERNAL_LABEL_PREFIX(FILE,PREFIX)   \
40561452Sdfr  fprintf (FILE, "%s..", PREFIX)
40661452Sdfr
40761452Sdfr/* This is how to output a label for a jump table.  Arguments are the same as
40861452Sdfr   for ASM_OUTPUT_INTERNAL_LABEL, except the insn for the jump table is
40961452Sdfr   passed.  */
41061452Sdfr
41161452Sdfr#define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,TABLEINSN)	\
41261452Sdfr{ ASM_OUTPUT_ALIGN (FILE, 2); ASM_OUTPUT_INTERNAL_LABEL (FILE, PREFIX, NUM); }
41361452Sdfr
41461452Sdfr/* This is how to store into the string LABEL
41561452Sdfr   the symbol_ref name of an internal numbered label where
41661452Sdfr   PREFIX is the class of label and NUM is the number within the class.
41761452Sdfr   This is suitable for output with `assemble_name'.  */
41861452Sdfr
41961452Sdfr#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM)	\
420  sprintf (LABEL, "*%s..%u", (PREFIX), (unsigned) (NUM))
421
422/* This is how to output an assembler line to define N characters starting
423   at P to FILE.  */
424
425#define ASM_OUTPUT_ASCII(FILE, P, N)  output_ascii ((FILE), (P), (N))
426
427/* This is how to advance the location counter by SIZE bytes.  */
428
429#define ASM_OUTPUT_SKIP(FILE,SIZE)  \
430  fprintf (FILE, "\t.space %d\n", (SIZE))
431
432/* This says how to output an assembler line
433   to define a global common symbol.  */
434
435#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGNMENT)	\
436  do { fputs ("\t.comm ", (FILE));			\
437       RS6000_OUTPUT_BASENAME ((FILE), (NAME));		\
438       if ( (SIZE) > 4)					\
439         fprintf ((FILE), ",%d,3\n", (SIZE));		\
440       else						\
441	 fprintf ((FILE), ",%d\n", (SIZE));		\
442  } while (0)
443
444/* This says how to output an assembler line
445   to define a local common symbol.
446   Alignment cannot be specified, but we can try to maintain
447   alignment after preceding TOC section if it was aligned
448   for 64-bit mode.  */
449
450#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED)	\
451  do { fputs ("\t.lcomm ", (FILE));			\
452       RS6000_OUTPUT_BASENAME ((FILE), (NAME));		\
453       fprintf ((FILE), ",%d,%s\n", (TARGET_32BIT ? (SIZE) : (ROUNDED)), \
454		xcoff_bss_section_name);		\
455     } while (0)
456
457/* This is how we tell the assembler that two symbols have the same value.  */
458#define SET_ASM_OP "\t.set "
459
460/* This is how we tell the assembler to equate two values.  */
461#define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2)				\
462 do {	fprintf ((FILE), "%s", SET_ASM_OP);				\
463	RS6000_OUTPUT_BASENAME (FILE, LABEL1);				\
464	fprintf (FILE, ",");						\
465	RS6000_OUTPUT_BASENAME (FILE, LABEL2);				\
466	fprintf (FILE, "\n");						\
467  } while (0)
468
469/* Used by rs6000_assemble_integer, among others.  */
470#define DOUBLE_INT_ASM_OP "\t.llong\t"
471
472/* Output before instructions.  */
473#define TEXT_SECTION_ASM_OP "\t.csect .text[PR]"
474
475/* Output before writable data.
476   Align entire section to BIGGEST_ALIGNMENT.  */
477#define DATA_SECTION_ASM_OP "\t.csect .data[RW],3"
478
479/* Define unique section name -- functions only.  */
480#define UNIQUE_SECTION(DECL,RELOC)			\
481  do {							\
482    int len;						\
483    const char *name;					\
484    char *string;					\
485							\
486    if (TREE_CODE (DECL) == FUNCTION_DECL) {		\
487      name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (DECL)); \
488      len = strlen (name) + 5;				\
489      string = alloca (len + 1);			\
490      sprintf (string, ".%s[PR]", name);		\
491      DECL_SECTION_NAME (DECL) = build_string (len, string); \
492    }							\
493  } while (0)
494
495/* Switch into a generic section.  */
496#define TARGET_ASM_NAMED_SECTION  xcoff_asm_named_section
497
498/* Define the name of the section to use for the EH language specific
499   data areas (.gcc_except_table on most other systems).  */
500#define TARGET_ASM_EXCEPTION_SECTION data_section
501
502/* Define to prevent DWARF2 unwind info in the data section rather
503   than in the .eh_frame section.  We do this because the AIX linker
504   would otherwise garbage collect these sections.  */
505#define EH_FRAME_IN_DATA_SECTION 1
506