1169689Skan/* Subroutines for insn-output.c for NetWare.
2169689Skan   Contributed by Jan Beulich (jbeulich@novell.com)
3169689Skan   Copyright (C) 2004 Free Software Foundation, Inc.
4169689Skan
5169689SkanThis file is part of GCC.
6169689Skan
7169689SkanGCC is free software; you can redistribute it and/or modify
8169689Skanit under the terms of the GNU General Public License as published by
9169689Skanthe Free Software Foundation; either version 2, or (at your option)
10169689Skanany later version.
11169689Skan
12169689SkanGCC is distributed in the hope that it will be useful,
13169689Skanbut WITHOUT ANY WARRANTY; without even the implied warranty of
14169689SkanMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15169689SkanGNU General Public License for more details.
16169689Skan
17169689SkanYou should have received a copy of the GNU General Public License
18169689Skanalong with GCC; see the file COPYING.  If not, write to
19169689Skanthe Free Software Foundation, 51 Franklin Street, Fifth Floor,
20169689SkanBoston, MA 02110-1301, USA.  */
21169689Skan
22169689Skan#include "config.h"
23169689Skan#include "system.h"
24169689Skan#include "coretypes.h"
25169689Skan#include "tm.h"
26169689Skan#include "rtl.h"
27169689Skan#include "regs.h"
28169689Skan#include "hard-reg-set.h"
29169689Skan#include "output.h"
30169689Skan#include "tree.h"
31169689Skan#include "flags.h"
32169689Skan#include "tm_p.h"
33169689Skan#include "toplev.h"
34169689Skan
35169689Skanvoid
36169689Skannwld_named_section_asm_out_constructor (rtx symbol, int priority)
37169689Skan{
38169689Skan#if !SUPPORTS_INIT_PRIORITY
39169689Skan  const char section[] = ".ctors"TARGET_SUB_SECTION_SEPARATOR;
40169689Skan#else
41169689Skan  char section[20];
42169689Skan
43169689Skan  sprintf (section,
44169689Skan	   ".ctors"TARGET_SUB_SECTION_SEPARATOR"%.5u",
45169689Skan	   /* Invert the numbering so the linker puts us in the proper
46169689Skan	      order; constructors are run from right to left, and the
47169689Skan	      linker sorts in increasing order.  */
48169689Skan	   MAX_INIT_PRIORITY - priority);
49169689Skan#endif
50169689Skan
51169689Skan  switch_to_section (get_section (section, 0, NULL));
52169689Skan  assemble_align (POINTER_SIZE);
53169689Skan  assemble_integer (symbol, POINTER_SIZE / BITS_PER_UNIT, POINTER_SIZE, 1);
54169689Skan}
55169689Skan
56169689Skanvoid
57169689Skannwld_named_section_asm_out_destructor (rtx symbol, int priority)
58169689Skan{
59169689Skan#if !SUPPORTS_INIT_PRIORITY
60169689Skan  const char section[] = ".dtors"TARGET_SUB_SECTION_SEPARATOR;
61169689Skan#else
62169689Skan  char section[20];
63169689Skan
64169689Skan  sprintf (section, ".dtors"TARGET_SUB_SECTION_SEPARATOR"%.5u",
65169689Skan	   /* Invert the numbering so the linker puts us in the proper
66169689Skan	      order; destructors are run from left to right, and the
67169689Skan	      linker sorts in increasing order.  */
68169689Skan	   MAX_INIT_PRIORITY - priority);
69169689Skan#endif
70169689Skan
71169689Skan  switch_to_section (get_section (section, 0, NULL));
72169689Skan  assemble_align (POINTER_SIZE);
73169689Skan  assemble_integer (symbol, POINTER_SIZE / BITS_PER_UNIT, POINTER_SIZE, 1);
74169689Skan}
75