[PATCH v4 2/2] bfd: properly use bfd_get_symbol_leading_char in peXXigen.
Jeremy Drake
sourceware-bugzilla@jdrake.com
Tue Apr 1 00:31:14 GMT 2025
This function returns the leading char to use, so we cannot just assume
it will always be '_' or '\0'.
Signed-off-by: Jeremy Drake <sourceware-bugzilla@jdrake.com>
---
bfd/peXXigen.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c
index 2fe643a7b1f..5676acf34bb 100644
--- a/bfd/peXXigen.c
+++ b/bfd/peXXigen.c
@@ -4405,6 +4405,7 @@ _bfd_XXi_final_link_postscript (bfd * abfd, struct coff_final_link_info *pfinfo)
struct coff_link_hash_entry *h1;
struct bfd_link_info *info = pfinfo->info;
bool result = true;
+ char buf[20];
/* There are a few fields that need to be filled in now while we
have symbol table access.
@@ -4542,10 +4543,10 @@ _bfd_XXi_final_link_postscript (bfd * abfd, struct coff_final_link_info *pfinfo)
}
}
- h1 = coff_link_hash_lookup (coff_hash_table (info),
- (bfd_get_symbol_leading_char (abfd) != 0
- ? "__tls_used" : "_tls_used"),
- false, false, true);
+ buf[0] = bfd_get_symbol_leading_char (abfd);
+ buf[1] = '\0';
+ strcat(buf, "_tls_used");
+ h1 = coff_link_hash_lookup (coff_hash_table (info), buf, false, false, true);
if (h1 != NULL)
{
if ((h1->root.type == bfd_link_hash_defined
@@ -4575,10 +4576,10 @@ _bfd_XXi_final_link_postscript (bfd * abfd, struct coff_final_link_info *pfinfo)
#endif
}
- h1 = coff_link_hash_lookup (coff_hash_table (info),
- (bfd_get_symbol_leading_char (abfd) != 0
- ? "__load_config_used" : "_load_config_used"),
- false, false, true);
+ buf[0] = bfd_get_symbol_leading_char (abfd);
+ buf[1] = '\0';
+ strcat(buf, "_load_config_used");
+ h1 = coff_link_hash_lookup (coff_hash_table (info), buf, false, false, true);
if (h1 != NULL)
{
char data[4];
--
2.48.1.windows.1
More information about the Binutils
mailing list