From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by sourceware.org (Postfix) with ESMTPS id C93A53858D1E for ; Mon, 26 Jun 2023 15:51:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C93A53858D1E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id DCF001F74B; Mon, 26 Jun 2023 15:51:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1687794661; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=8RN7HhLv1tvuAqYC82MoIVW2E1akouY8/nayO9JwmqU=; b=NtkAN4VwnZEFs2lpJ/lRlimy/Qull0zg2VnZmiZkJTCORiTB4KSsbfpuF55+RkgRzVol1B rYK/PO1rUx4Q1gPyX3kPCqvkS+SxZT1judsYQ8V7JxFEYLyGzK1voO1jY4+TmO4ntpbq9D V/+EA5JX8WtJzwwudlMhl++q25c6Sqk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1687794661; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=8RN7HhLv1tvuAqYC82MoIVW2E1akouY8/nayO9JwmqU=; b=V9lY8dBD2Thom5pHrzU33suy+jw7hwFaBmOTd2ezJn/x6AUHTq9msr9gDvHHh2CFqVLn80 or+Kof59RB+VN5BQ== Received: from wotan.suse.de (wotan.suse.de [10.160.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id B318D2C141; Mon, 26 Jun 2023 15:51:01 +0000 (UTC) Received: by wotan.suse.de (Postfix, from userid 10510) id AA22767ED; Mon, 26 Jun 2023 15:51:01 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by wotan.suse.de (Postfix) with ESMTP id A8AF2655F; Mon, 26 Jun 2023 15:51:01 +0000 (UTC) Date: Mon, 26 Jun 2023 15:51:01 +0000 (UTC) From: Michael Matz To: Andreas Krebbel cc: Alan Modra , "binutils@sourceware.org" Subject: Re: [RFC] Make __bss_start point at actual start of .bss In-Reply-To: <566bcf75-4459-37c9-e613-e572c436c25c@linux.ibm.com> Message-ID: References: <566bcf75-4459-37c9-e613-e572c436c25c@linux.ibm.com> User-Agent: Alpine 2.20 (LSU 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE 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: Hello, On Mon, 26 Jun 2023, Andreas Krebbel via Binutils wrote: > > The question is, how is __bss_start used? Is it the start of the .bss > > section or the start of the bss segment? I think it is mainly used as > > the start of the segment, when loaders zero out all bss memory, so it > > should stay before other bss-style sections like .sbss. > > The usage which triggered the problem came from qemu and the code there > clears memory from __bss_start through _end. This should work. But that's _exactly_ the case that Alan worried about: __bss_start being assumed to be the start of the bss segment, not merely of the section named .bss. If bss-style sections come before .bss (like .sbss does on some targets) then __bss_start should be in front of those ones, otherwise the above clearing that qemu does would not work anymore (.sbss wouldn't be cleared). See here (elf.sc): ${RELOCATING+${CREATE_SHLIB+PROVIDE (}${USER_LABEL_PREFIX}__bss_start = .${CREATE_SHLIB+)};} ${RELOCATING+${OTHER_BSS_SYMBOLS}} ${DATA_SDATA-${SBSS}} ${BSS_PLT+${PLT}} .${BSS_NAME} ${RELOCATING-0} : { ... normal bss stuff ... __bss_start needs to remain in front of the SBSS entry for the traditional usage to keep working (on targets where DATA_SDATA isn't set). Ciao, Michael.