This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH] [objcopy] Return a fatal error when --keep-global-symbol(s) is used with --globalize-symbols, since it is an error prone pattern.
- From: "Jordan Rupprecht via binutils" <binutils at sourceware dot org>
- To: nickc at redhat dot com
- Cc: echristo at gmail dot com, binutils at sourceware dot org, Jordan Rupprecht <rupprecht at google dot com>
- Date: Tue, 9 Oct 2018 14:16:16 -0700
- Subject: [PATCH] [objcopy] Return a fatal error when --keep-global-symbol(s) is used with --globalize-symbols, since it is an error prone pattern.
- Reply-to: Jordan Rupprecht <rupprecht at google dot com>
For more context, see https://sourceware.org/ml/binutils/2018-09/msg00031.html
---
binutils/objcopy.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index 9af3c1eb1b..33ca452e8b 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -4753,6 +4753,8 @@ copy_main (int argc, char *argv[])
bfd_boolean show_version = FALSE;
bfd_boolean change_warn = TRUE;
bfd_boolean formats_info = FALSE;
+ bfd_boolean use_globalize = FALSE;
+ bfd_boolean use_keep_global = FALSE;
int c;
struct stat statbuf;
const bfd_arch_info_type *input_arch = NULL;
@@ -4871,10 +4873,12 @@ copy_main (int argc, char *argv[])
break;
case OPTION_GLOBALIZE_SYMBOL:
+ use_globalize = TRUE;
add_specific_symbol (optarg, globalize_specific_htab);
break;
case 'G':
+ use_keep_global = TRUE;
add_specific_symbol (optarg, keepglobal_specific_htab);
break;
@@ -5306,11 +5310,13 @@ copy_main (int argc, char *argv[])
break;
case OPTION_GLOBALIZE_SYMBOLS:
+ use_globalize = TRUE;
add_specific_symbols (optarg, globalize_specific_htab,
&globalize_specific_buffer);
break;
case OPTION_KEEPGLOBAL_SYMBOLS:
+ use_keep_global = TRUE;
add_specific_symbols (optarg, keepglobal_specific_htab,
&keepglobal_specific_buffer);
break;
@@ -5444,6 +5450,9 @@ copy_main (int argc, char *argv[])
default:
copy_usage (stderr, 1);
}
+ if (use_globalize && use_keep_global)
+ fatal(_("--globalize-symbol(s) may not be used with -G or "
+ "--keep-global-symbol(s)"));
}
if (formats_info)
--
2.19.0.605.g01d371f741-goog