--with-libiberty=<file> path to libiberty.a library to use "
ac_help="$ac_help
--with-bfd-include-dir=<dir> include path for correct bfd.h "
+ac_help="$ac_help
+ --with-binutils-include-dir=<dir> include path for binutils headers "
# Initialize some variables set by options.
# The variables have the same names as the options, with
fi
+# Check whether --with-binutils-include-dir or --without-binutils-include-dir was given.
+if test "${with_binutils_include_dir+set}" = set; then
+ withval="$with_binutils_include_dir"
+ ac_binutils_include_dir=$withval
+else
+ ac_binutils_include_dir=NONE
+
+fi
+
+
ac_aux_dir=
for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
if test -f $ac_dir/install-sh; then
fi
echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:588: checking host system type" >&5
+echo "configure:600: checking host system type" >&5
host_alias=$host
case "$host_alias" in
echo "$ac_t""$host" 1>&6
echo $ac_n "checking target system type""... $ac_c" 1>&6
-echo "configure:609: checking target system type" >&5
+echo "configure:621: checking target system type" >&5
target_alias=$target
case "$target_alias" in
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:630: checking for $ac_word" >&5
+echo "configure:642: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:660: checking for $ac_word" >&5
+echo "configure:672: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "cl", so it can be a program name with args.
set dummy cl; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:711: checking for $ac_word" >&5
+echo "configure:723: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:743: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:755: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
cat > conftest.$ac_ext << EOF
-#line 754 "configure"
+#line 766 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
-if { (eval echo configure:759: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:771: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
ac_cv_prog_cc_works=yes
# If we can't run a trivial program, we are probably using a cross compiler.
if (./conftest; exit) 2>/dev/null; then
{ echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:785: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:797: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
cross_compiling=$ac_cv_prog_cc_cross
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:790: checking whether we are using GNU C" >&5
+echo "configure:802: checking whether we are using GNU C" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
yes;
#endif
EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:799: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:811: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gcc=yes
else
ac_cv_prog_gcc=no
ac_save_CFLAGS="$CFLAGS"
CFLAGS=
echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:818: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:830: checking whether ${CC-cc} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:861: checking for a BSD compatible install" >&5
+echo "configure:873: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
if test "$ac_libiberty" = "NONE"; then
echo $ac_n "checking for objalloc_create in -liberty""... $ac_c" 1>&6
-echo "configure:916: checking for objalloc_create in -liberty" >&5
+echo "configure:928: checking for objalloc_create in -liberty" >&5
ac_lib_var=`echo iberty'_'objalloc_create | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-liberty $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 924 "configure"
+#line 936 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
objalloc_create()
; return 0; }
EOF
-if { (eval echo configure:935: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:947: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
fi
if test "$ac_libbfd" = "NONE"; then
echo $ac_n "checking for bfd_openr in -lbfd""... $ac_c" 1>&6
-echo "configure:968: checking for bfd_openr in -lbfd" >&5
+echo "configure:980: checking for bfd_openr in -lbfd" >&5
ac_lib_var=`echo bfd'_'bfd_openr | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lbfd $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 976 "configure"
+#line 988 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
bfd_openr()
; return 0; }
EOF
-if { (eval echo configure:987: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:999: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
bfd_include_dir="-I$ac_bfd_include_dir"
fi
+binutils_include_dir=
+if test "$ac_binutils_include_dir" != "NONE"; then
+ binutils_include_dir="-I$ac_binutils_include_dir"
+fi
+
if test "$ac_libbfd" = "NONE" -o "$ac_libiberty" = "NONE" ; then
echo
echo "You need to specify the location of the libfd.a and libiberty.a"
fi
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:1051: checking how to run the C preprocessor" >&5
+echo "configure:1068: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
-#line 1066 "configure"
+#line 1083 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1072: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1089: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
-#line 1083 "configure"
+#line 1100 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1089: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1106: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
rm -rf conftest*
CPP="${CC-cc} -nologo -E"
cat > conftest.$ac_ext <<EOF
-#line 1100 "configure"
+#line 1117 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1106: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1123: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
echo "$ac_t""$CPP" 1>&6
echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:1131: checking for ANSI C header files" >&5
+echo "configure:1148: checking for ANSI C header files" >&5
if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1136 "configure"
+#line 1153 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
#include <float.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1144: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1161: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 1161 "configure"
+#line 1178 "configure"
#include "confdefs.h"
#include <string.h>
EOF
if test $ac_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 1179 "configure"
+#line 1196 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
:
else
cat > conftest.$ac_ext <<EOF
-#line 1200 "configure"
+#line 1217 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
exit (0); }
EOF
-if { (eval echo configure:1211: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1228: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
:
else
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1238: checking for $ac_hdr" >&5
+echo "configure:1255: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1243 "configure"
+#line 1260 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1248: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1265: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:1276: checking for working const" >&5
+echo "configure:1293: checking for working const" >&5
if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1281 "configure"
+#line 1298 "configure"
#include "confdefs.h"
int main() {
; return 0; }
EOF
-if { (eval echo configure:1330: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1347: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_const=yes
else
echo $ac_n "checking for vprintf""... $ac_c" 1>&6
-echo "configure:1352: checking for vprintf" >&5
+echo "configure:1369: checking for vprintf" >&5
if eval "test \"`echo '$''{'ac_cv_func_vprintf'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1357 "configure"
+#line 1374 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char vprintf(); below. */
; return 0; }
EOF
-if { (eval echo configure:1380: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1397: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_vprintf=yes"
else
if test "$ac_cv_func_vprintf" != yes; then
echo $ac_n "checking for _doprnt""... $ac_c" 1>&6
-echo "configure:1404: checking for _doprnt" >&5
+echo "configure:1421: checking for _doprnt" >&5
if eval "test \"`echo '$''{'ac_cv_func__doprnt'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1409 "configure"
+#line 1426 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char _doprnt(); below. */
; return 0; }
EOF
-if { (eval echo configure:1432: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1449: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func__doprnt=yes"
else
+
trap '' 1 2 15
cat > confcache <<\EOF
# This file is a shell script that caches the results of configure
s%@INSTALL_DATA@%$INSTALL_DATA%g
s%@CPP@%$CPP%g
s%@bfd_include_dir@%$bfd_include_dir%g
+s%@binutils_include_dir@%$binutils_include_dir%g
CEOF
EOF
* ELF format file handling. Extended relocation support for all of
* text and data.
*
- * (c) 2001, arm/arm-pic/arm-big-endian support <davidm@snapgear.com>
+ * (c) 2003, H8 support <davidm@snapgear.com>
+ * (c) 2001-2003, arm/arm-pic/arm-big-endian support <davidm@snapgear.com>
* (c) 2001, v850 changes, Mile Bader <miles@lsi.nec.co.jp>
* (c) 2001, zflat support <davidm@snapgear.com>
* (c) 2001, Changes for GOT entries
/* from $(INSTALLDIR)/include */
#include <bfd.h> /* Main header file for the BFD library */
+#if defined(TARGET_h8300)
+#include <elf/h8.h> /* TARGET_* ELF support for the BFD library */
+#else
#include <elf.h> /* TARGET_* ELF support for the BFD library */
+#endif
/* from uClinux-x.x.x/include/linux */
#include "flat.h" /* Binary flat header description */
#define ARCH "sparc"
#elif defined(TARGET_v850)
#define ARCH "v850"
+#elif defined(TARGET_h8300)
+#define ARCH "h8300"
#else
#error "Don't know how to support your CPU architecture??"
#endif
int flat_reloc_count;
int sym_reloc_size, rc;
int got_size = 0;
+ int bad_relocs = 0;
asymbol **symb;
long nsymb;
if (verbose)
printf("GOT table contains %d entries (%d bytes)\n",
got_size/sizeof(unsigned long), got_size);
+#ifdef TARGET_m68k
if (got_size > GOT_LIMIT) {
fprintf(stderr, "GOT too large: %d bytes (limit = %d bytes)\n",
got_size, GOT_LIMIT);
exit(1);
}
+#endif
}
for (a = abs_bfd->sections; (a != (asection *) NULL); a = a->next) {
} else {
/* Calculate the sym address ourselves. */
sym_reloc_size = bfd_get_reloc_size(q->howto);
+
+#ifndef TARGET_h8300
if (sym_reloc_size != 4) {
- printf("ERROR: bad reloc size=%d for symbol=%s\n",
- sym_reloc_size, sym_name);
+ printf("ERROR: bad reloc type %d size=%d for symbol=%s\n",
+ (*p)->howto->type, sym_reloc_size, sym_name);
+ bad_relocs++;
rc = -1;
continue;
}
+#endif
switch ((*p)->howto->type) {
#endif /* R_V850_ZDA_16_16_OFFSET || R_V850_ZDA_16_16_SPLIT_OFFSET */
#endif /* TARGET_v850 */
+#ifdef TARGET_h8300
+ case R_H8_DIR24R8:
+ if (sym_reloc_size != 4) {
+ printf("R_H8_DIR24R8 size %d\n", sym_reloc_size);
+ bad_relocs++;
+ continue;
+ }
+ relocation_needed = 1;
+ sym_addr = (*(q->sym_ptr_ptr))->value;
+ q->address -= 1;
+ sym_vma = bfd_section_vma(abs_bfd, sym_section);
+ sym_addr += sym_vma + q->addend;
+ sym_addr |= (*((unsigned char *)(sectionp+q->address))<<24);
+ break;
+ case R_H8_DIR24A8:
+ if (sym_reloc_size != 4) {
+ printf("R_H8_DIR24A8 size %d\n", sym_reloc_size);
+ bad_relocs++;
+ continue;
+ }
+ relocation_needed = 1;
+ sym_addr = (*(q->sym_ptr_ptr))->value;
+ sym_vma = bfd_section_vma(abs_bfd, sym_section);
+ sym_addr += sym_vma + q->addend;
+ break;
+ case R_H8_DIR32:
+ case R_H8_DIR32A16: /* currently 32, could be made 16 */
+ if (sym_reloc_size != 4) {
+ printf("R_H8_DIR32 size %d\n", sym_reloc_size);
+ bad_relocs++;
+ continue;
+ }
+ relocation_needed = 1;
+ sym_addr = (*(q->sym_ptr_ptr))->value;
+ sym_vma = bfd_section_vma(abs_bfd, sym_section);
+ sym_addr += sym_vma + q->addend;
+ break;
+ case R_H8_PCREL16:
+ sym_vma = 0;
+ sym_addr = (*(q->sym_ptr_ptr))->value;
+ sym_addr += sym_vma + q->addend;
+ sym_addr -= (q->address + 2);
+ if (bfd_big_endian(abs_bfd))
+ * ((unsigned short *) (sectionp + q->address)) =
+ bfd_big_endian(abs_bfd) ? htons(sym_addr) : sym_addr;
+ continue;
+ case R_H8_PCREL8:
+ sym_vma = 0;
+ sym_addr = (*(q->sym_ptr_ptr))->value;
+ sym_addr += sym_vma + q->addend;
+ sym_addr -= (q->address + 1);
+ * ((unsigned char *) (sectionp + q->address)) = sym_addr;
+ continue;
+#endif
+
#ifdef TARGET_sparc
case R_SPARC_32:
case R_SPARC_UA32:
case R_SPARC_WDISP30:
sym_addr = (((*(q->sym_ptr_ptr))->value-
q->address) >> 2) & 0x3fffffff;
- sym_addr |= (ntohl(*((unsigned long *) (sectionp + q->address))) & 0xc0000000);
+ sym_addr |= (
+ ntohl(*((unsigned long *) (sectionp + q->address))) &
+ 0xc0000000
+ );
break;
case R_SPARC_HI22:
relocation_needed = 1;
pflags = 0x80000000;
sym_vma = bfd_section_vma(abs_bfd, sym_section);
sym_addr += sym_vma + q->addend;
- sym_addr |= (htonl(*((unsigned long *) (sectionp + q->address))) & 0xffc00000);
+ sym_addr |= (
+ htonl(* ((unsigned long *) (sectionp + q->address))) &
+ 0xffc00000
+ );
break;
case R_SPARC_LO10:
relocation_needed = 1;
sym_vma = bfd_section_vma(abs_bfd, sym_section);
sym_addr += sym_vma + q->addend;
sym_addr &= 0x000003ff;
- sym_addr |= (htonl(*((unsigned long *) (sectionp + q->address))) & 0xfffffc00);
+ sym_addr |= (
+ htonl(* ((unsigned long *) (sectionp + q->address))) &
+ 0xfffffc00
+ );
break;
#endif /* TARGET_sparc */
default:
/* missing support for other types of relocs */
printf("ERROR: bad reloc type %d\n", (*p)->howto->type);
+ bad_relocs++;
continue;
}
}
}
}
+ if (bad_relocs) {
+ printf("%d bad relocs\n", bad_relocs);
+ exit(1);
+ }
+
if (rc < 0)
- return(NULL);
+ return(0);
- *n_relocs = flat_reloc_count;
- return flat_relocs;
+ *n_relocs = flat_reloc_count;
+ return flat_relocs;
}