* elf32-spu.c (mark_overlay_section): Move code calculating
[deliverable/binutils-gdb.git] / ld / emultempl / spuelf.em
CommitLineData
e9f53129 1# This shell script emits a C file. -*- C -*-
ff7a0acf 2# Copyright 2006, 2007, 2008 Free Software Foundation, Inc.
e9f53129 3#
f96b4a7b 4# This file is part of the GNU Binutils.
e9f53129
AM
5#
6# This program is free software; you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
f96b4a7b 8# the Free Software Foundation; either version 3 of the License, or
e9f53129
AM
9# (at your option) any later version.
10#
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.
15#
f96b4a7b
NC
16# You should have received a copy of the GNU General Public License
17# along with this program; if not, write to the Free Software
18# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
19# MA 02110-1301, USA.
e9f53129
AM
20#
21
22# This file is sourced from elf32.em, and defines extra spu specific
23# features.
24#
92b93329 25fragment <<EOF
e9f53129
AM
26#include "ldctor.h"
27#include "elf32-spu.h"
28
29/* Non-zero if no overlay processing should be done. */
30static int no_overlays = 0;
31
32/* Non-zero if we want stubs on all calls out of overlay regions. */
33static int non_overlay_stubs = 0;
34
35/* Whether to emit symbols for stubs. */
36static int emit_stub_syms = 0;
37
49fa1e15
AM
38/* Non-zero to perform stack space analysis. */
39static int stack_analysis = 0;
40
41/* Whether to emit symbols with stack requirements for each function. */
42static int emit_stack_syms = 0;
43
e9f53129
AM
44/* Range of valid addresses for loadable sections. */
45static bfd_vma local_store_lo = 0;
46static bfd_vma local_store_hi = 0x3ffff;
47
9dcc4794
AM
48/* Control --auto-overlay feature. */
49static int auto_overlay = 0;
50static char *auto_overlay_file = 0;
51static unsigned int auto_overlay_fixed = 0;
52static unsigned int auto_overlay_reserved = 0;
99302af9 53static int extra_stack_space = 2000;
9dcc4794
AM
54int my_argc;
55char **my_argv;
56
671ace2f
AM
57static const char ovl_mgr[] = {
58EOF
59
2f9300ef
JK
60if ! ../binutils/bin2c < ${srcdir}/emultempl/spu_ovl.o >> e${EMULATION_NAME}.c
61then
62 echo >&2 "Missing ${srcdir}/emultempl/spu_ovl.o"
63 echo >&2 "You must build gas/as-new with --target=spu to build spu_ovl.o"
64 exit 1
65fi
671ace2f 66
92b93329 67fragment <<EOF
671ace2f 68};
e9f53129
AM
69
70static const struct _ovl_stream ovl_mgr_stream = {
671ace2f
AM
71 ovl_mgr,
72 ovl_mgr + sizeof (ovl_mgr)
e9f53129
AM
73};
74
e9f53129
AM
75
76static int
77is_spu_target (void)
78{
79 extern const bfd_target bfd_elf32_spu_vec;
80
f13a99db 81 return link_info.output_bfd->xvec == &bfd_elf32_spu_vec;
e9f53129
AM
82}
83
84/* Create our note section. */
85
86static void
87spu_after_open (void)
88{
89 if (is_spu_target ()
90 && !link_info.relocatable
91 && link_info.input_bfds != NULL
c65be8d7 92 && !spu_elf_create_sections (&link_info,
49fa1e15 93 stack_analysis, emit_stack_syms))
e9f53129
AM
94 einfo ("%X%P: can not create note section: %E\n");
95
96 gld${EMULATION_NAME}_after_open ();
97}
98
47f6dab9
AM
99/* If O is NULL, add section S at the end of output section OUTPUT_NAME.
100 If O is not NULL, add section S at the beginning of output section O.
e9f53129
AM
101
102 Really, we should be duplicating ldlang.c map_input_to_output_sections
103 logic here, ie. using the linker script to find where the section
104 goes. That's rather a lot of code, and we don't want to run
105 map_input_to_output_sections again because most sections are already
106 mapped. So cheat, and put the section in a fixed place, ignoring any
107 attempt via a linker script to put .stub, .ovtab, and built-in
108 overlay manager code somewhere else. */
109
110static void
47f6dab9 111spu_place_special_section (asection *s, asection *o, const char *output_name)
e9f53129
AM
112{
113 lang_output_section_statement_type *os;
114
47f6dab9 115 os = lang_output_section_find (o != NULL ? o->name : output_name);
e9f53129
AM
116 if (os == NULL)
117 {
118 const char *save = s->name;
119 s->name = output_name;
120 gld${EMULATION_NAME}_place_orphan (s);
121 s->name = save;
122 }
47f6dab9
AM
123 else if (o != NULL && os->children.head != NULL)
124 {
125 lang_statement_list_type add;
126
127 lang_list_init (&add);
128 lang_add_section (&add, s, os);
129 *add.tail = os->children.head;
130 os->children.head = add.head;
131 }
e9f53129
AM
132 else
133 lang_add_section (&os->children, s, os);
134
135 s->output_section->size += s->size;
136}
137
138/* Load built-in overlay manager, and tweak overlay section alignment. */
139
140static void
141spu_elf_load_ovl_mgr (void)
142{
143 lang_output_section_statement_type *os;
144 struct elf_link_hash_entry *h;
145
146 h = elf_link_hash_lookup (elf_hash_table (&link_info),
147 "__ovly_load", FALSE, FALSE, FALSE);
148
149 if (h != NULL
150 && (h->root.type == bfd_link_hash_defined
151 || h->root.type == bfd_link_hash_defweak)
152 && h->def_regular)
153 {
154 /* User supplied __ovly_load. */
155 }
45d3b878
AM
156 else if (ovl_mgr_stream.start == ovl_mgr_stream.end)
157 einfo ("%F%P: no built-in overlay manager\n");
e9f53129
AM
158 else
159 {
160 lang_input_statement_type *ovl_is;
161
162 ovl_is = lang_add_input_file ("builtin ovl_mgr",
163 lang_input_file_is_file_enum,
164 NULL);
165
166 if (!spu_elf_open_builtin_lib (&ovl_is->the_bfd, &ovl_mgr_stream))
167 einfo ("%X%P: can not open built-in overlay manager: %E\n");
168 else
169 {
170 asection *in;
171
172 if (!load_symbols (ovl_is, NULL))
173 einfo ("%X%P: can not load built-in overlay manager: %E\n");
174
175 /* Map overlay manager sections to output sections. */
176 for (in = ovl_is->the_bfd->sections; in != NULL; in = in->next)
177 if ((in->flags & (SEC_ALLOC | SEC_LOAD))
178 == (SEC_ALLOC | SEC_LOAD))
47f6dab9 179 spu_place_special_section (in, NULL, ".text");
e9f53129
AM
180 }
181 }
182
183 /* Ensure alignment of overlay sections is sufficient. */
184 for (os = &lang_output_section_statement.head->output_section_statement;
185 os != NULL;
186 os = os->next)
187 if (os->bfd_section != NULL
188 && spu_elf_section_data (os->bfd_section) != NULL
47f6dab9 189 && spu_elf_section_data (os->bfd_section)->u.o.ovl_index != 0)
e9f53129
AM
190 {
191 if (os->bfd_section->alignment_power < 4)
192 os->bfd_section->alignment_power = 4;
193
194 /* Also ensure size rounds up. */
195 os->block_value = 16;
196 }
197}
198
199/* Go find if we need to do anything special for overlays. */
200
201static void
202spu_before_allocation (void)
203{
204 if (is_spu_target ()
205 && !link_info.relocatable
206 && !no_overlays)
207 {
208 /* Size the sections. This is premature, but we need to know the
209 rough layout so that overlays can be found. */
210 expld.phase = lang_mark_phase_enum;
211 expld.dataseg.phase = exp_dataseg_none;
212 one_lang_size_sections_pass (NULL, TRUE);
213
214 /* Find overlays by inspecting section vmas. */
c65be8d7 215 if (spu_elf_find_overlays (&link_info))
e9f53129 216 {
47f6dab9 217 int ret;
e9f53129 218
9dcc4794
AM
219 if (auto_overlay != 0)
220 {
221 einfo ("%P: --auto-overlay ignored with user overlay script\n");
222 auto_overlay = 0;
223 }
224
c65be8d7 225 ret = spu_elf_size_stubs (&link_info,
47f6dab9
AM
226 spu_place_special_section,
227 non_overlay_stubs);
228 if (ret == 0)
e9f53129 229 einfo ("%X%P: can not size overlay stubs: %E\n");
47f6dab9
AM
230 else if (ret == 2)
231 spu_elf_load_ovl_mgr ();
e9f53129
AM
232 }
233
234 /* We must not cache anything from the preliminary sizing. */
235 lang_reset_memory_regions ();
236 }
237
238 gld${EMULATION_NAME}_before_allocation ();
239}
240
9dcc4794
AM
241struct tflist {
242 struct tflist *next;
243 char name[9];
244};
245
246static struct tflist *tmp_file_list;
247
248static void clean_tmp (void)
249{
250 for (; tmp_file_list != NULL; tmp_file_list = tmp_file_list->next)
251 unlink (tmp_file_list->name);
252}
253
254static int
255new_tmp_file (char **fname)
256{
257 struct tflist *tf;
258 int fd;
259
260 if (tmp_file_list == NULL)
261 atexit (clean_tmp);
262 tf = xmalloc (sizeof (*tf));
263 tf->next = tmp_file_list;
264 tmp_file_list = tf;
265 memcpy (tf->name, "ldXXXXXX", sizeof (tf->name));
266 *fname = tf->name;
267#ifdef HAVE_MKSTEMP
268 fd = mkstemp (*fname);
269#else
270 *fname = mktemp (*fname);
271 if (*fname == NULL)
272 return -1;
273 fd = open (fname, O_RDWR | O_CREAT | O_EXCL, 0600);
274#endif
275 return fd;
276}
277
278static FILE *
279spu_elf_open_overlay_script (void)
280{
281 FILE *script = NULL;
282
283 if (auto_overlay_file == NULL)
284 {
285 int fd = new_tmp_file (&auto_overlay_file);
286 if (fd == -1)
287 goto file_err;
288 script = fdopen (fd, "w");
289 }
290 else
291 script = fopen (auto_overlay_file, "w");
292
293 if (script == NULL)
294 {
295 file_err:
296 einfo ("%F%P: can not open script: %E\n");
297 }
298 return script;
299}
300
301static void
302spu_elf_relink (void)
303{
d77ec871 304 char **argv = xmalloc ((my_argc + 4) * sizeof (*argv));
9dcc4794
AM
305
306 memcpy (argv, my_argv, my_argc * sizeof (*argv));
307 argv[my_argc++] = "--no-auto-overlay";
308 if (tmp_file_list->name == auto_overlay_file)
d77ec871
AM
309 argv[my_argc - 1] = concat (argv[my_argc - 1], "=",
310 auto_overlay_file, (const char *) NULL);
9dcc4794
AM
311 argv[my_argc++] = "-T";
312 argv[my_argc++] = auto_overlay_file;
313 argv[my_argc] = 0;
314 execvp (argv[0], (char *const *) argv);
315 perror (argv[0]);
316 _exit (127);
317}
318
e9f53129
AM
319/* Final emulation specific call. */
320
321static void
322gld${EMULATION_NAME}_finish (void)
323{
324 int need_laying_out;
325
f13a99db 326 need_laying_out = bfd_elf_discard_info (link_info.output_bfd, &link_info);
e9f53129
AM
327
328 gld${EMULATION_NAME}_map_segments (need_laying_out);
329
771a9c5f 330 if (is_spu_target ())
e9f53129 331 {
771a9c5f
AM
332 if (local_store_lo < local_store_hi)
333 {
334 asection *s;
335
9dcc4794
AM
336 s = spu_elf_check_vma (&link_info, auto_overlay,
337 local_store_lo, local_store_hi,
338 auto_overlay_fixed, auto_overlay_reserved,
99302af9 339 extra_stack_space,
9dcc4794
AM
340 spu_elf_load_ovl_mgr,
341 spu_elf_open_overlay_script,
342 spu_elf_relink);
343 if (s != NULL && !auto_overlay)
771a9c5f
AM
344 einfo ("%X%P: %A exceeds local store range\n", s);
345 }
9dcc4794
AM
346 else if (auto_overlay)
347 einfo ("%P: --auto-overlay ignored with zero local store range\n");
e9f53129 348
771a9c5f
AM
349 if (!spu_elf_build_stubs (&link_info,
350 emit_stub_syms || link_info.emitrelocations))
9f1a3ddf 351 einfo ("%F%P: can not build overlay stubs: %E\n");
e9f53129
AM
352 }
353
e9f53129
AM
354 finish_default ();
355}
356
9dcc4794
AM
357static char *
358gld${EMULATION_NAME}_choose_target (int argc, char *argv[])
359{
360 my_argc = argc;
361 my_argv = argv;
362 return ldemul_default_target (argc, argv);
363}
364
e9f53129
AM
365EOF
366
dc27aea4 367if grep -q 'ld_elf.*ppc.*_emulation' ldemul-list.h; then
92b93329 368 fragment <<EOF
dc27aea4
AM
369#include "filenames.h"
370#include <fcntl.h>
371#include <sys/wait.h>
372
3ba20bde
AM
373static const char *
374base_name (const char *path)
375{
376 const char *file = strrchr (path, '/');
377#ifdef HAVE_DOS_BASED_FILE_SYSTEM
378 {
0fd1c9f1 379 char *bslash = strrchr (path, '\\\\');
3ba20bde
AM
380
381 if (file == NULL || (bslash != NULL && bslash > file))
382 file = bslash;
383 if (file == NULL
384 && path[0] != '\0'
385 && path[1] == ':')
386 file = path + 1;
387 }
388#endif
389 if (file == NULL)
390 file = path;
391 else
392 ++file;
393 return file;
394}
395
dc27aea4
AM
396/* This function is called when building a ppc32 or ppc64 executable
397 to handle embedded spu images. */
398extern bfd_boolean embedded_spu_file (lang_input_statement_type *, const char *);
399
400bfd_boolean
401embedded_spu_file (lang_input_statement_type *entry, const char *flags)
402{
403 const char *cmd[6];
404 const char *sym;
405 char *handle, *p;
dc27aea4
AM
406 char *oname;
407 int fd;
408 pid_t pid;
409 int status;
410 union lang_statement_union **old_stat_tail;
411 union lang_statement_union **old_file_tail;
412 union lang_statement_union *new_ent;
3ba20bde 413 lang_input_statement_type *search;
dc27aea4
AM
414
415 if (entry->the_bfd->format != bfd_object
416 || strcmp (entry->the_bfd->xvec->name, "elf32-spu") != 0
417 || (entry->the_bfd->tdata.elf_obj_data->elf_header->e_type != ET_EXEC
418 && entry->the_bfd->tdata.elf_obj_data->elf_header->e_type != ET_DYN))
419 return FALSE;
420
421 /* Use the filename as the symbol marking the program handle struct. */
3ba20bde 422 sym = base_name (entry->the_bfd->filename);
dc27aea4
AM
423
424 handle = xstrdup (sym);
425 for (p = handle; *p; ++p)
426 if (!(ISALNUM (*p) || *p == '$' || *p == '.'))
427 *p = '_';
428
9dcc4794 429 fd = new_tmp_file (&oname);
dc27aea4
AM
430 if (fd == -1)
431 return FALSE;
432 close (fd);
433
3ba20bde
AM
434 for (search = (lang_input_statement_type *) input_file_chain.head;
435 search != NULL;
436 search = (lang_input_statement_type *) search->next_real_file)
80c4ed32
AM
437 if (search->filename != NULL)
438 {
439 const char *infile = base_name (search->filename);
440
441 if (strncmp (infile, "crtbegin", 8) == 0)
442 {
443 if (infile[8] == 'S')
ff7a0acf 444 flags = concat (flags, " -fPIC", (const char *) NULL);
80c4ed32 445 else if (infile[8] == 'T')
ff7a0acf 446 flags = concat (flags, " -fpie", (const char *) NULL);
80c4ed32
AM
447 break;
448 }
449 }
3ba20bde 450
dc27aea4
AM
451 /* Use fork() and exec() rather than system() so that we don't
452 need to worry about quoting args. */
42ba7415 453 cmd[0] = EMBEDSPU;
dc27aea4
AM
454 cmd[1] = flags;
455 cmd[2] = handle;
456 cmd[3] = entry->the_bfd->filename;
457 cmd[4] = oname;
458 cmd[5] = NULL;
459 if (trace_file_tries)
460 {
461 info_msg (_("running: %s \"%s\" \"%s\" \"%s\" \"%s\"\n"),
462 cmd[0], cmd[1], cmd[2], cmd[3], cmd[4]);
463 fflush (stdout);
464 }
465
466 pid = fork ();
467 if (pid == -1)
468 return FALSE;
469 if (pid == 0)
470 {
471 execvp (cmd[0], (char *const *) cmd);
42ba7415 472 if (strcmp ("embedspu", EMBEDSPU) != 0)
628e8859
AM
473 {
474 cmd[0] = "embedspu";
475 execvp (cmd[0], (char *const *) cmd);
476 }
dc27aea4
AM
477 perror (cmd[0]);
478 _exit (127);
479 }
480#ifdef HAVE_WAITPID
481#define WAITFOR(PID, STAT) waitpid (PID, STAT, 0)
482#else
483#define WAITFOR(PID, STAT) wait (STAT)
484#endif
485 if (WAITFOR (pid, &status) != pid
486 || !WIFEXITED (status)
487 || WEXITSTATUS (status) != 0)
488 return FALSE;
489#undef WAITFOR
490
491 old_stat_tail = stat_ptr->tail;
492 old_file_tail = input_file_chain.tail;
493 if (lang_add_input_file (oname, lang_input_file_is_file_enum, NULL) == NULL)
494 return FALSE;
495
496 /* lang_add_input_file put the new list entry at the end of the statement
497 and input file lists. Move it to just after the current entry. */
498 new_ent = *old_stat_tail;
499 *old_stat_tail = NULL;
500 stat_ptr->tail = old_stat_tail;
501 *old_file_tail = NULL;
502 input_file_chain.tail = old_file_tail;
503 new_ent->header.next = entry->header.next;
504 entry->header.next = new_ent;
505 new_ent->input_statement.next_real_file = entry->next_real_file;
506 entry->next_real_file = new_ent;
507
508 /* Ensure bfd sections are excluded from the output. */
509 bfd_section_list_clear (entry->the_bfd);
510 entry->loaded = TRUE;
511 return TRUE;
512}
513
514EOF
515fi
516
e9f53129
AM
517# Define some shell vars to insert bits of code into the standard elf
518# parse_args and list_options functions.
519#
520PARSE_AND_LIST_PROLOGUE='
521#define OPTION_SPU_PLUGIN 301
522#define OPTION_SPU_NO_OVERLAYS (OPTION_SPU_PLUGIN + 1)
523#define OPTION_SPU_STUB_SYMS (OPTION_SPU_NO_OVERLAYS + 1)
524#define OPTION_SPU_NON_OVERLAY_STUBS (OPTION_SPU_STUB_SYMS + 1)
525#define OPTION_SPU_LOCAL_STORE (OPTION_SPU_NON_OVERLAY_STUBS + 1)
49fa1e15
AM
526#define OPTION_SPU_STACK_ANALYSIS (OPTION_SPU_LOCAL_STORE + 1)
527#define OPTION_SPU_STACK_SYMS (OPTION_SPU_STACK_ANALYSIS + 1)
9dcc4794
AM
528#define OPTION_SPU_AUTO_OVERLAY (OPTION_SPU_STACK_SYMS + 1)
529#define OPTION_SPU_AUTO_RELINK (OPTION_SPU_AUTO_OVERLAY + 1)
530#define OPTION_SPU_OVERLAY_RODATA (OPTION_SPU_AUTO_RELINK + 1)
531#define OPTION_SPU_FIXED_SPACE (OPTION_SPU_OVERLAY_RODATA + 1)
532#define OPTION_SPU_RESERVED_SPACE (OPTION_SPU_FIXED_SPACE + 1)
99302af9
AM
533#define OPTION_SPU_EXTRA_STACK (OPTION_SPU_RESERVED_SPACE + 1)
534#define OPTION_SPU_NO_AUTO_OVERLAY (OPTION_SPU_EXTRA_STACK + 1)
e9f53129
AM
535'
536
537PARSE_AND_LIST_LONGOPTS='
538 { "plugin", no_argument, NULL, OPTION_SPU_PLUGIN },
539 { "no-overlays", no_argument, NULL, OPTION_SPU_NO_OVERLAYS },
540 { "emit-stub-syms", no_argument, NULL, OPTION_SPU_STUB_SYMS },
541 { "extra-overlay-stubs", no_argument, NULL, OPTION_SPU_NON_OVERLAY_STUBS },
542 { "local-store", required_argument, NULL, OPTION_SPU_LOCAL_STORE },
49fa1e15
AM
543 { "stack-analysis", no_argument, NULL, OPTION_SPU_STACK_ANALYSIS },
544 { "emit-stack-syms", no_argument, NULL, OPTION_SPU_STACK_SYMS },
9dcc4794
AM
545 { "auto-overlay", optional_argument, NULL, OPTION_SPU_AUTO_OVERLAY },
546 { "auto-relink", no_argument, NULL, OPTION_SPU_AUTO_RELINK },
547 { "overlay-rodata", no_argument, NULL, OPTION_SPU_OVERLAY_RODATA },
548 { "fixed-space", required_argument, NULL, OPTION_SPU_FIXED_SPACE },
549 { "reserved-space", required_argument, NULL, OPTION_SPU_RESERVED_SPACE },
99302af9 550 { "extra-stack-space", required_argument, NULL, OPTION_SPU_EXTRA_STACK },
9dcc4794 551 { "no-auto-overlay", optional_argument, NULL, OPTION_SPU_NO_AUTO_OVERLAY },
e9f53129
AM
552'
553
554PARSE_AND_LIST_OPTIONS='
555 fprintf (file, _("\
442996ee
AM
556 --plugin Make SPU plugin.\n\
557 --no-overlays No overlay handling.\n\
558 --emit-stub-syms Add symbols on overlay call stubs.\n\
559 --extra-overlay-stubs Add stubs on all calls out of overlay regions.\n\
560 --local-store=lo:hi Valid address range.\n\
561 --stack-analysis Estimate maximum stack requirement.\n\
9dcc4794
AM
562 --emit-stack-syms Add sym giving stack needed for each func.\n\
563 --auto-overlay [=filename] Create an overlay script in filename if\n\
564 executable does not fit in local store.\n\
565 --auto-relink Rerun linker using auto-overlay script.\n\
566 --overlay-rodata Place read-only data with associated function\n\
567 code in overlays.\n\
568 --fixed-space=bytes Local store for non-overlay code and data.\n\
99302af9
AM
569 --reserved-space=bytes Local store for stack and heap. If not specified\n\
570 ld will estimate stack size and assume no heap.\n\
571 --extra-stack-space=bytes Space for negative sp access (default 2000) if\n\
572 --reserved-space not given.\n"
e9f53129
AM
573 ));
574'
575
576PARSE_AND_LIST_ARGS_CASES='
577 case OPTION_SPU_PLUGIN:
578 spu_elf_plugin (1);
579 break;
580
581 case OPTION_SPU_NO_OVERLAYS:
582 no_overlays = 1;
583 break;
584
585 case OPTION_SPU_STUB_SYMS:
586 emit_stub_syms = 1;
587 break;
588
589 case OPTION_SPU_NON_OVERLAY_STUBS:
590 non_overlay_stubs = 1;
591 break;
592
593 case OPTION_SPU_LOCAL_STORE:
594 {
595 char *end;
596 local_store_lo = strtoul (optarg, &end, 0);
597 if (*end == '\'':'\'')
598 {
599 local_store_hi = strtoul (end + 1, &end, 0);
600 if (*end == 0)
601 break;
602 }
603 einfo (_("%P%F: invalid --local-store address range `%s'\''\n"), optarg);
604 }
605 break;
49fa1e15
AM
606
607 case OPTION_SPU_STACK_ANALYSIS:
608 stack_analysis = 1;
609 break;
610
611 case OPTION_SPU_STACK_SYMS:
612 emit_stack_syms = 1;
613 break;
9dcc4794
AM
614
615 case OPTION_SPU_AUTO_OVERLAY:
616 auto_overlay |= 1;
617 if (optarg != NULL)
618 {
619 auto_overlay_file = optarg;
620 break;
621 }
622 /* Fall thru */
623
624 case OPTION_SPU_AUTO_RELINK:
625 auto_overlay |= 2;
626 break;
627
628 case OPTION_SPU_OVERLAY_RODATA:
629 auto_overlay |= 4;
630 break;
631
632 case OPTION_SPU_FIXED_SPACE:
633 {
634 char *end;
635 auto_overlay_fixed = strtoul (optarg, &end, 0);
636 if (*end != 0)
637 einfo (_("%P%F: invalid --fixed-space value `%s'\''\n"), optarg);
638 }
639 break;
640
641 case OPTION_SPU_RESERVED_SPACE:
642 {
643 char *end;
644 auto_overlay_reserved = strtoul (optarg, &end, 0);
645 if (*end != 0)
646 einfo (_("%P%F: invalid --reserved-space value `%s'\''\n"), optarg);
647 }
648 break;
649
99302af9
AM
650 case OPTION_SPU_EXTRA_STACK:
651 {
652 char *end;
653 extra_stack_space = strtol (optarg, &end, 0);
654 if (*end != 0)
655 einfo (_("%P%F: invalid --extra-stack-space value `%s'\''\n"), optarg);
656 }
657 break;
658
9dcc4794
AM
659 case OPTION_SPU_NO_AUTO_OVERLAY:
660 auto_overlay = 0;
661 if (optarg != NULL)
662 {
663 struct tflist *tf;
664 size_t len;
665
666 if (tmp_file_list == NULL)
667 atexit (clean_tmp);
668
669 len = strlen (optarg) + 1;
670 tf = xmalloc (sizeof (*tf) - sizeof (tf->name) + len);
671 memcpy (tf->name, optarg, len);
672 tf->next = tmp_file_list;
673 tmp_file_list = tf;
674 break;
675 }
676 break;
e9f53129
AM
677'
678
679LDEMUL_AFTER_OPEN=spu_after_open
680LDEMUL_BEFORE_ALLOCATION=spu_before_allocation
681LDEMUL_FINISH=gld${EMULATION_NAME}_finish
9dcc4794 682LDEMUL_CHOOSE_TARGET=gld${EMULATION_NAME}_choose_target
This page took 0.11697 seconds and 4 git commands to generate.