From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1YOp2S-000258-8P for mharc-grub-devel@gnu.org; Fri, 20 Feb 2015 09:58:44 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57705) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YOp2P-00024v-SC for grub-devel@gnu.org; Fri, 20 Feb 2015 09:58:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YOp2P-0002cq-1x for grub-devel@gnu.org; Fri, 20 Feb 2015 09:58:41 -0500 Received: from mail-wi0-x234.google.com ([2a00:1450:400c:c05::234]:63192) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YOp2O-0002bl-OG for grub-devel@gnu.org; Fri, 20 Feb 2015 09:58:40 -0500 Received: by mail-wi0-f180.google.com with SMTP id h11so3485665wiw.1 for ; Fri, 20 Feb 2015 06:58:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type; bh=r1qAwln4rumsx4wygIaZa7Y9RA35zEiY9wgvC4ZLQYg=; b=viyJ4xe+WXoPN9VQ4CtvZMe5yIkqxiPIg5cPiKM6b0glGytigiI+tHFLJxDVKEaz/N i40kSK0RY+0lHuj48viSm8Gn81ZSaydZUqS//oImgcwHNwsAPV1oq/oQAbhPQY0GuxB+ ssJIqSwZwa36TcpwiOD8USjixiHgEM6m7RFw7LIck3OUXZLagcQI0damOTkCgbFDVwOi iz86+iYp+RTD7de7kKporiu53Zeyn/+m4GVRPtGUKhwqwj0ahUgJnXMXD4llfvlon2b+ dMJLI+22MwV6P7a/6hET0TrQSn8OBcMubpXLXfI46JY/vMYAfVxW3Jozq023eQIC0Kxd ym5A== X-Received: by 10.194.61.51 with SMTP id m19mr19801382wjr.39.1424444319402; Fri, 20 Feb 2015 06:58:39 -0800 (PST) Received: from ?IPv6:2620:0:105f:fd00:202:52ff:fe61:c42e? ([2620:0:105f:fd00:202:52ff:fe61:c42e]) by mx.google.com with ESMTPSA id qb8sm36314858wjc.4.2015.02.20.06.58.38 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Feb 2015 06:58:38 -0800 (PST) Message-ID: <54E74B9D.8090605@gmail.com> Date: Fri, 20 Feb 2015 15:58:37 +0100 From: =?UTF-8?B?VmxhZGltaXIgJ8+GLWNvZGVyL3BoY29kZXInIFNlcmJpbmVua28=?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.4.0 MIME-Version: 1.0 To: dwmw2@infradead.org, llvmdev@cs.uiuc.edu, The development of GRUB 2 Subject: clang .code16 with -Os producing larger code that it needs to Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="n7UgDXvid29v98OMgFXwl0iiJrmRWFE6N" X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c05::234 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: Fri, 20 Feb 2015 14:58:42 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --n7UgDXvid29v98OMgFXwl0iiJrmRWFE6N Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable When experimenting with compiling GRUB2 with clang using integrated as, I found out that it generates a 16-bit code bigger than gas counterpart and result gets too big for size constraints of bootsector. This was traced mainly to 2 problems. 32-bit access to 16-bit addresses. source: movl LOCAL(kernel_sector), %ebx movl %ebx, 8(%si) clang: 7cbc: 67 66 8b 1d 5c 7c 00 addr32 mov 0x7c5c,%ebx 7cc3: 00 7cc4: 66 89 5c 08 mov %ebx,0x8(%si) gas: 7cbc: 66 8b 1e 5c 7c mov 0x7c5c,%ebx 7cc1: 66 89 5c 08 mov %ebx,0x8(%si) 32-bit jump. source: jnb LOCAL(floppy_probe) clang: + 7cb5: 66 0f 83 07 01 00 00 jae 7dc3 gas: - 7cb5: 0f 83 0a 01 jae 7dc3 The last one is particularly problematic as it never makes sense to issue 32-bit jump if %ip is only 16 bits and it eats 3 extra bytes per jump. Is it possible to force clang to generate 16-bit jumps? On bright side if I remove error strings the code is functional. --n7UgDXvid29v98OMgFXwl0iiJrmRWFE6N Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iF4EAREKAAYFAlTnS54ACgkQmBXlbbo5nOuUxgD9ELAyXe6T3UKe/28/FqBmsU4a 9LK5Y1xP/TGC8lmjEV4A/RmE0h2VsRupj0KwTq28h8EfZCaLdM7sZcTT9oiqWKcg =EGmm -----END PGP SIGNATURE----- --n7UgDXvid29v98OMgFXwl0iiJrmRWFE6N--