From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19301 invoked by alias); 24 Feb 2005 00:32:34 -0000 Mailing-List: contact binutils-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sources.redhat.com Received: (qmail 19219 invoked from network); 24 Feb 2005 00:32:21 -0000 Received: from unknown (HELO exchfe2.cs.cornell.edu) (128.84.97.28) by sourceware.org with SMTP; 24 Feb 2005 00:32:21 -0000 Received: from exchfe2.cs.cornell.edu ([128.84.97.28]) by exchfe2.cs.cornell.edu with Microsoft SMTPSVC(6.0.3790.211); Wed, 23 Feb 2005 19:32:08 -0500 Received: from [128.84.99.47] ([128.84.99.47]) by exchfe2.cs.cornell.edu over TLS secured channel with Microsoft SMTPSVC(6.0.3790.211); Wed, 23 Feb 2005 19:32:07 -0500 Message-ID: <421D209E.4060502@cs.cornell.edu> Date: Thu, 24 Feb 2005 10:39:00 -0000 From: Daniel Marques User-Agent: Mozilla Thunderbird 0.8 (Windows/20040913) MIME-Version: 1.0 To: binutils@sources.redhat.com Subject: Proposed patch to objectcopy.c Content-Type: multipart/mixed; boundary="------------020205040706020504080201" X-OriginalArrivalTime: 24 Feb 2005 00:32:07.0624 (UTC) FILETIME=[45651480:01C51A08] X-SW-Source: 2005-02/txt/msg00577.txt.bz2 This is a multi-part message in MIME format. --------------020205040706020504080201 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 809 Hello. I would like to propose the attached patch to objectcopy.c. This patch adds the command-line flag '--globalize-symbol ', which will "force symbol to be marked as global". In effect, it does the inverse of the '--localize-symbol ' flag. As globalizing a symbol is not necessarily safe, usually one would redefine it at the same time: /objcopy --redefine-sym local4=fixed_local4 --globalize-symbol fixed_local4 a.o The order of the relative operations is important. This feature will be useful for "printf-style" debugging of a library from a client. It will be very useful for application-level-checkpointing, when a code intermittently writes its state to disk, and needs to be able to copy the data held in a library. Please let me know what you think. Thanks. Dan --------------020205040706020504080201 Content-Type: text/plain; name="patch.objectcopy" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="patch.objectcopy" Content-length: 2795 Index: objcopy.c =================================================================== RCS file: /cvs/src/src/binutils/objcopy.c,v retrieving revision 1.74 diff -u -r1.74 objcopy.c --- objcopy.c 22 Feb 2005 00:50:06 -0000 1.74 +++ objcopy.c 24 Feb 2005 00:03:23 -0000 @@ -195,6 +195,7 @@ static struct symlist *strip_unneeded_list = NULL; static struct symlist *keep_specific_list = NULL; static struct symlist *localize_specific_list = NULL; +static struct symlist *globalize_specific_list = NULL; static struct symlist *keepglobal_specific_list = NULL; static struct symlist *weaken_specific_list = NULL; static struct redefine_node *redefine_sym_list = NULL; @@ -236,6 +237,7 @@ OPTION_STRIP_UNNEEDED_SYMBOLS, OPTION_KEEP_SYMBOLS, OPTION_LOCALIZE_SYMBOLS, + OPTION_GLOBALIZE_SYMBOL, OPTION_KEEPGLOBAL_SYMBOLS, OPTION_WEAKEN_SYMBOLS, OPTION_RENAME_SECTION, @@ -306,6 +308,7 @@ {"discard-locals", no_argument, 0, 'X'}, {"format", required_argument, 0, 'F'}, /* Obsolete */ {"gap-fill", required_argument, 0, OPTION_GAP_FILL}, + {"globalize-symbol", required_argument, 0, OPTION_GLOBALIZE_SYMBOL}, {"help", no_argument, 0, 'h'}, {"impure", no_argument, 0, OPTION_IMPURE}, {"info", no_argument, 0, OPTION_FORMATS_INFO}, @@ -416,6 +419,7 @@ --only-keep-debug Strip everything but the debug information\n\ -K --keep-symbol Only copy symbol \n\ -L --localize-symbol Force symbol to be marked as a local\n\ + --globalize-symbol Force symbol to be marked as a global\n\ -G --keep-global-symbol Localize all symbols except \n\ -W --weaken-symbol Force symbol to be marked as a weak\n\ --weaken Force all global symbols to be marked as weak\n\ @@ -937,6 +941,12 @@ sym->flags &= ~(BSF_GLOBAL | BSF_WEAK); sym->flags |= BSF_LOCAL; } + if (keep && !undefined && (flags & BSF_LOCAL) + && ( (globalize_specific_list != NULL) && is_specified_symbol (name, globalize_specific_list))) + { + sym->flags &= ~(BSF_LOCAL); + sym->flags |= BSF_GLOBAL; + } if (keep) to[dst_count++] = sym; @@ -1389,6 +1399,7 @@ || strip_specific_list != NULL || keep_specific_list != NULL || localize_specific_list != NULL + || globalize_specific_list != NULL || keepglobal_specific_list != NULL || weaken_specific_list != NULL || prefix_symbols_string @@ -2548,6 +2559,10 @@ add_specific_symbol (optarg, &localize_specific_list); break; + case OPTION_GLOBALIZE_SYMBOL: + add_specific_symbol (optarg, &globalize_specific_list); + break; + case 'G': add_specific_symbol (optarg, &keepglobal_specific_list); break; --------------020205040706020504080201--