needrelax.em revision 85815
1228753Smm# This shell script emits a C file. -*- C -*-
2228753Smm#   Copyright (C) 2001 Free Software Foundation, Inc.
3228753Smm#
4228753Smm# This file is part of GLD, the Gnu Linker.
5228753Smm#
6228753Smm# This program is free software; you can redistribute it and/or modify
7228753Smm# it under the terms of the GNU General Public License as published by
8228753Smm# the Free Software Foundation; either version 2 of the License, or
9228753Smm# (at your option) any later version.
10228753Smm#
11228753Smm# This program is distributed in the hope that it will be useful,
12228753Smm# but WITHOUT ANY WARRANTY; without even the implied warranty of
13228753Smm# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14228753Smm# GNU General Public License for more details.
15228753Smm#
16228753Smm# You should have received a copy of the GNU General Public License
17228753Smm# along with this program; if not, write to the Free Software
18228753Smm# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19228753Smm#
20228753Smm
21228753Smm# This file is sourced from elf32.em.  It is used by targets for
22228753Smm# which relaxation is not just an optimization, but for correctness.
23228753Smm
24228753SmmLDEMUL_BEFORE_ALLOCATION=need_relax_${EMULATION_NAME}_before_allocation
25228753Smm
26228763Smmcat >>e${EMULATION_NAME}.c <<EOF
27228753Smm
28232153Smmstatic void need_relax_${EMULATION_NAME}_before_allocation PARAMS ((void));
29232153Smm
30232153Smmstatic void
31232153Smmneed_relax_${EMULATION_NAME}_before_allocation ()
32232153Smm{
33232153Smm  /* Call main function; we're just extending it.  */
34228753Smm  gld${EMULATION_NAME}_before_allocation ();
35228753Smm
36228753Smm  /* Force -relax on if not doing a relocatable link.  */
37228753Smm  if (! link_info.relocateable)
38228753Smm    command_line.relax = true;
39228753Smm}
40228753SmmEOF
41228753Smm