* [PATCH] gas: make S_IS_LOCAL() and S_IS_EXTERNAL() exclusive of one another
@ 2023-08-11 8:07 Jan Beulich
2023-08-16 23:54 ` Alan Modra
0 siblings, 1 reply; 2+ messages in thread
From: Jan Beulich @ 2023-08-11 8:07 UTC (permalink / raw)
To: Binutils
While they aren't opposites of each other, there also shouldn't be any
symbol for which both return true; both may return false. Therefore
use S_IS_EXTERNAL() in S_IS_LOCAL(), thus subsuming the sanity check
which so far both did alike.
--- a/gas/symbols.c
+++ b/gas/symbols.c
@@ -2420,15 +2420,14 @@ S_IS_LOCAL (symbolS *s)
if (s->flags.local_symbol)
return 1;
- flags = s->bsym->flags;
-
- /* Sanity check. */
- if ((flags & BSF_LOCAL) && (flags & BSF_GLOBAL))
- abort ();
+ if (S_IS_EXTERNAL (s))
+ return 0;
if (bfd_asymbol_section (s->bsym) == reg_section)
return 1;
+ flags = s->bsym->flags;
+
if (flag_strip_local_absolute
/* Keep BSF_FILE symbols in order to allow debuggers to identify
the source file even when the object file is stripped. */
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] gas: make S_IS_LOCAL() and S_IS_EXTERNAL() exclusive of one another
2023-08-11 8:07 [PATCH] gas: make S_IS_LOCAL() and S_IS_EXTERNAL() exclusive of one another Jan Beulich
@ 2023-08-16 23:54 ` Alan Modra
0 siblings, 0 replies; 2+ messages in thread
From: Alan Modra @ 2023-08-16 23:54 UTC (permalink / raw)
To: Jan Beulich; +Cc: Binutils
On Fri, Aug 11, 2023 at 10:07:50AM +0200, Jan Beulich via Binutils wrote:
> While they aren't opposites of each other, there also shouldn't be any
> symbol for which both return true; both may return false. Therefore
> use S_IS_EXTERNAL() in S_IS_LOCAL(), thus subsuming the sanity check
> which so far both did alike.
Yes, I agree that S_IS_EXTERNAL and S_IS_LOCAL should not both return
true, and it's good to enforce that here.
> --- a/gas/symbols.c
> +++ b/gas/symbols.c
> @@ -2420,15 +2420,14 @@ S_IS_LOCAL (symbolS *s)
> if (s->flags.local_symbol)
> return 1;
>
> - flags = s->bsym->flags;
> -
> - /* Sanity check. */
> - if ((flags & BSF_LOCAL) && (flags & BSF_GLOBAL))
> - abort ();
> + if (S_IS_EXTERNAL (s))
> + return 0;
>
> if (bfd_asymbol_section (s->bsym) == reg_section)
> return 1;
>
> + flags = s->bsym->flags;
> +
> if (flag_strip_local_absolute
> /* Keep BSF_FILE symbols in order to allow debuggers to identify
> the source file even when the object file is stripped. */
--
Alan Modra
Australia Development Lab, IBM
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-08-16 23:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-11 8:07 [PATCH] gas: make S_IS_LOCAL() and S_IS_EXTERNAL() exclusive of one another Jan Beulich
2023-08-16 23:54 ` Alan Modra
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).