| Summary: | OpenSSH 6.7p1 on AIX 7.1 compile issue | ||
|---|---|---|---|
| Product: | Portable OpenSSH | Reporter: | Yannick Bergeron <yaberger> |
| Component: | Build system | Assignee: | Assigned to nobody <unassigned-bugs> |
| Status: | CLOSED FIXED | ||
| Severity: | normal | CC: | aixtools, djm, dtucker, yaberger |
| Priority: | P5 | ||
| Version: | 6.7p1 | ||
| Hardware: | PPC | ||
| OS: | AIX | ||
| Bug Depends on: | |||
| Bug Blocks: | 2360, 2451 | ||
|
Description
Yannick Bergeron
2014-11-15 08:26:36 AEDT
The much easier way is to set CC=xlc before running configure.
By default cc is much closer to c89 (or even pre-c89?) whereas xlc is much closer to c99.
The key difference, as far as va_copy is concerned is that xlc and it's derivatives redefine va_copy into a builtin function.
Test program: va_copy_test.c:
===
#include <stdarg.h>
/*
* test va_copy changes by changing XL C compiler name (cc, c89, c99, xlc)
* and the -E flag
*/
va_copy_test(void *a, void *b)
{
#ifdef _ANSI_C_SOURCE
#ifdef _ISOC99_SOURCE
va_copy(a,b);
#else
fake_ansi_copy(a,b);
#endif
#endif
#ifndef _ANSI_C_SOURCE
fake_noansi_copy(a,b);
#endif
}
===
CC=cc
root@x064:[/data/prj/openbsd/openssh]cc -E va_copy_test.c
#line 62 "/usr/include/va_list.h"
typedef char *va_list;
#line 8 "va_copy_test.c"
va_copy_test(void *a, void *b)
{
#line 13
va_copy(a,b);
#line 21
}
CC=c89
root@x064:[/data/prj/openbsd/openssh]c89 -E va_copy_test.c
#line 62 "/usr/include/va_list.h"
typedef char *va_list;
#line 8 "va_copy_test.c"
va_copy_test(void *a, void *b)
{
#line 15
fake_ansi_copy(a,b);
#line 21
}
CC=c99
root@x064:[/data/prj/openbsd/openssh]c99 -E va_copy_test.c
#line 62 "/usr/include/va_list.h"
typedef char *va_list;
#line 8 "va_copy_test.c"
va_copy_test(void *a, void *b)
{
#line 13
__builtin_va_copy(a,b);
#line 21
}
CC=xlc
root@x064:[/data/prj/openbsd/openssh]xlc -E va_copy_test.c
#line 62 "/usr/include/va_list.h"
typedef char *va_list;
#line 8 "va_copy_test.c"
va_copy_test(void *a, void *b)
{
#line 13
__builtin_va_copy(a,b);
#line 21
}
Although c99 and xlc give the same results - for this - my preference is to use xlc. Review /etc/vac.cfg.?? and compare c99 with xlc and make your choice. Saves you a lot of code changes!
At to list to look at for 6.9p1 Does this still need fixing? Darren committed this last year: Author: Darren Tucker <dtucker@zip.com.au> Date: Thu Jun 12 05:22:49 2014 +1000 - (dtucker) [defines.h] Add va_copy if we don't already have it, taken from openbsd-compat/bsd-asprintf.c --- a/defines.h +++ b/defines.h ... +#ifndef HAVE_VA_COPY +# ifdef HAVE___VA_COPY +# define va_copy(dest, src) __va_copy(dest, src) +# else +# define va_copy(dest, src) (dest) = (src) +# endif +#endif No, not a bug imho - just use the right compiler option - either c99 or xlc.
The key differences in what the different compiler options are - when started by a different can be found in /etc/vac.cfg.NN where NN is 53, 61, or 71 depending your current version of AIX.
For your convenience the key differences are the default options triggered:
* -qlanglvl=extc99 C compiler with common extensions, UNIX headers
xlc: use = DEFLT_C
crt = /lib/crt0.o
mcrt = /lib/mcrt0.o
gcrt = /lib/gcrt0.o
libraries = -L/usr/vac/lib,-lxlopt,-lxlipa,-lxl,-lc
proflibs = -L/lib/profiled,-L/usr/lib/profiled
options = -qlanglvl=extc99,-qcpluscmt,-qkeyword=inline,-qalias=ansi
* C compiler, extended mode
cc: use = DEFLT_C
crt = /lib/crt0.o
mcrt = /lib/mcrt0.o
gcrt = /lib/gcrt0.o
libraries = -L/usr/vac/lib,-lxlopt,-lxlipa,-lxl,-lc
proflibs = -L/lib/profiled,-L/usr/lib/profiled
options = -qlanglvl=extended,-qnoro,-qnoroconst
* Strict ANSI compiler, ANSI headers
c89: use = DEFLT_C
crt = /lib/crt0.o
mcrt = /lib/mcrt0.o
gcrt = /lib/gcrt0.o
libraries = -L/usr/vac/lib,-lxlopt,-lxlipa,-lxl,-lc
proflibs = -L/lib/profiled,-L/usr/lib/profiled
options = -D_ANSI_C_SOURCE,-qalias=ansi,-qnolonglong,-qstrict_induction
* Strict ANSI compiler, ANSI headers
c99: use = DEFLT_C
crt = /lib/crt0.o
mcrt = /lib/mcrt0.o
gcrt = /lib/gcrt0.o
libraries = -L/usr/vac/lib,-lxlopt,-lxlipa,-lxl,-lc
proflibs = -L/lib/profiled,-L/usr/lib/profiled
options = -qlanglvl=stdc99,-D_ANSI_C_SOURCE,-D_ISOC99_SOURCE,-qalias=ansi,-qstrict_induction
If you wanted to be nice you could default cc=xlc (my recommendation) when running ./configure on AIX rather than cc when CC is not defined as an environment variable. This assumes gcc is also not available.
From my examples above showing the result of different ${CC} results both c99 and xlc do va_copy as a built-in - no external reference needed. No new define needed either.
Michael
Move unfinished bugs from 6.9 (how did I miss these?) to 7.1 I've added comment to README.platform with this. I would consider applying a diff to select xlc where $CC is not set however I do not have access to a system with xlc to test it myself. Close all resolved bugs after 7.3p1 release |