PR27198, segv in S_IS_WEAK
H.J. Lu
hjl.tools@gmail.com
Mon Jan 18 02:44:04 GMT 2021
On Sun, Jan 17, 2021 at 6:33 PM Alan Modra <amodra@gmail.com> wrote:
>
> On Sun, Jan 17, 2021 at 04:40:58PM -0800, H.J. Lu wrote:
> > OK with a testcase to show that the assembler issues an error
> > message.
>
> This is what I'll commit after running regression tests.
> (Apologies for the silly subject line at the start of this thread.)
>
> PR 27198
> * config/tc-i386.c (need_plt32_p): Return FALSE for NULL symbol.
> * testsuite/gas/i386/pr27198.d,
> * gas/testsuite/gas/i386/pr27198.err,
> * gas/testsuite/gas/i386/pr27198.s: New test.
> * gas/testsuite/gas/i386/i386.exp: Run it.
>
> diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
> index a7d2ff1c1f9..b0140e1128a 100644
> --- a/gas/config/tc-i386.c
> +++ b/gas/config/tc-i386.c
> @@ -8628,6 +8628,9 @@ need_plt32_p (symbolS *s)
> if (!object_64bit)
> return FALSE;
>
> + if (s == NULL)
> + return FALSE;
> +
> /* Weak or undefined symbol need PLT32 relocation. */
> if (S_IS_WEAK (s) || !S_IS_DEFINED (s))
> return TRUE;
> diff --git a/gas/testsuite/gas/i386/i386.exp b/gas/testsuite/gas/i386/i386.exp
> index c9bca8ab215..b4a75e4552f 100644
> --- a/gas/testsuite/gas/i386/i386.exp
> +++ b/gas/testsuite/gas/i386/i386.exp
> @@ -1293,6 +1293,7 @@ if [gas_64_check] then {
> }
>
> }
> + run_dump_test pr27198
>
> set ASFLAGS "$old_ASFLAGS --64"
>
> diff --git a/gas/testsuite/gas/i386/pr27198.d b/gas/testsuite/gas/i386/pr27198.d
> new file mode 100644
> index 00000000000..6cf0d547dcd
> --- /dev/null
> +++ b/gas/testsuite/gas/i386/pr27198.d
> @@ -0,0 +1,2 @@
> +#as:
> +#error_output: pr27198.err
> diff --git a/gas/testsuite/gas/i386/pr27198.err b/gas/testsuite/gas/i386/pr27198.err
> new file mode 100644
> index 00000000000..1f71543e1d4
> --- /dev/null
> +++ b/gas/testsuite/gas/i386/pr27198.err
> @@ -0,0 +1,5 @@
> +#failif
> +
> +#...
> +.*Internal error.*
> +#pass
> diff --git a/gas/testsuite/gas/i386/pr27198.s b/gas/testsuite/gas/i386/pr27198.s
> new file mode 100644
> index 00000000000..9ac98982f48
> --- /dev/null
> +++ b/gas/testsuite/gas/i386/pr27198.s
> @@ -0,0 +1 @@
> + call (%rax)junk
>
>
Thanks.
--
H.J.
More information about the Binutils
mailing list