@@ -134,7 +134,8 @@ AC_DEFUN([LIB_BUILD_BINUTILS],
134
134
BINUTILS_SRC="$with_binutils_src"
135
135
UTIL_FIXUP_PATH(BINUTILS_SRC)
136
136
137
- BINUTILS_DIR="$CONFIGURESUPPORT_OUTPUTDIR/binutils"
137
+ BINUTILS_BUILD_DIR="$CONFIGURESUPPORT_OUTPUTDIR/binutils"
138
+ BINUTILS_INSTALL_DIR="$CONFIGURESUPPORT_OUTPUTDIR/binutils-install"
138
139
139
140
if ! test -d $BINUTILS_SRC; then
140
141
AC_MSG_ERROR ( [ --with-binutils-src is not pointing to a directory] )
@@ -143,15 +144,15 @@ AC_DEFUN([LIB_BUILD_BINUTILS],
143
144
AC_MSG_ERROR ( [ --with-binutils-src does not look like a binutils source directory] )
144
145
fi
145
146
146
- if ! test -d $BINUTILS_DIR ; then
147
- $MKDIR -p $BINUTILS_DIR
147
+ if ! test -d $BINUTILS_BUILD_DIR ; then
148
+ $MKDIR -p $BINUTILS_BUILD_DIR
148
149
fi
149
150
150
- if test -e $BINUTILS_DIR/bfd/libbfd.a && \
151
- test -e $BINUTILS_DIR/opcodes/libopcodes .a && \
152
- test -e $BINUTILS_DIR/libiberty/libiberty .a && \
153
- test -e $BINUTILS_DIR/zlib/libz .a; then
154
- AC_MSG_NOTICE ( [ Found binutils binaries in binutils source directory -- not building] )
151
+ # We don't know the version, not checking for libsframe.a
152
+ if test -e $BINUTILS_INSTALL_DIR/lib/libbfd .a && \
153
+ test -e $BINUTILS_INSTALL_DIR/lib/libopcodes .a && \
154
+ test -e $BINUTILS_INSTALL_DIR/lib/libiberty .a; then
155
+ AC_MSG_NOTICE ( [ Found binutils binaries in binutils install directory -- not building] )
155
156
else
156
157
# On Windows, we cannot build with the normal Microsoft CL, but must instead use
157
158
# a separate mingw toolchain.
@@ -190,20 +191,26 @@ AC_DEFUN([LIB_BUILD_BINUTILS],
190
191
binutils_cflags="$binutils_cflags $MACHINE_FLAG $JVM_PICFLAG $C_O_FLAG_NORM"
191
192
192
193
AC_MSG_NOTICE ( [ Running binutils configure] )
193
- AC_MSG_NOTICE ( [ configure command line: cd $BINUTILS_DIR && $BINUTILS_SRC/configure --disable-nls CFLAGS="$binutils_cflags" CC="$binutils_cc" AR="$AR" $binutils_target] )
194
+ AC_MSG_NOTICE ( [ configure command line: cd $BINUTILS_BUILD_DIR && $BINUTILS_SRC/configure --disable-werror --prefix=$BINUTILS_INSTALL_DIR --enable-install-libiberty --with-system-zlib --without-zstd --disable-nls CFLAGS="$binutils_cflags" CC="$binutils_cc" AR="$AR" $binutils_target] )
194
195
saved_dir=`pwd`
195
- cd "$BINUTILS_DIR "
196
- $BINUTILS_SRC/configure --disable-nls CFLAGS="$binutils_cflags" CC="$binutils_cc" AR="$AR" $binutils_target
197
- if test $? -ne 0 || ! test -e $BINUTILS_DIR /Makefile; then
196
+ cd "$BINUTILS_BUILD_DIR "
197
+ $BINUTILS_SRC/configure --disable-werror --prefix=$BINUTILS_INSTALL_DIR --enable-install-libiberty --with-system-zlib --without-zstd --disable- nls CFLAGS="$binutils_cflags" CC="$binutils_cc" AR="$AR" $binutils_target
198
+ if test $? -ne 0 || ! test -e $BINUTILS_BUILD_DIR /Makefile; then
198
199
AC_MSG_NOTICE ( [ Automatic building of binutils failed on configure. Try building it manually] )
199
200
AC_MSG_ERROR ( [ Cannot continue] )
200
201
fi
201
202
AC_MSG_NOTICE ( [ Running binutils make] )
202
- $MAKE all-opcodes
203
+ $MAKE all-opcodes all-libiberty
203
204
if test $? -ne 0; then
204
205
AC_MSG_NOTICE ( [ Automatic building of binutils failed on make. Try building it manually] )
205
206
AC_MSG_ERROR ( [ Cannot continue] )
206
207
fi
208
+ AC_MSG_NOTICE ( [ Running binutils make install] )
209
+ $MAKE install-opcodes install-libiberty
210
+ if test $? -ne 0; then
211
+ AC_MSG_NOTICE ( [ Automatic building, install step, of binutils failed on make. Try building it manually] )
212
+ AC_MSG_ERROR ( [ Cannot continue] )
213
+ fi
207
214
cd $saved_dir
208
215
AC_MSG_NOTICE ( [ Building of binutils done] )
209
216
fi
@@ -223,41 +230,57 @@ AC_DEFUN([LIB_SETUP_HSDIS_BINUTILS],
223
230
224
231
# We need the binutils static libs and includes.
225
232
if test "x$with_binutils_src" != x; then
226
- # Try building the source first. If it succeeds, it sets $BINUTILS_DIR .
233
+ # Try building the source first. If it succeeds, it sets $BINUTILS_INSTALL_DIR .
227
234
LIB_BUILD_BINUTILS
228
235
fi
229
236
230
237
if test "x$with_binutils" != x; then
231
- BINUTILS_DIR ="$with_binutils"
238
+ BINUTILS_INSTALL_DIR ="$with_binutils"
232
239
fi
233
240
234
241
binutils_system_error=""
242
+ HSDIS_LDFLAGS=""
235
243
HSDIS_LIBS=""
236
- if test "x$BINUTILS_DIR" = xsystem; then
244
+ disasm_header="<dis-asm.h>"
245
+
246
+ if test "x$BINUTILS_INSTALL_DIR" = xsystem; then
237
247
AC_CHECK_LIB ( bfd , bfd_openr , [ HSDIS_LIBS="-lbfd" ] , [ binutils_system_error="libbfd not found" ] )
238
248
AC_CHECK_LIB ( opcodes , disassembler , [ HSDIS_LIBS="$HSDIS_LIBS -lopcodes" ] , [ binutils_system_error="libopcodes not found" ] )
249
+ AC_CHECK_LIB ( z , deflate , [ HSDIS_LIBS="$HSDIS_LIBS -lz" ] , [ binutils_system_error="libz not found" ] )
239
250
# libiberty is not required on Ubuntu
240
251
AC_CHECK_LIB ( iberty , xmalloc , [ HSDIS_LIBS="$HSDIS_LIBS -liberty" ] )
241
- AC_CHECK_LIB ( z , deflate , [ HSDIS_LIBS="$HSDIS_LIBS -lz " ] , [ binutils_system_error="libz not found" ] )
252
+ AC_CHECK_LIB ( sframe , frame , [ HSDIS_LIBS="$HSDIS_LIBS -lsframe " ] , )
242
253
HSDIS_CFLAGS="-DLIBARCH_$OPENJDK_TARGET_CPU_LEGACY_LIB"
243
- elif test "x$BINUTILS_DIR " != x; then
244
- if test -e $BINUTILS_DIR/bfd/libbfd.a && \
245
- test -e $BINUTILS_DIR/opcodes/libopcodes .a && \
246
- test -e $BINUTILS_DIR/libiberty/libiberty .a && \
247
- test -e $BINUTILS_DIR/zlib/libz .a; then
248
- HSDIS_CFLAGS="-DLIBARCH_$OPENJDK_TARGET_CPU_LEGACY_LIB"
249
- if test -n "$BINUTILS_SRC"; then
250
- HSDIS_CFLAGS="$HSDIS_CFLAGS -I$BINUTILS_SRC/include -I$BINUTILS_DIR/bfd"
251
- else
252
- HSDIS_CFLAGS ="$HSDIS_CFLAGS -I$BINUTILS_DIR/include -I$BINUTILS_DIR/bfd "
254
+ elif test "x$BINUTILS_INSTALL_DIR " != x; then
255
+ disasm_header="\"$BINUTILS_INSTALL_DIR/include/dis-asm.h\""
256
+ if test -e $BINUTILS_INSTALL_DIR/lib/libbfd .a && \
257
+ test -e $BINUTILS_INSTALL_DIR/lib/libopcodes .a && \
258
+ test -e $BINUTILS_INSTALL_DIR/lib/libiberty .a; then
259
+ HSDIS_CFLAGS="-DLIBARCH_$OPENJDK_TARGET_CPU_LEGACY_LIB -I$BINUTILS_INSTALL_DIR/include "
260
+ HSDIS_LIBS="$BINUTILS_INSTALL_DIR/lib/libbfd.a $BINUTILS_INSTALL_DIR/lib/libopcodes.a $BINUTILS_INSTALL_DIR/lib/libiberty.a"
261
+ # If we have libsframe add it.
262
+ if test -e $BINUTILS_INSTALL_DIR/lib/libsframe.a; then
263
+ HSDIS_LIBS ="$HSDIS_LIBS $BINUTILS_INSTALL_DIR/lib/libsframe.a "
253
264
fi
254
- HSDIS_LDFLAGS=""
255
- HSDIS_LIBS="$BINUTILS_DIR/bfd/libbfd.a $BINUTILS_DIR/opcodes/libopcodes.a $BINUTILS_DIR/libiberty/libiberty.a $BINUTILS_DIR/zlib/libz.a"
265
+ AC_CHECK_LIB ( z , deflate , [ HSDIS_LIBS="$HSDIS_LIBS -lz" ] , AC_MSG_ERROR ( [ libz not found] ) )
266
+ else
267
+ AC_MSG_ERROR ( [ "$BINUTILS_INSTALL_DIR/libs/ must contain libbfd.a, libopcodes.a, libiberty.a"] )
Has conversations. Original line has conversations. 256
268
fi
257
269
fi
258
270
271
+ AC_MSG_CHECKING ( [ Checking binutils API] )
272
+ AC_COMPILE_IFELSE ( [ AC_LANG_PROGRAM ( [ #include $disasm_header] ,[ [ void foo() {init_disassemble_info(0, 0, 0, 0);}] ] ) ] ,
273
+ [
274
+ AC_MSG_RESULT ( [ New API] )
275
+ HSDIS_CFLAGS="$HSDIS_CFLAGS -DBINUTILS_NEW_API"
276
+ ] ,
277
+ [
278
+ AC_MSG_RESULT ( [ Old API] )
279
+ ]
280
+ )
281
+
259
282
AC_MSG_CHECKING ( [ for binutils to use with hsdis] )
260
- case "x$BINUTILS_DIR " in
283
+ case "x$BINUTILS_INSTALL_DIR " in
261
284
xsystem)
262
285
if test "x$OPENJDK_TARGET_OS" != xlinux; then
263
286
AC_MSG_RESULT ( [ invalid] )
@@ -280,10 +303,10 @@ AC_DEFUN([LIB_SETUP_HSDIS_BINUTILS],
280
303
;;
281
304
*)
282
305
if test "x$HSDIS_LIBS" != x; then
283
- AC_MSG_RESULT ( [ $BINUTILS_DIR ] )
306
+ AC_MSG_RESULT ( [ $BINUTILS_INSTALL_DIR ] )
284
307
else
285
308
AC_MSG_RESULT ( [ invalid] )
286
- AC_MSG_ERROR ( [ $BINUTILS_DIR does not contain a proper binutils installation] )
309
+ AC_MSG_ERROR ( [ $BINUTILS_INSTALL_DIR does not contain a proper binutils installation] )
287
310
fi
288
311
;;
289
312
esac