From owner-freebsd-toolchain@freebsd.org Fri Feb 19 14:18:26 2021 Return-Path: Delivered-To: freebsd-toolchain@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7F9B052DF82 for ; Fri, 19 Feb 2021 14:18:26 +0000 (UTC) (envelope-from pjfloyd@wanadoo.fr) Received: from mailman.nyi.freebsd.org (unknown [127.0.1.3]) by mx1.freebsd.org (Postfix) with ESMTP id 4DhtwL2Q96z4XWK for ; Fri, 19 Feb 2021 14:18:26 +0000 (UTC) (envelope-from pjfloyd@wanadoo.fr) Received: by mailman.nyi.freebsd.org (Postfix) id 52E2352DDA6; Fri, 19 Feb 2021 14:18:26 +0000 (UTC) Delivered-To: toolchain@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 52A8E52DCED for ; Fri, 19 Feb 2021 14:18:26 +0000 (UTC) (envelope-from pjfloyd@wanadoo.fr) Received: from smtp.smtpout.orange.fr (smtp01.smtpout.orange.fr [80.12.242.123]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (Client CN "Bizanga Labs SMTP Client Certificate", Issuer "Bizanga Labs CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DhtwK2rxmz4XSx for ; Fri, 19 Feb 2021 14:18:21 +0000 (UTC) (envelope-from pjfloyd@wanadoo.fr) Received: from [192.168.1.17] ([2.7.65.44]) by mwinf5d53 with ME id X2JK2400J0xHJey032JKkS; Fri, 19 Feb 2021 15:18:19 +0100 X-ME-Helo: [192.168.1.17] X-ME-Auth: cGpmbG95ZEB3YW5hZG9vLmZy X-ME-Date: Fri, 19 Feb 2021 15:18:19 +0100 X-ME-IP: 2.7.65.44 To: toolchain@FreeBSD.org From: Paul Floyd Subject: clang options for load segments Message-ID: Date: Fri, 19 Feb 2021 15:18:18 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Rspamd-Queue-Id: 4DhtwK2rxmz4XSx X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of pjfloyd@wanadoo.fr has no SPF policy when checking 80.12.242.123) smtp.mailfrom=pjfloyd@wanadoo.fr X-Spamd-Result: default: False [-0.83 / 15.00]; FREEMAIL_FROM(0.00)[wanadoo.fr]; TO_DN_NONE(0.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[2.7.65.44:received]; RCVD_TLS_LAST(0.00)[]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[wanadoo.fr]; ASN(0.00)[asn:3215, ipnet:80.12.240.0/20, country:FR]; MID_RHS_MATCH_FROM(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FROM_HAS_DN(0.00)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[80.12.242.123:from]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[wanadoo.fr]; AUTH_NA(1.00)[]; RCPT_COUNT_ONE(0.00)[1]; SPAMHAUS_ZRD(0.00)[80.12.242.123:from:127.0.2.255]; NEURAL_SPAM_SHORT(0.27)[0.268]; RCVD_IN_DNSWL_NONE(0.00)[80.12.242.123:from]; R_SPF_NA(0.00)[no SPF record]; RWL_MAILSPIKE_POSSIBLE(0.00)[80.12.242.123:from]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[toolchain] X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Feb 2021 14:18:26 -0000 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