Received: from list by lists.gnu.org with archive (Exim 4.71) id 1VnnxZ-0001WD-Ta for mharc-grub-devel@gnu.org; Tue, 03 Dec 2013 06:16:09 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51451) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VnnxT-0001Ve-95 for grub-devel@gnu.org; Tue, 03 Dec 2013 06:16:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VnnxN-0004pZ-8z for grub-devel@gnu.org; Tue, 03 Dec 2013 06:16:03 -0500 Received: from mail-we0-f182.google.com ([74.125.82.182]:42210) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VnnxN-0004pT-3A for grub-devel@gnu.org; Tue, 03 Dec 2013 06:15:57 -0500 Received: by mail-we0-f182.google.com with SMTP id q59so13473204wes.13 for ; Tue, 03 Dec 2013 03:15:56 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:subject:message-id:references :mime-version:content-type:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=mxdI2HTWBmIo1/KleDgZQl8YjHvlT96egs57NwBin28=; b=dbOM2w1AaMl1AvkIrW6B/XqV4ejNh/o8KYA6E/EtbFVAHXBW/K5q1b64BSeXZzyfmj FstPDKhsOn1Yojlu4gDzhczkQ5OROLBgDaYlE1zDBmEOEM/nUTV8fQn9WHzalnzPep+T 7oTApnHjcBfOIlxzslnQYPJgjc8ajfcmdWwGqEjMe5DiUh2cbTatmrcp+Jxm8NpBF+wl WIX5B5A6ka0RIhe1KfDFmOdnzb5wK4DP47vK8IatXh4JQeMtiTAc6zemPROsGCQnK7dz JdeK1cyp0zri4IUn/1i+hMKVZWSK71YPDD6zW2uXD8b/z5gJWy1wGL3a/1ow2eNApA4A UtLA== X-Gm-Message-State: ALoCoQmAujCwocr0x4XXhe19B4fqeJYNfTq7Miu5hU+q4tZwWEdYXEUuHHa4gni5ZXiqS1Vm6HaE X-Received: by 10.180.107.168 with SMTP id hd8mr1970280wib.32.1386069355901; Tue, 03 Dec 2013 03:15:55 -0800 (PST) Received: from rocoto.smurfnet.nu ([2001:4b98:dc0:41:216:3eff:fea7:75f3]) by mx.google.com with ESMTPSA id uc18sm4458912wib.11.2013.12.03.03.15.54 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 03 Dec 2013 03:15:55 -0800 (PST) Date: Tue, 3 Dec 2013 12:16:10 +0100 From: Leif Lindholm To: The development of GNU GRUB Subject: Re: [PATCH, RFC, RFT] ARM relocation fixes Message-ID: <20131203111609.GT24997@rocoto.smurfnet.nu> References: <20131202133051.GE24997@rocoto.smurfnet.nu> <529CC74C.2060903@gmail.com> <20131202194020.GN24997@rocoto.smurfnet.nu> <529CE7DF.6000906@gmail.com> <20131202204622.GO24997@rocoto.smurfnet.nu> <529D6E1D.3010806@gmail.com> <20131203081441.GR24997@rocoto.smurfnet.nu> <529D94E0.3060402@gmail.com> <20131203084730.GS24997@rocoto.smurfnet.nu> <529DA4E1.8050201@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <529DA4E1.8050201@gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 74.125.82.182 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2013 11:16:09 -0000 On Tue, Dec 03, 2013 at 10:31:13AM +0100, Vladimir 'φ-coder/phcoder' Serbinenko wrote: > >> I meant that you can use conditions with bl but not blx. So if we have a > >> reloc on ARM bl.e targetting Thumb then we have to add veneers. Since we > >> have only small number of interworking calls it's probably easier to > >> always add veneers on interworking relative relocations rather than > >> having micro-optimisation and get some minor case wrong. > > > > OK, but the only place we could ever have a problem with this would > > be if we had asm in the kernel _explicitly_ done as .thumb. > > Which we don't. We explicitly moved away from that in order to have > > support for pre-v7 processors. > > > We also call C code from asm. One such instance (for division > instructions) caused the problem > > All modules will have full 32-bit external references, so will not > > use these instructions anyway. Any internal references within modules > > will be linked with LD, which will fix this up automatically. > > > In my small test I compiled: > extern void g(void); > > void f (int x) > { > if (!x) > g(); > } > And got following assembly with -Os: > > 0: e3500000 cmp r0, #0 > 4: e92d4008 push {r3, lr} > 8: 0bfffffe bleq 0 > 8: R_ARM_JUMP24 g > c: e8bd4008 pop {r3, lr} > 10: e12fff1e bx lr > > If g is a function in thumb kernel or thumb module then you need a veneer. Ok, you got me. Didn't consider -Os. But the second case would still be auto-added by the linker. But what is the objection to -mlong-calls? My armv7 kernel ends up only slightly larger with this option (57272 bytes vs. 57088) - 184 bytes, from which 12 bytes per veneer can be subtracted. And the overall arm-efi directory is smaller (10031244 vs. 10254924). For just the *.mod too (1229498 vs. 1234034). When compiling for For ARM (A32) (i.e. armv6), there is no difference in kernel size, but modules do grow 1.8% from 1477726 to 1503986. But is it really worth adding complexity to grub-mkimage for a small benefit to legacy platforms only? Could we instead add an arm_cflags with -mlong-calls for kernel in Makefile.core.def? / Leif