diff options
author | Timo Teräs <timo.teras@iki.fi> | 2018-09-12 10:00:49 +0300 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2018-09-12 10:00:49 +0300 |
commit | 45f6bdfb1a880b60bbe0ef3213ef411aba15263b (patch) | |
tree | f5dc119c59ac80f9aa0d1e30db557b0f3defb0e1 | |
parent | 399fed273cdb25a82f9d58e165e5d000dd0b6e2b (diff) | |
download | aports-45f6bdfb1a880b60bbe0ef3213ef411aba15263b.tar.bz2 aports-45f6bdfb1a880b60bbe0ef3213ef411aba15263b.tar.xz |
main/valgrind: fix to work with new binutils generated DSOs
-rw-r--r-- | main/valgrind/APKBUILD | 4 | ||||
-rw-r--r-- | main/valgrind/valgrind-3.13.0-ld-separate-code.patch | 93 |
2 files changed, 96 insertions, 1 deletions
diff --git a/main/valgrind/APKBUILD b/main/valgrind/APKBUILD index 0bf3bba970..1d8b462e48 100644 --- a/main/valgrind/APKBUILD +++ b/main/valgrind/APKBUILD @@ -1,7 +1,7 @@ # Maintainer: Natanael Copa <ncopa@alpinelinux.org> pkgname=valgrind pkgver=3.13.0 -pkgrel=0 +pkgrel=1 pkgdesc="A tool to help find memory-management problems in programs" url="http://valgrind.org/" arch="all" @@ -16,6 +16,7 @@ makedepends="sed paxmark perl bash autoconf automake libtool" options="!strip !check" subpackages="$pkgname-dev $pkgname-doc" source="ftp://sourceware.org/pub/$pkgname/$pkgname-$pkgver.tar.bz2 + valgrind-3.13.0-ld-separate-code.patch uclibc.patch arm.patch" # musl-fixes.patch @@ -70,5 +71,6 @@ package() { } sha512sums="34e1013cd3815d30a459b86220e871bb0a6209cc9e87af968f347083693779f022e986f211bdf1a5184ad7370cde12ff2cfca8099967ff94732970bd04a97009 valgrind-3.13.0.tar.bz2 +644512263adab13a43ac9d3a5064f9476254c659a65686ee062093c3cc112adf731645a4ee2611d23524144b4ab3fcfe50ec0bb5a6faf3a683004e7e245d39df valgrind-3.13.0-ld-separate-code.patch d59a10db9037e120df2ee94a103402ca95a79abee9d8be63e4e1bca29c82dca775cc402a79b854ec11a2160a4d2da202c237369418e221d1925267ea2613fd5d uclibc.patch 9ee297d1b2b86891584443ad0caadc4977e1447979611ccf1cc55dbee61911b0b063bc4ad936d86c451cedae410cb3219b5a088b2ad0aa17df182d564fe36cfe arm.patch" diff --git a/main/valgrind/valgrind-3.13.0-ld-separate-code.patch b/main/valgrind/valgrind-3.13.0-ld-separate-code.patch new file mode 100644 index 0000000000..a8f8a908ce --- /dev/null +++ b/main/valgrind/valgrind-3.13.0-ld-separate-code.patch @@ -0,0 +1,93 @@ +commit 3bce9544deab0261c7c55ccdc46ce1f36e468040 +Author: Mark Wielaard <mark@klomp.org> +Date: Thu Jul 12 13:56:00 2018 +0200 + + Accept read-only PT_LOAD segments and .rodata. + + The new binutils ld -z separate-code option creates multiple read-only + PT_LOAD segments and might place .rodata in a non-executable segment. + + Allow and keep track of separate read-only segments and allow a readonly + page with .rodata section. + + Based on patches from Tom Hughes <tom@compton.nu> and + H.J. Lu <hjl.tools@gmail.com>. + + https://bugs.kde.org/show_bug.cgi?id=395682 + +index 13991b6..c36d498 100644 +--- a/coregrind/m_debuginfo/debuginfo.c ++++ b/coregrind/m_debuginfo/debuginfo.c +@@ -1126,9 +1126,7 @@ ULong VG_(di_notify_mmap)( Addr a, Bool allow_SkFileV, Int use_fd ) + # error "Unknown platform" + # endif + +-# if defined(VGP_x86_darwin) && DARWIN_VERS >= DARWIN_10_7 + is_ro_map = seg->hasR && !seg->hasW && !seg->hasX; +-# endif + + # if defined(VGO_solaris) + is_rx_map = seg->hasR && seg->hasX && !seg->hasW; +diff --git a/coregrind/m_debuginfo/readelf.c b/coregrind/m_debuginfo/readelf.c +index 62192f0..95b97d6 100644 +--- a/coregrind/m_debuginfo/readelf.c ++++ b/coregrind/m_debuginfo/readelf.c +@@ -1881,7 +1881,7 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di ) + Bool loaded = False; + for (j = 0; j < VG_(sizeXA)(di->fsm.maps); j++) { + const DebugInfoMapping* map = VG_(indexXA)(di->fsm.maps, j); +- if ( (map->rx || map->rw) ++ if ( (map->rx || map->rw || map->ro) + && map->size > 0 /* stay sane */ + && a_phdr.p_offset >= map->foff + && a_phdr.p_offset < map->foff + map->size +@@ -1912,6 +1912,16 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di ) + i, (UWord)item.bias); + loaded = True; + } ++ if (map->ro ++ && (a_phdr.p_flags & (PF_R | PF_W | PF_X)) ++ == PF_R) { ++ item.exec = False; ++ VG_(addToXA)(svma_ranges, &item); ++ TRACE_SYMTAB( ++ "PT_LOAD[%ld]: acquired as ro, bias 0x%lx\n", ++ i, (UWord)item.bias); ++ loaded = True; ++ } + } + } + if (!loaded) { +@@ -2179,17 +2189,25 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di ) + } + } + +- /* Accept .rodata where mapped as rx (data), even if zero-sized */ ++ /* Accept .rodata where mapped as rx or rw (data), even if zero-sized */ + if (0 == VG_(strcmp)(name, ".rodata")) { +- if (inrx && !di->rodata_present) { +- di->rodata_present = True; ++ if (!di->rodata_present) { + di->rodata_svma = svma; +- di->rodata_avma = svma + inrx->bias; ++ di->rodata_avma = svma; + di->rodata_size = size; +- di->rodata_bias = inrx->bias; + di->rodata_debug_svma = svma; +- di->rodata_debug_bias = inrx->bias; +- /* NB was 'inrw' prior to r11794 */ ++ if (inrx) { ++ di->rodata_avma += inrx->bias; ++ di->rodata_bias = inrx->bias; ++ di->rodata_debug_bias = inrx->bias; ++ } else if (inrw) { ++ di->rodata_avma += inrw->bias; ++ di->rodata_bias = inrw->bias; ++ di->rodata_debug_bias = inrw->bias; ++ } else { ++ BAD(".rodata"); ++ } ++ di->rodata_present = True; + TRACE_SYMTAB("acquiring .rodata svma = %#lx .. %#lx\n", + di->rodata_svma, + di->rodata_svma + di->rodata_size - 1); |