Received: by 10.192.165.156 with SMTP id m28csp283271imm; Wed, 18 Apr 2018 22:12:00 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/bji6tnGi0lMCPV+KNI9lPbtN22QZlH+vj46HJIBuQSzWUs4ors/Fqt8y7vSvi4lTZl8pu X-Received: by 10.98.214.218 with SMTP id a87mr74231pfl.200.1524114720049; Wed, 18 Apr 2018 22:12:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524114720; cv=none; d=google.com; s=arc-20160816; b=FI6CRX7JHn8mH3ARBsn4DlLmq2Cxik8VFwcKL3UcqFR1XUlzmePKZArz2ZSuNaEefW R1SN5KgTitAgfPSBFzUFGvFmcYDilgNAYNfv50njeNaB+xmHQvgwgp7lqUse+ipKqQBv 25QSvOPW/c5BjnCyywGj55r5iSNvineBtd+WHOobufmmSDFCowYdhmiO71eIR8M+k1JX bhAnkXroXZa0DrJNzZIOtccyKuPe5I7j/KegWmlZLEylaEWW7D91t8Ip1YfGPQJL+OLg c5xouuB7e/dGQqxooG03syxZXsIWo5/xGZWt5LNRGjGxZS73YI06bCMNbbHtVTVTC9SH OwIA== 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 :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature:arc-authentication-results; bh=Lo/bLSu38qjeb53IRpouCA6N7lN/XAKseZSHaAVGSqI=; b=rV/GkqNDkxLWB9JosrUYvxlw/9sjVNzNNF5ZLpK5uD5g1gR7Oxvi3jwq8c2DkHHmPQ LZ8EllgwGYfqdFa22nJ3fsh4kT2fhQgYaRDKqF8XdqxyRav6Lwu48ri6SRn98VzoQXw5 lZi6jKEouNL3bGPAhR3XmTjKxVSqGhX5ZaIRRfPLIFhDXrHouqvG9721t/03QvsG3AqI X9dW3mU4DcLLAGAEvMQQTRpjL3HMDAwXZpk/P1x4jhgT52aocaFjQIh0kqb6I18AwSxG vL/v1p7gLTrP95IEiTIrudSj8KPJWAyaes1onU2wSjzGPIKo+/kCvSqLShydwSM2zfkE NDOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ZNBvBps8; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b1-v6si2737461plc.403.2018.04.18.22.11.45; Wed, 18 Apr 2018 22:12:00 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ZNBvBps8; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753293AbeDSFK2 (ORCPT + 99 others); Thu, 19 Apr 2018 01:10:28 -0400 Received: from mail-pl0-f66.google.com ([209.85.160.66]:33963 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750953AbeDSFK1 (ORCPT ); Thu, 19 Apr 2018 01:10:27 -0400 Received: by mail-pl0-f66.google.com with SMTP id z12-v6so2518375plo.1 for ; Wed, 18 Apr 2018 22:10:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:in-reply-to:references :organization:mime-version:content-transfer-encoding; bh=Lo/bLSu38qjeb53IRpouCA6N7lN/XAKseZSHaAVGSqI=; b=ZNBvBps8qS3NkJva9rMUwdGmtoMzFtC4bi6Q9/CoAOKx3+ick8cuatshfh6UvsrSf/ hBtAiQNE9muFZY08x4bWhctRUh9i6A+6dGeHheym1gMc4RZr+3v8SON52bGGJMFpM/4V d6XeoCqPhfLlbHW3eWF0tSxkJy8H/P9X7vWO/yntNWs+9/Ed0s51zOlAGTBvIpD/aK7U QJYkFIyTZdl3JYIyNWCsomU4mnAXZP4hSdFqYtpkzMWB2inTc0ATST13cQdgRiqJBybr 7cDLX0Vt4CiVHWW9gcbKCLWVcX9IhoHauQ93YOrx2bYB+/iJsrlEB+sTeZyLOyyGgRy0 1IZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:organization:mime-version:content-transfer-encoding; bh=Lo/bLSu38qjeb53IRpouCA6N7lN/XAKseZSHaAVGSqI=; b=V4MVnK2yV8PEGoBniGMIJ94iUPFcQ/TWu8RSKAdbhDJt8MnkWI4cdQyM8suDqDH06U 6rCpsK9+fQnhe2n6eW2Fr4pUM460dQyvRXVdHqhYIlSzcMz4okqwbpoaF9dI5TRV8+5n X34JHxIQGVBXwkfPvFtDSxEQyuKa8p9GUA9MLuH0eJOh2DbWBzEHHnh3MbpLQdHa7pEx oOxzqPuZyxtMKLefPpmiSph08qnvkIKe2R8FLmOIH+rMfUXFBSLfsgx0Xc/7rz9FeH56 XYOMtZH1PgQXhvcKgqBFURgubIBv7jQZ4Zp0Qf17HqUdIVJ/GcODUJVrPK3A+uyVw0Es FuRw== X-Gm-Message-State: ALQs6tBM+cSXzeCPmKHqU07/31AqW5x1Hfx3cx2rrkduCjlP94pDgzFt 59go46l43daeU11Ih7gW6eWdnw== X-Received: by 2002:a17:902:8692:: with SMTP id g18-v6mr4741025plo.152.1524114626603; Wed, 18 Apr 2018 22:10:26 -0700 (PDT) Received: from roar.ozlabs.ibm.com (59-102-70-78.tpgi.com.au. [59.102.70.78]) by smtp.gmail.com with ESMTPSA id s17sm7559865pfk.105.2018.04.18.22.10.22 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Apr 2018 22:10:25 -0700 (PDT) Date: Thu, 19 Apr 2018 15:10:08 +1000 From: Nicholas Piggin To: Christophe LEROY Cc: Mathieu Malaterre , Paul Mackerras , linuxppc-dev , LKML Subject: Re: [PATCH] powerpc: Allow selection of CONFIG_LD_DEAD_CODE_DATA_ELIMINATION Message-ID: <20180419150955.6c2ae486@roar.ozlabs.ibm.com> In-Reply-To: References: <20180417104909.22D416C07D@po15720vm.idsi0.si.c-s.fr> <48cdb73c-f0c4-0c8a-19f5-8fce000e7050@c-s.fr> Organization: IBM X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 18 Apr 2018 15:11:24 +0200 Christophe LEROY wrote: > Le 18/04/2018 à 10:36, Mathieu Malaterre a écrit : > > Christophe, > > > > On Wed, Apr 18, 2018 at 8:34 AM, Christophe LEROY > > wrote: > >> > >> > >> Le 17/04/2018 à 19:10, Mathieu Malaterre a écrit : > >>> > >>> On Tue, Apr 17, 2018 at 6:49 PM, Christophe LEROY > >>> wrote: > >>>> > >>>> > >>>> > >>>> Le 17/04/2018 à 18:45, Mathieu Malaterre a écrit : > >>>>> > >>>>> > >>>>> On Tue, Apr 17, 2018 at 12:49 PM, Christophe Leroy > >>>>> wrote: > >>>>>> > >>>>>> > >>>>>> This option does dead code and data elimination with the linker by > >>>>>> compiling with -ffunction-sections -fdata-sections and linking with > >>>>>> --gc-sections. > >>>>>> > >>>>>> By selecting this option on mpc885_ads_defconfig, > >>>>>> vmlinux LOAD segment size gets reduced by 10% > >>>>>> > >>>>>> Program Header before the patch: > >>>>>> LOAD off 0x00010000 vaddr 0xc0000000 paddr 0x00000000 align > >>>>>> 2**16 > >>>>>> filesz 0x0036eda4 memsz 0x0038de04 flags rwx > >>>>>> > >>>>>> Program Header after the patch: > >>>>>> LOAD off 0x00010000 vaddr 0xc0000000 paddr 0x00000000 align > >>>>>> 2**16 > >>>>>> filesz 0x00316da4 memsz 0x00334268 flags rwx > >>>>>> > >>>>>> Signed-off-by: Christophe Leroy > >>>>>> --- > >>>>>> arch/powerpc/Kconfig | 8 ++++++++ > >>>>>> 1 file changed, 8 insertions(+) > >>>>>> > >>>>>> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig > >>>>>> index 8fe4353be5e3..e1fac49cf465 100644 > >>>>>> --- a/arch/powerpc/Kconfig > >>>>>> +++ b/arch/powerpc/Kconfig > >>>>>> @@ -888,6 +888,14 @@ config PPC_MEM_KEYS > >>>>>> > >>>>>> If unsure, say y. > >>>>>> > >>>>>> +config PPC_UNUSED_ELIMINATION > >>>>>> + bool "Eliminate unused functions and data from vmlinux" > >>>>>> + default n > >>>>>> + select LD_DEAD_CODE_DATA_ELIMINATION > >>>>>> + help > >>>>>> + Select this to do dead code and data elimination with the > >>>>>> linker > >>>>>> + by compiling with -ffunction-sections -fdata-sections and > >>>>>> linking > >>>>>> + with --gc-sections. > >>>>>> endmenu > >>>>>> > >>>>> > >>>>> Just for reference, I cannot boot my Mac Mini G4 anymore (yaboot). The > >>>>> messages I can see (prom_init) are: > >>>> > >>>> > >>>> > >>>> Which version of GCC do you use ? > >>> > >>> > >>> $ powerpc-linux-gnu-gcc --version > >>> powerpc-linux-gnu-gcc (Debian 6.3.0-18) 6.3.0 20170516 > >>> Copyright (C) 2016 Free Software Foundation, Inc. > >>> This is free software; see the source for copying conditions. There is NO > >>> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR > >>> PURPOSE. > >>> > >>> this is simply coming from: > >>> > >>> $ apt-cache policy crossbuild-essential-powerpc > >>> crossbuild-essential-powerpc: > >>> Installed: 12.3 > >>> Candidate: 12.3 > >>> Version table: > >>> *** 12.3 500 > >>> 500 http://ftp.fr.debian.org/debian stretch/main amd64 Packages > >>> 500 http://ftp.fr.debian.org/debian stretch/main i386 Packages > >>> 100 /var/lib/dpkg/status > >>> > >>> > >>>> Can you provide the generated System.map with and without that option > >>>> active > >>>> ? > >>> > >>> > >>> $ du -sh g4/System.map.* > >>> 1.7M g4/System.map.with > >>> 1.8M g4/System.map.without > >> > >> > >> Here below is the list of objects removed with the option selected. I can't > >> see anything suspect at first. > > > > Does this help: > > > > $ grep orphan /tmp/g4.log|grep prom_init > > powerpc-linux-gnu-ld: warning: orphan section `.sbss.of_workarounds' > > from `arch/powerpc/kernel/prom_init.o' being placed in section > > `.sbss.of_workarounds'. > > powerpc-linux-gnu-ld: warning: orphan section `.sbss.of_workarounds' > > from `arch/powerpc/kernel/prom_init.o' being placed in section > > `.sbss.of_workarounds'. > > powerpc-linux-gnu-ld: warning: orphan section `.sbss.of_workarounds' > > from `arch/powerpc/kernel/prom_init.o' being placed in section > > `.sbss.of_workarounds'. > > Well, in a way yes. I initially thought that all those warnings where > normal, but indeed not. We were missing some things in powerpc linker > script, and most likely some sections ended up in the wrong place. > > Last week I tested on an 8xx and it was booting without any issue. > I tested today on an 83xx and it was not booting. > > I will soon send new patches with the fixes in the linker scripts. Yeah there needs to be a bit more work for powerpc before we can enable this. I have some old patches I will dust off and re-send. I never got modules working properly, I'll see if I can figure it out. Thanks, Nick