diff options
| -rw-r--r-- | ConfigureChecks.cmake | 1 | ||||
| -rw-r--r-- | src/config.h.cmake | 3 | ||||
| -rw-r--r-- | src/libr-bfd.c | 10 |
3 files changed, 14 insertions, 0 deletions
diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake index 3590495..af683ff 100644 --- a/ConfigureChecks.cmake +++ b/ConfigureChecks.cmake @@ -40,6 +40,7 @@ if( WITH_BACKEND_LIBBFD ) bfd_copy_private_section_data(ihandle, iscn, ohandle, oscn, NULL); }" HAVE_BFD_2_45) + check_symbol_exists( bfd_finalize_section_relocs bfd.h HAVE_BFD_2_46 ) tde_restore( CMAKE_REQUIRED_LIBRARIES ) tde_restore( CMAKE_REQUIRED_DEFINITIONS ) set( BACKEND_LIBRARIES "-lbfd" ) diff --git a/src/config.h.cmake b/src/config.h.cmake index e2673d2..bf6d3e7 100644 --- a/src/config.h.cmake +++ b/src/config.h.cmake @@ -13,3 +13,6 @@ /* Define to 1 if you have Binutils >= 2.45 */ #cmakedefine HAVE_BFD_2_45 1 + +/* Define to 1 if you have Binutils >= 2.46 */ +#cmakedefine HAVE_BFD_2_46 1 diff --git a/src/libr-bfd.c b/src/libr-bfd.c index 9d72cce..b472543 100644 --- a/src/libr-bfd.c +++ b/src/libr-bfd.c @@ -320,12 +320,22 @@ int build_output(libr_file *file_handle) oscn = iscn->output_section; reloc_size = bfd_get_reloc_upper_bound(ihandle, iscn); if(reloc_size == 0) + { + #ifdef HAVE_BFD_2_46 + bfd_finalize_section_relocs(ohandle, oscn, NULL, 0); + #else bfd_set_reloc(ohandle, oscn, NULL, 0); + #endif + } else { reloc_buffer = malloc(reloc_size); reloc_count = bfd_canonicalize_reloc(ihandle, iscn, reloc_buffer, symtab_buffer); + #ifdef HAVE_BFD_2_46 + bfd_finalize_section_relocs(ohandle, oscn, reloc_buffer, reloc_count); + #else bfd_set_reloc(ohandle, oscn, reloc_buffer, reloc_count); + #endif } if( |
