1 # This shell script emits a C file. -*- C -*-
2 # It does some substitutions.
3 # This file is now misnamed, because it supports both 32 bit and 64 bit
5 test -z "${ELFSIZE}" && ELFSIZE=32
6 if [ -z "$MACHINE" ]; then
9 OUTPUT_ARCH=${ARCH}:${MACHINE}
12 /* This file is is generated by a shell script. DO NOT EDIT! */
14 /* ${ELFSIZE} bit ELF emulation code for ${EMULATION_NAME}
15 Copyright (C) 1991-2014 Free Software Foundation, Inc.
16 Written by Steve Chamberlain <sac@cygnus.com>
17 ELF support by Ian Lance Taylor <ian@cygnus.com>
19 This file is part of the GNU Binutils.
21 This program is free software; you can redistribute it and/or modify
22 it under the terms of the GNU General Public License as published by
23 the Free Software Foundation; either version 3 of the License, or
24 (at your option) any later version.
26 This program is distributed in the hope that it will be useful,
27 but WITHOUT ANY WARRANTY; without even the implied warranty of
28 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29 GNU General Public License for more details.
31 You should have received a copy of the GNU General Public License
32 along with this program; if not, write to the Free Software
33 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
34 MA 02110-1301, USA. */
36 #define TARGET_IS_${EMULATION_NAME}
40 #include "libiberty.h"
41 #include "filenames.h"
42 #include "safe-ctype.h"
58 #include "elf/common.h"
60 #include "filenames.h"
62 /* Declare functions used by various EXTRA_EM_FILEs. */
63 static void gld${EMULATION_NAME}_before_parse (void);
64 static void gld${EMULATION_NAME}_after_open (void);
65 static void gld${EMULATION_NAME}_before_allocation (void);
66 static void gld${EMULATION_NAME}_after_allocation (void);
67 static lang_output_section_statement_type *gld${EMULATION_NAME}_place_orphan
68 (asection *, const char *, int);
71 if [ "x${USE_LIBPATH}" = xyes ] ; then
73 *-*-linux-* | *-*-k*bsd*-* | *-*-gnu*)
83 # Import any needed special functions and/or overrides.
85 source_em ${srcdir}/emultempl/elf-generic.em
86 if test -n "$EXTRA_EM_FILE" ; then
87 source_em ${srcdir}/emultempl/${EXTRA_EM_FILE}.em
90 # Functions in this file can be overridden by setting the LDEMUL_* shell
91 # variables. If the name of the overriding function is the same as is
92 # defined in this file, then don't output this file's version.
93 # If a different overriding name is given then output the standard function
94 # as presumably it is called from the overriding function.
96 if test x"$LDEMUL_BEFORE_PARSE" != xgld"$EMULATION_NAME"_before_parse; then
100 gld${EMULATION_NAME}_before_parse (void)
102 ldfile_set_output_arch ("${OUTPUT_ARCH}", bfd_arch_`echo ${ARCH} | sed -e 's/:.*//'`);
103 input_flags.dynamic = ${DYNAMIC_LINK-TRUE};
104 config.has_shared = `if test -n "$GENERATE_SHLIB_SCRIPT" ; then echo TRUE ; else echo FALSE ; fi`;
105 config.separate_code = `if test "x${SEPARATE_CODE}" = xyes ; then echo TRUE ; else echo FALSE ; fi`;
111 if test x"$LDEMUL_RECOGNIZED_FILE" != xgld"${EMULATION_NAME}"_load_symbols; then
113 /* Handle the generation of DT_NEEDED tags. */
116 gld${EMULATION_NAME}_load_symbols (lang_input_statement_type *entry)
120 /* Tell the ELF linker that we don't want the output file to have a
121 DT_NEEDED entry for this file, unless it is used to resolve
122 references in a regular object. */
123 if (entry->flags.add_DT_NEEDED_for_regular)
124 link_class = DYN_AS_NEEDED;
126 /* Tell the ELF linker that we don't want the output file to have a
127 DT_NEEDED entry for any dynamic library in DT_NEEDED tags from
129 if (!entry->flags.add_DT_NEEDED_for_dynamic)
130 link_class |= DYN_NO_ADD_NEEDED;
132 if (entry->flags.just_syms
133 && (bfd_get_file_flags (entry->the_bfd) & DYNAMIC) != 0)
134 einfo (_("%P%F: --just-symbols may not be used on DSO: %B\n"),
138 || (bfd_get_file_flags (entry->the_bfd) & DYNAMIC) == 0)
141 bfd_elf_set_dyn_lib_class (entry->the_bfd,
142 (enum dynamic_lib_link_class) link_class);
144 /* Continue on with normal load_symbols processing. */
152 /* These variables are required to pass information back and forth
153 between after_open and check_needed and stat_needed and vercheck. */
155 static struct bfd_link_needed_list *global_needed;
156 static struct stat global_stat;
157 static lang_input_statement_type *global_found;
158 static struct bfd_link_needed_list *global_vercheck_needed;
159 static bfd_boolean global_vercheck_failed;
161 /* These variables are used to implement target options */
163 static char *audit; /* colon (typically) separated list of libs */
164 static char *depaudit; /* colon (typically) separated list of libs */
166 /* Style of .note.gnu.build-id section. */
167 static const char *emit_note_gnu_build_id;
169 /* On Linux, it's possible to have different versions of the same
170 shared library linked against different versions of libc. The
171 dynamic linker somehow tags which libc version to use in
172 /etc/ld.so.cache, and, based on the libc that it sees in the
173 executable, chooses which version of the shared library to use.
175 We try to do a similar check here by checking whether this shared
176 library needs any other shared libraries which may conflict with
177 libraries we have already included in the link. If it does, we
178 skip it, and try to find another shared library farther on down the
181 This is called via lang_for_each_input_file.
182 GLOBAL_VERCHECK_NEEDED is the list of objects needed by the object
183 which we are checking. This sets GLOBAL_VERCHECK_FAILED if we find
184 a conflicting version. */
187 gld${EMULATION_NAME}_vercheck (lang_input_statement_type *s)
190 struct bfd_link_needed_list *l;
192 if (global_vercheck_failed)
194 if (s->the_bfd == NULL
195 || (bfd_get_file_flags (s->the_bfd) & DYNAMIC) == 0)
198 soname = bfd_elf_get_dt_soname (s->the_bfd);
200 soname = lbasename (bfd_get_filename (s->the_bfd));
202 for (l = global_vercheck_needed; l != NULL; l = l->next)
206 if (filename_cmp (soname, l->name) == 0)
208 /* Probably can't happen, but it's an easy check. */
212 if (strchr (l->name, '/') != NULL)
215 suffix = strstr (l->name, ".so.");
219 suffix += sizeof ".so." - 1;
221 if (filename_ncmp (soname, l->name, suffix - l->name) == 0)
223 /* Here we know that S is a dynamic object FOO.SO.VER1, and
224 the object we are considering needs a dynamic object
225 FOO.SO.VER2, and VER1 and VER2 are different. This
226 appears to be a version mismatch, so we tell the caller
227 to try a different version of this library. */
228 global_vercheck_failed = TRUE;
235 /* See if an input file matches a DT_NEEDED entry by running stat on
239 gld${EMULATION_NAME}_stat_needed (lang_input_statement_type *s)
245 if (global_found != NULL)
247 if (s->the_bfd == NULL)
250 /* If this input file was an as-needed entry, and wasn't found to be
251 needed at the stage it was linked, then don't say we have loaded it. */
252 if ((bfd_elf_get_dyn_lib_class (s->the_bfd) & DYN_AS_NEEDED) != 0)
255 if (bfd_stat (s->the_bfd, &st) != 0)
257 einfo ("%P:%B: bfd_stat failed: %E\n", s->the_bfd);
261 /* Some operating systems, e.g. Windows, do not provide a meaningful
262 st_ino; they always set it to zero. (Windows does provide a
263 meaningful st_dev.) Do not indicate a duplicate library in that
264 case. While there is no guarantee that a system that provides
265 meaningful inode numbers will never set st_ino to zero, this is
266 merely an optimization, so we do not need to worry about false
268 if (st.st_dev == global_stat.st_dev
269 && st.st_ino == global_stat.st_ino
276 /* We issue a warning if it looks like we are including two
277 different versions of the same shared library. For example,
278 there may be a problem if -lc picks up libc.so.6 but some other
279 shared library has a DT_NEEDED entry of libc.so.5. This is a
280 heuristic test, and it will only work if the name looks like
281 NAME.so.VERSION. FIXME: Depending on file names is error-prone.
282 If we really want to issue warnings about mixing version numbers
283 of shared libraries, we need to find a better way. */
285 if (strchr (global_needed->name, '/') != NULL)
287 suffix = strstr (global_needed->name, ".so.");
290 suffix += sizeof ".so." - 1;
292 soname = bfd_elf_get_dt_soname (s->the_bfd);
294 soname = lbasename (s->filename);
296 if (filename_ncmp (soname, global_needed->name, suffix - global_needed->name) == 0)
297 einfo ("%P: warning: %s, needed by %B, may conflict with %s\n",
298 global_needed->name, global_needed->by, soname);
307 /* This function is called for each possible name for a dynamic object
308 named by a DT_NEEDED entry. The FORCE parameter indicates whether
309 to skip the check for a conflicting version. */
312 gld${EMULATION_NAME}_try_needed (struct dt_needed *needed,
316 const char *name = needed->name;
320 abfd = bfd_openr (name, bfd_get_target (link_info.output_bfd));
324 /* Linker needs to decompress sections. */
325 abfd->flags |= BFD_DECOMPRESS;
327 if (! bfd_check_format (abfd, bfd_object))
332 if ((bfd_get_file_flags (abfd) & DYNAMIC) == 0)
338 /* For DT_NEEDED, they have to match. */
339 if (abfd->xvec != link_info.output_bfd->xvec)
345 /* Check whether this object would include any conflicting library
346 versions. If FORCE is set, then we skip this check; we use this
347 the second time around, if we couldn't find any compatible
348 instance of the shared library. */
352 struct bfd_link_needed_list *needs;
354 if (! bfd_elf_get_bfd_needed_list (abfd, &needs))
355 einfo ("%F%P:%B: bfd_elf_get_bfd_needed_list failed: %E\n", abfd);
359 global_vercheck_needed = needs;
360 global_vercheck_failed = FALSE;
361 lang_for_each_input_file (gld${EMULATION_NAME}_vercheck);
362 if (global_vercheck_failed)
365 /* Return FALSE to force the caller to move on to try
366 another file on the search path. */
370 /* But wait! It gets much worse. On Linux, if a shared
371 library does not use libc at all, we are supposed to skip
372 it the first time around in case we encounter a shared
373 library later on with the same name which does use the
374 version of libc that we want. This is much too horrible
375 to use on any system other than Linux. */
379 *-*-linux-* | *-*-k*bsd*-* | *-*-gnu*)
382 struct bfd_link_needed_list *l;
384 for (l = needs; l != NULL; l = l->next)
385 if (CONST_STRNEQ (l->name, "libc.so"))
401 /* We've found a dynamic object matching the DT_NEEDED entry. */
403 /* We have already checked that there is no other input file of the
404 same name. We must now check again that we are not including the
405 same file twice. We need to do this because on many systems
406 libc.so is a symlink to, e.g., libc.so.1. The SONAME entry will
407 reference libc.so.1. If we have already included libc.so, we
408 don't want to include libc.so.1 if they are the same file, and we
409 can only check that using stat. */
411 if (bfd_stat (abfd, &global_stat) != 0)
412 einfo ("%F%P:%B: bfd_stat failed: %E\n", abfd);
414 /* First strip off everything before the last '/'. */
415 soname = lbasename (abfd->filename);
418 info_msg (_("found %s at %s\n"), soname, name);
421 lang_for_each_input_file (gld${EMULATION_NAME}_stat_needed);
422 if (global_found != NULL)
424 /* Return TRUE to indicate that we found the file, even though
425 we aren't going to do anything with it. */
429 /* Specify the soname to use. */
430 bfd_elf_set_dt_needed_name (abfd, soname);
432 /* Tell the ELF linker that we don't want the output file to have a
433 DT_NEEDED entry for this file, unless it is used to resolve
434 references in a regular object. */
435 link_class = DYN_DT_NEEDED;
437 /* Tell the ELF linker that we don't want the output file to have a
438 DT_NEEDED entry for this file at all if the entry is from a file
439 with DYN_NO_ADD_NEEDED. */
440 if (needed->by != NULL
441 && (bfd_elf_get_dyn_lib_class (needed->by) & DYN_NO_ADD_NEEDED) != 0)
442 link_class |= DYN_NO_NEEDED | DYN_NO_ADD_NEEDED;
444 bfd_elf_set_dyn_lib_class (abfd, (enum dynamic_lib_link_class) link_class);
446 /* Add this file into the symbol table. */
447 if (! bfd_link_add_symbols (abfd, &link_info))
448 einfo ("%F%B: error adding symbols: %E\n", abfd);
454 /* Search for a needed file in a path. */
457 gld${EMULATION_NAME}_search_needed (const char *path,
458 struct dt_needed *n, int force)
461 const char *name = n->name;
463 struct dt_needed needed;
466 return gld${EMULATION_NAME}_try_needed (n, force);
468 if (path == NULL || *path == '\0')
472 needed.name = n->name;
477 char *filename, *sset;
479 s = strchr (path, config.rpath_separator);
481 s = path + strlen (path);
483 #if HAVE_DOS_BASED_FILE_SYSTEM
484 /* Assume a match on the second char is part of drive specifier. */
485 else if (config.rpath_separator == ':'
489 s = strchr (s + 1, config.rpath_separator);
491 s = path + strlen (path);
494 filename = (char *) xmalloc (s - path + len + 2);
499 memcpy (filename, path, s - path);
500 filename[s - path] = '/';
501 sset = filename + (s - path) + 1;
505 needed.name = filename;
506 if (gld${EMULATION_NAME}_try_needed (&needed, force))
520 if [ "x${USE_LIBPATH}" = xyes ] ; then
523 /* Add the sysroot to every entry in a path separated by
524 config.rpath_separator. */
527 gld${EMULATION_NAME}_add_sysroot (const char *path)
536 if (path[i++] == config.rpath_separator)
542 len = len + (colons + 1) * strlen (ld_sysroot);
543 ret = xmalloc (len + 1);
544 strcpy (ret, ld_sysroot);
545 p = ret + strlen (ret);
548 if (path[i] == config.rpath_separator)
551 strcpy (p, ld_sysroot);
563 *-*-freebsd* | *-*-dragonfly*)
565 /* Read the system search path the FreeBSD way rather than the Linux way. */
566 #ifdef HAVE_ELF_HINTS_H
567 #include <elf-hints.h>
569 #include "elf-hints-local.h"
573 gld${EMULATION_NAME}_check_ld_elf_hints (const struct bfd_link_needed_list *l,
576 static bfd_boolean initialized;
577 static char *ld_elf_hints;
578 struct dt_needed needed;
585 tmppath = concat (ld_sysroot, _PATH_ELF_HINTS, (const char *) NULL);
586 f = fopen (tmppath, FOPEN_RB);
590 struct elfhints_hdr hdr;
592 if (fread (&hdr, 1, sizeof (hdr), f) == sizeof (hdr)
593 && hdr.magic == ELFHINTS_MAGIC
596 if (fseek (f, hdr.strtab + hdr.dirlist, SEEK_SET) != -1)
600 b = xmalloc (hdr.dirlistlen + 1);
601 if (fread (b, 1, hdr.dirlistlen + 1, f) ==
603 ld_elf_hints = gld${EMULATION_NAME}_add_sysroot (b);
614 if (ld_elf_hints == NULL)
618 needed.name = l->name;
619 return gld${EMULATION_NAME}_search_needed (ld_elf_hints, &needed, force);
625 *-*-linux-* | *-*-k*bsd*-* | *-*-gnu*)
627 /* For a native linker, check the file /etc/ld.so.conf for directories
628 in which we may find shared libraries. /etc/ld.so.conf is really
629 only meaningful on Linux. */
631 struct gld${EMULATION_NAME}_ld_so_conf
638 gld${EMULATION_NAME}_parse_ld_so_conf
639 (struct gld${EMULATION_NAME}_ld_so_conf *info, const char *filename);
642 gld${EMULATION_NAME}_parse_ld_so_conf_include
643 (struct gld${EMULATION_NAME}_ld_so_conf *info, const char *filename,
651 if (pattern[0] != '/')
653 char *p = strrchr (filename, '/');
654 size_t patlen = strlen (pattern) + 1;
656 newp = xmalloc (p - filename + 1 + patlen);
657 memcpy (newp, filename, p - filename + 1);
658 memcpy (newp + (p - filename + 1), pattern, patlen);
663 if (glob (pattern, 0, NULL, &gl) == 0)
667 for (i = 0; i < gl.gl_pathc; ++i)
668 gld${EMULATION_NAME}_parse_ld_so_conf (info, gl.gl_pathv[i]);
672 /* If we do not have glob, treat the pattern as a literal filename. */
673 gld${EMULATION_NAME}_parse_ld_so_conf (info, pattern);
681 gld${EMULATION_NAME}_parse_ld_so_conf
682 (struct gld${EMULATION_NAME}_ld_so_conf *info, const char *filename)
684 FILE *f = fopen (filename, FOPEN_RT);
692 line = xmalloc (linelen);
697 /* Normally this would use getline(3), but we need to be portable. */
698 while ((q = fgets (p, linelen - (p - line), f)) != NULL
699 && strlen (q) == linelen - (p - line) - 1
700 && line[linelen - 2] != '\n')
702 line = xrealloc (line, 2 * linelen);
703 p = line + linelen - 1;
707 if (q == NULL && p == line)
710 p = strchr (line, '\n');
714 /* Because the file format does not know any form of quoting we
715 can search forward for the next '#' character and if found
716 make it terminating the line. */
717 p = strchr (line, '#');
721 /* Remove leading whitespace. NUL is no whitespace character. */
723 while (*p == ' ' || *p == '\f' || *p == '\r' || *p == '\t' || *p == '\v')
726 /* If the line is blank it is ignored. */
730 if (CONST_STRNEQ (p, "include") && (p[7] == ' ' || p[7] == '\t'))
736 while (*p == ' ' || *p == '\t')
744 while (*p != ' ' && *p != '\t' && *p)
750 gld${EMULATION_NAME}_parse_ld_so_conf_include (info, filename,
758 while (*p && *p != '=' && *p != ' ' && *p != '\t' && *p != '\f'
759 && *p != '\r' && *p != '\v')
762 while (p != dir && p[-1] == '/')
764 if (info->path == NULL)
766 info->alloc = p - dir + 1 + 256;
767 info->path = xmalloc (info->alloc);
772 if (info->len + 1 + (p - dir) >= info->alloc)
774 info->alloc += p - dir + 256;
775 info->path = xrealloc (info->path, info->alloc);
777 info->path[info->len++] = config.rpath_separator;
779 memcpy (info->path + info->len, dir, p - dir);
780 info->len += p - dir;
781 info->path[info->len] = '\0';
791 gld${EMULATION_NAME}_check_ld_so_conf (const struct bfd_link_needed_list *l,
794 static bfd_boolean initialized;
795 static char *ld_so_conf;
796 struct dt_needed needed;
801 struct gld${EMULATION_NAME}_ld_so_conf info;
804 info.len = info.alloc = 0;
805 tmppath = concat (ld_sysroot, "${prefix}/etc/ld.so.conf",
806 (const char *) NULL);
807 if (!gld${EMULATION_NAME}_parse_ld_so_conf (&info, tmppath))
810 tmppath = concat (ld_sysroot, "/etc/ld.so.conf",
811 (const char *) NULL);
812 gld${EMULATION_NAME}_parse_ld_so_conf (&info, tmppath);
818 char *d = gld${EMULATION_NAME}_add_sysroot (info.path);
825 if (ld_so_conf == NULL)
830 needed.name = l->name;
831 return gld${EMULATION_NAME}_search_needed (ld_so_conf, &needed, force);
841 /* See if an input file matches a DT_NEEDED entry by name. */
844 gld${EMULATION_NAME}_check_needed (lang_input_statement_type *s)
848 /* Stop looking if we've found a loaded lib. */
849 if (global_found != NULL
850 && (bfd_elf_get_dyn_lib_class (global_found->the_bfd)
851 & DYN_AS_NEEDED) == 0)
854 if (s->filename == NULL || s->the_bfd == NULL)
857 /* Don't look for a second non-loaded as-needed lib. */
858 if (global_found != NULL
859 && (bfd_elf_get_dyn_lib_class (s->the_bfd) & DYN_AS_NEEDED) != 0)
862 if (filename_cmp (s->filename, global_needed->name) == 0)
868 if (s->flags.search_dirs)
870 const char *f = strrchr (s->filename, '/');
872 && filename_cmp (f + 1, global_needed->name) == 0)
879 soname = bfd_elf_get_dt_soname (s->the_bfd);
881 && filename_cmp (soname, global_needed->name) == 0)
890 if test x"$LDEMUL_AFTER_OPEN" != xgld"$EMULATION_NAME"_after_open; then
894 id_note_section_size (bfd *abfd ATTRIBUTE_UNUSED)
896 const char *style = emit_note_gnu_build_id;
899 size = offsetof (Elf_External_Note, name[sizeof "GNU"]);
900 size = (size + 3) & -(bfd_size_type) 4;
902 if (!strcmp (style, "md5") || !strcmp (style, "uuid"))
904 else if (!strcmp (style, "sha1"))
906 else if (!strncmp (style, "0x", 2))
908 /* ID is in string form (hex). Convert to bits. */
909 const char *id = style + 2;
912 if (ISXDIGIT (id[0]) && ISXDIGIT (id[1]))
917 else if (*id == '-' || *id == ':')
924 } while (*id != '\0');
933 read_hex (const char xdigit)
935 if (ISDIGIT (xdigit))
937 if (ISUPPER (xdigit))
938 return xdigit - 'A' + 0xa;
939 if (ISLOWER (xdigit))
940 return xdigit - 'a' + 0xa;
946 write_build_id (bfd *abfd)
948 const struct elf_backend_data *bed = get_elf_backend_data (abfd);
949 struct elf_obj_tdata *t = elf_tdata (abfd);
952 Elf_Internal_Shdr *i_shdr;
953 unsigned char *contents, *id_bits;
956 Elf_External_Note *e_note;
957 typedef void (*sum_fn) (const void *, size_t, void *);
959 style = t->o->build_id.style;
960 asec = t->o->build_id.sec;
961 if (bfd_is_abs_section (asec->output_section))
963 einfo (_("%P: warning: .note.gnu.build-id section discarded,"
964 " --build-id ignored.\n"));
967 i_shdr = &elf_section_data (asec->output_section)->this_hdr;
969 if (i_shdr->contents == NULL)
971 if (asec->contents == NULL)
972 asec->contents = (unsigned char *) xmalloc (asec->size);
973 contents = asec->contents;
976 contents = i_shdr->contents + asec->output_offset;
978 e_note = (Elf_External_Note *) contents;
979 size = offsetof (Elf_External_Note, name[sizeof "GNU"]);
980 size = (size + 3) & -(bfd_size_type) 4;
981 id_bits = contents + size;
982 size = asec->size - size;
984 bfd_h_put_32 (abfd, sizeof "GNU", &e_note->namesz);
985 bfd_h_put_32 (abfd, size, &e_note->descsz);
986 bfd_h_put_32 (abfd, NT_GNU_BUILD_ID, &e_note->type);
987 memcpy (e_note->name, "GNU", sizeof "GNU");
989 if (strcmp (style, "md5") == 0)
994 if (!bed->s->checksum_contents (abfd, (sum_fn) &md5_process_bytes, &ctx))
996 md5_finish_ctx (&ctx, id_bits);
998 else if (strcmp (style, "sha1") == 0)
1000 struct sha1_ctx ctx;
1002 sha1_init_ctx (&ctx);
1003 if (!bed->s->checksum_contents (abfd, (sum_fn) &sha1_process_bytes, &ctx))
1005 sha1_finish_ctx (&ctx, id_bits);
1007 else if (strcmp (style, "uuid") == 0)
1010 int fd = open ("/dev/urandom", O_RDONLY);
1013 n = read (fd, id_bits, size);
1018 else if (strncmp (style, "0x", 2) == 0)
1020 /* ID is in string form (hex). Convert to bits. */
1021 const char *id = style + 2;
1025 if (ISXDIGIT (id[0]) && ISXDIGIT (id[1]))
1027 id_bits[n] = read_hex (*id++) << 4;
1028 id_bits[n++] |= read_hex (*id++);
1030 else if (*id == '-' || *id == ':')
1033 abort (); /* Should have been validated earlier. */
1034 } while (*id != '\0');
1037 abort (); /* Should have been validated earlier. */
1039 position = i_shdr->sh_offset + asec->output_offset;
1041 return (bfd_seek (abfd, position, SEEK_SET) == 0
1042 && bfd_bwrite (contents, size, abfd) == size);
1045 /* Make .note.gnu.build-id section, and set up elf_tdata->build_id. */
1048 setup_build_id (bfd *ibfd)
1054 size = id_note_section_size (ibfd);
1057 einfo ("%P: warning: unrecognized --build-id style ignored.\n");
1061 flags = (SEC_ALLOC | SEC_LOAD | SEC_IN_MEMORY
1062 | SEC_LINKER_CREATED | SEC_READONLY | SEC_DATA);
1063 s = bfd_make_section_with_flags (ibfd, ".note.gnu.build-id", flags);
1064 if (s != NULL && bfd_set_section_alignment (ibfd, s, 2))
1066 struct elf_obj_tdata *t = elf_tdata (link_info.output_bfd);
1067 t->o->build_id.after_write_object_contents = &write_build_id;
1068 t->o->build_id.style = emit_note_gnu_build_id;
1069 t->o->build_id.sec = s;
1070 elf_section_type (s) = SHT_NOTE;
1075 einfo ("%P: warning: Cannot create .note.gnu.build-id section,"
1076 " --build-id ignored.\n");
1080 /* This is called after all the input files have been opened. */
1083 gld${EMULATION_NAME}_after_open (void)
1085 struct bfd_link_needed_list *needed, *l;
1086 struct elf_link_hash_table *htab;
1088 after_open_default ();
1090 htab = elf_hash_table (&link_info);
1091 if (!is_elf_hash_table (htab))
1094 if (emit_note_gnu_build_id != NULL)
1098 /* Find an ELF input. */
1099 for (abfd = link_info.input_bfds;
1100 abfd != (bfd *) NULL; abfd = abfd->link_next)
1101 if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
1104 /* PR 10555: If there are no ELF input files do not try to
1105 create a .note.gnu-build-id section. */
1107 || !setup_build_id (abfd))
1109 free ((char *) emit_note_gnu_build_id);
1110 emit_note_gnu_build_id = NULL;
1114 if (link_info.relocatable)
1116 if (link_info.execstack == ! link_info.noexecstack)
1117 /* PR ld/16744: If "-z [no]execstack" has been specified on the
1118 command line and we are perfoming a relocatable link then no
1119 PT_GNU_STACK segment will be created and so the
1120 linkinfo.[no]execstack values set in _handle_option() will have no
1121 effect. Instead we create a .note.GNU-stack section in much the
1122 same way as the assembler does with its --[no]execstack option. */
1123 (void) bfd_make_section_with_flags (link_info.input_bfds,
1125 SEC_READONLY | (link_info.execstack ? SEC_CODE : 0));
1130 if (link_info.eh_frame_hdr
1131 && !link_info.traditional_format)
1133 bfd *abfd, *elfbfd = NULL;
1134 bfd_boolean warn_eh_frame = FALSE;
1137 for (abfd = link_info.input_bfds; abfd; abfd = abfd->link_next)
1139 if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
1143 s = bfd_get_section_by_name (abfd, ".eh_frame");
1146 || bfd_is_abs_section (s->output_section)))
1147 s = bfd_get_next_section_by_name (s);
1148 warn_eh_frame = s != NULL;
1150 if (elfbfd && warn_eh_frame)
1155 const struct elf_backend_data *bed;
1157 bed = get_elf_backend_data (elfbfd);
1158 s = bfd_make_section_with_flags (elfbfd, ".eh_frame_hdr",
1159 bed->dynamic_sec_flags
1162 && bfd_set_section_alignment (elfbfd, s, 2))
1164 htab->eh_info.hdr_sec = s;
1165 warn_eh_frame = FALSE;
1169 einfo ("%P: warning: Cannot create .eh_frame_hdr section,"
1170 " --eh-frame-hdr ignored.\n");
1173 /* Get the list of files which appear in DT_NEEDED entries in
1174 dynamic objects included in the link (often there will be none).
1175 For each such file, we want to track down the corresponding
1176 library, and include the symbol table in the link. This is what
1177 the runtime dynamic linker will do. Tracking the files down here
1178 permits one dynamic object to include another without requiring
1179 special action by the person doing the link. Note that the
1180 needed list can actually grow while we are stepping through this
1182 needed = bfd_elf_get_needed_list (link_info.output_bfd, &link_info);
1183 for (l = needed; l != NULL; l = l->next)
1185 struct bfd_link_needed_list *ll;
1186 struct dt_needed n, nn;
1189 /* If the lib that needs this one was --as-needed and wasn't
1190 found to be needed, then this lib isn't needed either. */
1192 && (bfd_elf_get_dyn_lib_class (l->by) & DYN_AS_NEEDED) != 0)
1195 /* Skip the lib if --no-copy-dt-needed-entries and
1196 --allow-shlib-undefined is in effect. */
1198 && link_info.unresolved_syms_in_shared_libs == RM_IGNORE
1199 && (bfd_elf_get_dyn_lib_class (l->by) & DYN_NO_ADD_NEEDED) != 0)
1202 /* If we've already seen this file, skip it. */
1203 for (ll = needed; ll != l; ll = ll->next)
1205 || (bfd_elf_get_dyn_lib_class (ll->by) & DYN_AS_NEEDED) == 0)
1206 && strcmp (ll->name, l->name) == 0)
1211 /* See if this file was included in the link explicitly. */
1213 global_found = NULL;
1214 lang_for_each_input_file (gld${EMULATION_NAME}_check_needed);
1215 if (global_found != NULL
1216 && (bfd_elf_get_dyn_lib_class (global_found->the_bfd)
1217 & DYN_AS_NEEDED) == 0)
1224 info_msg (_("%s needed by %B\n"), l->name, l->by);
1226 /* As-needed libs specified on the command line (or linker script)
1227 take priority over libs found in search dirs. */
1228 if (global_found != NULL)
1230 nn.name = global_found->filename;
1231 if (gld${EMULATION_NAME}_try_needed (&nn, TRUE))
1235 /* We need to find this file and include the symbol table. We
1236 want to search for the file in the same way that the dynamic
1237 linker will search. That means that we want to use
1238 rpath_link, rpath, then the environment variable
1239 LD_LIBRARY_PATH (native only), then the DT_RPATH/DT_RUNPATH
1240 entries (native only), then the linker script LIB_SEARCH_DIRS.
1241 We do not search using the -L arguments.
1243 We search twice. The first time, we skip objects which may
1244 introduce version mismatches. The second time, we force
1245 their use. See gld${EMULATION_NAME}_vercheck comment. */
1246 for (force = 0; force < 2; force++)
1249 search_dirs_type *search;
1251 if [ "x${NATIVE}" = xyes ] ; then
1253 const char *lib_path;
1256 if [ "x${USE_LIBPATH}" = xyes ] ; then
1258 struct bfd_link_needed_list *rp;
1264 if (gld${EMULATION_NAME}_search_needed (command_line.rpath_link,
1268 if [ "x${USE_LIBPATH}" = xyes ] ; then
1270 if (gld${EMULATION_NAME}_search_needed (command_line.rpath,
1275 if [ "x${NATIVE}" = xyes ] ; then
1277 if (command_line.rpath_link == NULL
1278 && command_line.rpath == NULL)
1280 lib_path = (const char *) getenv ("LD_RUN_PATH");
1281 if (gld${EMULATION_NAME}_search_needed (lib_path, &n,
1285 lib_path = (const char *) getenv ("LD_LIBRARY_PATH");
1286 if (gld${EMULATION_NAME}_search_needed (lib_path, &n, force))
1290 if [ "x${USE_LIBPATH}" = xyes ] ; then
1293 rp = bfd_elf_get_runpath_list (link_info.output_bfd, &link_info);
1294 for (; !found && rp != NULL; rp = rp->next)
1296 char *tmpname = gld${EMULATION_NAME}_add_sysroot (rp->name);
1297 found = (rp->by == l->by
1298 && gld${EMULATION_NAME}_search_needed (tmpname,
1308 if [ "x${USE_LIBPATH}" = xyes ] ; then
1310 *-*-freebsd* | *-*-dragonfly*)
1312 if (gld${EMULATION_NAME}_check_ld_elf_hints (l, force))
1318 *-*-linux-* | *-*-k*bsd*-* | *-*-gnu*)
1320 if (gld${EMULATION_NAME}_check_ld_so_conf (l, force))
1329 len = strlen (l->name);
1330 for (search = search_head; search != NULL; search = search->next)
1334 if (search->cmdline)
1336 filename = (char *) xmalloc (strlen (search->name) + len + 2);
1337 sprintf (filename, "%s/%s", search->name, l->name);
1339 if (gld${EMULATION_NAME}_try_needed (&nn, force))
1352 einfo ("%P: warning: %s, needed by %B, not found (try using -rpath or -rpath-link)\n",
1362 /* Look through an expression for an assignment statement. */
1365 gld${EMULATION_NAME}_find_exp_assignment (etree_type *exp)
1367 bfd_boolean provide = FALSE;
1369 switch (exp->type.node_class)
1372 case etree_provided:
1376 /* We call record_link_assignment even if the symbol is defined.
1377 This is because if it is defined by a dynamic object, we
1378 actually want to use the value defined by the linker script,
1379 not the value from the dynamic object (because we are setting
1380 symbols like etext). If the symbol is defined by a regular
1381 object, then, as it happens, calling record_link_assignment
1383 if (strcmp (exp->assign.dst, ".") != 0)
1385 if (!bfd_elf_record_link_assignment (link_info.output_bfd,
1387 exp->assign.dst, provide,
1388 exp->assign.hidden))
1389 einfo ("%P%F: failed to record assignment to %s: %E\n",
1392 gld${EMULATION_NAME}_find_exp_assignment (exp->assign.src);
1396 gld${EMULATION_NAME}_find_exp_assignment (exp->binary.lhs);
1397 gld${EMULATION_NAME}_find_exp_assignment (exp->binary.rhs);
1401 gld${EMULATION_NAME}_find_exp_assignment (exp->trinary.cond);
1402 gld${EMULATION_NAME}_find_exp_assignment (exp->trinary.lhs);
1403 gld${EMULATION_NAME}_find_exp_assignment (exp->trinary.rhs);
1407 gld${EMULATION_NAME}_find_exp_assignment (exp->unary.child);
1416 /* This is called by the before_allocation routine via
1417 lang_for_each_statement. It locates any assignment statements, and
1418 tells the ELF backend about them, in case they are assignments to
1419 symbols which are referred to by dynamic objects. */
1422 gld${EMULATION_NAME}_find_statement_assignment (lang_statement_union_type *s)
1424 if (s->header.type == lang_assignment_statement_enum)
1425 gld${EMULATION_NAME}_find_exp_assignment (s->assignment_statement.exp);
1430 if test x"$LDEMUL_BEFORE_ALLOCATION" != xgld"$EMULATION_NAME"_before_allocation; then
1431 if test x"${ELF_INTERPRETER_NAME+set}" = xset; then
1432 ELF_INTERPRETER_SET_DEFAULT="
1433 if (sinterp != NULL)
1435 sinterp->contents = (unsigned char *) ${ELF_INTERPRETER_NAME};
1436 sinterp->size = strlen ((char *) sinterp->contents) + 1;
1441 ELF_INTERPRETER_SET_DEFAULT=
1445 /* used by before_allocation and handle_option. */
1447 gld${EMULATION_NAME}_append_to_separated_string (char **to, char *op_arg)
1450 *to = xstrdup (op_arg);
1453 size_t to_len = strlen (*to);
1454 size_t op_arg_len = strlen (op_arg);
1458 /* First see whether OPTARG is already in the path. */
1461 if (strncmp (op_arg, cp, op_arg_len) == 0
1462 && (cp[op_arg_len] == 0
1463 || cp[op_arg_len] == config.rpath_separator))
1467 /* Not yet found. */
1468 cp = strchr (cp, config.rpath_separator);
1476 buf = xmalloc (to_len + op_arg_len + 2);
1477 sprintf (buf, "%s%c%s", *to,
1478 config.rpath_separator, op_arg);
1485 /* This is called after the sections have been attached to output
1486 sections, but before any sizes or addresses have been set. */
1489 gld${EMULATION_NAME}_before_allocation (void)
1494 struct elf_link_hash_entry *ehdr_start = NULL;
1495 struct bfd_link_hash_entry ehdr_start_save = ehdr_start_save;
1497 if (is_elf_hash_table (link_info.hash))
1499 _bfd_elf_tls_setup (link_info.output_bfd, &link_info);
1501 /* Make __ehdr_start hidden if it has been referenced, to
1502 prevent the symbol from being dynamic. */
1503 if (!link_info.relocatable)
1505 struct elf_link_hash_entry *h
1506 = elf_link_hash_lookup (elf_hash_table (&link_info), "__ehdr_start",
1507 FALSE, FALSE, TRUE);
1509 /* Only adjust the export class if the symbol was referenced
1510 and not defined, otherwise leave it alone. */
1512 && (h->root.type == bfd_link_hash_new
1513 || h->root.type == bfd_link_hash_undefined
1514 || h->root.type == bfd_link_hash_undefweak
1515 || h->root.type == bfd_link_hash_common))
1517 _bfd_elf_link_hash_hide_symbol (&link_info, h, TRUE);
1518 if (ELF_ST_VISIBILITY (h->other) != STV_INTERNAL)
1519 h->other = (h->other & ~ELF_ST_VISIBILITY (-1)) | STV_HIDDEN;
1520 /* Don't leave the symbol undefined. Undefined hidden
1521 symbols typically won't have dynamic relocations, but
1522 we most likely will need dynamic relocations for
1523 __ehdr_start if we are building a PIE or shared
1526 ehdr_start_save = h->root;
1527 h->root.type = bfd_link_hash_defined;
1528 h->root.u.def.section = bfd_abs_section_ptr;
1529 h->root.u.def.value = 0;
1533 /* If we are going to make any variable assignments, we need to
1534 let the ELF backend know about them in case the variables are
1535 referred to by dynamic objects. */
1536 lang_for_each_statement (gld${EMULATION_NAME}_find_statement_assignment);
1539 /* Let the ELF backend work out the sizes of any sections required
1540 by dynamic linking. */
1541 rpath = command_line.rpath;
1543 rpath = (const char *) getenv ("LD_RUN_PATH");
1545 for (abfd = link_info.input_bfds; abfd; abfd = abfd->link_next)
1546 if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
1548 const char *audit_libs = elf_dt_audit (abfd);
1550 /* If the input bfd contains an audit entry, we need to add it as
1551 a dep audit entry. */
1552 if (audit_libs && *audit_libs != '\0')
1554 char *cp = xstrdup (audit_libs);
1558 char *cp2 = strchr (cp, config.rpath_separator);
1566 if (cp != NULL && *cp != '\0')
1567 gld${EMULATION_NAME}_append_to_separated_string (&depaudit, cp);
1569 cp = more ? ++cp2 : NULL;
1575 if (! (bfd_elf_size_dynamic_sections
1576 (link_info.output_bfd, command_line.soname, rpath,
1577 command_line.filter_shlib, audit, depaudit,
1578 (const char * const *) command_line.auxiliary_filters,
1579 &link_info, &sinterp)))
1580 einfo ("%P%F: failed to set dynamic section sizes: %E\n");
1582 ${ELF_INTERPRETER_SET_DEFAULT}
1583 /* Let the user override the dynamic linker we are using. */
1584 if (command_line.interpreter != NULL
1587 sinterp->contents = (bfd_byte *) command_line.interpreter;
1588 sinterp->size = strlen (command_line.interpreter) + 1;
1591 /* Look for any sections named .gnu.warning. As a GNU extensions,
1592 we treat such sections as containing warning messages. We print
1593 out the warning message, and then zero out the section size so
1594 that it does not get copied into the output file. */
1597 LANG_FOR_EACH_INPUT_STATEMENT (is)
1604 if (is->flags.just_syms)
1607 s = bfd_get_section_by_name (is->the_bfd, ".gnu.warning");
1612 msg = (char *) xmalloc ((size_t) (sz + 1));
1613 if (! bfd_get_section_contents (is->the_bfd, s, msg,
1615 einfo ("%F%B: Can't read contents of section .gnu.warning: %E\n",
1618 ret = link_info.callbacks->warning (&link_info, msg,
1619 (const char *) NULL,
1620 is->the_bfd, (asection *) NULL,
1625 /* Clobber the section size, so that we don't waste space
1626 copying the warning into the output file. If we've already
1627 sized the output section, adjust its size. The adjustment
1628 is on rawsize because targets that size sections early will
1629 have called lang_reset_memory_regions after sizing. */
1630 if (s->output_section != NULL
1631 && s->output_section->rawsize >= s->size)
1632 s->output_section->rawsize -= s->size;
1636 /* Also set SEC_EXCLUDE, so that local symbols defined in the
1637 warning section don't get copied to the output. */
1638 s->flags |= SEC_EXCLUDE | SEC_KEEP;
1642 before_allocation_default ();
1644 if (!bfd_elf_size_dynsym_hash_dynstr (link_info.output_bfd, &link_info))
1645 einfo ("%P%F: failed to set dynamic section sizes: %E\n");
1647 if (ehdr_start != NULL)
1649 /* If we twiddled __ehdr_start to defined earlier, put it back
1651 ehdr_start->root.type = ehdr_start_save.type;
1652 ehdr_start->root.u = ehdr_start_save.u;
1659 if test x"$LDEMUL_OPEN_DYNAMIC_ARCHIVE" != xgld"$EMULATION_NAME"_open_dynamic_archive; then
1662 /* Try to open a dynamic archive. This is where we know that ELF
1663 dynamic libraries have an extension of .so (or .sl on oddball systems
1667 gld${EMULATION_NAME}_open_dynamic_archive
1668 (const char *arch, search_dirs_type *search, lang_input_statement_type *entry)
1670 const char *filename;
1673 bfd_boolean opened = FALSE;
1675 if (! entry->flags.maybe_archive)
1678 filename = entry->filename;
1679 len = strlen (search->name) + strlen (filename);
1680 if (entry->flags.full_name_provided)
1683 string = (char *) xmalloc (len);
1684 sprintf (string, "%s/%s", search->name, filename);
1690 len += strlen (arch) + sizeof "/lib.so";
1691 #ifdef EXTRA_SHLIB_EXTENSION
1692 xlen = (strlen (EXTRA_SHLIB_EXTENSION) > 3
1693 ? strlen (EXTRA_SHLIB_EXTENSION) - 3
1696 string = (char *) xmalloc (len + xlen);
1697 sprintf (string, "%s/lib%s%s.so", search->name, filename, arch);
1698 #ifdef EXTRA_SHLIB_EXTENSION
1699 /* Try the .so extension first. If that fails build a new filename
1700 using EXTRA_SHLIB_EXTENSION. */
1701 opened = ldfile_try_open_bfd (string, entry);
1703 strcpy (string + len - 4, EXTRA_SHLIB_EXTENSION);
1707 if (!opened && !ldfile_try_open_bfd (string, entry))
1713 entry->filename = string;
1715 /* We have found a dynamic object to include in the link. The ELF
1716 backend linker will create a DT_NEEDED entry in the .dynamic
1717 section naming this file. If this file includes a DT_SONAME
1718 entry, it will be used. Otherwise, the ELF linker will just use
1719 the name of the file. For an archive found by searching, like
1720 this one, the DT_NEEDED entry should consist of just the name of
1721 the file, without the path information used to find it. Note
1722 that we only need to do this if we have a dynamic object; an
1723 archive will never be referenced by a DT_NEEDED entry.
1725 FIXME: This approach--using bfd_elf_set_dt_needed_name--is not
1726 very pretty. I haven't been able to think of anything that is
1728 if (bfd_check_format (entry->the_bfd, bfd_object)
1729 && (entry->the_bfd->flags & DYNAMIC) != 0)
1731 ASSERT (entry->flags.maybe_archive && entry->flags.search_dirs);
1733 /* Rather than duplicating the logic above. Just use the
1734 filename we recorded earlier. */
1736 if (!entry->flags.full_name_provided)
1737 filename = lbasename (entry->filename);
1738 bfd_elf_set_dt_needed_name (entry->the_bfd, filename);
1747 if test x"$LDEMUL_PLACE_ORPHAN" != xgld"$EMULATION_NAME"_place_orphan; then
1750 /* A variant of lang_output_section_find used by place_orphan. */
1752 static lang_output_section_statement_type *
1753 output_rel_find (asection *sec, int isdyn)
1755 lang_output_section_statement_type *lookup;
1756 lang_output_section_statement_type *last = NULL;
1757 lang_output_section_statement_type *last_alloc = NULL;
1758 lang_output_section_statement_type *last_ro_alloc = NULL;
1759 lang_output_section_statement_type *last_rel = NULL;
1760 lang_output_section_statement_type *last_rel_alloc = NULL;
1761 int rela = sec->name[4] == 'a';
1763 for (lookup = &lang_output_section_statement.head->output_section_statement;
1765 lookup = lookup->next)
1767 if (lookup->constraint >= 0
1768 && CONST_STRNEQ (lookup->name, ".rel"))
1770 int lookrela = lookup->name[4] == 'a';
1772 /* .rel.dyn must come before all other reloc sections, to suit
1777 /* Don't place after .rel.plt as doing so results in wrong
1779 if (strcmp (".plt", lookup->name + 4 + lookrela) == 0)
1782 if (rela == lookrela || last_rel == NULL)
1784 if ((rela == lookrela || last_rel_alloc == NULL)
1785 && lookup->bfd_section != NULL
1786 && (lookup->bfd_section->flags & SEC_ALLOC) != 0)
1787 last_rel_alloc = lookup;
1791 if (lookup->bfd_section != NULL
1792 && (lookup->bfd_section->flags & SEC_ALLOC) != 0)
1794 last_alloc = lookup;
1795 if ((lookup->bfd_section->flags & SEC_READONLY) != 0)
1796 last_ro_alloc = lookup;
1801 return last_rel_alloc;
1807 return last_ro_alloc;
1815 /* Place an orphan section. We use this to put random SHF_ALLOC
1816 sections in the right segment. */
1818 static lang_output_section_statement_type *
1819 gld${EMULATION_NAME}_place_orphan (asection *s,
1820 const char *secname,
1823 static struct orphan_save hold[] =
1826 SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_CODE,
1829 SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_DATA,
1832 SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_DATA | SEC_THREAD_LOCAL,
1835 SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_DATA,
1841 SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_DATA,
1844 SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_DATA,
1847 SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_DATA | SEC_SMALL_DATA,
1853 enum orphan_save_index
1865 static int orphan_init_done = 0;
1866 struct orphan_save *place;
1867 lang_output_section_statement_type *after;
1868 lang_output_section_statement_type *os;
1869 lang_output_section_statement_type *match_by_name = NULL;
1871 int iself = s->owner->xvec->flavour == bfd_target_elf_flavour;
1872 unsigned int sh_type = iself ? elf_section_type (s) : SHT_NULL;
1874 if (! link_info.relocatable
1875 && link_info.combreloc
1876 && (s->flags & SEC_ALLOC))
1882 secname = ".rela.dyn";
1886 secname = ".rel.dyn";
1892 else if (CONST_STRNEQ (secname, ".rel"))
1894 secname = secname[4] == 'a' ? ".rela.dyn" : ".rel.dyn";
1899 /* Look through the script to see where to place this section. */
1900 if (constraint == 0)
1901 for (os = lang_output_section_find (secname);
1903 os = next_matching_output_section_statement (os, 0))
1905 /* If we don't match an existing output section, tell
1906 lang_insert_orphan to create a new output section. */
1907 constraint = SPECIAL;
1909 if (os->bfd_section != NULL
1910 && (os->bfd_section->flags == 0
1911 || (_bfd_elf_match_sections_by_type (link_info.output_bfd,
1914 && ((s->flags ^ os->bfd_section->flags)
1915 & (SEC_LOAD | SEC_ALLOC)) == 0)))
1917 /* We already have an output section statement with this
1918 name, and its bfd section has compatible flags.
1919 If the section already exists but does not have any flags
1920 set, then it has been created by the linker, probably as a
1921 result of a --section-start command line switch. */
1922 lang_add_section (&os->children, s, NULL, os);
1926 /* Save unused output sections in case we can match them
1927 against orphans later. */
1928 if (os->bfd_section == NULL)
1932 /* If we didn't match an active output section, see if we matched an
1933 unused one and use that. */
1936 lang_add_section (&match_by_name->children, s, NULL, match_by_name);
1937 return match_by_name;
1940 if (!orphan_init_done)
1942 struct orphan_save *ho;
1944 for (ho = hold; ho < hold + sizeof (hold) / sizeof (hold[0]); ++ho)
1945 if (ho->name != NULL)
1947 ho->os = lang_output_section_find (ho->name);
1948 if (ho->os != NULL && ho->os->flags == 0)
1949 ho->os->flags = ho->flags;
1951 orphan_init_done = 1;
1954 /* If this is a final link, then always put .gnu.warning.SYMBOL
1955 sections into the .text section to get them out of the way. */
1956 if (link_info.executable
1957 && ! link_info.relocatable
1958 && CONST_STRNEQ (s->name, ".gnu.warning.")
1959 && hold[orphan_text].os != NULL)
1961 os = hold[orphan_text].os;
1962 lang_add_section (&os->children, s, NULL, os);
1966 /* Decide which segment the section should go in based on the
1967 section name and section flags. We put loadable .note sections
1968 right after the .interp section, so that the PT_NOTE segment is
1969 stored right after the program headers where the OS can read it
1970 in the first page. */
1973 if ((s->flags & (SEC_ALLOC | SEC_DEBUGGING)) == 0)
1974 place = &hold[orphan_nonalloc];
1975 else if ((s->flags & SEC_ALLOC) == 0)
1977 else if ((s->flags & SEC_LOAD) != 0
1978 && ((iself && sh_type == SHT_NOTE)
1979 || (!iself && CONST_STRNEQ (secname, ".note"))))
1980 place = &hold[orphan_interp];
1981 else if ((s->flags & (SEC_LOAD | SEC_HAS_CONTENTS | SEC_THREAD_LOCAL)) == 0)
1982 place = &hold[orphan_bss];
1983 else if ((s->flags & SEC_SMALL_DATA) != 0)
1984 place = &hold[orphan_sdata];
1985 else if ((s->flags & SEC_THREAD_LOCAL) != 0)
1986 place = &hold[orphan_tdata];
1987 else if ((s->flags & SEC_READONLY) == 0)
1988 place = &hold[orphan_data];
1989 else if (((iself && (sh_type == SHT_RELA || sh_type == SHT_REL))
1990 || (!iself && CONST_STRNEQ (secname, ".rel")))
1991 && (s->flags & SEC_LOAD) != 0)
1992 place = &hold[orphan_rel];
1993 else if ((s->flags & SEC_CODE) == 0)
1994 place = &hold[orphan_rodata];
1996 place = &hold[orphan_text];
2001 if (place->os == NULL)
2003 if (place->name != NULL)
2004 place->os = lang_output_section_find (place->name);
2006 place->os = output_rel_find (s, isdyn);
2010 after = lang_output_section_find_by_flags
2011 (s, &place->os, _bfd_elf_match_sections_by_type);
2013 /* *ABS* is always the first output section statement. */
2014 after = &lang_output_section_statement.head->output_section_statement;
2017 return lang_insert_orphan (s, secname, constraint, after, place, NULL, NULL);
2022 if test x"$LDEMUL_AFTER_ALLOCATION" != xgld"$EMULATION_NAME"_after_allocation; then
2026 gld${EMULATION_NAME}_after_allocation (void)
2028 bfd_boolean need_layout = bfd_elf_discard_info (link_info.output_bfd,
2030 gld${EMULATION_NAME}_map_segments (need_layout);
2035 if test x"$LDEMUL_GET_SCRIPT" != xgld"$EMULATION_NAME"_get_script; then
2039 gld${EMULATION_NAME}_get_script (int *isfile)
2042 if test x"$COMPILE_IN" = xyes
2044 # Scripts compiled in.
2046 # sed commands to quote an ld script as a C string.
2047 sc="-f stringify.sed"
2053 if (link_info.relocatable && config.build_constructors)
2056 sed $sc ldscripts/${EMULATION_NAME}.xu >> e${EMULATION_NAME}.c
2057 echo ' ; else if (link_info.relocatable) return' >> e${EMULATION_NAME}.c
2058 sed $sc ldscripts/${EMULATION_NAME}.xr >> e${EMULATION_NAME}.c
2059 echo ' ; else if (!config.text_read_only) return' >> e${EMULATION_NAME}.c
2060 sed $sc ldscripts/${EMULATION_NAME}.xbn >> e${EMULATION_NAME}.c
2061 if cmp -s ldscripts/${EMULATION_NAME}.x ldscripts/${EMULATION_NAME}.xn; then : ; else
2062 echo ' ; else if (!config.magic_demand_paged) return' >> e${EMULATION_NAME}.c
2063 sed $sc ldscripts/${EMULATION_NAME}.xn >> e${EMULATION_NAME}.c
2065 if test -n "$GENERATE_PIE_SCRIPT" ; then
2066 if test -n "$GENERATE_COMBRELOC_SCRIPT" ; then
2067 echo ' ; else if (link_info.pie && link_info.combreloc' >> e${EMULATION_NAME}.c
2068 echo ' && link_info.relro' >> e${EMULATION_NAME}.c
2069 echo ' && (link_info.flags & DF_BIND_NOW)) return' >> e${EMULATION_NAME}.c
2070 sed $sc ldscripts/${EMULATION_NAME}.xdw >> e${EMULATION_NAME}.c
2071 echo ' ; else if (link_info.pie && link_info.combreloc) return' >> e${EMULATION_NAME}.c
2072 sed $sc ldscripts/${EMULATION_NAME}.xdc >> e${EMULATION_NAME}.c
2074 echo ' ; else if (link_info.pie) return' >> e${EMULATION_NAME}.c
2075 sed $sc ldscripts/${EMULATION_NAME}.xd >> e${EMULATION_NAME}.c
2077 if test -n "$GENERATE_SHLIB_SCRIPT" ; then
2078 if test -n "$GENERATE_COMBRELOC_SCRIPT" ; then
2079 echo ' ; else if (link_info.shared && link_info.combreloc' >> e${EMULATION_NAME}.c
2080 echo ' && link_info.relro' >> e${EMULATION_NAME}.c
2081 echo ' && (link_info.flags & DF_BIND_NOW)) return' >> e${EMULATION_NAME}.c
2082 sed $sc ldscripts/${EMULATION_NAME}.xsw >> e${EMULATION_NAME}.c
2083 echo ' ; else if (link_info.shared && link_info.combreloc) return' >> e${EMULATION_NAME}.c
2084 sed $sc ldscripts/${EMULATION_NAME}.xsc >> e${EMULATION_NAME}.c
2086 echo ' ; else if (link_info.shared) return' >> e${EMULATION_NAME}.c
2087 sed $sc ldscripts/${EMULATION_NAME}.xs >> e${EMULATION_NAME}.c
2089 if test -n "$GENERATE_COMBRELOC_SCRIPT" ; then
2090 echo ' ; else if (link_info.combreloc && link_info.relro' >> e${EMULATION_NAME}.c
2091 echo ' && (link_info.flags & DF_BIND_NOW)) return' >> e${EMULATION_NAME}.c
2092 sed $sc ldscripts/${EMULATION_NAME}.xw >> e${EMULATION_NAME}.c
2093 echo ' ; else if (link_info.combreloc) return' >> e${EMULATION_NAME}.c
2094 sed $sc ldscripts/${EMULATION_NAME}.xc >> e${EMULATION_NAME}.c
2096 echo ' ; else return' >> e${EMULATION_NAME}.c
2097 sed $sc ldscripts/${EMULATION_NAME}.x >> e${EMULATION_NAME}.c
2098 echo '; }' >> e${EMULATION_NAME}.c
2101 # Scripts read from the filesystem.
2107 if (link_info.relocatable && config.build_constructors)
2108 return "ldscripts/${EMULATION_NAME}.xu";
2109 else if (link_info.relocatable)
2110 return "ldscripts/${EMULATION_NAME}.xr";
2111 else if (!config.text_read_only)
2112 return "ldscripts/${EMULATION_NAME}.xbn";
2114 if cmp -s ldscripts/${EMULATION_NAME}.x ldscripts/${EMULATION_NAME}.xn; then :
2117 else if (!config.magic_demand_paged)
2118 return "ldscripts/${EMULATION_NAME}.xn";
2121 if test -n "$GENERATE_PIE_SCRIPT" ; then
2122 if test -n "$GENERATE_COMBRELOC_SCRIPT" ; then
2124 else if (link_info.pie && link_info.combreloc
2125 && link_info.relro && (link_info.flags & DF_BIND_NOW))
2126 return "ldscripts/${EMULATION_NAME}.xdw";
2127 else if (link_info.pie && link_info.combreloc)
2128 return "ldscripts/${EMULATION_NAME}.xdc";
2132 else if (link_info.pie)
2133 return "ldscripts/${EMULATION_NAME}.xd";
2136 if test -n "$GENERATE_SHLIB_SCRIPT" ; then
2137 if test -n "$GENERATE_COMBRELOC_SCRIPT" ; then
2139 else if (link_info.shared && link_info.combreloc
2140 && link_info.relro && (link_info.flags & DF_BIND_NOW))
2141 return "ldscripts/${EMULATION_NAME}.xsw";
2142 else if (link_info.shared && link_info.combreloc)
2143 return "ldscripts/${EMULATION_NAME}.xsc";
2147 else if (link_info.shared)
2148 return "ldscripts/${EMULATION_NAME}.xs";
2151 if test -n "$GENERATE_COMBRELOC_SCRIPT" ; then
2153 else if (link_info.combreloc && link_info.relro
2154 && (link_info.flags & DF_BIND_NOW))
2155 return "ldscripts/${EMULATION_NAME}.xw";
2156 else if (link_info.combreloc)
2157 return "ldscripts/${EMULATION_NAME}.xc";
2162 return "ldscripts/${EMULATION_NAME}.x";
2169 if test -n "$PARSE_AND_LIST_PROLOGUE" ; then
2171 $PARSE_AND_LIST_PROLOGUE
2177 #define OPTION_DISABLE_NEW_DTAGS (400)
2178 #define OPTION_ENABLE_NEW_DTAGS (OPTION_DISABLE_NEW_DTAGS + 1)
2179 #define OPTION_GROUP (OPTION_ENABLE_NEW_DTAGS + 1)
2180 #define OPTION_EH_FRAME_HDR (OPTION_GROUP + 1)
2181 #define OPTION_EXCLUDE_LIBS (OPTION_EH_FRAME_HDR + 1)
2182 #define OPTION_HASH_STYLE (OPTION_EXCLUDE_LIBS + 1)
2183 #define OPTION_BUILD_ID (OPTION_HASH_STYLE + 1)
2184 #define OPTION_AUDIT (OPTION_BUILD_ID + 1)
2187 gld${EMULATION_NAME}_add_options
2188 (int ns, char **shortopts, int nl, struct option **longopts,
2189 int nrl ATTRIBUTE_UNUSED, struct option **really_longopts ATTRIBUTE_UNUSED)
2192 if test x"$GENERATE_SHLIB_SCRIPT" = xyes; then
2194 static const char xtra_short[] = "${PARSE_AND_LIST_SHORTOPTS}z:P:";
2198 static const char xtra_short[] = "${PARSE_AND_LIST_SHORTOPTS}z:";
2202 static const struct option xtra_long[] = {
2204 if test x"$GENERATE_SHLIB_SCRIPT" = xyes; then
2206 {"audit", required_argument, NULL, OPTION_AUDIT},
2207 {"Bgroup", no_argument, NULL, OPTION_GROUP},
2211 {"build-id", optional_argument, NULL, OPTION_BUILD_ID},
2213 if test x"$GENERATE_SHLIB_SCRIPT" = xyes; then
2215 {"depaudit", required_argument, NULL, 'P'},
2216 {"disable-new-dtags", no_argument, NULL, OPTION_DISABLE_NEW_DTAGS},
2217 {"enable-new-dtags", no_argument, NULL, OPTION_ENABLE_NEW_DTAGS},
2218 {"eh-frame-hdr", no_argument, NULL, OPTION_EH_FRAME_HDR},
2219 {"exclude-libs", required_argument, NULL, OPTION_EXCLUDE_LIBS},
2220 {"hash-style", required_argument, NULL, OPTION_HASH_STYLE},
2223 if test -n "$PARSE_AND_LIST_LONGOPTS" ; then
2225 $PARSE_AND_LIST_LONGOPTS
2229 {NULL, no_argument, NULL, 0}
2232 *shortopts = (char *) xrealloc (*shortopts, ns + sizeof (xtra_short));
2233 memcpy (*shortopts + ns, &xtra_short, sizeof (xtra_short));
2234 *longopts = (struct option *)
2235 xrealloc (*longopts, nl * sizeof (struct option) + sizeof (xtra_long));
2236 memcpy (*longopts + nl, &xtra_long, sizeof (xtra_long));
2239 #define DEFAULT_BUILD_ID_STYLE "sha1"
2242 gld${EMULATION_NAME}_handle_option (int optc)
2249 case OPTION_BUILD_ID:
2250 if (emit_note_gnu_build_id != NULL)
2252 free ((char *) emit_note_gnu_build_id);
2253 emit_note_gnu_build_id = NULL;
2256 optarg = DEFAULT_BUILD_ID_STYLE;
2257 if (strcmp (optarg, "none"))
2258 emit_note_gnu_build_id = xstrdup (optarg);
2263 if test x"$GENERATE_SHLIB_SCRIPT" = xyes; then
2266 gld${EMULATION_NAME}_append_to_separated_string (&audit, optarg);
2270 gld${EMULATION_NAME}_append_to_separated_string (&depaudit, optarg);
2273 case OPTION_DISABLE_NEW_DTAGS:
2274 link_info.new_dtags = FALSE;
2277 case OPTION_ENABLE_NEW_DTAGS:
2278 link_info.new_dtags = TRUE;
2281 case OPTION_EH_FRAME_HDR:
2282 link_info.eh_frame_hdr = TRUE;
2286 link_info.flags_1 |= (bfd_vma) DF_1_GROUP;
2287 /* Groups must be self-contained. */
2288 link_info.unresolved_syms_in_objects = RM_GENERATE_ERROR;
2289 link_info.unresolved_syms_in_shared_libs = RM_GENERATE_ERROR;
2292 case OPTION_EXCLUDE_LIBS:
2293 add_excluded_libs (optarg);
2296 case OPTION_HASH_STYLE:
2297 link_info.emit_hash = FALSE;
2298 link_info.emit_gnu_hash = FALSE;
2299 if (strcmp (optarg, "sysv") == 0)
2300 link_info.emit_hash = TRUE;
2301 else if (strcmp (optarg, "gnu") == 0)
2302 link_info.emit_gnu_hash = TRUE;
2303 else if (strcmp (optarg, "both") == 0)
2305 link_info.emit_hash = TRUE;
2306 link_info.emit_gnu_hash = TRUE;
2309 einfo (_("%P%F: invalid hash style \`%s'\n"), optarg);
2316 if (strcmp (optarg, "defs") == 0)
2317 link_info.unresolved_syms_in_objects = RM_GENERATE_ERROR;
2318 else if (strcmp (optarg, "muldefs") == 0)
2319 link_info.allow_multiple_definition = TRUE;
2320 else if (CONST_STRNEQ (optarg, "max-page-size="))
2324 config.maxpagesize = strtoul (optarg + 14, &end, 0);
2325 if (*end || (config.maxpagesize & (config.maxpagesize - 1)) != 0)
2326 einfo (_("%P%F: invalid maxium page size \`%s'\n"),
2329 else if (CONST_STRNEQ (optarg, "common-page-size="))
2332 config.commonpagesize = strtoul (optarg + 17, &end, 0);
2334 || (config.commonpagesize & (config.commonpagesize - 1)) != 0)
2335 einfo (_("%P%F: invalid common page size \`%s'\n"),
2338 else if (CONST_STRNEQ (optarg, "stack-size="))
2341 link_info.stacksize = strtoul (optarg + 11, &end, 0);
2342 if (*end || link_info.stacksize < 0)
2343 einfo (_("%P%F: invalid stack size \`%s'\n"), optarg + 11);
2344 if (!link_info.stacksize)
2345 /* Use -1 for explicit no-stack, because zero means
2347 link_info.stacksize = -1;
2349 else if (strcmp (optarg, "execstack") == 0)
2351 link_info.execstack = TRUE;
2352 link_info.noexecstack = FALSE;
2354 else if (strcmp (optarg, "noexecstack") == 0)
2356 link_info.noexecstack = TRUE;
2357 link_info.execstack = FALSE;
2360 if test x"$GENERATE_SHLIB_SCRIPT" = xyes; then
2362 else if (strcmp (optarg, "global") == 0)
2363 link_info.flags_1 |= (bfd_vma) DF_1_GLOBAL;
2364 else if (strcmp (optarg, "initfirst") == 0)
2365 link_info.flags_1 |= (bfd_vma) DF_1_INITFIRST;
2366 else if (strcmp (optarg, "interpose") == 0)
2367 link_info.flags_1 |= (bfd_vma) DF_1_INTERPOSE;
2368 else if (strcmp (optarg, "loadfltr") == 0)
2369 link_info.flags_1 |= (bfd_vma) DF_1_LOADFLTR;
2370 else if (strcmp (optarg, "nodefaultlib") == 0)
2371 link_info.flags_1 |= (bfd_vma) DF_1_NODEFLIB;
2372 else if (strcmp (optarg, "nodelete") == 0)
2373 link_info.flags_1 |= (bfd_vma) DF_1_NODELETE;
2374 else if (strcmp (optarg, "nodlopen") == 0)
2375 link_info.flags_1 |= (bfd_vma) DF_1_NOOPEN;
2376 else if (strcmp (optarg, "nodump") == 0)
2377 link_info.flags_1 |= (bfd_vma) DF_1_NODUMP;
2378 else if (strcmp (optarg, "now") == 0)
2380 link_info.flags |= (bfd_vma) DF_BIND_NOW;
2381 link_info.flags_1 |= (bfd_vma) DF_1_NOW;
2383 else if (strcmp (optarg, "lazy") == 0)
2385 link_info.flags &= ~(bfd_vma) DF_BIND_NOW;
2386 link_info.flags_1 &= ~(bfd_vma) DF_1_NOW;
2388 else if (strcmp (optarg, "origin") == 0)
2390 link_info.flags |= (bfd_vma) DF_ORIGIN;
2391 link_info.flags_1 |= (bfd_vma) DF_1_ORIGIN;
2393 else if (strcmp (optarg, "combreloc") == 0)
2394 link_info.combreloc = TRUE;
2395 else if (strcmp (optarg, "nocombreloc") == 0)
2396 link_info.combreloc = FALSE;
2397 else if (strcmp (optarg, "nocopyreloc") == 0)
2398 link_info.nocopyreloc = TRUE;
2399 else if (strcmp (optarg, "relro") == 0)
2400 link_info.relro = TRUE;
2401 else if (strcmp (optarg, "norelro") == 0)
2402 link_info.relro = FALSE;
2403 else if (strcmp (optarg, "text") == 0)
2404 link_info.error_textrel = TRUE;
2405 else if (strcmp (optarg, "notext") == 0)
2406 link_info.error_textrel = FALSE;
2407 else if (strcmp (optarg, "textoff") == 0)
2408 link_info.error_textrel = FALSE;
2414 einfo (_("%P: warning: -z %s ignored.\n"), optarg);
2418 if test -n "$PARSE_AND_LIST_ARGS_CASES" ; then
2420 $PARSE_AND_LIST_ARGS_CASES
2432 if test x"$LDEMUL_LIST_OPTIONS" != xgld"$EMULATION_NAME"_list_options; then
2436 gld${EMULATION_NAME}_list_options (FILE * file)
2439 if test x"$GENERATE_SHLIB_SCRIPT" = xyes; then
2442 --audit=AUDITLIB Specify a library to use for auditing\n"));
2444 -Bgroup Selects group name lookup rules for DSO\n"));
2449 --build-id[=STYLE] Generate build ID note\n"));
2451 if test x"$GENERATE_SHLIB_SCRIPT" = xyes; then
2454 -P AUDITLIB, --depaudit=AUDITLIB\n" "\
2455 Specify a library to use for auditing dependencies\n"));
2457 --disable-new-dtags Disable new dynamic tags\n"));
2459 --enable-new-dtags Enable new dynamic tags\n"));
2461 --eh-frame-hdr Create .eh_frame_hdr section\n"));
2463 --exclude-libs=LIBS Make all symbols in LIBS hidden\n"));
2465 --hash-style=STYLE Set hash style to sysv, gnu or both\n"));
2467 -z combreloc Merge dynamic relocs into one section and sort\n"));
2473 -z common-page-size=SIZE Set common page size to SIZE\n"));
2475 -z defs Report unresolved symbols in object files.\n"));
2477 -z execstack Mark executable as requiring executable stack\n"));
2480 if test x"$GENERATE_SHLIB_SCRIPT" = xyes; then
2483 -z global Make symbols in DSO available for subsequently\n\
2484 loaded objects\n"));
2486 -z initfirst Mark DSO to be initialized first at runtime\n"));
2488 -z interpose Mark object to interpose all DSOs but executable\n"));
2490 -z lazy Mark object lazy runtime binding (default)\n"));
2492 -z loadfltr Mark object requiring immediate process\n"));
2498 -z max-page-size=SIZE Set maximum page size to SIZE\n"));
2500 -z muldefs Allow multiple definitions\n"));
2503 if test x"$GENERATE_SHLIB_SCRIPT" = xyes; then
2506 -z nocombreloc Don't merge dynamic relocs into one section\n"));
2508 -z nocopyreloc Don't create copy relocs\n"));
2510 -z nodefaultlib Mark object not to use default search paths\n"));
2512 -z nodelete Mark DSO non-deletable at runtime\n"));
2514 -z nodlopen Mark DSO not available to dlopen\n"));
2516 -z nodump Mark DSO not available to dldump\n"));
2521 -z noexecstack Mark executable as not requiring executable stack\n"));
2523 if test x"$GENERATE_SHLIB_SCRIPT" = xyes; then
2526 -z norelro Don't create RELRO program header\n"));
2528 -z now Mark object non-lazy runtime binding\n"));
2530 -z origin Mark object requiring immediate \$ORIGIN\n\
2531 processing at runtime\n"));
2533 -z relro Create RELRO program header\n"));
2535 -z stacksize=SIZE Set size of stack segment\n"));
2539 if test -n "$PARSE_AND_LIST_OPTIONS" ; then
2541 $PARSE_AND_LIST_OPTIONS
2549 if test -n "$PARSE_AND_LIST_EPILOGUE" ; then
2551 $PARSE_AND_LIST_EPILOGUE
2558 struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
2560 ${LDEMUL_BEFORE_PARSE-gld${EMULATION_NAME}_before_parse},
2561 ${LDEMUL_SYSLIB-syslib_default},
2562 ${LDEMUL_HLL-hll_default},
2563 ${LDEMUL_AFTER_PARSE-after_parse_default},
2564 ${LDEMUL_AFTER_OPEN-gld${EMULATION_NAME}_after_open},
2565 ${LDEMUL_AFTER_ALLOCATION-gld${EMULATION_NAME}_after_allocation},
2566 ${LDEMUL_SET_OUTPUT_ARCH-set_output_arch_default},
2567 ${LDEMUL_CHOOSE_TARGET-ldemul_default_target},
2568 ${LDEMUL_BEFORE_ALLOCATION-gld${EMULATION_NAME}_before_allocation},
2569 ${LDEMUL_GET_SCRIPT-gld${EMULATION_NAME}_get_script},
2570 "${EMULATION_NAME}",
2572 ${LDEMUL_FINISH-finish_default},
2573 ${LDEMUL_CREATE_OUTPUT_SECTION_STATEMENTS-NULL},
2574 ${LDEMUL_OPEN_DYNAMIC_ARCHIVE-gld${EMULATION_NAME}_open_dynamic_archive},
2575 ${LDEMUL_PLACE_ORPHAN-gld${EMULATION_NAME}_place_orphan},
2576 ${LDEMUL_SET_SYMBOLS-NULL},
2577 ${LDEMUL_PARSE_ARGS-NULL},
2578 gld${EMULATION_NAME}_add_options,
2579 gld${EMULATION_NAME}_handle_option,
2580 ${LDEMUL_UNRECOGNIZED_FILE-NULL},
2581 ${LDEMUL_LIST_OPTIONS-gld${EMULATION_NAME}_list_options},
2582 ${LDEMUL_RECOGNIZED_FILE-gld${EMULATION_NAME}_load_symbols},
2583 ${LDEMUL_FIND_POTENTIAL_LIBRARIES-NULL},
2584 ${LDEMUL_NEW_VERS_PATTERN-NULL}