[patch] Fix gas/1948 -- Duplicate .comm symbols

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[patch] Fix gas/1948 -- Duplicate .comm symbols

John David Anglin-4
The enclosed fixes Bug gas/1948 on hppa*-*-hpux*.  Under HP-UX, common
symbols are supposed to only be defined in the $BSS$ subspace in the
$PRIVATE$ space.  There isn't a unique subspace just for common symbols.

In the code in symbols.c that checks for duplicated comm symbols, we
have now_seg = bss_section for the testcase in the bug report.
S_GET_SEGMENT (symbolP) is the BDF segment *COM*.  Thus, we never
enter the hunk of code which accepts redefinition of common symbols.

The fix proposed here is to just check to see if now_seg == bss_section.
Tested on hppa2.0w-hp-hpux11.11.

Ok?

Dave
--
J. David Anglin                                  [hidden email]
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)

2005-12-04  John David Anglin  <[hidden email]>

        Bug gas/1948
        * symbols.c (colon): Check if now_seg is bss_section when the target
        is hppa*-*-hpux*.

Index: symbols.c
===================================================================
RCS file: /cvs/src/src/gas/symbols.c,v
retrieving revision 1.71
diff -u -3 -p -r1.71 symbols.c
--- symbols.c 17 Nov 2005 07:29:28 -0000 1.71
+++ symbols.c 3 Dec 2005 22:18:09 -0000
@@ -376,6 +376,9 @@ colon (/* Just seen "x:" - rattle symbol
     && S_IS_EXTERNAL (symbolP))
    || S_GET_SEGMENT (symbolP) == bss_section)
   && (now_seg == data_section
+#if defined (TC_HPPA) && !(defined (OBJ_ELF) && (defined (TE_LINUX) || defined (TE_NetBSD)))
+      || now_seg == bss_section
+#endif
       || now_seg == S_GET_SEGMENT (symbolP)))
  {
   /* Select which of the 2 cases this is.  */

Reply | Threaded
Open this post in threaded view
|

Re: [patch] Fix gas/1948 -- Duplicate .comm symbols

Alan Modra
On Sun, Dec 04, 2005 at 01:21:58PM -0500, John David Anglin wrote:

> --- symbols.c 17 Nov 2005 07:29:28 -0000 1.71
> +++ symbols.c 3 Dec 2005 22:18:09 -0000
> @@ -376,6 +376,9 @@ colon (/* Just seen "x:" - rattle symbol
>      && S_IS_EXTERNAL (symbolP))
>     || S_GET_SEGMENT (symbolP) == bss_section)
>    && (now_seg == data_section
> +#if defined (TC_HPPA) && !(defined (OBJ_ELF) && (defined (TE_LINUX) || defined (TE_NetBSD)))
> +      || now_seg == bss_section
> +#endif
>        || now_seg == S_GET_SEGMENT (symbolP)))
>   {
>    /* Select which of the 2 cases this is.  */

I don't think you need the #if.

--
Alan Modra
IBM OzLabs - Linux Technology Centre
Reply | Threaded
Open this post in threaded view
|

Re: [patch] Fix gas/1948 -- Duplicate .comm symbols

John David Anglin-4
> I don't think you need the #if.

I removed the #if and rechecked the change on hppa2.0w-hp-hpux11.11.  I
also tested the change with a build and check on hppa-unknown-linux with
no regressions.

Ok?

Dave
--
J. David Anglin                                  [hidden email]
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)

2005-12-04  John David Anglin  <[hidden email]>

        Bug gas/1948
        * symbols.c (colon): Also check if now_seg is bss_section when a symbol
        is being redefined.

Index: symbols.c
===================================================================
RCS file: /cvs/src/src/gas/symbols.c,v
retrieving revision 1.71
diff -u -3 -p -r1.71 symbols.c
--- symbols.c 17 Nov 2005 07:29:28 -0000 1.71
+++ symbols.c 5 Dec 2005 04:01:18 -0000
@@ -376,6 +376,7 @@ colon (/* Just seen "x:" - rattle symbol
     && S_IS_EXTERNAL (symbolP))
    || S_GET_SEGMENT (symbolP) == bss_section)
   && (now_seg == data_section
+      || now_seg == bss_section
       || now_seg == S_GET_SEGMENT (symbolP)))
  {
   /* Select which of the 2 cases this is.  */
Reply | Threaded
Open this post in threaded view
|

Re: [patch] Fix gas/1948 -- Duplicate .comm symbols

Alan Modra
On Sun, Dec 04, 2005 at 11:43:18PM -0500, John David Anglin wrote:
> > I don't think you need the #if.
>
> I removed the #if and rechecked the change on hppa2.0w-hp-hpux11.11.  I
> also tested the change with a build and check on hppa-unknown-linux with
> no regressions.
>
> Ok?

Sure.

--
Alan Modra
IBM OzLabs - Linux Technology Centre