Accepting request 632193 from devel:tools
OBS-URL: https://build.opensuse.org/request/show/632193 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/valgrind?expand=0&rev=109
This commit is contained in:
commit
3b4667582c
102
0001-Accept-read-only-PT_LOAD-segments-and-.rodata.patch
Normal file
102
0001-Accept-read-only-PT_LOAD-segments-and-.rodata.patch
Normal file
@ -0,0 +1,102 @@
|
||||
From cb72566ac3af13889f7ae88068c3b3ee6a6b757b Mon Sep 17 00:00:00 2001
|
||||
From: Mark Wielaard <mark@klomp.org>
|
||||
Date: Thu, 12 Jul 2018 13:56:00 +0200
|
||||
Subject: [PATCH] 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
|
||||
|
||||
[sbruens] Backported to 3.13.0 release
|
||||
---
|
||||
coregrind/m_debuginfo/debuginfo.c | 2 --
|
||||
coregrind/m_debuginfo/readelf.c | 34 +++++++++++++++++++++++--------
|
||||
2 files changed, 26 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/coregrind/m_debuginfo/debuginfo.c b/coregrind/m_debuginfo/debuginfo.c
|
||||
index 24814d8..2cf433a 100644
|
||||
--- a/coregrind/m_debuginfo/debuginfo.c
|
||||
+++ b/coregrind/m_debuginfo/debuginfo.c
|
||||
@@ -957,9 +957,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 3c8e62b..34a40c9 100644
|
||||
--- a/coregrind/m_debuginfo/readelf.c
|
||||
+++ b/coregrind/m_debuginfo/readelf.c
|
||||
@@ -1785,7 +1785,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
|
||||
@@ -1816,6 +1816,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) {
|
||||
@@ -2083,17 +2093,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);
|
||||
--
|
||||
2.18.0
|
||||
|
@ -1,3 +1,16 @@
|
||||
-------------------------------------------------------------------
|
||||
Tue Aug 28 19:39:14 UTC 2018 - stefan.bruens@rwth-aachen.de
|
||||
|
||||
- Filter out -m64 from optflags, breaks build of 32 bit parts
|
||||
- Cleanup, remove suse_version < 1100 conditionals
|
||||
- Use %license for COPYING, COPYING.DOCS
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Aug 27 22:22:17 UTC 2018 - stefan.bruens@rwth-aachen.de
|
||||
|
||||
- Fix missing debuginfo with current binutils, boo#1103239
|
||||
0001-Accept-read-only-PT_LOAD-segments-and-.rodata.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Jun 8 08:07:03 UTC 2018 - mbrugger@suse.com
|
||||
|
||||
|
@ -19,11 +19,8 @@
|
||||
# during building the major version of glibc is built into the suppression file
|
||||
%define glibc_main_version %(getconf GNU_LIBC_VERSION | cut -d' ' -f2 | cut -d. -f1)
|
||||
%define glibc_major_version %(getconf GNU_LIBC_VERSION | cut -d' ' -f2 | cut -d. -f2)
|
||||
%if 0%{?suse_version} > 1100
|
||||
%define building_docs 1
|
||||
%else
|
||||
%define building_docs 0
|
||||
%endif
|
||||
|
||||
Name: valgrind
|
||||
Version: 3.13.0
|
||||
Release: 0
|
||||
@ -39,6 +36,8 @@ Patch1: jit-register-unregister.diff
|
||||
Patch2: armv6-support.diff
|
||||
Patch3: epoll-wait-fix.patch
|
||||
Patch4: Implement-emulated-system-registers.-Fixes-392146.patch
|
||||
# PATCH-FIX-UPSTREAM [backport] - https://sourceware.org/git/?p=valgrind.git;a=commit;h=64aa729bfae71561505a40c12755bd6b55bb3061
|
||||
Patch5: 0001-Accept-read-only-PT_LOAD-segments-and-.rodata.patch
|
||||
BuildRequires: automake
|
||||
BuildRequires: docbook-xsl-stylesheets
|
||||
BuildRequires: docbook_4
|
||||
@ -56,9 +55,6 @@ ExclusiveArch: aarch64 %ix86 x86_64 ppc ppc64 ppc64le s390x armv7l armv7hl armv
|
||||
BuildRequires: gcc-32bit
|
||||
BuildRequires: glibc-devel-32bit
|
||||
%endif
|
||||
%if 0%{?suse_version} <= 1100
|
||||
Provides: valgrind-devel = %{version}
|
||||
%endif
|
||||
|
||||
%description
|
||||
Valgrind checks all memory operations in an application, like read,
|
||||
@ -80,7 +76,6 @@ directory. A debugged application runs slower and needs much more
|
||||
memory, but is usually still usable. Valgrind is still in development,
|
||||
but it has been successfully used to optimize several KDE applications.
|
||||
|
||||
%if 0%{?suse_version} > 1100
|
||||
%package devel
|
||||
Summary: Memory Management Debugger
|
||||
Group: Development/Tools/Debuggers
|
||||
@ -106,7 +101,6 @@ directory. A debugged application runs slower and needs much more
|
||||
memory, but is usually still usable. Valgrind is still in development,
|
||||
but it has been successfully used to optimize several KDE applications.
|
||||
|
||||
%endif
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
@ -116,6 +110,7 @@ but it has been successfully used to optimize several KDE applications.
|
||||
%patch2
|
||||
%patch3
|
||||
%patch4 -p1
|
||||
%patch5 -p1
|
||||
|
||||
%build
|
||||
export FLAGS="%{optflags}"
|
||||
@ -128,12 +123,13 @@ FLAGS=${FLAGS/-mthumb/-mthumb-interwork -marm}
|
||||
FLAGS="${FLAGS/-D_FORTIFY_SOURCE=2/}"
|
||||
FLAGS="${FLAGS/-fstack-protector-strong/}"
|
||||
FLAGS="${FLAGS/-fstack-protector/}"
|
||||
# -m64 / -m32 is set explicitly everywhere, do not override it
|
||||
FLAGS="${FLAGS/-m64/}"
|
||||
export CFLAGS="$FLAGS"
|
||||
export CXXFLAGS="$FLAGS"
|
||||
export FFLAGS="$FLAGS"
|
||||
%if 0%{?suse_version} > 1100
|
||||
autoreconf -fi
|
||||
%endif
|
||||
|
||||
export GDB=%{_bindir}/gdb
|
||||
%configure \
|
||||
%ifarch aarch64
|
||||
@ -156,10 +152,10 @@ if test -d %{buildroot}%{_datadir}/doc/valgrind; then
|
||||
mv %{buildroot}%{_datadir}/doc/valgrind %{buildroot}/%{_defaultdocdir}
|
||||
fi
|
||||
mkdir -p %{buildroot}%{_docdir}/%{name}
|
||||
cp -a README* NEWS AUTHORS COPYING COPYING.DOCS %{buildroot}/%{_defaultdocdir}/%{name}
|
||||
cp -a README* NEWS AUTHORS %{buildroot}/%{_defaultdocdir}/%{name}
|
||||
|
||||
%files
|
||||
%defattr(-,root,root)
|
||||
%license COPYING COPYING.DOCS
|
||||
%{_bindir}/*
|
||||
%doc %{_defaultdocdir}/%{name}
|
||||
%doc %{_mandir}/*/*
|
||||
@ -265,10 +261,7 @@ cp -a README* NEWS AUTHORS COPYING COPYING.DOCS %{buildroot}/%{_defaultdocdir}/%
|
||||
%{_libdir}/valgrind/s390x-linux64-valgrind-s*.xml
|
||||
%{_libdir}/valgrind/s390x-linux64.xml
|
||||
|
||||
%if 0%{?suse_version} > 1100
|
||||
%files devel
|
||||
%defattr(-,root,root)
|
||||
%endif
|
||||
%{_libdir}/valgrind/lib*.a
|
||||
%{_includedir}/valgrind
|
||||
%{_libdir}/pkgconfig/valgrind.pc
|
||||
|
Loading…
Reference in New Issue
Block a user