public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH PR target/65058] AIX: missing extern decorations "[DS]" for functions and "[RW]" for variables
@ 2015-02-13 22:02 Michael Haubenwallner
  2015-02-14 21:05 ` David Edelsohn
  2015-02-24 21:52 ` Michael Haubenwallner
  0 siblings, 2 replies; 7+ messages in thread
From: Michael Haubenwallner @ 2015-02-13 22:02 UTC (permalink / raw)
  To: GCC Patches; +Cc: David Edelsohn

[-- Attachment #1: Type: text/plain, Size: 114 bytes --]

Hi David,

this is the patch I'm currently testing with gcc-4.8.4 for
http://gcc.gnu.org/PR65058

Thanks!
/haubi/

[-- Attachment #2: 0001-Fix-decorating-referenced-externals-for-xcoff.patch --]
[-- Type: text/x-patch, Size: 2248 bytes --]

From 0f5003fb25608cdae53445777e6a13fec3fbfffc Mon Sep 17 00:00:00 2001
From: Michael Haubenwallner <michael.haubenwallner@ssi-schaefer.com>
Date: Fri, 13 Feb 2015 19:26:27 +0100
Subject: [PATCH 1/5] Fix decorating referenced externals for xcoff.

2015-02-13  Michael Haubenwallner <michael.haubenwallner@ssi-schaefer.com>

	PR target/65058
	* config/rs6000/rs6000.c: (rs6000_output_symbol_ref) Decorate
	referenced external variable or function accordingly.
	* config/rs6000/xcoff.h: (ASM_OUTPUT_EXTERNAL) Stop decorating
	referenced variable or function.
---
 gcc/config/rs6000/rs6000.c | 13 +++++++++++++
 gcc/config/rs6000/xcoff.h  |  9 ---------
 2 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 86ef0fe..15dd25f 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -26030,6 +26030,19 @@ rs6000_output_symbol_ref (FILE *file, rtx x)
      section.  */
   const char *name = XSTR (x, 0);
 
+  tree decl = SYMBOL_REF_DECL (x);
+  if (decl /* sync condition with assemble_external () */
+      && DECL_P (decl) && DECL_EXTERNAL (decl) && TREE_PUBLIC (decl)
+      && (TREE_CODE (decl) == VAR_DECL
+       || TREE_CODE (decl) == FUNCTION_DECL)
+      && name[strlen (name) - 1] != ']')
+    {
+      name = concat (name,
+		     (TREE_CODE (decl) == FUNCTION_DECL
+		      ? "[DS]" : "[RW]"),
+		     NULL);
+      XSTR (x, 0) = name;
+    }									\
   if (VTABLE_NAME_P (name))
     {
       RS6000_OUTPUT_BASENAME (file, name);
diff --git a/gcc/config/rs6000/xcoff.h b/gcc/config/rs6000/xcoff.h
index 6dc1207..db024fc 100644
--- a/gcc/config/rs6000/xcoff.h
+++ b/gcc/config/rs6000/xcoff.h
@@ -170,15 +170,6 @@
       putc ('\n', FILE);						\
       fprintf(FILE, "\t.rename .%s,\".%s\"\n", buffer, NAME);		\
     }									\
-  if ((TREE_CODE (DECL) == VAR_DECL					\
-       || TREE_CODE (DECL) == FUNCTION_DECL)				\
-      && (NAME)[strlen (NAME) - 1] != ']')				\
-    {									\
-      XSTR (_symref, 0) = concat (XSTR (_symref, 0),			\
-				  (TREE_CODE (DECL) == FUNCTION_DECL	\
-				   ? "[DS]" : "[RW]"),			\
-				  NULL);				\
-    }									\
 }
 
 /* This is how to output a reference to a user-level label named NAME.
-- 
2.0.5


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH PR target/65058] AIX: missing extern decorations "[DS]" for functions and "[RW]" for variables
  2015-02-13 22:02 [PATCH PR target/65058] AIX: missing extern decorations "[DS]" for functions and "[RW]" for variables Michael Haubenwallner
@ 2015-02-14 21:05 ` David Edelsohn
  2015-02-17  7:33   ` Michael Haubenwallner
  2015-02-24 21:52 ` Michael Haubenwallner
  1 sibling, 1 reply; 7+ messages in thread
From: David Edelsohn @ 2015-02-14 21:05 UTC (permalink / raw)
  To: Michael Haubenwallner; +Cc: GCC Patches

Hi, Michael

Thanks for noticing this.  This patch generally seems to be on the
right track.  The original ASM_OUTPUT_EXTERNAL code was not completely
correct in the pedantic sense.  It should use [UA] mapping class
instead of [RW] for all non-function descriptor symbols.

This patch also needs a dg-final scan-assembler test to check for [DS]
and [UA] to ensure that this does not regress again in the future.

Thanks, David


On Fri, Feb 13, 2015 at 5:02 PM, Michael Haubenwallner
<michael.haubenwallner@ssi-schaefer.com> wrote:
> Hi David,
>
> this is the patch I'm currently testing with gcc-4.8.4 for
> http://gcc.gnu.org/PR65058
>
> Thanks!
> /haubi/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH PR target/65058] AIX: missing extern decorations "[DS]" for functions and "[RW]" for variables
  2015-02-14 21:05 ` David Edelsohn
@ 2015-02-17  7:33   ` Michael Haubenwallner
  2015-02-17 15:00     ` David Edelsohn
  0 siblings, 1 reply; 7+ messages in thread
From: Michael Haubenwallner @ 2015-02-17  7:33 UTC (permalink / raw)
  To: David Edelsohn; +Cc: GCC Patches

Hi David,

Am 2015-02-14 um 22:05 schrieb David Edelsohn:
> Hi, Michael
> 
> Thanks for noticing this.  This patch generally seems to be on the
> right track.  The original ASM_OUTPUT_EXTERNAL code was not completely
> correct in the pedantic sense.  It should use [UA] mapping class
> instead of [RW] for all non-function descriptor symbols.

One more thought: How is that dollar_inside thing seen in
ASM_OUTPUT_EXTERNAL supposed to work/be used?

> This patch also needs a dg-final scan-assembler test to check for [DS]
> and [UA] to ensure that this does not regress again in the future.

Thanks for committing!

/haubi/ (the one you gave commit access already:)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH PR target/65058] AIX: missing extern decorations "[DS]" for functions and "[RW]" for variables
  2015-02-17  7:33   ` Michael Haubenwallner
@ 2015-02-17 15:00     ` David Edelsohn
  2015-02-17 16:39       ` Michael Haubenwallner
  0 siblings, 1 reply; 7+ messages in thread
From: David Edelsohn @ 2015-02-17 15:00 UTC (permalink / raw)
  To: Michael Haubenwallner; +Cc: GCC Patches

On Tue, Feb 17, 2015 at 2:33 AM, Michael Haubenwallner
<michael.haubenwallner@ssi-schaefer.com> wrote:
> Hi David,
>
> Am 2015-02-14 um 22:05 schrieb David Edelsohn:
>> Hi, Michael
>>
>> Thanks for noticing this.  This patch generally seems to be on the
>> right track.  The original ASM_OUTPUT_EXTERNAL code was not completely
>> correct in the pedantic sense.  It should use [UA] mapping class
>> instead of [RW] for all non-function descriptor symbols.
>
> One more thought: How is that dollar_inside thing seen in
> ASM_OUTPUT_EXTERNAL supposed to work/be used?

AIX XCOFF does not allow $ in label names.  The code is suppose to
substitute underscore "_" in the name and then generate a ".rename"
pseudo-op so the visible name of the symbol is correct.

Thanks, David

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH PR target/65058] AIX: missing extern decorations "[DS]" for functions and "[RW]" for variables
  2015-02-17 15:00     ` David Edelsohn
@ 2015-02-17 16:39       ` Michael Haubenwallner
  2015-02-17 17:28         ` David Edelsohn
  0 siblings, 1 reply; 7+ messages in thread
From: Michael Haubenwallner @ 2015-02-17 16:39 UTC (permalink / raw)
  To: David Edelsohn; +Cc: GCC Patches


Am 2015-02-17 um 16:00 schrieb David Edelsohn:
> On Tue, Feb 17, 2015 at 2:33 AM, Michael Haubenwallner
> <michael.haubenwallner@ssi-schaefer.com> wrote:

>> One more thought: How is that dollar_inside thing seen in
>> ASM_OUTPUT_EXTERNAL supposed to work/be used?
> 
> AIX XCOFF does not allow $ in label names.  The code is suppose to
> substitute underscore "_" in the name and then generate a ".rename"
> pseudo-op so the visible name of the symbol is correct.

Ok - but how to make use of that?
I've tried:

  $ cat dollarfunc.c
  extern void externfunc(void) asm("extern$func");
  void (*localfunc)(void) = externfunc;

  $ gcc -c dollar.c
  Assembler:
  /tmp//ccg2B8d2.s: line 9: 1252-142 Syntax error.
  /tmp//ccg2B8d2.s: line 11: 1252-142 Syntax error.

Is this something that should work already?

Thanks!
/haubi/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH PR target/65058] AIX: missing extern decorations "[DS]" for functions and "[RW]" for variables
  2015-02-17 16:39       ` Michael Haubenwallner
@ 2015-02-17 17:28         ` David Edelsohn
  0 siblings, 0 replies; 7+ messages in thread
From: David Edelsohn @ 2015-02-17 17:28 UTC (permalink / raw)
  To: Michael Haubenwallner; +Cc: GCC Patches

On Tue, Feb 17, 2015 at 11:39 AM, Michael Haubenwallner
<michael.haubenwallner@ssi-schaefer.com> wrote:
>
> Am 2015-02-17 um 16:00 schrieb David Edelsohn:
>> On Tue, Feb 17, 2015 at 2:33 AM, Michael Haubenwallner
>> <michael.haubenwallner@ssi-schaefer.com> wrote:
>
>>> One more thought: How is that dollar_inside thing seen in
>>> ASM_OUTPUT_EXTERNAL supposed to work/be used?
>>
>> AIX XCOFF does not allow $ in label names.  The code is suppose to
>> substitute underscore "_" in the name and then generate a ".rename"
>> pseudo-op so the visible name of the symbol is correct.
>
> Ok - but how to make use of that?
> I've tried:
>
>   $ cat dollarfunc.c
>   extern void externfunc(void) asm("extern$func");
>   void (*localfunc)(void) = externfunc;
>
>   $ gcc -c dollar.c
>   Assembler:
>   /tmp//ccg2B8d2.s: line 9: 1252-142 Syntax error.
>   /tmp//ccg2B8d2.s: line 11: 1252-142 Syntax error.
>
> Is this something that should work already?

It used to work.  Patches welcome.

- David

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH PR target/65058] AIX: missing extern decorations "[DS]" for functions and "[RW]" for variables
  2015-02-13 22:02 [PATCH PR target/65058] AIX: missing extern decorations "[DS]" for functions and "[RW]" for variables Michael Haubenwallner
  2015-02-14 21:05 ` David Edelsohn
@ 2015-02-24 21:52 ` Michael Haubenwallner
  1 sibling, 0 replies; 7+ messages in thread
From: Michael Haubenwallner @ 2015-02-24 21:52 UTC (permalink / raw)
  To: GCC Patches; +Cc: David Edelsohn

[-- Attachment #1: Type: text/plain, Size: 229 bytes --]


Am 2015-02-13 um 23:02 schrieb Michael Haubenwallner:
> Hi David,
> 
> this is the patch I'm currently testing with gcc-4.8.4 for
> http://gcc.gnu.org/PR65058

There's one unused variable now - obvious patch committed.

/haubi/

[-- Attachment #2: 0001-PR-target-65058-Drop-unused-variable.patch --]
[-- Type: text/x-patch, Size: 1382 bytes --]

From bfea87e3e9e84c995a3b678a4c234cd0187a41fe Mon Sep 17 00:00:00 2001
From: haubi <haubi@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Tue, 24 Feb 2015 20:19:54 +0000
Subject: [PATCH] PR target/65058: Drop unused variable.

PR target/65058
* config/rs6000/xcoff.h (ASM_OUTPUT_EXTERNAL): Drop unused variable.


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@220947 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/ChangeLog             | 5 +++++
 gcc/config/rs6000/xcoff.h | 1 -
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 6941bce..f71deca 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2015-02-24  Michael Haubenwallner <michael.haubenwallner@ssi-schaefer.com>
+
+	PR target/65058
+	* config/rs6000/xcoff.h (ASM_OUTPUT_EXTERNAL): Drop unused variable.
+
 2015-02-24  Vladimir Makarov  <vmakarov@redhat.com>
 
 	PR rtl-optimization/65123
diff --git a/gcc/config/rs6000/xcoff.h b/gcc/config/rs6000/xcoff.h
index db024fc..152320b 100644
--- a/gcc/config/rs6000/xcoff.h
+++ b/gcc/config/rs6000/xcoff.h
@@ -155,7 +155,6 @@
 #define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME)				\
 { char *buffer = (char *) alloca (strlen (NAME) + 1);			\
   char *p;								\
-  rtx _symref = XEXP (DECL_RTL (DECL), 0);				\
   int dollar_inside = 0;						\
   strcpy (buffer, NAME);						\
   p = strchr (buffer, '$');						\
-- 
2.0.5


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-02-24 21:13 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-13 22:02 [PATCH PR target/65058] AIX: missing extern decorations "[DS]" for functions and "[RW]" for variables Michael Haubenwallner
2015-02-14 21:05 ` David Edelsohn
2015-02-17  7:33   ` Michael Haubenwallner
2015-02-17 15:00     ` David Edelsohn
2015-02-17 16:39       ` Michael Haubenwallner
2015-02-17 17:28         ` David Edelsohn
2015-02-24 21:52 ` Michael Haubenwallner

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).