Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8191006

hsdis disassembler plugin does not compile with binutils 2.29+

XMLWordPrintable

    • b06
    • x86_64
    • linux

        FULL PRODUCT VERSION :
        java version "9.0.1"
        Java(TM) SE Runtime Environment (build 9.0.1+11)
        Java HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode)


        ADDITIONAL OS VERSION INFORMATION :
        Linux 2.6.32-504.30.3.el6.x86_64 #1 SMP Wed Jul 15 10:13:09 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

        A DESCRIPTION OF THE PROBLEM :
        Binutils 2.2.9 changed API and disassembler() constructor now requires more parameters. See patch.

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Download binutils-2.29 or later, e.g.
        BINUTILS=build/binutils-2.29.1 CC=icc LP64=1 make

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        compilation successs
        ACTUAL -
        compilation error

        ERROR MESSAGES/STACK TRACES THAT OCCUR :
        hsdis.c: In function ‘setup_app_data’:
        hsdis.c:315: error: incompatible type for argument 1 of ‘disassembler’
        src/share/tools/hsdis/build/binutils-2.29.1/include/dis-asm.h:276: note: expected ‘enum bfd_architecture’ but argument is of type ‘struct bfd *’
        hsdis.c:315: error: too few arguments to function ‘disassembler’
        make: *** [build/linux-amd64/hsdis-amd64.so] Error 1


        REPRODUCIBILITY :
        This bug can be reproduced always.

        CUSTOMER SUBMITTED WORKAROUND :
        diff --git a/src/share/tools/hsdis/hsdis.c b/src/share/tools/hsdis/hsdis.c
        index 3d038f1..88122fb 100644
        --- a/src/share/tools/hsdis/hsdis.c
        +++ b/src/share/tools/hsdis/hsdis.c
        @@ -30,6 +30,7 @@
         #include <config.h> /* required by bfd.h */
         #include <libiberty.h>
         #include <bfd.h>
        +#include <bfdver.h>
         #include <dis-asm.h>
         #include <inttypes.h>
         #include <string.h>
        @@ -312,7 +313,13 @@ static void setup_app_data(struct hsdis_app_data* app_data,
         
           /* Finish linking together the various callback blocks. */
           app_data->dinfo.application_data = (void*) app_data;
        - app_data->dfn = disassembler(native_bfd);
        + app_data->dfn = disassembler(
        +#if BFD_VERSION >= 229000000
        + bfd_get_arch(native_bfd),
        + bfd_big_endian(native_bfd),
        + bfd_get_mach(native_bfd),
        +#endif
        + native_bfd);
           app_data->dinfo.print_address_func = hsdis_print_address_func;
           app_data->dinfo.read_memory_func = hsdis_read_memory_func;


              dbuck David Buck
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

                Created:
                Updated:
                Resolved: