From owner-svn-src-head@freebsd.org Thu Aug 3 12:51:45 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 80DD3DB6BFB; Thu, 3 Aug 2017 12:51:45 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pf0-x229.google.com (mail-pf0-x229.google.com [IPv6:2607:f8b0:400e:c00::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4A4D476445; Thu, 3 Aug 2017 12:51:45 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pf0-x229.google.com with SMTP id d67so6027592pfc.0; Thu, 03 Aug 2017 05:51:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:mime-version:from:in-reply-to:date:cc:message-id:references :to; bh=NWlqcWaCGlX2NOEdQ5SeuLPmtlsPOth5X8/aaoz8SIg=; b=kYk3b9OpaWvlub6NULKWerEHPdxWxTJ0K5zmqmHC6nfor4Vd4JMY+WnrGTRRkhEmGm s2MOyzPID6vkpckmzMXQUf6Vb1MexZhw6U9WJh2Wp9gOIpeiCikOMZpJLeso2ETj3Y9v +UYacX6rtvW3U+WdGaGYEImui4s66g4oiYRfY3+JgjCz5eP+p85S/IGAM/O6wuqRxZbr xe7X4axar2lpxLC9rIJdpoU8Es+N6pJm2B4y+6t8hYjqKAvbw7CnrakhGqT8CDbzgb5v XhSl8gQIVcVrHyQJzVJ3SqDyzZDZ/TY7Wbs3ZjygrXt47Kft2gtrgGgaB2u1q+4IWDDQ Qzqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:mime-version:from:in-reply-to:date:cc :message-id:references:to; bh=NWlqcWaCGlX2NOEdQ5SeuLPmtlsPOth5X8/aaoz8SIg=; b=T7UjS6n+f/GPwj8RWJtaAzSbhacE3UQrummF3J4/CFbI9/9Ks+MlUr+2uQvPNz+mOK 04h6gzI+A0errv0p9qpCxgvqFB3B+MIxES00w4Eo0YgKcqWjGn9e6fdBPSfvnMsAdNRY sCkshzQti5yzk/ALvnhOhdhRQCk0P4MW8hUKX+lvY4okcWmiEmwoVCwl8Q7HARRwOA2M KXj1HrYCdO0UqwqdbOZezPbyN4HspDXblGCOVtvmuAL9U3cM479goyuH2doowYlWRI+G 4argwB5CjaWAi4so+GO1BNRC8z79nuoDwq88L/F0sOnQEiOfck9st+NU1hiTPELPgvcx 215w== X-Gm-Message-State: AIVw110HSMAYTS0DlVuoSPXpwHouQbJ+sajYXcTWwxu5H8YXrdQ/Wvib Uso1QNzAhB+9IRL4+bY= X-Received: by 10.84.228.215 with SMTP id y23mr1778115pli.358.1501764704596; Thu, 03 Aug 2017 05:51:44 -0700 (PDT) Received: from pinklady.local (c-73-19-52-228.hsd1.wa.comcast.net. [73.19.52.228]) by smtp.gmail.com with ESMTPSA id i67sm12875393pgd.25.2017.08.03.05.51.43 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 03 Aug 2017 05:51:43 -0700 (PDT) Subject: Re: svn commit: r321969 - in head/sys/boot: arm/at91/libat91 arm/ixp425/boot2 i386/boot2 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Content-Type: multipart/signed; boundary="Apple-Mail=_00D0BBC5-84C1-4464-844F-7D7F64E274A1"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Pgp-Agent: GPGMail From: "Ngie Cooper (yaneurabeya)" In-Reply-To: <20170803173421.C2203@besplex.bde.org> Date: Thu, 3 Aug 2017 05:51:42 -0700 Cc: Ngie Cooper , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-Id: References: <201708030527.v735R5dg041043@repo.freebsd.org> <20170803173421.C2203@besplex.bde.org> To: Bruce Evans X-Mailer: Apple Mail (2.3124) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Aug 2017 12:51:45 -0000 --Apple-Mail=_00D0BBC5-84C1-4464-844F-7D7F64E274A1 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Aug 3, 2017, at 00:53, Bruce Evans wrote: >=20 > On Thu, 3 Aug 2017, Ngie Cooper wrote: >=20 >> Log: >> Fix the return types for printf and putchar to match their libc and >> POSIX equivalents >>=20 >> Both printf and putchar return int, not void. >>=20 >> This will allow code that leverages the libcalls and checks/rely on = the >> return type to interchangeably between loader code and non-loader >> code. >>=20 >> MFC after: 1 month >>=20 >> Modified: >> head/sys/boot/arm/at91/libat91/lib.h >> head/sys/boot/arm/at91/libat91/printf.c >> head/sys/boot/arm/at91/libat91/putchar.c >> head/sys/boot/arm/ixp425/boot2/ixp425_board.c >> head/sys/boot/arm/ixp425/boot2/lib.h >> head/sys/boot/i386/boot2/boot2.c >=20 > This is wrong for at least i386/boot2. It isn't part of the loader, = and > saves space by not returning unused values. >=20 >> Modified: head/sys/boot/i386/boot2/boot2.c >> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >> --- head/sys/boot/i386/boot2/boot2.c Thu Aug 3 03:45:48 2017 = (r321968) >> +++ head/sys/boot/i386/boot2/boot2.c Thu Aug 3 05:27:05 2017 = (r321969) >> @@ -114,8 +114,8 @@ void exit(int); >> static void load(void); >> static int parse(void); >> static int dskread(void *, unsigned, unsigned); >> -static void printf(const char *,...); >> -static void putchar(int); >> +static int printf(const char *,...); >> +static int putchar(int); >=20 > These are freestanding static functions, so they have nothing to do > with library functions except their name is a hint that they are > similar. >=20 > Since they are static, -funit-at-a-time might allow the unused return = values > to be optimized away. Then returning unused values would be just an > obfuscation. >=20 > This file still has a static memcpy() which is quite different from = the > libc version. It doesn't return an unused value, and its arg types = are > all different (no newfangled size_t or newerfangled restrict). >=20 > Freestanding versions (static and otherwise) cause problems with = builtins. > -ffreestanding turns off all builtins. The static memcpy used to be > ifdefed so as to use __builtin_memcpy instead of the static one if the > compiler is gcc. That apparently broke with gcc-4.2, since the = builtin > will call libc memcpy() in some cases, although memcpy() is = unavailable > in the freestanding case. I get the point about them being freestanding functions, but if the = functions aren=E2=80=99t meant to be compatible they should be named = differently. Part of the issue some code that bridged loader and = non-loader users (bootdevtest and zfsboottest for example) relied on = feature parity (in part because the ZFS code required it and because of = how things are compiled/linked together). If compilers get pedantic = enough, then they=E2=80=99ll flag these issues as errors and we=E2=80=99ll= have to address these compatibilities at that point. My intent was ok (I think), but the implementation I did is wrong, so = I=E2=80=99ll revert the change completely and leave it for someone else = to deal with the incompatibilities (I=E2=80=99ll just integrate = bootdevtest and zfsboottest into buildworld under sys/boot so they = won=E2=80=99t remain broken for weeks on end, like they were recently). Thanks, -Ngie --Apple-Mail=_00D0BBC5-84C1-4464-844F-7D7F64E274A1 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJZgxxeAAoJEPWDqSZpMIYV9cwQALEbGxM4T5iX8c8dSM8SnRXR ZIU7so3LCYyB90eUAejhAmf9DD0VKkPq/Jt4btMpht8Y5zqZuskvcweuAxTZlZ+y EDHVVrvz0afYO9iwjV3UVjVCE7Kh7aZ0PfH44Nu1SqseTxqd5mueG6Gi/oAXv0nu +n35vZnbNcyl1ZpPrxp+UQ01TcyOJkjUHwW+Bzb4EXtE+7DRzIkO2popNWvJf12a ht6iapBUWuTLj/zfPb2cSa2R+bWUeXBFVbGmP4ugIws/Nv2cgGbLpZw/EoAviYvq vh/7r/pzQDQPqg/Zz0QOlprZ1TtwsnJ+XaLPHmjXYanFplCZ6NRtIp2AWnRX++AT /7IQ0oaCUtos2oakqHgH9Xiw7vESpfSJxR8yZsYtYSH0xSG9gbR1gBBWCd0B1x6F 2Dvr5zzc2pOs9mDsPjiRsyU5lecKH1ULn81jIK/FSxmI34o0O/KjarYu4jDtabqE NkxfvQBYAl3XALM1iSfNuo640/gPJoHGI5lpuLhz4Pl/a6pMTNXUBk+dE1EX9lOK LkjtzqjAAvVly2tl4dLJWLPUeAoyjJNbOo2NbHzcp1zXwxqXEGFGwscY6ZIukCWy 6BGusj35HqWEQdhhgeRC2zXuLiQPnb/hkBSaVWTxisCL06rOgmnbBokkwgzVOXtp WdQ5xacFWGHgp0l1iGGq =TrgD -----END PGP SIGNATURE----- --Apple-Mail=_00D0BBC5-84C1-4464-844F-7D7F64E274A1--