Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perl5.005_03, Configure script confused by GNU assembler "-A" (sparc) #1915

Closed
p5pRT opened this issue May 1, 2000 · 3 comments
Closed

perl5.005_03, Configure script confused by GNU assembler "-A" (sparc) #1915

p5pRT opened this issue May 1, 2000 · 3 comments

Comments

@p5pRT
Copy link

p5pRT commented May 1, 2000

Migrated from rt.perl.org#3185 (status was 'resolved')

Searchable as RT3185$

@p5pRT
Copy link
Author

p5pRT commented May 1, 2000

From torek@BSDI.COM

(This is fairly long, so I will pick out the important lines with ==>)

Here is the relevant bit from the Configure script​:

==> for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
  do
  case "\$i" in
  -D*) echo "\$i" | $sed 's/^-D//';;
  -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
  esac
  done

(at or near line 11121 in Configure).

Now, on the i386 running BSD/OS 4.1, "cc -v" produces​:

  Using builtin specs.
  gcc version 2.95.2 19991024 (release)
  /usr/libexec/gcc-2.95.2/i386-unknown-bsdielf4.1/2.95.2/cpp -lang-c -v -D__GNUC__=2 -D__GNUC_MINOR__=95 -Dunix -D__i386__ -Di386 -D__bsdi__ -Dbsdi -D__ELF__ -D__unix__ -D__i386__ -D__i386__ -D__bsdi__ -D__bsdi__ -D__ELF__ -D__unix -D__i386 -D__bsdi -Asystem(unix) -Asystem(bsd) -Acpu(i386) -Amachine(i386) -Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__ tmp.c /var/tmp/ccOBWF5S.i
  GNU CPP version 2.95.2 19991024 (release) (i386 ELF BSD/OS)
  #include "..." search starts here​:
  #include <...> search starts here​:
  /usr/include
  /usr/include
  /usr/include
  End of search list.
  The following default directories have been omitted from the search path​:
  /usr/include/g++
  End of omitted list.
  /usr/libexec/gcc-2.95.2/i386-unknown-bsdielf4.1/2.95.2/cc1 /var/tmp/ccOBWF5S.i -quiet -dumpbase tmp.c -version -o /var/tmp/ccOuzSfK.s
  GNU C version 2.95.2 19991024 (release) (i386-unknown-bsdielf4.1) compiled by GNU C version egcs-2.91.66 19990314 (egcs-1.1.2 release).
==> as -V -Qy -o tmp.o /var/tmp/ccOuzSfK.s
  GNU assembler version 2.9.1 (bsdielf), using BFD version 2.9.1

but on a sparc running the same system, we get​:

  Using builtin specs.
  gcc version 2.95.2 19991024 (release)
  /usr/libexec/gcc-2.95.2/sparc-unknown-bsdielf4.1/2.95.2/cpp -lang-c -v -D__GNUC__=2 -D__GNUC_MINOR__=95 -Dunix -Dsparc -Dbsdi -D__ELF__ -D__unix__ -D__sparc__ -D__bsdi__ -D__ELF__ -D__unix -D__sparc -D__bsdi -Asystem(unix) -Asystem(bsd) -Asystem(posix) -D__SIZE_TYPE__=unsigned int -D__PTRDIFF_TYPE__=int -D__GCC_NEW_VARARGS__ -Acpu(sparc) -Amachine(sparc) tmp.c /tmp/cczE3UYW.i
  GNU CPP version 2.95.2 19991024 (release) (sparc/sparc64 BSD/OS ELF)
  #include "..." search starts here​:
  #include <...> search starts here​:
  /usr/include
  /usr/include
  /usr/include
  End of search list.
  The following default directories have been omitted from the search path​:
  /usr/include/g++
  End of omitted list.
  /usr/libexec/gcc-2.95.2/sparc-unknown-bsdielf4.1/2.95.2/cc1 /tmp/cczE3UYW.i -quiet -dumpbase tmp.c -version -o /tmp/ccqpovFL.s
  GNU C version 2.95.2 19991024 (release) (sparc-unknown-bsdielf4.1) compiled by GNU C version 2.95.2 19991024 (release).
==> as -V -Qy -s -Av8 -o tmp.o /tmp/ccqpovFL.s
  GNU assembler version 2.9.1 (bsdielf), using BFD version 2.9.1

Note that the "as" command asserts "-Av8" to the assembler! This is
the "enable v8 instruction set" flag. (Using other cc flags, gcc
will tell "gas" to use the v7, v8, v8a, v9, or v9a flags, depending
on how inclusive you wish the resulting binary to be, vs how efficient.
By default we now build for V8 SPARC, with kernel emulation for the
missing instructions if anyone runs on a V7 box. Thus -Av8 is not
the only possible -A flag, just the default one.)

For some reason, Configure wants to capture the -Asystem(), -Acpu(),
and -Amachine() directives and turn them into perl defines as well.
Thus, the final output from this part of the Configure process is,
on a sparc running BSD/OS 4.1​:

  Hmm...
  Your C compiler and pre-processor define these symbols​:
  __bsdi__
  __sparc__
  __unix
  __unix__
  bsdi
  sparc
  unix
 
  Your C pre-processor also defines the following symbols​:
  -Av8
  __ELF__
  __GCC_NEW_VARARGS__
  __GNUC_MINOR__=95
  __GNUC__=2
  __PTRDIFF_TYPE__=int
  __SIZE_TYPE__=unsigned
  __bsdi
  __sparc
  cpu=sparc
  machine=sparc
  system=bsd
  system=posix
  system=unix

Of course, it does not define -Av8, nor does it define system= three
different values. (Also, __PTRDIFF_TYPE__ and __SIZE_TYPE__ are
for internal use only and change with different "cc" flags.) I have
no idea why anyone would want to capture the silly System V -A flags
in the first place, but this is what is leading to the bogus -Av8 in
the final output.

This eventually results in h2ph producing a bogus _h2ph_pre.ph​:

  Warning​: Use of "defined" without parens is ambiguous at /usr/libdata/perl5/site_perl/sparc-bsdos/include/_h2ph_pre.ph line 2.
  Bareword found where operator expected at /usr/libdata/perl5/site_perl/sparc-bsdos/include/_h2ph_pre.ph line 2, near "&-Av8"
  (Missing operator before Av8?)
  syntax error at /usr/libdata/perl5/site_perl/sparc-bsdos/include/_h2ph_pre.ph line 2, near "&-Av8"

where line 2 is​:

  unless (defined &-Av8) { sub -Av8() { 1 } }

There are several obvious cures. The "sed" command could be changed
to discard -A flags that have no parentheses, so that the -Av8
disappears. The "cc" line could be changed from "cc -v -c ..." to
"cc -v -S ..." or even "cc -v -E ...". The -A stuff could even be
dropped entirely.

I am not sure which of these fixes to apply, or whether there is
some better alternative. Any suggestions?

Chris

@p5pRT
Copy link
Author

p5pRT commented Apr 19, 2006

From @smpeters

[torek@​BSDI.COM - Mon May 01 03​:14​:00 2000]​:

(This is fairly long, so I will pick out the important lines with ==>)

Here is the relevant bit from the Configure script​:

==> for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
do
case "\$i" in
-D*) echo "\$i" | $sed 's/^-D//';;
-A*) $test "$gccversion" && echo "\$i" | $sed 's/^-
A\(.*\)(\(.*\))/\1=\2/';;
esac
done

(at or near line 11121 in Configure).

Now, on the i386 running BSD/OS 4.1, "cc -v" produces​:

Using builtin specs\.
gcc version 2\.95\.2 19991024 \(release\)
 /usr/libexec/gcc\-2\.95\.2/i386\-unknown\-bsdielf4\.1/2\.95\.2/cpp \-lang\-c

-v -D__GNUC__=2 -D__GNUC_MINOR__=95 -Dunix -D__i386__ -Di386
-D__bsdi__ -Dbsdi -D__ELF__ -D__unix__ -D__i386__ -D__i386__
-D__bsdi__ -D__bsdi__ -D__ELF__ -D__unix -D__i386 -D__bsdi
-Asystem(unix) -Asystem(bsd) -Acpu(i386) -Amachine(i386)
-Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__ tmp.c
/var/tmp/ccOBWF5S.i
GNU CPP version 2.95.2 19991024 (release) (i386 ELF BSD/OS)
#include "..." search starts here​:
#include <...> search starts here​:
/usr/include
/usr/include
/usr/include
End of search list.
The following default directories have been omitted from the search
path​:
/usr/include/g++
End of omitted list.
/usr/libexec/gcc-2.95.2/i386-unknown-bsdielf4.1/2.95.2/cc1
/var/tmp/ccOBWF5S.i -quiet -dumpbase tmp.c -version -o
/var/tmp/ccOuzSfK.s
GNU C version 2.95.2 19991024 (release) (i386-unknown-bsdielf4.1)
compiled by GNU C version egcs-2.91.66 19990314 (egcs-1.1.2
release).
==> as -V -Qy -o tmp.o /var/tmp/ccOuzSfK.s
GNU assembler version 2.9.1 (bsdielf), using BFD version 2.9.1

but on a sparc running the same system, we get​:

Using builtin specs\.
gcc version 2\.95\.2 19991024 \(release\)
 /usr/libexec/gcc\-2\.95\.2/sparc\-unknown\-bsdielf4\.1/2\.95\.2/cpp \-lang\-c

-v -D__GNUC__=2 -D__GNUC_MINOR__=95 -Dunix -Dsparc -Dbsdi -D__ELF__
-D__unix__ -D__sparc__ -D__bsdi__ -D__ELF__ -D__unix -D__sparc
-D__bsdi -Asystem(unix) -Asystem(bsd) -Asystem(posix)
-D__SIZE_TYPE__=unsigned int -D__PTRDIFF_TYPE__=int
-D__GCC_NEW_VARARGS__ -Acpu(sparc) -Amachine(sparc) tmp.c
/tmp/cczE3UYW.i
GNU CPP version 2.95.2 19991024 (release) (sparc/sparc64 BSD/OS ELF)
#include "..." search starts here​:
#include <...> search starts here​:
/usr/include
/usr/include
/usr/include
End of search list.
The following default directories have been omitted from the search
path​:
/usr/include/g++
End of omitted list.
/usr/libexec/gcc-2.95.2/sparc-unknown-bsdielf4.1/2.95.2/cc1
/tmp/cczE3UYW.i -quiet -dumpbase tmp.c -version -o /tmp/ccqpovFL.s
GNU C version 2.95.2 19991024 (release) (sparc-unknown-bsdielf4.1)
compiled by GNU C version 2.95.2 19991024 (release).
==> as -V -Qy -s -Av8 -o tmp.o /tmp/ccqpovFL.s
GNU assembler version 2.9.1 (bsdielf), using BFD version 2.9.1

Note that the "as" command asserts "-Av8" to the assembler! This is
the "enable v8 instruction set" flag. (Using other cc flags, gcc
will tell "gas" to use the v7, v8, v8a, v9, or v9a flags, depending
on how inclusive you wish the resulting binary to be, vs how
efficient.
By default we now build for V8 SPARC, with kernel emulation for the
missing instructions if anyone runs on a V7 box. Thus -Av8 is not
the only possible -A flag, just the default one.)

For some reason, Configure wants to capture the -Asystem(), -Acpu(),
and -Amachine() directives and turn them into perl defines as well.
Thus, the final output from this part of the Configure process is,
on a sparc running BSD/OS 4.1​:

Hmm\.\.\.
Your C compiler and pre\-processor define these symbols&#8203;:
\_\_bsdi\_\_
\_\_sparc\_\_
\_\_unix
\_\_unix\_\_
bsdi
sparc
unix

Your C pre\-processor also defines the following symbols&#8203;:
\-Av8
\_\_ELF\_\_
\_\_GCC\_NEW\_VARARGS\_\_
\_\_GNUC\_MINOR\_\_=95
\_\_GNUC\_\_=2
\_\_PTRDIFF\_TYPE\_\_=int
\_\_SIZE\_TYPE\_\_=unsigned
\_\_bsdi
\_\_sparc
cpu=sparc
machine=sparc
system=bsd
system=posix
system=unix

Of course, it does not define -Av8, nor does it define system= three
different values. (Also, __PTRDIFF_TYPE__ and __SIZE_TYPE__ are
for internal use only and change with different "cc" flags.) I have
no idea why anyone would want to capture the silly System V -A flags
in the first place, but this is what is leading to the bogus -Av8 in
the final output.

This eventually results in h2ph producing a bogus _h2ph_pre.ph​:

Warning&#8203;: Use of "defined" without parens is ambiguous at

/usr/libdata/perl5/site_perl/sparc-bsdos/include/_h2ph_pre.ph line
2.
Bareword found where operator expected at
/usr/libdata/perl5/site_perl/sparc-bsdos/include/_h2ph_pre.ph line
2, near "&-Av8"
(Missing operator before Av8?)
syntax error at /usr/libdata/perl5/site_perl/sparc-
bsdos/include/_h2ph_pre.ph line 2, near "&-Av8"

where line 2 is​:

unless \(defined &\-Av8\) \{ sub \-Av8\(\) \{ 1 \} \}

There are several obvious cures. The "sed" command could be changed
to discard -A flags that have no parentheses, so that the -Av8
disappears. The "cc" line could be changed from "cc -v -c ..." to
"cc -v -S ..." or even "cc -v -E ...". The -A stuff could even be
dropped entirely.

I am not sure which of these fixes to apply, or whether there is
some better alternative. Any suggestions?

This appears to have been fixed with the following change...

Change 16504 by jhi@​alpha on 2002/05/08 22​:51​:54

  Subject​: [ID 20020508.012] with gcc-3.1, Config.pm's
ccsymbols='-Acpu=i386 ...' is bad (esp for _h2ph_pre.ph)
  From​: Pixel <pixel@​mandrakesoft.com>
  Date​: 08 May 2002 18​:19​:51 +0200
  Message-Id​: <ly3cx2wr14.fsf@​leia.mandrakesoft.com>

@p5pRT
Copy link
Author

p5pRT commented Apr 19, 2006

@smpeters - Status changed from 'open' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant