1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-15 04:32:24 +00:00

Build fix for Linux i386

iffe feature test that add a -D_LARGEFILE64_SOURCE compiler flag to
detect the presence of 64-bit types like off64_t are very
incorrect; they always find the type even if the rest of the source
is not compiled with that flag, causing an inconsistent compilation
environment. This was the cause of mysterious failures to compile
some feature tests on Linux i386 -- it tried to use an off64_t type
that was wrongly detected.

A flag like -D_LARGEFILE64_SOURCE needs to be added to the compiler
flags consistently so it is used for compiling all files and tests.

src/lib/libast/features/dirent,
src/lib/libast/features/fs,
src/lib/libast/features/lib,
src/lib/libast/features/mmap,
src/cmd/ksh93/features/rlimits:
- Remove the -D_LARGEFILE64_SOURCE flag from all the tests that
  used it.
- Fix some preprocessor directives for compiling without
  _LARGEFILE64_SOURCE. We cannot rely on the result of the _lib_*64
  tests because those functions are still found in glibc even if
  _LARGEFILE64_SOURCE is not defined; we have to check for the
  existence of the type definitions before using them.

src/cmd/INIT/cc.linux.i386,
src/cmd/INIT/cc.linux.i386-icc:
- Add/update compiler wrappers to hardcode -D_LARGEFILE64_SOURCE
  in the flags for the default compiler. If it is overriden with
  $CC, then it needs to be added manually if desired.
This commit is contained in:
Martijn Dekker 2021-01-31 23:47:43 +00:00
parent a1f727749a
commit f37098f177
7 changed files with 31 additions and 24 deletions

View file

@ -0,0 +1,9 @@
: linux.i386 cc wrapper : 2021-01-31 :
HOSTTYPE=linux.i386
case " $* " in
*" -dumpmachine "*) echo $HOSTTYPE; exit ;;
esac
exec /usr/bin/cc -P -D_LARGEFILE64_SOURCE "$@"

View file

@ -1,4 +1,4 @@
: linux.ia64 icc wrapper : 2011-10-18 :
: linux.ia64 icc wrapper : 2021-01-31 :
HOSTTYPE=linux.ia64-icc
@ -19,4 +19,4 @@ case $icc in
esac
;;
esac
$icc "$@"
exec "$icc" -D_LARGEFILE64_SOURCE "$@"

View file

@ -6,17 +6,15 @@ cat{
#if _sys_resource
# include <sys/resource.h>
# if _lib_getrlimit64
# if _lib_getrlimit64 && _typ_rlim64_t
# undef getrlimit
# define getrlimit getrlimit64
# undef setrlimit
# define setrlimit setrlimit64
# if _typ_rlim64_t
# undef rlimit
# define rlimit rlimit64
# undef rlim_t
# define rlim_t rlim64_t
# endif
# undef rlimit
# define rlimit rlimit64
# undef rlim_t
# define rlim_t rlim64_t
# ifdef RLIM64_INFINITY
# undef RLIM_INFINITY
# define RLIM_INFINITY RLIM64_INFINITY

View file

@ -1,8 +1,8 @@
set prototyped
set nodefine
lib stat64 -D_LARGEFILE64_SOURCE
typ off64_t -D_LARGEFILE64_SOURCE
lib stat64
typ off64_t
set define
lib opendir
@ -10,7 +10,7 @@ hdr dirent,ndir
sys dir
nxt dirent
tst botch_d_ino_dirent64 -D_LARGEFILE64_SOURCE note{ dirent64.d_ino vs. readdir64 mismatch }end compile{
tst botch_d_ino_dirent64 note{ dirent64.d_ino vs. readdir64 mismatch }end compile{
#if !__arm__
)
#endif

View file

@ -1,9 +1,9 @@
set prototyped
lib _fxstat,__fxstat,_lxstat,__lxstat,_xmknod,__xmknod,_xstat,__xstat,lstat,mknod,sync sys/types.h sys/stat.h
lib _fxstat64,__fxstat64,_lxstat64,__lxstat64,_xstat64,__xstat64 -D_LARGEFILE64_SOURCE sys/types.h sys/stat.h
lib _fxstat64,__fxstat64,_lxstat64,__lxstat64,_xstat64,__xstat64 sys/types.h sys/stat.h
mac fstat,lstat,stat,mknod sys/types.h sys/stat.h
lcl xstat -D_LARGEFILE64_SOURCE link{
lcl xstat link{
#include <sys/types.h>
#include <sys/stat.h>
struct stat64 { int xxx; }; /* disable if stat64 available */
@ -29,7 +29,7 @@ lcl xstat -D_LARGEFILE64_SOURCE link{
}
}end
lcl xstat64 -D_LARGEFILE64_SOURCE link{
lcl xstat64 link{
#include <sys/types.h>
#include <sys/stat.h>
#if _STD_
@ -211,7 +211,6 @@ cat{
#if _typ_off64_t
#undef off_t
#define off_t off64_t
#endif
#if _lib_statvfs64 && !defined(statvfs)
#define statvfs statvfs64
#if !defined(__USE_LARGEFILE64)
@ -224,6 +223,7 @@ cat{
extern int fstatvfs64(int, struct statvfs64*);
#endif
#endif
#endif /* _typ_off64_t */
}end
str st_fstype sys/types.h sys/stat.h note{ stat.st_fstype is a string }end compile{

View file

@ -37,9 +37,9 @@ lib strchr,strcoll,strdup,strerror,strcasecmp,strncasecmp,strrchr,strstr
lib strmode,strxfrm,strftime,swab,symlink,sysconf,sysinfo,syslog
lib telldir,tmpnam,tzset,universe,unlink,utime,wctype
lib ftruncate,truncate
lib creat64,fstat64,fstatvfs64,ftruncate64 -D_LARGEFILE64_SOURCE
lib lseek64,lstat64 -D_LARGEFILE64_SOURCE
lib open64,readdir64,stat64,statvfs64,truncate64 -D_LARGEFILE64_SOURCE
lib creat64,fstat64,fstatvfs64,ftruncate64
lib lseek64,lstat64
lib open64,readdir64,stat64,statvfs64,truncate64
lib,npt strtod,strtold,strtol,strtoll,strtoul,strtoull stdlib.h
lib,npt sigflag signal.h
@ -53,8 +53,8 @@ mem inheritance.pgroup spawn.h
sys dir,filio,jioctl,localedef,ptem,resource
sys socket,stream,systeminfo,universe,vfork
typ ino64_t,off64_t -D_LARGEFILE64_SOURCE
typ struct.dirent64 -D_LARGEFILE64_SOURCE dirent.h
typ ino64_t,off64_t
typ struct.dirent64 dirent.h
tst tst_errno note{ errno can be assigned }end link{
_BEGIN_EXTERNS_
@ -703,7 +703,7 @@ tst - output{
echo '#error The output block in src/lib/libast/features/lib failed to compile. Rebuild with IFFEFLAGS=-d1 to debug.'
}end
tst no64 -D_LARGEFILE64_SOURCE note{ largefile 64 broken }end execute{
tst no64 note{ largefile 64 broken }end execute{
#include <sys/types.h>
#include <sys/stat.h>
int
@ -726,7 +726,7 @@ tst no64 -D_LARGEFILE64_SOURCE note{ largefile 64 broken }end execute{
echo "#undef _lib_truncate64"
}end
tst need64 -D_LARGEFILE64_SOURCE note{ off64_t necessary }end nocompile{
tst need64 note{ off64_t necessary }end nocompile{
#include <sys/types.h>
typedef off64_t __ast_off64_t__;
typedef off_t __ast_off_t__;

View file

@ -118,7 +118,7 @@ tst lib_mmap note{ standard mmap interface that works }end execute{
}
}end
tst lib_mmap64 -D_LARGEFILE64_SOURCE note{ mmap64 interface and implementation work }end execute{
tst lib_mmap64 note{ mmap64 interface and implementation work }end execute{
#if !_lib_mmap
(
#endif