Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1617558imm; Tue, 2 Oct 2018 11:03:42 -0700 (PDT) X-Google-Smtp-Source: ACcGV63g1cM6osusO1t59UqXai0xNIJKlJWEtMb1OEwUmVVrgNkxt8Ea17YJMaNxjiEN5n5PpNAC X-Received: by 2002:a62:9c8c:: with SMTP id u12-v6mr17468879pfk.162.1538503421975; Tue, 02 Oct 2018 11:03:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538503421; cv=none; d=google.com; s=arc-20160816; b=RCb90FLtj69VNz7avH4EgDxL1k7Ojzu/cZiHdaMw4FsPc6tvu+O7fkrcLmdrqNOFus Omd6gFAY7ReLW6uS8yll4G+gjg+qHyD4jgHUNjatezuHnClC9bt+dps+mb3YWBNDPW8l A2XksZybOmlVQadXZhJZ1M9f2W8t58gCjB/IkLbK5TFguNI6+MoaSEWDKMmzsV0gBn1y Ft97IIv1CHuBgONf0hEbn1nLBRTETmhD4OznG/EuuJWqEcpdeUl/ULF6vR3n/hZc1cFu 6au/m+gdwkrTn1V46dvQ1SORwPhCAxugVsVwo2LMj5Nf9VKCGolGzhEYupG9ueBI/dq0 7Qcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id; bh=VHQalcPe77VvkFXaX4smZmsIPYKvGDd7NTwICe+XGdM=; b=C/S80elMbbZptpKJezgcGWs5J7nF9hacfjKfXZ/Umzo6yf/6IR0KmemshXHcg8hylF 0CqncXS9GDqaBpeZVRCzLCaAymdxWB9nzY/15G83YBJ7zy05BIjBxyy8y5bp9zj9DLfS SqGgb8ahmC6jJSTXqzqnVgG6Uj1aQnP9B9XwPGe9p0oSjAoiwqsuTNBmM8gBOTz6Pk+5 e+OjnaiT7ib5Xq/Rogu4WzeY/ESnwH13aziQVT+6INVYqW5ZiZACYg+zkjROVYKaEmIG HIgG2va8H7+Q8R7VGkPzs/ZaJ56ZwbL/FOx5+h9LLmZnNaUQQ/jjiApZ+lhG8kkZfjpO rOvw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w4-v6si10389419pll.214.2018.10.02.11.03.26; Tue, 02 Oct 2018 11:03:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728075AbeJCAmV (ORCPT + 99 others); Tue, 2 Oct 2018 20:42:21 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:45104 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726645AbeJCAmU (ORCPT ); Tue, 2 Oct 2018 20:42:20 -0400 Received: by mail-pf1-f194.google.com with SMTP id a23-v6so328398pfi.12; Tue, 02 Oct 2018 10:57:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:mime-version:content-transfer-encoding; bh=VHQalcPe77VvkFXaX4smZmsIPYKvGDd7NTwICe+XGdM=; b=N9PEQo5zyMfTg9+oHZjQFpBu7i8TZbCA+rNyZiZgogqvTltzxjBqKqMxAsTzJgulAD Tj2VQMMzj1lMwsrKY5msNJxvuUjmmFTGeC1GmfhGv+MMXMF2I3lFmyFX3t81vOFdsMT6 kRi8lDlvycSr4vXxH0CPadKXPgeUViEBjMtrRScvLsx6ItEir1Zetcrg7z59DZHQBZMt IGRxRjnO1OAKLqp1rCnPi4f6YQiIivg+46JgQYZ59t2oxlsiqzVg9qPEhAUJ5JsYORfx NIUtOjiT4w4e2qnDM1BK4kBvbnuEWcxdPN+cdeBxB79KUvO3KvA2iKbvz4ubYBRmFo8X 1uFg== X-Gm-Message-State: ABuFfogcSZvJbaPbrwVQrp0pv1i9HiQUkMjvKuqlUTqqyZXu5F0+nfO5 MkuNpxCIitmoaSX7slSXvmc= X-Received: by 2002:a62:2646:: with SMTP id m67-v6mr17547033pfm.254.1538503065842; Tue, 02 Oct 2018 10:57:45 -0700 (PDT) Received: from ?IPv6:2620:15c:2cd:203:5cdc:422c:7b28:ebb5? ([2620:15c:2cd:203:5cdc:422c:7b28:ebb5]) by smtp.gmail.com with ESMTPSA id j14-v6sm6272494pgh.52.2018.10.02.10.57.44 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 02 Oct 2018 10:57:45 -0700 (PDT) Message-ID: <1538503063.193396.6.camel@acm.org> Subject: Re: [PATCH] libosd: Remove ignored __weak attribute From: Bart Van Assche To: Nick Desaulniers Cc: Nathan Chancellor , ooo@electrozaur.com, "James E.J. Bottomley" , "Martin K. Petersen" , linux-scsi@vger.kernel.org, LKML Date: Tue, 02 Oct 2018 10:57:43 -0700 In-Reply-To: References: <20180930205448.26205-1-natechancellor@gmail.com> <10b12992-3570-4646-374b-82cbd7276839@acm.org> Content-Type: text/plain; charset="UTF-7" X-Mailer: Evolution 3.26.2-1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2018-10-02 at 10:24 -0700, Nick Desaulniers wrote: +AD4 On Mon, Oct 1, 2018 at 6:16 PM Bart Van Assche +ADw-bvanassche+AEA-acm.org+AD4 wrote: +AD4 +AD4 Additionally, zero initializers should be left out to minimize +AD4 +AD4 the size of object files. +AD4 +AD4 Sorry, my understanding was that global variables either occupy the +AD4 .bss section or the .data section, depending on whether they were +AD4 zero-initialized vs initialized to non-zero, respectively (where +AD4 non-initialized are treated as zero initialized). Looks like without +AD4 the explicit zero initialization, compilers will put the symbols in a +AD4 +ACI-common+ACI section, which +AGA-man 1 nm+AGA says is also unitialized data. I +AD4 didn't think .bss sections occupied space in an object file or binary+ADs +AD4 the kernel's loader would set up the mappings at execution? Can you +AD4 clarify? Explicitly initialized global and static variables end up in the .data section and need space in that section. That is not the case if the initializer is left out and these variables end up in the .bss section. From https://en.wikipedia.org/wiki/.bss: +ACI-In computer programming, the name .bss or bss is used by many compilers and linkers for the portion of an object file or executable containing statically-allocated variables that are not explicitly initialized to any value. It is often referred to as the +ACI-bss section+ACI or +ACI-bss segment+ACI. Typically only the length of the bss section, but no data, is stored in the object file.+ACI This is why checkpatch warns if a global or static variable is initialized explicitly to zero. From scripts/checkpatch.pl: our +ACQ-zero+AF8-initializer +AD0 qr+AHs(?:(?:0+AFs-xX+AF0)?0+-+ACQ-Int+AF8-type?+AHw-NULL+AHw-false)+AFw-b+AH0AOw +ACM check for global initialisers. if (+ACQ-line +AD0Afg /+AF4AXAArACQ-Type+AFw-s+ACoAJA-Ident(?:+AFw-s+-+ACQ-Modifier)+ACoAXA-s+ACoAPQBc-s+ACo(+ACQ-zero+AF8-initializer)+AFw-s+ACoAOw-/) +AHs if (ERROR(+ACI-GLOBAL+AF8-INITIALISERS+ACI, +ACI-do not initialise globals to +ACQ-1+AFw-n+ACI . +ACQ-herecurr) +ACYAJg +ACQ-fix) +AHs +ACQ-fixed+AFsAJA-fixlinenr+AF0 +AD0Afg s/(+AF4.+ACQ-Type+AFw-s+ACoAJA-Ident(?:+AFw-s+-+ACQ-Modifier)+ACo)+AFw-s+ACoAPQBc-s+ACoAJA-zero+AF8-initializer+AFw-s+ACoAOw-/+ACQ-1+ADs-/+ADs +AH0 +AH0 +ACM check for static initialisers. if (+ACQ-line +AD0Afg /+AF4AXAAr.+ACoAXA-bstatic+AFw-s.+ACoAPQBc-s+ACo(+ACQ-zero+AF8-initializer)+AFw-s+ACoAOw-/) +AHs if (ERROR(+ACI-INITIALISED+AF8-STATIC+ACI, +ACI-do not initialise statics to +ACQ-1+AFw-n+ACI . +ACQ-herecurr) +ACYAJg +ACQ-fix) +AHs +ACQ-fixed+AFsAJA-fixlinenr+AF0 +AD0Afg s/(+AFw-bstatic+AFw-s.+ACo?)+AFw-s+ACoAPQBc-s+ACoAJA-zero+AF8-initializer+AFw-s+ACoAOw-/+ACQ-1+ADs-/+ADs +AH0 +AH0 Bart.