1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
Index: libr-0.6.0/src/libr-bfd.c
===================================================================
--- libr-0.6.0.orig/src/libr-bfd.c 2011-03-02 22:06:52.000000000 +0000
+++ libr-0.6.0/src/libr-bfd.c 2014-03-30 10:57:27.132041406 +0000
@@ -159,7 +159,18 @@
continue; /* Section has been marked for deletion */
}
/* Use SEC_LINKER_CREATED to ask the libbfd backend to take care of configuring the section */
- oscn = bfd_make_section_anyway_with_flags(ohandle, iscn->name, iscn->flags | SEC_LINKER_CREATED);
+
+ // Keep the ARM_ATTRIBUTES section type intact on armhf systems
+ // If this is not done, readelf -A will not print any architecture information for the modified library,
+ // and ldd will report that the library cannot be found
+ if (strcmp(iscn->name, ".ARM.attributes") == 0)
+ {
+ oscn = bfd_make_section_anyway_with_flags(ohandle, iscn->name, iscn->flags);
+ }
+ else
+ {
+ oscn = bfd_make_section_anyway_with_flags(ohandle, iscn->name, iscn->flags | SEC_LINKER_CREATED);
+ }
if(oscn == NULL)
{
printf("failed to create out section: %s\n", bfd_errmsg(bfd_get_error()));
@@ -262,6 +273,7 @@
reloc_count = bfd_canonicalize_reloc(ihandle, iscn, reloc_buffer, symtab_buffer);
bfd_set_reloc(ohandle, oscn, reloc_buffer, reloc_count);
}
+
if(bfd_get_section_flags(ihandle, iscn) & SEC_HAS_CONTENTS)
{
/* NOTE: if the section is just being copied then do that, otherwise grab
@@ -286,6 +298,11 @@
return false;
}
free(buffer);
+ if(!bfd_copy_private_section_data(ihandle, iscn, ohandle, oscn))
+ {
+ printf("failed to copy private section data: %s\n", bfd_errmsg(bfd_get_error()));
+ return false;
+ }
}
}
if(!bfd_copy_private_bfd_data(ihandle, ohandle))
|