Message ID | 54DE7467.3060901@ssi-schaefer.com |
---|---|
State | New |
Headers | show |
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/
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:)
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
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/
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
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