nwld.c revision 169689
1/* Subroutines for insn-output.c for NetWare.
2   Contributed by Jan Beulich (jbeulich@novell.com)
3   Copyright (C) 2004 Free Software Foundation, Inc.
4
5This file is part of GCC.
6
7GCC is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2, or (at your option)
10any later version.
11
12GCC is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GCC; see the file COPYING.  If not, write to
19the Free Software Foundation, 51 Franklin Street, Fifth Floor,
20Boston, MA 02110-1301, USA.  */
21
22#include "config.h"
23#include "system.h"
24#include "coretypes.h"
25#include "tm.h"
26#include "rtl.h"
27#include "regs.h"
28#include "hard-reg-set.h"
29#include "output.h"
30#include "tree.h"
31#include "flags.h"
32#include "tm_p.h"
33#include "toplev.h"
34
35void
36nwld_named_section_asm_out_constructor (rtx symbol, int priority)
37{
38#if !SUPPORTS_INIT_PRIORITY
39  const char section[] = ".ctors"TARGET_SUB_SECTION_SEPARATOR;
40#else
41  char section[20];
42
43  sprintf (section,
44	   ".ctors"TARGET_SUB_SECTION_SEPARATOR"%.5u",
45	   /* Invert the numbering so the linker puts us in the proper
46	      order; constructors are run from right to left, and the
47	      linker sorts in increasing order.  */
48	   MAX_INIT_PRIORITY - priority);
49#endif
50
51  switch_to_section (get_section (section, 0, NULL));
52  assemble_align (POINTER_SIZE);
53  assemble_integer (symbol, POINTER_SIZE / BITS_PER_UNIT, POINTER_SIZE, 1);
54}
55
56void
57nwld_named_section_asm_out_destructor (rtx symbol, int priority)
58{
59#if !SUPPORTS_INIT_PRIORITY
60  const char section[] = ".dtors"TARGET_SUB_SECTION_SEPARATOR;
61#else
62  char section[20];
63
64  sprintf (section, ".dtors"TARGET_SUB_SECTION_SEPARATOR"%.5u",
65	   /* Invert the numbering so the linker puts us in the proper
66	      order; destructors are run from left to right, and the
67	      linker sorts in increasing order.  */
68	   MAX_INIT_PRIORITY - priority);
69#endif
70
71  switch_to_section (get_section (section, 0, NULL));
72  assemble_align (POINTER_SIZE);
73  assemble_integer (symbol, POINTER_SIZE / BITS_PER_UNIT, POINTER_SIZE, 1);
74}
75