Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Feb 2021 15:18:18 +0100
From:      Paul Floyd <pjfloyd@wanadoo.fr>
To:        toolchain@FreeBSD.org
Subject:   clang options for load segments
Message-ID:  <fb3e3660-a6c0-c8ce-5055-624cde7ce95c@wanadoo.fr>

next in thread | raw e-mail | index | archive | help
Hi

A while back when I upgraded to FreeBSD 12.2 (and thus to clang 10) I 
got quite a new category of errors with Valgrind.

The problem is that the clang 10 toolchain produces two RW LOAD 
segments, for instance see below. Valgrind assumes
that there is only one, and ignores the second one which results in 
false positives when reading PLTs. I've added a hack
to make it seem like there is just one such segment, but it isn't 100% 
reliable - there's at least one issue when loading
shared libraries.

I will carry on looking for a proper solution. In the meantime, are 
there any flags to revert to the previous behaviour
and only generate a single RW LOAD segment?

A+
Paul


paulf> /usr/bin/readelf --segments bar_trivial

Elf file type is EXEC (Executable file)
Entry point 0x2018c0
There are 11 program headers, starting at offset 64

Program Headers:
   Type           Offset             VirtAddr           PhysAddr
                  FileSiz            MemSiz              Flg Align
[snip]
   LOAD           0x0000000000000f80 0x0000000000202f80 0x0000000000202f80
                  0x0000000000000158 0x0000000000000158  RW 0x1000
   LOAD           0x00000000000010d8 0x00000000002040d8 0x00000000002040d8
                  0x0000000000000090 0x00000000000000a8  RW 0x1000
[snip]


  Section to Segment mapping:
   Segment Sections...
    00
    01     .interp
    02     .interp .note.tag .dynsym .gnu.version .gnu.version_r 
.gnu.hash .hash .dynstr .rela.plt .rodata .eh_frame_hdr .eh_frame
    03     .text .init .fini .plt
    04     .ctors .dtors .jcr .dynamic
    05     .data .got.plt .bss
    06     .dynamic
    07     .ctors .dtors .jcr .dynamic
    08     .eh_frame_hdr
    09
    10     .note.tag






Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?fb3e3660-a6c0-c8ce-5055-624cde7ce95c>