* ffsll.c: New file.
* configure.ac: Call AC_REPLACE_FUNCS on ffsll. * gold.h (ffsll): Declare if HAVE_FFSLL is not defined. * ftruncate.c (ftruncate): Declare before definition. * mremap.c (mremap): Likewise. * pread.c (pread): Likewise. * configure, Makefile.in, config.in: Rebuild.
This commit is contained in:
parent
1b31f75d63
commit
fd03461a93
10 changed files with 72 additions and 5 deletions
|
@ -1,5 +1,13 @@
|
||||||
2009-03-27 Ian Lance Taylor <iant@google.com>
|
2009-03-27 Ian Lance Taylor <iant@google.com>
|
||||||
|
|
||||||
|
* ffsll.c: New file.
|
||||||
|
* configure.ac: Call AC_REPLACE_FUNCS on ffsll.
|
||||||
|
* gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
|
||||||
|
* ftruncate.c (ftruncate): Declare before definition.
|
||||||
|
* mremap.c (mremap): Likewise.
|
||||||
|
* pread.c (pread): Likewise.
|
||||||
|
* configure, Makefile.in, config.in: Rebuild.
|
||||||
|
|
||||||
* mremap.c: New file.
|
* mremap.c: New file.
|
||||||
* configure.ac: Call AC_REPLACE_FUNCS on mremap.
|
* configure.ac: Call AC_REPLACE_FUNCS on mremap.
|
||||||
* gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
|
* gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
|
||||||
|
|
|
@ -50,7 +50,8 @@ DIST_COMMON = README $(am__configure_deps) $(srcdir)/../config.guess \
|
||||||
$(srcdir)/../mkinstalldirs $(srcdir)/Makefile.am \
|
$(srcdir)/../mkinstalldirs $(srcdir)/Makefile.am \
|
||||||
$(srcdir)/Makefile.in $(srcdir)/config.in \
|
$(srcdir)/Makefile.in $(srcdir)/config.in \
|
||||||
$(top_srcdir)/configure $(top_srcdir)/po/Make-in ChangeLog \
|
$(top_srcdir)/configure $(top_srcdir)/po/Make-in ChangeLog \
|
||||||
NEWS TODO ftruncate.c mremap.c pread.c yyscript.c yyscript.h
|
NEWS TODO ffsll.c ftruncate.c mremap.c pread.c yyscript.c \
|
||||||
|
yyscript.h
|
||||||
subdir = .
|
subdir = .
|
||||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||||
am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \
|
am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \
|
||||||
|
@ -535,6 +536,7 @@ mostlyclean-compile:
|
||||||
distclean-compile:
|
distclean-compile:
|
||||||
-rm -f *.tab.c
|
-rm -f *.tab.c
|
||||||
|
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/ffsll.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/ftruncate.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/ftruncate.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/mremap.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/mremap.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/pread.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/pread.Po@am__quote@
|
||||||
|
|
|
@ -34,6 +34,9 @@
|
||||||
/* Define to 1 if you have the <ext/hash_set> header file. */
|
/* Define to 1 if you have the <ext/hash_set> header file. */
|
||||||
#undef HAVE_EXT_HASH_SET
|
#undef HAVE_EXT_HASH_SET
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `ffsll' function. */
|
||||||
|
#undef HAVE_FFSLL
|
||||||
|
|
||||||
/* Define to 1 if you have the `ftruncate' function. */
|
/* Define to 1 if you have the `ftruncate' function. */
|
||||||
#undef HAVE_FTRUNCATE
|
#undef HAVE_FTRUNCATE
|
||||||
|
|
||||||
|
|
3
gold/configure
vendored
3
gold/configure
vendored
|
@ -5168,7 +5168,8 @@ done
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for ac_func in pread ftruncate mremap
|
|
||||||
|
for ac_func in pread ftruncate mremap ffsll
|
||||||
do
|
do
|
||||||
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||||
echo "$as_me:$LINENO: checking for $ac_func" >&5
|
echo "$as_me:$LINENO: checking for $ac_func" >&5
|
||||||
|
|
|
@ -312,7 +312,7 @@ LFS_CFLAGS="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
|
||||||
AC_SUBST(LFS_CFLAGS)
|
AC_SUBST(LFS_CFLAGS)
|
||||||
|
|
||||||
AC_CHECK_FUNCS(chsize)
|
AC_CHECK_FUNCS(chsize)
|
||||||
AC_REPLACE_FUNCS(pread ftruncate mremap)
|
AC_REPLACE_FUNCS(pread ftruncate mremap ffsll)
|
||||||
|
|
||||||
# Link in zlib if we can. This allows us to write compressed sections.
|
# Link in zlib if we can. This allows us to write compressed sections.
|
||||||
AC_SEARCH_LIBS(zlibVersion, z, [AC_CHECK_HEADERS(zlib.h)])
|
AC_SEARCH_LIBS(zlibVersion, z, [AC_CHECK_HEADERS(zlib.h)])
|
||||||
|
|
43
gold/ffsll.c
Normal file
43
gold/ffsll.c
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
/* ffsll.c -- version of ffsll for gold. */
|
||||||
|
|
||||||
|
/* Copyright 2009 Free Software Foundation, Inc.
|
||||||
|
Written by Ian Lance Taylor <iant@google.com>.
|
||||||
|
|
||||||
|
This file is part of gold.
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
|
||||||
|
MA 02110-1301, USA. */
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
extern int ffsll (long long);
|
||||||
|
|
||||||
|
/* This file implements ffsll for systems which don't have it. We use
|
||||||
|
ffsll if possible because gcc supports it as a builtin which will
|
||||||
|
use a machine instruction if there is one. */
|
||||||
|
|
||||||
|
int
|
||||||
|
ffsll (long long arg)
|
||||||
|
{
|
||||||
|
unsigned long long i;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = 0;
|
||||||
|
for (i = (unsigned long long) arg; i != 0; i >>= 1)
|
||||||
|
++ret;
|
||||||
|
return ret;
|
||||||
|
}
|
|
@ -9,6 +9,8 @@
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
|
extern int ftruncate (int, off_t);
|
||||||
|
|
||||||
#ifdef F_CHSIZE
|
#ifdef F_CHSIZE
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
|
@ -127,7 +127,11 @@ extern "C" int ftruncate(int, off_t);
|
||||||
|
|
||||||
#ifndef HAVE_MREMAP
|
#ifndef HAVE_MREMAP
|
||||||
#define MREMAP_MAYMOVE 1
|
#define MREMAP_MAYMOVE 1
|
||||||
extern "C" void *mremap (void *, size_t, size_t, int, ...);
|
extern "C" void *mremap(void *, size_t, size_t, int, ...);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef HAVE_FFSLL
|
||||||
|
extern "C" int ffsll(long long);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace gold
|
namespace gold
|
||||||
|
|
|
@ -40,6 +40,8 @@
|
||||||
# define MAP_ANONYMOUS MAP_ANON
|
# define MAP_ANONYMOUS MAP_ANON
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
extern void *mremap (void *, size_t, size_t, int, ...);
|
||||||
|
|
||||||
void *
|
void *
|
||||||
mremap (void *old_address, size_t old_size, size_t new_size,
|
mremap (void *old_address, size_t old_size, size_t new_size,
|
||||||
int flags ATTRIBUTE_UNUSED, ...)
|
int flags ATTRIBUTE_UNUSED, ...)
|
||||||
|
|
|
@ -30,8 +30,10 @@
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
extern ssize_t pread (int, void *, size_t, off_t);
|
||||||
|
|
||||||
ssize_t
|
ssize_t
|
||||||
pread(int fd, void* buf, size_t count, off_t offset)
|
pread (int fd, void *buf, size_t count, off_t offset)
|
||||||
{
|
{
|
||||||
if (lseek(fd, offset, SEEK_SET) != offset)
|
if (lseek(fd, offset, SEEK_SET) != offset)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
Loading…
Reference in a new issue