From f81112823f68bcfb92e3a132d405cd2c8c13322a Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Tue, 27 Jul 1999 14:45:44 +0000 Subject: [PATCH] Change to strip out only symbols that start with LOCAL_LABEL_PREFIX followed by 'L'. --- bfd/ChangeLog | 7 +++++++ bfd/coff-arm.c | 39 ++++++++++++++++++++------------------- 2 files changed, 27 insertions(+), 19 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index e013fb5d4e4..27c370263b9 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,10 @@ +1999-07-27 Nick Clifton + + Patch generated by Bernd Schmidt. + + * coff-arm.c (coff_arm_is_local_label_name): Change to strip + out only symbols that start with LOCAL_LABEL_PREFIX followed by 'L'. + 1999-07-23 Donn Terry * libcoff-in.h (coff_link_hash_entry): Add coff_link_hash_flags diff --git a/bfd/coff-arm.c b/bfd/coff-arm.c index 2af1a94fe3f..f50cf8cc026 100644 --- a/bfd/coff-arm.c +++ b/bfd/coff-arm.c @@ -2287,21 +2287,16 @@ coff_arm_copy_private_bfd_data (src, dest) #define USER_LABEL_PREFIX "_" #endif +/* Like _bfd_coff_is_local_label_name, but + a) test against USER_LABEL_PREFIX, to avoid stripping labels known to be + non-local. + b) Allow other prefixes than ".", e.g. an empty prefix would cause all + labels of the form Lxxx to be stripped. */ static boolean coff_arm_is_local_label_name (abfd, name) bfd * abfd ATTRIBUTE_UNUSED; const char * name; { -#ifdef LOCAL_LABEL_PREFIX - /* If there is a prefix for local labels then look for this. - If the prefix exists, but it is empty, then ignore the test. */ - - if (LOCAL_LABEL_PREFIX[0] != 0) - { - if (strncmp (name, LOCAL_LABEL_PREFIX, strlen (LOCAL_LABEL_PREFIX)) == 0) - return true; - } -#endif #ifdef USER_LABEL_PREFIX if (USER_LABEL_PREFIX[0] != 0) { @@ -2309,18 +2304,24 @@ coff_arm_is_local_label_name (abfd, name) return false; } #endif + +#ifdef LOCAL_LABEL_PREFIX + /* If there is a prefix for local labels then look for this. + If the prefix exists, but it is empty, then ignore the test. */ - /* devo/gcc/config/dbxcoff.h defines ASM_OUTPUT_SOURCE_LINE to generate - local line numbers as .LM, so treat these as local. */ - - switch (name[0]) + if (LOCAL_LABEL_PREFIX[0] != 0) { - case 'L': return true; - case '.': return (name[1] == 'L' && name[2] == 'M') ? true : false; - default: return false; /* Cannot make our minds up - default to - false so that it will not be stripped - by accident. */ + int len = strlen (LOCAL_LABEL_PREFIX); + + if (strncmp (name, LOCAL_LABEL_PREFIX, len) != 0) + return false; + + /* Perform the checks below for the rest of the name. */ + name += len; } +#endif + + return name[0] == 'L'; } /* This piece of machinery exists only to guarantee that the bfd that holds -- 2.30.2