From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by sourceware.org (Postfix) with ESMTPS id A28CF3858D20 for ; Tue, 2 Apr 2024 03:54:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A28CF3858D20 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 A28CF3858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::62a ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712030089; cv=none; b=QiWZN40dacKfFQid+Q1AHalRzDojmTrzIKf2Sq2UElUCbCpgvGZwL3EOrTY7N5vHvcnN54DJuiHM3BNZbU21ZTcESAuCaM2vqM1bfNP1IOwzXgAfMZTG/wS18bNpxraqpx9Y+doGK2bFD8PtFck/8KCAhX/49SsEln/kisMI3Ko= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712030089; c=relaxed/simple; bh=zMgeXhPlywRhcUHY00nlBG9BmhsyDYfmdoY7iY8bh9A=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=L9jXEqujnxUoAXAGt8gPqox3xT+Z/wR4nC17JyrDld6mzy5BWSuY6NWbZrqCDP8Mb/mZReMqVEwo7vZzz907KOjxsEsPs8S3MIWI5Udda4I5EA7jDNj0vXhUEd+0cMCelYttU1wHUzQnXov9kPHN+wRac7y7Bmb4GSzTTG5JGBY= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-1e0d82d441bso42151935ad.3 for ; Mon, 01 Apr 2024 20:54:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712030086; x=1712634886; darn=sourceware.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=031Fde7xFbcuYpl8rQveFqML7zo2HQYhuHs4qb2z0AY=; b=L3yC/3BVPgqDWIvrHjB1lpR0VCfNPbkQSh6bOcGc9/bABCa99oTK5lo2/nmSdTEnp7 mu+Ap4UgkpbKB7z68qdOwQulPQWfvZli7PFRNgGcCUV4szyWYaWQ9lyrUz+BHnIIuU47 ymeKSB/v8sc6btnwd+v9xma9vNsMSFG6w2q+eCVGtJaIpxzDNBrXWHnNhJ9LyGGWCF4J H/T+slThucaH29jwXYQuUBmFs1UFvxO00W3NLt81GIIpKaxz1lzVWt4tfXxA9kY80Ofz OD/9GO4sMJV6aWVlbl6VIUZsz2FRxtCcynJ0zsV6PZ8+WgufBMJosoH+8X6hOn3jU99W 9alA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712030086; x=1712634886; h=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=031Fde7xFbcuYpl8rQveFqML7zo2HQYhuHs4qb2z0AY=; b=n6M9npPxg8g5Wa9377V8n4xluoNtkE/OSM8/jxMIb0baHJFfPv0Zwvk3PvFlratOXH yY2t2CEYl5HLZPlFPt9Z0ZJHU3R9Etj4sOb3iccSZ4yvsG2F4NyQfpMb37yxmg4ITZxI vCnfgGVCoQyV6zD778ifbkCJvgQEW1xAPr+jmhWmyXBkAS1KrTtQuOu5sE7Tb6zwMBti VWRN8AOw4RCQOh7fUQpNEG5ZiwFO6EVsZE2MsLNADIS4zQ06LKeFSWy9DOlCDWWAh8wk wmKlhDmLAS4CdGeTNC0NEGzoRlspYKyQnhT9v5/ccx4rP+v2kgD8uN4gB6aBjxm7Tfia CXwg== X-Forwarded-Encrypted: i=1; AJvYcCVy5UClU2QUqoV70coPJe0KyKE5CHQ/6//iFfnTjG6wFE+nHPnjkCA/CwemclRUX37RoMkQgzePlWa+76C5vnDHK2ruTkGHdS/W X-Gm-Message-State: AOJu0Yy+wUHLyrpA64xrc5cZJX7hMmc/9xweBistanx+IoEuAeALYnPt 0KWfBCld776dqg+VXZeV26kQIBXS2uHo2dfRLwQGdOjsbQkXsK00UmLlcvgDf7xdzJRXq2R7clJ jb6+PIyWbE571/bR0rSquy318bnNVTkkQZisv/g== X-Google-Smtp-Source: AGHT+IFgLxYbe24eC+qqKxW/FHr4TDlrQBXVhvkEwf5u4eWiopKyjT7++Bh5Rw5L1zZpo/O+yvFsB93t6ChTcynM8tw= X-Received: by 2002:a17:903:22c6:b0:1e2:732b:daa with SMTP id y6-20020a17090322c600b001e2732b0daamr463631plg.29.1712030086436; Mon, 01 Apr 2024 20:54:46 -0700 (PDT) MIME-Version: 1.0 References: <87plv91b22.fsf@oldenburg3.str.redhat.com> In-Reply-To: From: abush wang Date: Tue, 2 Apr 2024 11:54:35 +0800 Message-ID: Subject: Re: [PATCH] stdlib: reorganize stdlib Makefile routines by functionality To: "H.J. Lu" Cc: Florian Weimer , abushwang via Libc-alpha , adhemerval.zanella@linaro.org Content-Type: multipart/alternative; boundary="00000000000025b1090615151121" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE,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: --00000000000025b1090615151121 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi, Lu it seems like there is some build issue: ``` /usr/bin/ld: /tmp/cc1NV6qZ.ltrans2.ltrans.o: warning: relocation against `seen_eof_include_file' in read-only section `.text' /usr/bin/ld: /tmp/cc1NV6qZ.ltrans1.ltrans.o: in function `lang_add_wild': /builddir/build/BUILD/binutils-2.42.50/build-x86_64-redhat-linux/ld/../../l= d/ldlang.c:8518:(.text+0xa108): undefined reference to `in_text_section_ordering_file' /usr/bin/ld: /builddir/build/BUILD/binutils-2.42.50/build-x86_64-redhat-linux/ld/../../l= d/ldlang.c:8552:(.text+0xa3aa): undefined reference to `seen_eof_include_file' /usr/bin/ld: /builddir/build/BUILD/binutils-2.42.50/build-x86_64-redhat-linux/ld/../../l= d/ldlang.c:8553:(.text+0xa3b8): undefined reference to `in_text_section_ordering_file' /usr/bin/ld: /builddir/build/BUILD/binutils-2.42.50/build-x86_64-redhat-linux/ld/../../l= d/ldlang.c:8551:(.text+0xa48f): undefined reference to `in_text_section_ordering_file' /usr/bin/ld: /tmp/cc1NV6qZ.ltrans2.ltrans.o: in function `ldfile_open_command_file_1.lto_priv.0': /builddir/build/BUILD/binutils-2.42.50/build-x86_64-redhat-linux/ld/../../l= d/ldfile.c:939:(.text+0x9fc2): undefined reference to `in_text_section_ordering_file' /usr/bin/ld: /builddir/build/BUILD/binutils-2.42.50/build-x86_64-redhat-linux/ld/../../l= d/ldfile.c:965:(.text+0x9ff3): undefined reference to `in_text_section_ordering_file' /usr/bin/ld: /builddir/build/BUILD/binutils-2.42.50/build-x86_64-redhat-linux/ld/../../l= d/ldfile.c:998:(.text+0xa0e7): undefined reference to `in_text_section_ordering_file' /usr/bin/ld: /builddir/build/BUILD/binutils-2.42.50/build-x86_64-redhat-linux/ld/../../l= d/ldfile.c:995:(.text+0xa0f7): undefined reference to `seen_eof_include_file' /usr/bin/ld: warning: creating DT_TEXTREL in a PIE collect2: error: ld returned 1 exit status make[4]: *** [Makefile:1265: ld-new] Error 1 make[3]: *** [Makefile:1903: all-recursive] Error 1 make[2]: *** [Makefile:1092: all] Error 2 make[1]: *** [Makefile:8046: all-ld] Error 2 ``` test by binutils-2.42.50-6.fc41.src.rpm this is my repo https://mirrors.aliyun.com/fedora/development/rawhide/Everything/x86_64/os/ I have verified that the error reported is caused by these patches. On Mon, Apr 1, 2024 at 9:17=E2=80=AFPM H.J. Lu wrote: > On Mon, Apr 1, 2024 at 6:13=E2=80=AFAM Florian Weimer wrote: > > > > * abush wang: > > > > > This is test: > > > ``` > > > uint64_t getnsecs() { > > > uint32_t lo, hi; > > > __asm__ __volatile__ ( > > > "rdtsc" : "=3Da"(lo), "=3Dd"(hi) > > > ); > > > return ((uint64_t)hi << 32) | lo; > > > } > > > > > > int main() { > > > const int num_iterations =3D 1; > > > uint64_t start, end, total_time =3D 0; > > > > > > start =3D getnsecs(); > > > for (int i =3D 0; i < num_iterations; i++) { > > > (void) lrand48(); > > > } > > > end =3D getnsecs(); > > > total_time +=3D (end - start); > > > > > > printf("Average time for lrand48: %lu cycles\n", total_time / > num_iterations); > > > return 0; > > > } > > > ``` > > > before: > > > Average time for lrand48: 21418 cycles > > > > > > after: > > > Average time for lrand48: 9892 cycles > > > > Do you see this on x86-64? So this isn't a displacement range issue? > > > > It could be that this is a random performance change due to code > > alignment, and not actually caused by the direct call distance. > > > > I have a linker patch to control section layout: > > https://patchwork.sourceware.org/project/binutils/list/?series=3D29973 > > It can > > 1. Reduce gaps between text sections. > 2. Put hot text sections close to each other. > > If it can solve this issue, we should add this feature to ld. > > -- > H.J. > --00000000000025b1090615151121--