ld/
[deliverable/binutils-gdb.git] / ld / emultempl / vxworks.em
1 if test -n "$VXWORKS_BASE_EM_FILE" ; then
2 . "${srcdir}/emultempl/${VXWORKS_BASE_EM_FILE}.em"
3 fi
4
5 cat >>e${EMULATION_NAME}.c <<EOF
6
7 static int force_dynamic;
8
9 static void
10 vxworks_before_parse (void)
11 {
12 ${LDEMUL_BEFORE_PARSE-gld${EMULATION_NAME}_before_parse} ();
13 config.rpath_separator = ';';
14 }
15
16 static void
17 vxworks_after_open (void)
18 {
19 ${LDEMUL_AFTER_OPEN-gld${EMULATION_NAME}_after_open} ();
20
21 if (force_dynamic
22 && link_info.input_bfds
23 && output_bfd->xvec->flavour == bfd_target_elf_flavour
24 && !_bfd_elf_link_create_dynamic_sections (link_info.input_bfds,
25 &link_info))
26 einfo ("%X%P: Cannot create dynamic sections %E\n");
27
28 if (!force_dynamic
29 && !link_info.shared
30 && output_bfd->xvec->flavour == bfd_target_elf_flavour
31 && elf_hash_table (&link_info)->dynamic_sections_created)
32 einfo ("%X%P: Dynamic sections created in non-dynamic link\n");
33 }
34
35 EOF
36
37 PARSE_AND_LIST_PROLOGUE=$PARSE_AND_LIST_PROLOGUE'
38 enum {
39 OPTION_FORCE_DYNAMIC = 501
40 };
41 '
42
43 PARSE_AND_LIST_LONGOPTS=$PARSE_AND_LIST_LONGOPTS'
44 {"force-dynamic", no_argument, NULL, OPTION_FORCE_DYNAMIC},
45 '
46
47 PARSE_AND_LIST_OPTIONS=$PARSE_AND_LIST_OPTIONS'
48 fprintf (file, _("\
49 --force-dynamic Always create dynamic sections\n"));
50 '
51
52 PARSE_AND_LIST_ARGS_CASES=$PARSE_AND_LIST_ARGS_CASES'
53 case OPTION_FORCE_DYNAMIC:
54 force_dynamic = 1;
55 break;
56 '
57
58 # Hook in our routines above. There are three possibilities:
59 #
60 # (1) VXWORKS_BASE_EM_FILE did not set the hook's LDEMUL_FOO variable.
61 # We want to define LDEMUL_FOO to vxworks_foo in that case,
62 #
63 # (2) VXWORKS_BASE_EM_FILE set the hook's LDEMUL_FOO variable to
64 # gld${EMULATION_NAME}_foo. This means that the file has
65 # replaced elf32.em's default definition, so we simply #define
66 # the current value of LDEMUL_FOO to vxworks_foo.
67 #
68 # (3) VXWORKS_BASE_EM_FILE set the hook's LDEMUL_FOO variable to
69 # something other than gld${EMULATION_NAME}_foo. We handle
70 # this case in the same way as (1).
71 for override in before_parse after_open; do
72 var="LDEMUL_`echo ${override} | tr a-z A-Z`"
73 eval value=\$${var}
74 if test "${value}" = "gld${EMULATION_NAME}_${override}"; then
75 cat >>e${EMULATION_NAME}.c <<EOF
76 #define ${value} vxworks_${override}
77 EOF
78 else
79 eval $var=vxworks_${override}
80 fi
81 done
This page took 0.031255 seconds and 4 git commands to generate.