From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oa1-x2e.google.com (mail-oa1-x2e.google.com [IPv6:2001:4860:4864:20::2e]) by sourceware.org (Postfix) with ESMTPS id A8C903858CD1 for ; Tue, 9 Apr 2024 05:47:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A8C903858CD1 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A8C903858CD1 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:4860:4864:20::2e ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712641644; cv=none; b=dpNWbOuq4d2eIoDqNfbcibG3LHCcF3tBT+UhHy2SUFgMmiq2vx0N+55iBvUa9XN1HCOfvfJiPkT6D3URps+1xLzPa3xK0UZJX3P0b8Z/D0vj75wTX5YbyWf8D0N7pEJrbyLHzkdxKoKfsN3+GHYpi0AWxaSjWccrp9kGJcHXSjc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712641644; c=relaxed/simple; bh=EZtqgwprvnr4r0y9TK3ibODwOH2tiz934D2auhkNBO4=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=ulxPLXFCylUZA2gGqHS091Bcb8+dzSYmuvUxJ9j1WTVNUdDOJ1FOy3pac08NkBkU8A6vMcFUIVDNFFS7E4Ze6xKl2ANgvdenvuAz9dGsrcsRN3WJ43IukKY8VvgPCX7j3zc4iDMqCUEZV8vE+HRu62R0JI1vhcUi76nNh2+2Rao= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-oa1-x2e.google.com with SMTP id 586e51a60fabf-2228c4c5ac3so3229387fac.0 for ; Mon, 08 Apr 2024 22:47:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712641641; x=1713246441; darn=sourceware.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=AsHgwtFO1H0Fyp10fCo8sx4nGyAHgx0uVRCbC1o8RgE=; b=TR4naEiKYvicKfUCf/G7iqT7ODqhtgVW9F6g/y6Xtu36c0OhR/s/mL4qWMjk3Z57y4 T8i5hIQfNZi4GXTpZ3F87CWf/xWFm+w4cm47Wqn3XhvYrQya6bphA5kOghrSIPCAKvoO jFQEUqAoJyIOKyK3NgH1ocU5XqbdXmcKR/nQAzmrsikrMdHTp+B3QxxIN+OpKz2jAUWo +DUTeH3rfRhvoSB0Z02t6voCYRn7kSYvU/9myURXmIpvblu4uljE0x1TLBkS2Ry7zCRj fYGMIXTjW+B7MOlKhiJqQnf/ppZAHIRLAw9q8X8WGf/CN5PiD7gf2gNQypkRPfNwrYvO FtGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712641641; x=1713246441; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=AsHgwtFO1H0Fyp10fCo8sx4nGyAHgx0uVRCbC1o8RgE=; b=SJhZ2RzvHjk5XlPMdiAhzT6wWYlB19ss9NivLvJg0ygPLZeAxFFak3Czq20+wzkZ+R iYZtPvxL5U76PwLHQxcYXXn/xlcFnpIKhuWOihMlaiNK7JhXamCdaL9vrDi2F3Rjj1ui kCDaaT0HI/+nV3zEWOA3zN/a0TcttUKrM6GA1d30RsgEW8xk2h8/aDaYZaoI4EIg91Bi R4+Dt5nrHRr84QUGg9Nqs54bCBedViXIE7gfRPoZWGMl4WH1GIsaSSwvY7IKZqmQIgLM QojYm015RjtI4zo9oWfzJWfQwyjhy1CX1rASVKUAAN87bYB8vwcTxxYeyx1rHIpFZkYQ NUjw== X-Forwarded-Encrypted: i=1; AJvYcCWGdh25D/Qk5KMbPjg2+Ui+k1PxqhBKXqb7RiJkfWj5CBeh91GhtvtbPK6vqVeuk4BMT0zvk9t+nUxoKI1meKSIfbBiJmVp6Q== X-Gm-Message-State: AOJu0YxtBOSxv4sBAxyjysFv+Ur/qRNZrO+KjBuhQ3mHYNO0rpJNM+HK xVn4pOJP/7548WYTNmxl7SGw3kMTT9s3cpkiJrDLOeN5+GOJP6Is X-Google-Smtp-Source: AGHT+IEP/+kNXR4fOnAZOBKzM6zoSWt6Wq6KslkhM6yTJ/N5McvQZ9u8yQZ9ivBZiCg9RXjxpVGVzg== X-Received: by 2002:a05:6870:1609:b0:22e:d20d:1274 with SMTP id b9-20020a056870160900b0022ed20d1274mr12846580oae.9.1712641641243; Mon, 08 Apr 2024 22:47:21 -0700 (PDT) Received: from squeak.grove.modra.org ([2406:3400:51d:8cc0:4414:97ff:97da:7d1a]) by smtp.gmail.com with ESMTPSA id t20-20020a056a00139400b006ed38ae38f2sm2750776pfg.121.2024.04.08.22.47.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Apr 2024 22:47:20 -0700 (PDT) Received: by squeak.grove.modra.org (Postfix, from userid 1000) id 54EB111400E4; Tue, 9 Apr 2024 15:17:18 +0930 (ACST) Date: Tue, 9 Apr 2024 15:17:18 +0930 From: Alan Modra To: "H.J. Lu" Cc: Simon Marchi , Binutils , Noah Goldstein , Sam James Subject: Re: [PATCH] bfd: Define pagesize variables only for mmap Message-ID: References: <20240317121912.799372-1-hjl.tools@gmail.com> <20240317121912.799372-2-hjl.tools@gmail.com> <6665080c-42e3-4fd7-a843-460de7cef778@polymtl.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-3026.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Mon, Apr 08, 2024 at 07:49:26PM -0700, H.J. Lu wrote: > On Mon, Apr 8, 2024 at 3:55 PM Alan Modra wrote: > > > > On Mon, Apr 08, 2024 at 07:26:37AM -0700, H.J. Lu wrote: > > > On Sun, Apr 7, 2024 at 8:58 PM Simon Marchi wrote: > > > > Since this commit, when building for --host=x86_64-w64-mingw32, I get: > > > > > > > > > > > > make[4]: Entering directory '/home/simark/build/binutils-gdb-x86_64-w64-mingw32/bfd' > > > > CC libbfd.lo > > > > /home/simark/src/binutils-gdb/bfd/libbfd.c: In function ‘bfd_init_pagesize’: > > > > /home/simark/src/binutils-gdb/bfd/libbfd.c:1583:19: error: implicit declaration of function ‘getpagesize’ [-Werror=implicit-function-declaration] > > > > 1583 | _bfd_pagesize = getpagesize (); > > > > | ^~~~~~~~~~~ > > > > > > > > Simon > > > > > > Please try this patch. > > > > You need to revert the change to lynx-core.c as well. > > The v2 patch is at > > https://sourceware.org/pipermail/binutils/2024-April/133466.html > > > Somewhat related, why does binutils/elfedit.c depend on HAVE_MMAP? > > It uses mmap to update the ELF program header directly. > > > I run into failures with asan builds (ie. -fsanitize=address,undefined > > in CFLAGS and CXXFLAGS passed to configure). > > elfedit: unrecognized option '--enable-x86-feature' > > I built binutils with GCC 13 using > > CC="gcc -fsanitize=address,undefined" CXX="g++ > -fsanitize=address,undefined" > /export/gnu/import/git/gitlab/x86-binutils/configure \ > --disable-werror --disable-gprofng \ > \ > --enable-plugins --disable-gdb --disable-gdbserver > --disable-libbacktrace --disable-libdecnumber --disable-readline > --disable-sim --enable-mark-plt --with-sysroot=/ --with-system-zlib \ > --prefix=/usr/local \ > --with-local-prefix=/usr/local > > elfedit works: > > [hjl@gnu-cfl-3 binutils]$ ./elfedit --enable-x86-feature ibt xx > [hjl@gnu-cfl-3 binutils]$ > > > Apparently HAVE_MMAP configury fusses too much, see this comment: > > gnulib/import/m4/mmap-anon.m4: # Check for mmap(). Don't use AC_FUNC_MMAP, because it checks too much: it > > It checks MAP_ANONYMOUS, not mmap: > > # Check for mmap(). Don't use AC_FUNC_MMAP, because it checks too much: it > # fails on HP-UX 11, because MAP_FIXED mappings do not work. But this is > # irrelevant for anonymous mappings. Yes, it isn't that. I fail to get HAVE_MMAP for the rather more mundane reason that the config test fails with: ================================================================= ==231796==ERROR: LeakSanitizer: detected memory leaks Direct leak of 4096 byte(s) in 1 object(s) allocated from: #0 0x7cdd3d0defdf in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69 #1 0x5750c7f6d72b in main /home/alan/build/gas-san/all/bfd/conftest.c:239 Direct leak of 4096 byte(s) in 1 object(s) allocated from: #0 0x7cdd3d0defdf in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69 #1 0x5750c7f6d2e1 in main /home/alan/build/gas-san/all/bfd/conftest.c:190 SUMMARY: AddressSanitizer: 8192 byte(s) leaked in 2 allocation(s). This can be avoided by export ASAN_OPTIONS=detect_leaks=0 -- Alan Modra Australia Development Lab, IBM