This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH][GOLD] Make gold buildable on OSX


I attached the wrong patch then I forgot to copy to
binutils@sourceware.org when I replied to Ian.  Here is the correct
patch and Ian's approval.  I will commit this after the e-mail.

-Doug

2009/6/22 Ian Lance Taylor <iant@google.com>:
> "Doug Kwan (Ãö®¶¼w)" <dougkwan@google.com> writes:
>
>> Sorry,  this is the correct patch.
>
> This patch is OK.
>
> Thanks.
>
> Please send the actual patch to binutils@sourceware.org if you haven't
> already.
>
> Ian
>
>>
>> -Doug
>>
>> 2009/6/22 Ian Lance Taylor <iant@google.com>:
>>> "Doug Kwan (Ãö®¶¼w)" <dougkwan@google.com> writes:
>>>
>>>> This patch makes gold buildable on OSX for cross-compilation.  This
>>>> has been tested by building and running the testsuite for the
>>>> following host/target combinations:
>>>
>>> I think you attached the wrong patch.  I see a diff to elf32-arm.c.
>>>
>>> Ian
>>>
>>
>> Index: gold/Makefile.am
>> ===================================================================
>> RCS file: /cvs/src/src/gold/Makefile.am,v
>> retrieving revision 1.48
>> diff -u -p -r1.48 Makefile.am
>> --- gold/Makefile.am  5 Jun 2009 21:32:56 -0000       1.48
>> +++ gold/Makefile.am  22 Jun 2009 23:46:19 -0000
>> @@ -131,6 +131,7 @@ ALL_TARGETOBJS = \
>>       arm.$(OBJEXT)
>>
>>  libgold_a_SOURCES = $(CCFILES) $(HFILES) $(YFILES)
>> +libgold_a_LIBADD = $(LIBOBJS)
>>
>>  sources_var = main.cc
>>  deps_var = $(TARGETOBJS) libgold.a $(LIBIBERTY) $(LIBINTL_DEP)
>> @@ -138,8 +139,8 @@ ldadd_var = $(TARGETOBJS) libgold.a $(LI
>>        $(THREADSLIB) $(LIBDL)
>>
>>  ld_new_SOURCES = $(sources_var)
>> -ld_new_DEPENDENCIES = $(deps_var) $(LIBOBJS)
>> -ld_new_LDADD = $(ldadd_var) $(LIBOBJS)
>> +ld_new_DEPENDENCIES = $(deps_var)
>> +ld_new_LDADD = $(ldadd_var)
>>
>>  EXTRA_ld_new_SOURCES = $(TARGETSOURCES)
>>
>> Index: gold/Makefile.in
>> ===================================================================
>> RCS file: /cvs/src/src/gold/Makefile.in,v
>> retrieving revision 1.70
>> diff -u -p -r1.70 Makefile.in
>> --- gold/Makefile.in  22 Jun 2009 06:51:53 -0000      1.70
>> +++ gold/Makefile.in  22 Jun 2009 23:46:19 -0000
>> @@ -74,7 +74,8 @@ LIBRARIES = $(noinst_LIBRARIES)
>>  AR = ar
>>  ARFLAGS = cru
>>  libgold_a_AR = $(AR) $(ARFLAGS)
>> -libgold_a_LIBADD =
>> +am__DEPENDENCIES_1 = @LIBOBJS@
>> +libgold_a_DEPENDENCIES = $(am__DEPENDENCIES_1)
>>  am__objects_1 = archive.$(OBJEXT) binary.$(OBJEXT) common.$(OBJEXT) \
>>       compressed_output.$(OBJEXT) copy-relocs.$(OBJEXT) \
>>       cref.$(OBJEXT) defstd.$(OBJEXT) descriptors.$(OBJEXT) \
>> @@ -99,12 +100,11 @@ PROGRAMS = $(noinst_PROGRAMS)
>>  am__objects_4 = main.$(OBJEXT)
>>  am_ld_new_OBJECTS = $(am__objects_4)
>>  ld_new_OBJECTS = $(am_ld_new_OBJECTS)
>> -am__DEPENDENCIES_1 =
>> -am__DEPENDENCIES_2 = ../libiberty/libiberty.a
>> -am__DEPENDENCIES_3 = $(am__DEPENDENCIES_1) libgold.a \
>> -     $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) \
>> -     $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
>> -am__DEPENDENCIES_4 = @LIBOBJS@
>> +am__DEPENDENCIES_2 =
>> +am__DEPENDENCIES_3 = ../libiberty/libiberty.a
>> +am__DEPENDENCIES_4 = $(am__DEPENDENCIES_2) libgold.a \
>> +     $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_2) \
>> +     $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_2)
>>  am__ld1_SOURCES_DIST = main.cc
>>  @GCC_TRUE@@NATIVE_LINKER_TRUE@am_ld1_OBJECTS = $(am__objects_4)
>>  ld1_OBJECTS = $(am_ld1_OBJECTS)
>> @@ -416,14 +416,15 @@ ALL_TARGETOBJS = \
>>       arm.$(OBJEXT)
>>
>>  libgold_a_SOURCES = $(CCFILES) $(HFILES) $(YFILES)
>> +libgold_a_LIBADD = $(LIBOBJS)
>>  sources_var = main.cc
>>  deps_var = $(TARGETOBJS) libgold.a $(LIBIBERTY) $(LIBINTL_DEP)
>>  ldadd_var = $(TARGETOBJS) libgold.a $(LIBIBERTY) $(LIBINTL) \
>>        $(THREADSLIB) $(LIBDL)
>>
>>  ld_new_SOURCES = $(sources_var)
>> -ld_new_DEPENDENCIES = $(deps_var) $(LIBOBJS)
>> -ld_new_LDADD = $(ldadd_var) $(LIBOBJS)
>> +ld_new_DEPENDENCIES = $(deps_var)
>> +ld_new_LDADD = $(ldadd_var)
>>  EXTRA_ld_new_SOURCES = $(TARGETSOURCES)
>>  POTFILES = $(CCFILES) $(HFILES) $(TARGETSOURCES)
>>  @GCC_TRUE@@NATIVE_LINKER_TRUE@ld1_SOURCES = $(sources_var)
>> Index: gold/config.in
>> ===================================================================
>> RCS file: /cvs/src/src/gold/config.in,v
>> retrieving revision 1.23
>> diff -u -p -r1.23 config.in
>> --- gold/config.in    15 May 2009 18:32:13 -0000      1.23
>> +++ gold/config.in    22 Jun 2009 23:46:19 -0000
>> @@ -39,10 +39,18 @@
>>  /* Define to 1 if you have the declaration of `ffs', and to 0 if you don't. */
>>  #undef HAVE_DECL_FFS
>>
>> +/* Define to 1 if you have the declaration of `memmem', and to 0 if you
>> +   don't. */
>> +#undef HAVE_DECL_MEMMEM
>> +
>>  /* Define to 1 if you have the declaration of `snprintf', and to 0 if you
>>     don't. */
>>  #undef HAVE_DECL_SNPRINTF
>>
>> +/* Define to 1 if you have the declaration of `strndup', and to 0 if you
>> +   don't. */
>> +#undef HAVE_DECL_STRNDUP
>> +
>>  /* Define to 1 if you have the declaration of `strverscmp', and to 0 if you
>>     don't. */
>>  #undef HAVE_DECL_STRVERSCMP
>> Index: gold/configure
>> ===================================================================
>> RCS file: /cvs/src/src/gold/configure,v
>> retrieving revision 1.45
>> diff -u -p -r1.45 configure
>> --- gold/configure    22 Jun 2009 06:51:53 -0000      1.45
>> +++ gold/configure    22 Jun 2009 23:46:19 -0000
>> @@ -7355,6 +7355,146 @@ _ACEOF
>>
>>
>>  fi
>> +echo "$as_me:$LINENO: checking whether strndup is declared" >&5
>> +echo $ECHO_N "checking whether strndup is declared... $ECHO_C" >&6
>> +if test "${ac_cv_have_decl_strndup+set}" = set; then
>> +  echo $ECHO_N "(cached) $ECHO_C" >&6
>> +else
>> +  cat >conftest.$ac_ext <<_ACEOF
>> +/* confdefs.h.  */
>> +_ACEOF
>> +cat confdefs.h >>conftest.$ac_ext
>> +cat >>conftest.$ac_ext <<_ACEOF
>> +/* end confdefs.h.  */
>> +$ac_includes_default
>> +int
>> +main ()
>> +{
>> +#ifndef strndup
>> +  char *p = (char *) strndup;
>> +#endif
>> +
>> +  ;
>> +  return 0;
>> +}
>> +_ACEOF
>> +rm -f conftest.$ac_objext
>> +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
>> +  (eval $ac_compile) 2>conftest.er1
>> +  ac_status=$?
>> +  grep -v '^ *+' conftest.er1 >conftest.err
>> +  rm -f conftest.er1
>> +  cat conftest.err >&5
>> +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
>> +  (exit $ac_status); } &&
>> +      { ac_try='test -z "$ac_cxx_werror_flag"
>> +                      || test ! -s conftest.err'
>> +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
>> +  (eval $ac_try) 2>&5
>> +  ac_status=$?
>> +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
>> +  (exit $ac_status); }; } &&
>> +      { ac_try='test -s conftest.$ac_objext'
>> +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
>> +  (eval $ac_try) 2>&5
>> +  ac_status=$?
>> +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
>> +  (exit $ac_status); }; }; then
>> +  ac_cv_have_decl_strndup=yes
>> +else
>> +  echo "$as_me: failed program was:" >&5
>> +sed 's/^/| /' conftest.$ac_ext >&5
>> +
>> +ac_cv_have_decl_strndup=no
>> +fi
>> +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
>> +fi
>> +echo "$as_me:$LINENO: result: $ac_cv_have_decl_strndup" >&5
>> +echo "${ECHO_T}$ac_cv_have_decl_strndup" >&6
>> +if test $ac_cv_have_decl_strndup = yes; then
>> +
>> +cat >>confdefs.h <<_ACEOF
>> +#define HAVE_DECL_STRNDUP 1
>> +_ACEOF
>> +
>> +
>> +else
>> +  cat >>confdefs.h <<_ACEOF
>> +#define HAVE_DECL_STRNDUP 0
>> +_ACEOF
>> +
>> +
>> +fi
>> +echo "$as_me:$LINENO: checking whether memmem is declared" >&5
>> +echo $ECHO_N "checking whether memmem is declared... $ECHO_C" >&6
>> +if test "${ac_cv_have_decl_memmem+set}" = set; then
>> +  echo $ECHO_N "(cached) $ECHO_C" >&6
>> +else
>> +  cat >conftest.$ac_ext <<_ACEOF
>> +/* confdefs.h.  */
>> +_ACEOF
>> +cat confdefs.h >>conftest.$ac_ext
>> +cat >>conftest.$ac_ext <<_ACEOF
>> +/* end confdefs.h.  */
>> +$ac_includes_default
>> +int
>> +main ()
>> +{
>> +#ifndef memmem
>> +  char *p = (char *) memmem;
>> +#endif
>> +
>> +  ;
>> +  return 0;
>> +}
>> +_ACEOF
>> +rm -f conftest.$ac_objext
>> +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
>> +  (eval $ac_compile) 2>conftest.er1
>> +  ac_status=$?
>> +  grep -v '^ *+' conftest.er1 >conftest.err
>> +  rm -f conftest.er1
>> +  cat conftest.err >&5
>> +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
>> +  (exit $ac_status); } &&
>> +      { ac_try='test -z "$ac_cxx_werror_flag"
>> +                      || test ! -s conftest.err'
>> +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
>> +  (eval $ac_try) 2>&5
>> +  ac_status=$?
>> +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
>> +  (exit $ac_status); }; } &&
>> +      { ac_try='test -s conftest.$ac_objext'
>> +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
>> +  (eval $ac_try) 2>&5
>> +  ac_status=$?
>> +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
>> +  (exit $ac_status); }; }; then
>> +  ac_cv_have_decl_memmem=yes
>> +else
>> +  echo "$as_me: failed program was:" >&5
>> +sed 's/^/| /' conftest.$ac_ext >&5
>> +
>> +ac_cv_have_decl_memmem=no
>> +fi
>> +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
>> +fi
>> +echo "$as_me:$LINENO: result: $ac_cv_have_decl_memmem" >&5
>> +echo "${ECHO_T}$ac_cv_have_decl_memmem" >&6
>> +if test $ac_cv_have_decl_memmem = yes; then
>> +
>> +cat >>confdefs.h <<_ACEOF
>> +#define HAVE_DECL_MEMMEM 1
>> +_ACEOF
>> +
>> +
>> +else
>> +  cat >>confdefs.h <<_ACEOF
>> +#define HAVE_DECL_MEMMEM 0
>> +_ACEOF
>> +
>> +
>> +fi
>>
>>
>>
>> Index: gold/configure.ac
>> ===================================================================
>> RCS file: /cvs/src/src/gold/configure.ac,v
>> retrieving revision 1.44
>> diff -u -p -r1.44 configure.ac
>> --- gold/configure.ac 22 Jun 2009 06:51:53 -0000      1.44
>> +++ gold/configure.ac 22 Jun 2009 23:46:19 -0000
>> @@ -327,7 +327,7 @@ AC_CHECK_HEADERS(tr1/unordered_set tr1/u
>>  AC_CHECK_HEADERS(ext/hash_map ext/hash_set)
>>  AC_CHECK_HEADERS(byteswap.h)
>>  AC_CHECK_FUNCS(mallinfo posix_fallocate)
>> -AC_CHECK_DECLS([basename, ffs, asprintf, vasprintf, snprintf, vsnprintf, strverscmp])
>> +AC_CHECK_DECLS([basename, ffs, asprintf, vasprintf, snprintf, vsnprintf, strverscmp, strndup, memmem])
>>
>>  # Use of ::std::tr1::unordered_map::rehash causes undefined symbols
>>  # at link time with some versions of GCC.
>> Index: gold/fileread.cc
>> ===================================================================
>> RCS file: /cvs/src/src/gold/fileread.cc,v
>> retrieving revision 1.50
>> diff -u -p -r1.50 fileread.cc
>> --- gold/fileread.cc  14 Mar 2009 05:56:46 -0000      1.50
>> +++ gold/fileread.cc  22 Jun 2009 23:46:19 -0000
>> @@ -28,6 +28,7 @@
>>  #include <unistd.h>
>>  #include <sys/mman.h>
>>  #include <sys/uio.h>
>> +#include <sys/stat.h>
>>  #include "filenames.h"
>>
>>  #include "debug.h"
>> Index: gold/gold.h
>> ===================================================================
>> RCS file: /cvs/src/src/gold/gold.h,v
>> retrieving revision 1.37
>> diff -u -p -r1.37 gold.h
>> --- gold/gold.h       15 May 2009 17:01:04 -0000      1.37
>> +++ gold/gold.h       22 Jun 2009 23:46:19 -0000
>> @@ -141,6 +141,14 @@ extern "C" void *mremap(void *, size_t,
>>  extern "C" int ffsll(long long);
>>  #endif
>>
>> +#if !HAVE_DECL_MEMMEM
>> +extern "C" void *memmem(const void *, size_t, const void *, size_t);
>> +#endif
>> +
>> +#if !HAVE_DECL_STRNDUP
>> +extern "C" char *strndup(const char *, size_t);
>> +#endif
>> +
>>  namespace gold
>>  {
>>
>> Index: gold/reloc.h
>> ===================================================================
>> RCS file: /cvs/src/src/gold/reloc.h,v
>> retrieving revision 1.24
>> diff -u -p -r1.24 reloc.h
>> --- gold/reloc.h      28 Jan 2009 02:25:33 -0000      1.24
>> +++ gold/reloc.h      22 Jun 2009 23:46:19 -0000
>> @@ -24,7 +24,9 @@
>>  #define GOLD_RELOC_H
>>
>>  #include <vector>
>> +#ifdef HAVE_BYTESWAP_H
>>  #include <byteswap.h>
>> +#endif
>>
>>  #include "elfcpp.h"
>>  #include "workqueue.h"
>

Attachment: patch.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]