-
Bug
-
Resolution: Fixed
-
P4
-
11, 15
-
b24
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8260503 | 13.0.7 | Yuri Nesterenko | P4 | Resolved | Fixed | b01 |
JDK-8261058 | 13.0.6 | Yuri Nesterenko | P4 | Resolved | Fixed | b01 |
JDK-8256553 | 11.0.11-oracle | Dukebot | P4 | Resolved | Fixed | b01 |
JDK-8252806 | 11.0.10 | Yasumasa Suenaga | P4 | Resolved | Fixed | b01 |
binutils 2.34 introduces new section flag: SEC_ELF_OCTETS, and it affects arguments of bfd_octets_per_byte() [1]. So we can see new compiler error as below:
```
gcc -o build/linux-amd64/hsdis-amd64.so -I/home/ysuenaga/rpmbuild/BUILD/binutils-2.34/include -I/home/ysuenaga/rpmbuild/BUILD/binutils-2.34/bfd -Ibuild/linux-amd64/bfd -DLIBARCH_amd64 -DLIBARCH=\"amd64\" -DLIB_EXT=\".so\" -fPIC -O hsdis.c -shared build/linux-amd64/bfd/libbfd.a build/linux-amd64/opcodes/libopcodes.a build/linux-amd64/libiberty/libiberty.a
hsdis.c: In function 'init_disassemble_info_from_bfd':
hsdis.c:571:28: error: too few arguments to function 'bfd_octets_per_byt
'
571 | dinfo->octets_per_byte = bfd_octets_per_byte (abfd);
| ^~~~~~~~~~~~~~~~~~~
In file included from hsdis.c:58:
build/linux-amd64/bfd/bfd.h:1999:14: note: declared here
1999 | unsigned int bfd_octets_per_byte (const bfd *abfd,
| ^~~~~~~~~~~~~~~~~~~
make: *** [Makefile:229: build/linux-amd64/hsdis-amd64.so] Error 1
```
We can fix it with following patch:
```
diff --git a/src/utils/hsdis/hsdis.c b/src/utils/hsdis/hsdis.c
--- a/src/utils/hsdis/hsdis.c
+++ b/src/utils/hsdis/hsdis.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* The Universal Permissive License (UPL), Version 1.0
@@ -568,7 +568,12 @@
dinfo->arch = bfd_get_arch(abfd);
dinfo->mach = bfd_get_mach(abfd);
dinfo->disassembler_options = disassembler_options;
+#if BFD_VERSION >= 234000000
+ /* bfd_octets_per_byte() has 2 args since binutils 2.34 */
+ dinfo->octets_per_byte = bfd_octets_per_byte (abfd, NULL);
+#else
dinfo->octets_per_byte = bfd_octets_per_byte (abfd);
+#endif
dinfo->skip_zeroes = sizeof(void*) * 2;
dinfo->skip_zeroes_at_end = sizeof(void*)-1;
dinfo->disassembler_needs_relocs = FALSE;
```
[1] https://sourceware.org/git/?p=binutils-gdb.git;h=618265039f697eab9e72bb58b95fc2d32925df58
```
gcc -o build/linux-amd64/hsdis-amd64.so -I/home/ysuenaga/rpmbuild/BUILD/binutils-2.34/include -I/home/ysuenaga/rpmbuild/BUILD/binutils-2.34/bfd -Ibuild/linux-amd64/bfd -DLIBARCH_amd64 -DLIBARCH=\"amd64\" -DLIB_EXT=\".so\" -fPIC -O hsdis.c -shared build/linux-amd64/bfd/libbfd.a build/linux-amd64/opcodes/libopcodes.a build/linux-amd64/libiberty/libiberty.a
hsdis.c: In function 'init_disassemble_info_from_bfd':
hsdis.c:571:28: error: too few arguments to function 'bfd_octets_per_byt
'
571 | dinfo->octets_per_byte = bfd_octets_per_byte (abfd);
| ^~~~~~~~~~~~~~~~~~~
In file included from hsdis.c:58:
build/linux-amd64/bfd/bfd.h:1999:14: note: declared here
1999 | unsigned int bfd_octets_per_byte (const bfd *abfd,
| ^~~~~~~~~~~~~~~~~~~
make: *** [Makefile:229: build/linux-amd64/hsdis-amd64.so] Error 1
```
We can fix it with following patch:
```
diff --git a/src/utils/hsdis/hsdis.c b/src/utils/hsdis/hsdis.c
--- a/src/utils/hsdis/hsdis.c
+++ b/src/utils/hsdis/hsdis.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* The Universal Permissive License (UPL), Version 1.0
@@ -568,7 +568,12 @@
dinfo->arch = bfd_get_arch(abfd);
dinfo->mach = bfd_get_mach(abfd);
dinfo->disassembler_options = disassembler_options;
+#if BFD_VERSION >= 234000000
+ /* bfd_octets_per_byte() has 2 args since binutils 2.34 */
+ dinfo->octets_per_byte = bfd_octets_per_byte (abfd, NULL);
+#else
dinfo->octets_per_byte = bfd_octets_per_byte (abfd);
+#endif
dinfo->skip_zeroes = sizeof(void*) * 2;
dinfo->skip_zeroes_at_end = sizeof(void*)-1;
dinfo->disassembler_needs_relocs = FALSE;
```
[1] https://sourceware.org/git/?p=binutils-gdb.git;h=618265039f697eab9e72bb58b95fc2d32925df58
- backported by
-
JDK-8252806 hsdis does not compile with binutils 2.34+
-
- Resolved
-
-
JDK-8256553 hsdis does not compile with binutils 2.34+
-
- Resolved
-
-
JDK-8260503 hsdis does not compile with binutils 2.34+
-
- Resolved
-
-
JDK-8261058 hsdis does not compile with binutils 2.34+
-
- Resolved
-
(1 links to)