diff options
author | Alan Modra <amodra@gmail.com> | 2002-07-11 01:07:49 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2002-07-11 01:07:49 +0000 |
commit | 7e8d4ab4d1db50fe54dbc90d632c07e98b869d55 (patch) | |
tree | 4e54ea0f9fea57cd4856bcf26e0c27644e6c823f /gas/config/tc-ppc.c | |
parent | 2b3c4602718d2951e30572be3c1c6dcf5defa4fb (diff) | |
download | gdb-7e8d4ab4d1db50fe54dbc90d632c07e98b869d55.zip gdb-7e8d4ab4d1db50fe54dbc90d632c07e98b869d55.tar.gz gdb-7e8d4ab4d1db50fe54dbc90d632c07e98b869d55.tar.bz2 |
* config/tc-ppc.c (ppc_elf_frob_symbol): Delete.
(ppc_frob_file_before_adjust): New function.
* config/tc-ppc.h (tc_frob_symbol): Don't define.
(ppc_elf_frob_symbol): Don't declare.
(tc_frob_file_before_adjust): Define.
(ppc_frob_file_before_adjust): Declare.
Diffstat (limited to 'gas/config/tc-ppc.c')
-rw-r--r-- | gas/config/tc-ppc.c | 48 |
1 files changed, 38 insertions, 10 deletions
diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c index b73d30c..68f8764 100644 --- a/gas/config/tc-ppc.c +++ b/gas/config/tc-ppc.c @@ -1688,21 +1688,49 @@ ppc_elf_validate_fix (fixp, seg) } } -/* Don't emit .TOC. symbol. */ -int -ppc_elf_frob_symbol (sym) - symbolS *sym; +/* Prevent elf_frob_file_before_adjust removing a weak undefined + function descriptor sym if the corresponding code sym is used. */ + +void +ppc_frob_file_before_adjust () { - const char *name; + symbolS *symp; + + if (!ppc_obj64) + return; - name = S_GET_NAME (sym); - if (name != NULL && strcmp (name, ".TOC.") == 0) + for (symp = symbol_rootP; symp; symp = symbol_next (symp)) { - S_CLEAR_EXTERNAL (sym); - return 1; + const char *name; + char *dotname; + symbolS *dotsym; + size_t len; + + name = S_GET_NAME (symp); + if (name[0] == '.') + continue; + + if (! S_IS_WEAK (symp) + || S_IS_DEFINED (symp)) + continue; + + len = strlen (name) + 1; + dotname = xmalloc (len + 1); + dotname[0] = '.'; + memcpy (dotname + 1, name, len); + dotsym = symbol_find (dotname); + free (dotname); + if (dotsym != NULL && (symbol_used_p (dotsym) + || symbol_used_in_reloc_p (dotsym))) + { + symbol_mark_used (symp); + } } - return 0; + /* Don't emit .TOC. symbol. */ + symp = symbol_find (".TOC."); + if (symp != NULL) + symbol_remove (symp, &symbol_rootP, &symbol_lastP); } #endif /* OBJ_ELF */ |