|
|
|
|
@ -114,7 +114,7 @@ int keep_symbol(libr_section *sections, libr_section *chkscn)
|
|
|
|
|
{
|
|
|
|
|
/* if it is, and has size zero, then it was marked for deletion */
|
|
|
|
|
if(
|
|
|
|
|
#ifdef HAVE_BFD_2_34
|
|
|
|
|
#if (LINKER_VERSION_C >= 2034000)
|
|
|
|
|
bfd_section_size(chkscn) == 0
|
|
|
|
|
#else
|
|
|
|
|
bfd_get_section_size(chkscn) == 0
|
|
|
|
|
@ -144,7 +144,7 @@ void remove_sections(libr_section *sections, void *symtab_buffer, long *symtab_c
|
|
|
|
|
|
|
|
|
|
if(symbol != NULL)
|
|
|
|
|
{
|
|
|
|
|
#ifdef HAVE_BFD_2_34
|
|
|
|
|
#if (LINKER_VERSION_C >= 2034000)
|
|
|
|
|
chkscn = bfd_asymbol_section(symbol);
|
|
|
|
|
#else
|
|
|
|
|
chkscn = bfd_get_section(symbol);
|
|
|
|
|
@ -171,7 +171,7 @@ int setup_sections(bfd *ihandle, bfd *ohandle)
|
|
|
|
|
for(iscn = ihandle->sections; iscn != NULL; iscn = iscn->next)
|
|
|
|
|
{
|
|
|
|
|
if(
|
|
|
|
|
#ifdef HAVE_BFD_2_34
|
|
|
|
|
#if (LINKER_VERSION_C >= 2034000)
|
|
|
|
|
bfd_section_size(iscn) == 0
|
|
|
|
|
#else
|
|
|
|
|
bfd_get_section_size(iscn) == 0
|
|
|
|
|
@ -199,7 +199,7 @@ int setup_sections(bfd *ihandle, bfd *ohandle)
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if(
|
|
|
|
|
#ifdef HAVE_BFD_2_34
|
|
|
|
|
#if (LINKER_VERSION_C >= 2034000)
|
|
|
|
|
!bfd_set_section_size(oscn, iscn->size)
|
|
|
|
|
#else
|
|
|
|
|
!bfd_set_section_size(ohandle, oscn, iscn->size)
|
|
|
|
|
@ -209,13 +209,13 @@ int setup_sections(bfd *ihandle, bfd *ohandle)
|
|
|
|
|
printf("failed to set data size: %s\n", bfd_errmsg(bfd_get_error()));
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
#ifdef HAVE_BFD_2_34
|
|
|
|
|
#if (LINKER_VERSION_C >= 2034000)
|
|
|
|
|
vma = bfd_section_vma(iscn);
|
|
|
|
|
#else
|
|
|
|
|
vma = bfd_section_vma(ihandle, iscn);
|
|
|
|
|
#endif
|
|
|
|
|
if(
|
|
|
|
|
#ifdef HAVE_BFD_2_34
|
|
|
|
|
#if (LINKER_VERSION_C >= 2034000)
|
|
|
|
|
!bfd_set_section_vma(oscn, vma)
|
|
|
|
|
#else
|
|
|
|
|
!bfd_set_section_vma(ohandle, oscn, vma)
|
|
|
|
|
@ -227,7 +227,7 @@ int setup_sections(bfd *ihandle, bfd *ohandle)
|
|
|
|
|
}
|
|
|
|
|
oscn->lma = iscn->lma;
|
|
|
|
|
if(
|
|
|
|
|
#ifdef HAVE_BFD_2_34
|
|
|
|
|
#if (LINKER_VERSION_C >= 2034000)
|
|
|
|
|
!bfd_set_section_alignment(oscn, bfd_section_alignment(iscn))
|
|
|
|
|
#else
|
|
|
|
|
!bfd_set_section_alignment(ohandle, oscn, bfd_section_alignment(ihandle, iscn))
|
|
|
|
|
@ -240,7 +240,13 @@ int setup_sections(bfd *ihandle, bfd *ohandle)
|
|
|
|
|
oscn->entsize = iscn->entsize;
|
|
|
|
|
iscn->output_section = oscn;
|
|
|
|
|
iscn->output_offset = vma;
|
|
|
|
|
if(!bfd_copy_private_section_data(ihandle, iscn, ohandle, oscn))
|
|
|
|
|
if(
|
|
|
|
|
#if (LINKER_VERSION_C >= 2045000)
|
|
|
|
|
!bfd_copy_private_section_data(ihandle, iscn, ohandle, oscn, NULL)
|
|
|
|
|
#else
|
|
|
|
|
!bfd_copy_private_section_data(ihandle, iscn, ohandle, oscn)
|
|
|
|
|
#endif
|
|
|
|
|
)
|
|
|
|
|
{
|
|
|
|
|
printf("failed to compute section alignment: %s\n", bfd_errmsg(bfd_get_error()));
|
|
|
|
|
return false;
|
|
|
|
|
@ -304,7 +310,7 @@ int build_output(libr_file *file_handle)
|
|
|
|
|
/* Actually copy section data */
|
|
|
|
|
for(iscn = ihandle->sections; iscn != NULL; iscn = iscn->next)
|
|
|
|
|
{
|
|
|
|
|
#ifdef HAVE_BFD_2_34
|
|
|
|
|
#if (LINKER_VERSION_C >= 2034000)
|
|
|
|
|
size = bfd_section_size(iscn);
|
|
|
|
|
#else
|
|
|
|
|
size = bfd_get_section_size(iscn);
|
|
|
|
|
@ -323,7 +329,7 @@ int build_output(libr_file *file_handle)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(
|
|
|
|
|
#ifdef HAVE_BFD_2_34
|
|
|
|
|
#if (LINKER_VERSION_C >= 2034000)
|
|
|
|
|
bfd_section_flags(iscn) & SEC_HAS_CONTENTS
|
|
|
|
|
#else
|
|
|
|
|
bfd_get_section_flags(ihandle, iscn) & SEC_HAS_CONTENTS
|
|
|
|
|
@ -548,7 +554,7 @@ libr_intstatus add_section(libr_file *file_handle, char *resource_name, libr_sec
|
|
|
|
|
if(scn == NULL)
|
|
|
|
|
RETURN(LIBR_ERROR_NEWSECTION, "Failed to create new section");
|
|
|
|
|
if(
|
|
|
|
|
#ifdef HAVE_BFD_2_34
|
|
|
|
|
#if (LINKER_VERSION_C >= 2034000)
|
|
|
|
|
!bfd_set_section_flags(scn, SEC_HAS_CONTENTS | SEC_DATA | SEC_IN_MEMORY)
|
|
|
|
|
#else
|
|
|
|
|
!bfd_set_section_flags(file_handle->bfd_read, scn, SEC_HAS_CONTENTS | SEC_DATA | SEC_IN_MEMORY)
|
|
|
|
|
|