From 04f4cd766a79a8e04b5a91e2d967c2151a41cd28 Mon Sep 17 00:00:00 2001 From: Arne Goedeke <el@laramies.com> Date: Mon, 12 May 2014 23:07:46 +0200 Subject: [PATCH] Stdio: use -Os for file.c with gcc gcc -O3 generates extremely bloated code for functions in file.c, even though it makes no sense to unroll the loop around open(2). --- src/modules/_Stdio/file.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/modules/_Stdio/file.c b/src/modules/_Stdio/file.c index 40378e8618..9de978539c 100644 --- a/src/modules/_Stdio/file.c +++ b/src/modules/_Stdio/file.c @@ -145,6 +145,14 @@ #define UNIX_SOCKET_CAPABILITIES (fd_INTERPROCESSABLE | fd_BIDIRECTIONAL | fd_CAN_NONBLOCK | fd_CAN_SHUTDOWN | fd_SEND_FD) #endif +/* + * gcc with -O3 generates very bloated code for the functions in this file. One rather extreme example + * is file_open, which ends up having 32 call sites of open(2). + */ +#ifdef __GNUC__ +#pragma GCC optimize "-Os" +#endif + /* #define SOCKETPAIR_DEBUG */ struct program *file_program; -- GitLab