From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/12246 Path: news.gmane.org!.POSTED!not-for-mail From: Nicholas Wilson Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH] split __libc_start_main.c into two files (Wasm) Date: Fri, 15 Dec 2017 13:04:14 +0000 Message-ID: References: <20171207170356.GX1627@brightrain.aerifal.cx> <20171215041925.GG1627@brightrain.aerifal.cx> ,<20171215123331.GG15263@port70.net> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1513343077 6786 195.159.176.226 (15 Dec 2017 13:04:37 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 15 Dec 2017 13:04:37 +0000 (UTC) To: "musl@lists.openwall.com" Original-X-From: musl-return-12262-gllmg-musl=m.gmane.org@lists.openwall.com Fri Dec 15 14:04:27 2017 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1ePpf8-0001AL-8f for gllmg-musl@m.gmane.org; Fri, 15 Dec 2017 14:04:26 +0100 Original-Received: (qmail 28212 invoked by uid 550); 15 Dec 2017 13:04:31 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 28194 invoked from network); 15 Dec 2017 13:04:30 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=realvnc.onmicrosoft.com; s=selector1-realvnc-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=102ifR/9YsIhnDHCzMPeXO5SldSZ3/U3dFUawWKbJlQ=; b=bdkpzAk7sv9h7m08tYjrMWoS7xqSES2DknVdIVRCr/wSMbYstIPhpxxEZdPZHYqhXlvegF1cmR5wRpN7bgGiYIoDYG3md4RVxEcv2qkNAq/Gv8Flvt1bzdHCTJcRzXGKXsjyAxC+oroPhbk/crIv9RPVu1t7O6Zu0VCE9Blt3HE= Thread-Topic: [musl] [PATCH] split __libc_start_main.c into two files (Wasm) Thread-Index: AQHTb2pBP8VsOCdulkepcQ6wgWaD9qM4G+cAgAu9DICAAHLZ/4AAFzSAgAAC5HM= In-Reply-To: <20171215123331.GG15263@port70.net> Accept-Language: en-GB, en-US Content-Language: en-GB X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=nicholas.wilson@realvnc.com; x-originating-ip: [2a02:390:a001:192:d6be:d9ff:fe9c:1892] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;HE1PR0502MB3881;6:0aPMvS43oGMeJSI4TpVu5nSrjdRcJkeq78vIt52xCgnfptWIgfGcARgb1vnAlNE5gx5zxGT9XLx5p32QMq6WhgYZPkcUoiLWKeCkENEXmJnqhXI2OO5Fasb+glWap6VHXGPGeIETW1qJq45m8khmNq8r0LqIAYlvx2HG4hOOsZ0x2CIVlZX3++v59SoS5vj2pmZHmbJFSQd1CYLl5dTQF0kOjeof62qVhlXGGglJ6VcVIkXtZOjhDZraVcZj8Y7+vS2rGNYBMtbtWpGLVOPMCtQl0q7UL6cQ07P/PrDjOFVafHNqN3mosRMtsCxso3edvD4PQ/g6H0hWapTLIo8ay97z8PKYp4yDSjPUfctvpxc=;5:e4WuxcZcThM7wVWL4/vb1EQwxwgLVFYZ2Hcal5TWhB5a3SkhU2wgNNjvKqiLj42UCFgGSq2oghysWawajxmVDy/dXncazUFjeBEZS2ot+8KZQmpmZ3sS/ceETkQoju5hJS9RmBYrgdHo7pNPd1ts44P4im0+YF986/yJcR37ZJk=;24:IBFsLDY7M0FXOeqvpN5VnzuUDzgH0KqMraLtmKSAUh0QzvEq5pmaie08+xSmuuskm5WuxHTHTzHvfeFSC8UOB12PP5wBzE6AFCsE97bM5U0=;7:xsGsvW6K9/Fr2tzjoiAlvcW/QZiD4W48UE/ute6WsjgfX1l/UW2QETZg1U73v1UDP1WoMSp97ULPQck+SEGmjYH56MJQ 7+HYNcux6I+tTQ2ez60L78sPZUqTQF5Us1KDcokf7XtnNP+G6NnFk7JHx33VoYIPtG1+To2eg92PI/E6Sw1wvNzkl6jyQNOZgz x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-correlation-id: ea34aeeb-924a-4f1b-30db-08d543bc57a4 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(5600026)(4604075)(4534020)(4602075)(4603075)(4627115)(201702281549075)(2017052603307);SRVR:HE1PR0502MB3881; x-ms-traffictypediagnostic: HE1PR0502MB3881: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(278428928389397); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040450)(2401047)(5005006)(8121501046)(3002001)(10201501046)(3231023)(93006095)(93001095)(6041248)(2016111802025)(20161123562025)(20161123560025)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(20161123564025)(6043046)(6072148)(201708071742011);SRVR:HE1PR0502MB3881;BCL:0;PCL:0;RULEID:(100000803101)(100110400095);SRVR:HE1PR0502MB3881; x-forefront-prvs: 05220145DE x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(346002)(39840400004)(376002)(396003)(366004)(199004)(24454002)(189003)(45080400002)(5640700003)(5660300001)(53936002)(25786009)(6116002)(102836003)(6246003)(33656002)(93886005)(9686003)(229853002)(6436002)(2351001)(316002)(2900100001)(86362001)(7736002)(105586002)(2906002)(3280700002)(305945005)(2501003)(74316002)(106356001)(55016002)(6506007)(68736007)(99286004)(7696005)(59450400001)(76176011)(97736004)(14454004)(53546011)(6916009)(5250100002)(8676002)(8936002)(3660700001)(81156014)(81166006)(2950100002)(1730700003)(478600001);DIR:OUT;SFP:1101;SCL:1;SRVR:HE1PR0502MB3881;H:HE1PR0502MB3883.eurprd05.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; received-spf: None (protection.outlook.com: realvnc.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM X-MS-Exchange-CrossTenant-Network-Message-Id: ea34aeeb-924a-4f1b-30db-08d543bc57a4 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Dec 2017 13:04:14.4677 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 9ad766d3-c6a5-4458-8c58-244e7c118728 X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0502MB3881 X-OriginatorOrg: realvnc.com Xref: news.gmane.org gmane.linux.lib.musl.general:12246 Archived-At: Hi, On 15 December 2017 12:33, Szabolcs Nagy wrote: > why is exit ugly? > halting execution should not be complicated on whatever platform In WebAssembly, the runtime environment is (typically) a webpage. It's not = clear what exit() would be expected to do to the webpage or Wasm module. Th= e Wasm interpreter offered by browsers doesn't offer a way to cleanly exit/= terminate a running WebAssembly function; the "trap" instruction to abort i= s the closest you could get. If you have some existing C code that you want to compile/port to WebAssemb= ly, whatever the code previously expects to happen on exit() won't happen. = It will need to be changed when ported to the web, the semantics of a Unix = process and a web page are unavoidably different. For brand-new code specif= ically targeting a web page, you wouldn't deliberately add a dependency on = exit(), because it's not clearly meaningful for a webpage. So, it's "ugly" to me because the lifecycle of the webpage is an awkward fi= t for exit(). We could bodge in some emulation, but it's just ugly to pull = in the emulation when we don't expect it to be used. My preference is "you = should only link in the hacks you rely on". It's not too bad - we will have to implement exit() emulation for legacy co= de, so I could live with it being linked in to every application. I just di= slike hacks, and don't enjoy seeing them bundled into my own applications! > how do you implement a_crash? > the c runtime uses that all over the place anyway so it's unlikely > that you can get away without process termination code. a_crash will invoke the Wasm "trap" instruction, which throws an exception = up to the WebAssembly interpreter. It will have proper "noreturn" semantics= , but it's then up to the interpreter to do whatever it feels is most helpf= ul to the developer - probably print a message. Nick=