/src/binutils-gdb/bfd/elf-solaris2.c
Line | Count | Source |
1 | | /* Solaris2 link support for BFD. |
2 | | Copyright (C) 2026 Free Software Foundation, Inc. |
3 | | |
4 | | This file is part of BFD, the Binary File Descriptor library. |
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 |
8 | | the Free Software Foundation; either version 3 of the License, or |
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 | | |
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. */ |
20 | | |
21 | | #include "sysdep.h" |
22 | | #include "bfd.h" |
23 | | #include "elf-bfd.h" |
24 | | #include "elf-solaris2.h" |
25 | | |
26 | | /* Global symbols required by the Solaris 2 ABI. */ |
27 | | const char *const elf_solaris2_global_syms[] = { |
28 | | "_DYNAMIC", |
29 | | "_GLOBAL_OFFSET_TABLE_", |
30 | | "_PROCEDURE_LINKAGE_TABLE_", |
31 | | "_edata", |
32 | | "_end", |
33 | | "_etext", |
34 | | NULL |
35 | | }; |
36 | | |
37 | | /* Strip these symbols out of any dynamic library. Their value in a |
38 | | shared library can never be of use in the output executable or |
39 | | shared library being produced by the linker. They will of course |
40 | | be defined relative to the current output, but in the case of a PDE |
41 | | that happens for the first three symbols after loading the first |
42 | | shared library. The trouble with that is that if the first shared |
43 | | library happens to be as-needed, references from crt*.o to those |
44 | | symbols will always make the library seem to be needed. */ |
45 | | bool |
46 | | elf_solaris2_add_symbol_hook (bfd *abfd, |
47 | | struct bfd_link_info *info ATTRIBUTE_UNUSED, |
48 | | Elf_Internal_Sym *isym ATTRIBUTE_UNUSED, |
49 | | const char **name, |
50 | | flagword *flags ATTRIBUTE_UNUSED, |
51 | | asection **sec ATTRIBUTE_UNUSED, |
52 | | bfd_vma *value ATTRIBUTE_UNUSED) |
53 | 0 | { |
54 | 0 | if ((bfd_get_file_flags (abfd) & DYNAMIC) == 0 || *name == NULL) |
55 | 0 | return true; |
56 | | |
57 | 0 | if (is_solaris2_abi_global_sym (*name)) |
58 | 0 | *name = NULL; |
59 | |
|
60 | | return true; |
61 | 0 | } |