From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/12249 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 17:43:33 +0000 Message-ID: References: <20171207170356.GX1627@brightrain.aerifal.cx> <20171215041925.GG1627@brightrain.aerifal.cx> <20171215123331.GG15263@port70.net> ,<20171215172353.GL1627@brightrain.aerifal.cx> 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 1513359831 7102 195.159.176.226 (15 Dec 2017 17:43:51 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 15 Dec 2017 17:43:51 +0000 (UTC) To: "musl@lists.openwall.com" Original-X-From: musl-return-12265-gllmg-musl=m.gmane.org@lists.openwall.com Fri Dec 15 18:43:47 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 1ePu1R-0001R7-JH for gllmg-musl@m.gmane.org; Fri, 15 Dec 2017 18:43:45 +0100 Original-Received: (qmail 9724 invoked by uid 550); 15 Dec 2017 17:43:50 -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 9703 invoked from network); 15 Dec 2017 17:43:50 -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=BWOT4/VAOAiKLlssWQGLHCeMe5SsX/lmlcO2J02LEa4=; b=Xqq9WCv6fH9ma8TPrbTHy3LoxHmu86rXMiVePb+fcRJFZlupzphlThRgqxOg8kZ96Kexpz3X9TW0y+rNTBblgZvPtznIRmcbp9eRPPoN7HbnVUuQoPdvJfk4xkOSmq/+0EfWc4W2jDfa0WZ/Xocy4cFfcGgGCqyF1Rhgl7raj/o= Thread-Topic: [musl] [PATCH] split __libc_start_main.c into two files (Wasm) Thread-Index: AQHTb2pBP8VsOCdulkepcQ6wgWaD9qM4G+cAgAu9DICAAHLZ/4AAFzSAgAAC5HOAAE48gIAAAoPO In-Reply-To: <20171215172353.GL1627@brightrain.aerifal.cx> 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;HE1PR0502MB3884;6:f8Ixo7J3R/RzOmangYv/eHQjvWJqOKjcqsQIlsfzETYXAT6OaL/1/aDs/YSzh4/QZizw2UU8bsJjtULuAAiHhZkGg2SYz4rrpcL7ZqtPfLsNTA61aWMK1P2HEjr75mek4GuAsWCyP6Jym476wXp/B1Xjf4BA+XVq0QGYpMpniqeibfyyx5YNkjTwB1r35gc6VnScwVJsK+4HPJAVb6kL15mgtUGfIEsN/WLpm1hiZcMQ3BGEr1rTx4bfKlfQQDTrA6tTybrfwkve0pKbZQAEhiZ5poCABoM0qeDPi7wgRdCygBAseXEb9TAef7L/plyw9+eTXkTVQ+EAMCxME584cUqIoZypZl4M7IdVNwO5Jj0=;5:Li1SY4XVyav1alMmUay5Jyka+rOj2icdY/CvYfV8adPs1YwdFevgq2i+0Gme2juho+XSV0+IaSxjJC5Blvz+xmKsu4MvTEUnNn1pyBroTjbVoTHSBE4we6AFuxoMmSmDnDzIb4gxbILpDqMlHuvGd62NCJxOtRdMGGgotI8i+tk=;24:x/VeAFZ90GUo7JSda8HqJx2ZLKp4AD1HizYOADgLvTYN6p/b0pH8dRuaVEGiZPixD6WueCg9Eo9wktkKQkTEgBBCN9VYVP0m2EOkHk/Du8k=;7:bboB3FumDJiSFuit6U1jm7dZ6Yjr3dvkDBY/EXCreMNHqjmx80plGPogpFTSvrMUrlUSoz9skp7sywBYBcnPXx8Zcb1S 9z/a8f4z7bPMWAhSXokBFXokWW0OKRWEHRd/jloATgaCzBnW8UX+K7/98+/SUm7sDhgwm2zz+69Jt/xdV/9yetCEQKoZQqprLn x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-correlation-id: ca46fed4-2de0-4e83-0fa8-08d543e35cc1 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(5600026)(4604075)(4534020)(4602075)(4603075)(4627115)(201702281549075)(2017052603307);SRVR:HE1PR0502MB3884; x-ms-traffictypediagnostic: HE1PR0502MB3884: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040450)(2401047)(5005006)(8121501046)(3231023)(93006095)(93001095)(3002001)(10201501046)(6041248)(2016111802025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(20161123555025)(20161123560025)(20161123564025)(20161123562025)(6072148)(6043046)(201708071742011);SRVR:HE1PR0502MB3884;BCL:0;PCL:0;RULEID:(100000803101)(100110400095);SRVR:HE1PR0502MB3884; x-forefront-prvs: 05220145DE x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(39850400004)(346002)(396003)(376002)(366004)(189003)(199004)(24454002)(2900100001)(93886005)(81166006)(6116002)(97736004)(1730700003)(81156014)(478600001)(25786009)(102836003)(8676002)(55016002)(5640700003)(8936002)(6506007)(53546011)(53936002)(6246003)(229853002)(316002)(6436002)(9686003)(2906002)(86362001)(76176011)(305945005)(7736002)(68736007)(7696005)(3660700001)(99286004)(3280700002)(2501003)(105586002)(33656002)(5660300001)(6916009)(2351001)(106356001)(14454004)(59450400001)(2950100002)(74316002)(5250100002);DIR:OUT;SFP:1101;SCL:1;SRVR:HE1PR0502MB3884;H:HE1PR0502MB3883.eurprd05.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A: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: ca46fed4-2de0-4e83-0fa8-08d543e35cc1 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Dec 2017 17:43:33.4180 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 9ad766d3-c6a5-4458-8c58-244e7c118728 X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0502MB3884 X-OriginatorOrg: realvnc.com Xref: news.gmane.org gmane.linux.lib.musl.general:12249 Archived-At: On 15 December 2017 17:23, Rich Felker wrote: > I don't see this as ugly at all -- the obvious behavior for exit is > for it to just go into a "halted" state. There is no builtin lifecycle for that in web browsers, but we can emulate = it. > This is what you generally > expect on embedded C implementations with no OS, or if pid 1 exits on > a unix-like system. If you don't yet support thread creation, all it > has to do is something like for(;;) wait_for_something(); or similar. > Once you have threads, you may need some nontrivial work to ensure > that all threads enter a halted state, or it might just be as simple > as stopping the interpreter. We certainly can't do an infinite loop (who wants tabs in their browser to = lock their CPU at 100%?) - and there's no way to wait on anything in Wasm s= ince it's single-threaded. A trap is the only way to report to the interpreter that it should stop exe= cution. It's workable, although awkward. (JavaScript can also throw excepti= ons, but Wasm code will soon be able to catch those, so a trap is I believe= the only uncatchable exceptional condition.) It will look something like defining "__syscall_exit() { __builtin_trap(); = }" for Wasm. If you really don't want to split the translation unit, I can live with it,= although it doesn't seem like a big request, since it's not changing the c= ode at all, just giving independent linkage to two different functions. I'll revert the change on my branch. Thanks for discussing it. Nick=