summaryrefslogtreecommitdiffstats
path: root/ubuntu/maverick/dependencies/libr/debian/patches/005-fix-arm-mangled-section.diff
diff options
context:
space:
mode:
Diffstat (limited to 'ubuntu/maverick/dependencies/libr/debian/patches/005-fix-arm-mangled-section.diff')
-rw-r--r--ubuntu/maverick/dependencies/libr/debian/patches/005-fix-arm-mangled-section.diff44
1 files changed, 44 insertions, 0 deletions
diff --git a/ubuntu/maverick/dependencies/libr/debian/patches/005-fix-arm-mangled-section.diff b/ubuntu/maverick/dependencies/libr/debian/patches/005-fix-arm-mangled-section.diff
new file mode 100644
index 000000000..141c4c92e
--- /dev/null
+++ b/ubuntu/maverick/dependencies/libr/debian/patches/005-fix-arm-mangled-section.diff
@@ -0,0 +1,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))