From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yb1-xb31.google.com (mail-yb1-xb31.google.com [IPv6:2607:f8b0:4864:20::b31]) by sourceware.org (Postfix) with ESMTPS id EC9A5384475B for ; Tue, 9 Apr 2024 14:26:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EC9A5384475B 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 EC9A5384475B Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::b31 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712672785; cv=none; b=JJhJJqk5ro2/Dusl38YG6pN3oVRITRX+isclGvgVI2Tq7ALbawgG0z2o3/cCCYr09k/+uX5mIErdptdhQDyox5U8X692bEX4PxIllQS3gtV4ZRU0+J3HidkEZDeo3p5q+TEPtMMUyBTr6vwcma1VXoyWH6t7HpYXf/6goG3BlcE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712672785; c=relaxed/simple; bh=2FPoiFHKTs2d03xUBxBNnURFEqPtriLbt4EwTujclgQ=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=fEv4xZ+qU2N+Ok97oE3XneKHGuyW1I8zKxEyDmMQFb77waQG5Iu6AdiwkYAbry17QhjvnZV94vlh8mpIcChiP+azCVuruznYun6v2YG3zVZDWlJQSngHOqPUcanIhVNzY4l0eSkS+1ixZ2IO1Uu58ho/EWoMyJdn1lwfqxDnJB8= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-yb1-xb31.google.com with SMTP id 3f1490d57ef6-dd14d8e7026so5246521276.2 for ; Tue, 09 Apr 2024 07:26:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712672782; x=1713277582; darn=sourceware.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=h+155HPFY5G3G8g5TeP2PNzHu5QCii/v0w+JSSwMyA0=; b=QzqqVsK8YDMxj9hoggMw9N0YAz++Mt1sUAf6FeFBoqg9TMBF9bvztrHOzOk6xTfGQV 6U78+A6cYIWLkw+gScHqCoQu9aYZCv6dnBerlq2HL6hjU0QzYLwO2tercviL59UJP/jb PX3aWukT+F6JnupGB2qNKXd7cTsZqUu2yDwayQpkmwfMn4bdESXKAUP00znJJQmpjI+w qYfHCc+ycxEDVWLN8JSpSHZK3ik23HFXRIaE3AVxQ+PrURZOXvXvRDVlhC6H8rHreJpc rZbXlEiShkJ39lts97WUXncMKvmh2soOzFWth1cr5MsMcU6n9H2zG6XRGTJcJ7FUYHzT gE7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712672782; x=1713277582; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=h+155HPFY5G3G8g5TeP2PNzHu5QCii/v0w+JSSwMyA0=; b=YG6aDUZlfHtVohxauAzyk2bbFMbROh7pMXU/lHIuq9406GSOk7eD2xtw1KriRzc4cu 0I4C22erBLuN+3GGGFlXH7wAVv6SP3ef/xL5rkzSnMffmUf7ZvUbEWfb09eY5wkdAmEu QPYrgPWD8/E3oE45hSrPtCkJv4wrvhYiY5zsShFFXQcXyU/DhzJIWODPg+8Q1ww/FOFS oruqB1NgQtbpSb/E6u2xtyiXGNXM6sLLws8ylzOhFfEVOQDMr/nvb/S8HMsdsOTqDD+I 0jjJNiekNnojNkwy2Ni2v6FEawkwq7ouNbShFySAndWCyizrkKfFogulixc/NkhNaRUW JjgA== X-Forwarded-Encrypted: i=1; AJvYcCV23GNv2+P9PcGIKPhZvgR/5+c70VtBzq0A9ST5Cc5u8bc0WwYgO8fMEpI39PUeJcVB75T7/0kLFQSL4ZOuMVs0mWbTY3PsJw== X-Gm-Message-State: AOJu0YzpO+/5o8ooYfjVyr8WFw8mOsjjPknMtL0sLvT4r8jqgYxSmtZP Wbg2fY1Lwc8bHyTW+4xan9v5qj+CVl5PM61E2VXfDj86KFEfZLsPh48+fIi5HW79Xi7GKNEgfbj uM/rcOq8rOwf5W86ys8hpnnFFN5Q= X-Google-Smtp-Source: AGHT+IGWRawmI7M732c2x0C59kWmYpeXYz4dOraua2mMhnesReeAruLVJXvnEHmGhlJiz8AS6nBfYEngiVpMAc82qks= X-Received: by 2002:a25:c783:0:b0:dc2:466a:23bd with SMTP id w125-20020a25c783000000b00dc2466a23bdmr9519485ybe.54.1712672782233; Tue, 09 Apr 2024 07:26:22 -0700 (PDT) MIME-Version: 1.0 References: <20240317121912.799372-1-hjl.tools@gmail.com> <20240317121912.799372-2-hjl.tools@gmail.com> <6665080c-42e3-4fd7-a843-460de7cef778@polymtl.ca> In-Reply-To: From: "H.J. Lu" Date: Tue, 9 Apr 2024 07:25:46 -0700 Message-ID: Subject: Re: [PATCH] bfd: Define pagesize variables only for mmap To: Alan Modra Cc: Simon Marchi , Binutils , Noah Goldstein , Sam James Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-3013.1 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 8, 2024 at 10:47=E2=80=AFPM Alan Modra wrote= : > > On Mon, Apr 08, 2024 at 07:49:26PM -0700, H.J. Lu wrote: > > On Mon, Apr 8, 2024 at 3:55=E2=80=AFPM Alan Modra wr= ote: > > > > > > On Mon, Apr 08, 2024 at 07:26:37AM -0700, H.J. Lu wrote: > > > > On Sun, Apr 7, 2024 at 8:58=E2=80=AFPM Simon Marchi wrote: > > > > > Since this commit, when building for --host=3Dx86_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 =E2=80=98= bfd_init_pagesize=E2=80=99: > > > > > /home/simark/src/binutils-gdb/bfd/libbfd.c:1583:19: error: implic= it declaration of function =E2=80=98getpagesize=E2=80=99 [-Werror=3Dimplici= t-function-declaration] > > > > > 1583 | _bfd_pagesize =3D 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=3Daddress,undefi= ned > > > in CFLAGS and CXXFLAGS passed to configure). > > > elfedit: unrecognized option '--enable-x86-feature' > > > > I built binutils with GCC 13 using > > > > CC=3D"gcc -fsanitize=3Daddress,undefined" CXX=3D"g++ > > -fsanitize=3Daddress,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=3D/ --with-system-zlib \ > > --prefix=3D/usr/local \ > > --with-local-prefix=3D/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 muc= h: 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: > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > =3D=3D231796=3D=3DERROR: LeakSanitizer: detected memory leaks > > Direct leak of 4096 byte(s) in 1 object(s) allocated from: > #0 0x7cdd3d0defdf in __interceptor_malloc ../../../../src/libsanitize= r/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/libsanitize= r/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=3Ddetect_leaks=3D0 > A patch set is posted at https://sourceware.org/pipermail/binutils/2024-April/133484.html -- H.J.