https://bugs.kde.org/show_bug.cgi?id=452802

            Bug ID: 452802
           Summary: Handle lld 9+ split RW PT_LOAD segments correctly
           Product: valgrind
           Version: unspecified
          Platform: Other
                OS: Other
            Status: REPORTED
          Severity: major
          Priority: NOR
         Component: general
          Assignee: jsew...@acm.org
          Reporter: pjfl...@wanadoo.fr
  Target Milestone: ---

Since llvm 9.0.0, lld has produced split RW PT_LOAD segments

ld.bfd and llvm ld  before 9.0.0

One RW segment containing
RW PT_LOAD(PT_GNU_RELRO(.data.rel.ro .bss.rel.ro) .data .bss)

llvm lld after 9.0.0

Two RW segments containing
RW PT_LOAD(PT_GNU_RELRO(.data.rel.ro .bss.rel.ro))
RW PT_LOAD(.data. .bss)

Valgrind is hard coded to only read debuginfo for one RW PT_LOAD segment and
ignores the second.

See debuginfo.c line 1269 at the time of writing which contains

line 1269

/* PJF this is true for the 2nd RW PT_LOAD which finds di->have_dinfo from the
1st */
if (di->have_dinfo) {
   if (debug)
      VG_(dmsg)("di_notify_mmap-4x: "
         "ignoring mapping because we already read debuginfo "
         "for DebugInfo* %p\n", di);
      return 0;
}

I see two possible solutions
1. Add full handling of multiple RW PT_LOAD segments
2. Merge contiguous RW PT_LOAD segments so that they appear like ld.bfd single
RW PT_LOAD segemnts.

I'll start with 2 as it sounds easier to me.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to