From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/8795 Path: news.gmane.org!not-for-mail From: Denys Vlasenko Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH] configure: add gcc flags for better link-time optimization Date: Wed, 28 Oct 2015 10:53:41 +0100 Message-ID: References: <1445603426-4827-1-git-send-email-vda.linux@googlemail.com> <20151023131202.GI10551@port70.net> <20151027012131.GR8645@brightrain.aerifal.cx> <20151027210123.GZ8645@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1446026061 13325 80.91.229.3 (28 Oct 2015 09:54:21 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 28 Oct 2015 09:54:21 +0000 (UTC) To: musl , Rich Felker Original-X-From: musl-return-8808-gllmg-musl=m.gmane.org@lists.openwall.com Wed Oct 28 10:54:18 2015 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1ZrNQw-0004El-Bi for gllmg-musl@m.gmane.org; Wed, 28 Oct 2015 10:54:18 +0100 Original-Received: (qmail 31898 invoked by uid 550); 28 Oct 2015 09:54:14 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 31869 invoked from network); 28 Oct 2015 09:54:12 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=/3LpuJ2zn+zaE53T+FtbWUC8QkVFRLl5nBs99Ln/VC4=; b=aZhh28bdmlNps6U4EpUsTzk6v1kSx8qfWorlY8v9ep7fCZFF00wgvyHNFH+WRAbB4N E9gmwSZklzZ8OzbaoHXoQmCyWhk+hdS2TKDUbqvtjAJLQ1As7rk7yNC2lydjolUf3Y3W ZxpCQIcqERxAIhmQgdC8zlfUP82lnVJu0/pJKD42ao0cm5CgjpIwaB08v8rcu7k+VkzX dV0OiiVXOOtbQQXLabpe/FCYi9MHYQx4/VBcoApJMjPxyPARNaxvzQoQl2b556Gc/YU4 LUFH9xX6na75TfOAMPopslqfUkBL/bLZpZdtd3EJTT54BFTOIfnm1ZXs9fA2ltgB5kMs 7VaQ== X-Received: by 10.55.200.220 with SMTP id t89mr55756543qkl.78.1446026041160; Wed, 28 Oct 2015 02:54:01 -0700 (PDT) In-Reply-To: <20151027210123.GZ8645@brightrain.aerifal.cx> Xref: news.gmane.org gmane.linux.lib.musl.general:8795 Archived-At: On Tue, Oct 27, 2015 at 10:01 PM, Rich Felker wrote: >> After -ffunction-sections -fdata-sections are added to gcc command line, >> "nm" output does change, the entire difference is as follows: >> >> --- libc.so.nm.OLD 2015-10-27 19:57:52.971964518 +0100 >> +++ libc.so.nm 2015-10-27 19:58:28.544115009 +0100 >> @@ -18,7 +18,6 @@ >> 0000000000000001 T setutxent >> 0000000000000001 W updwtmp >> 0000000000000001 T updwtmpx >> -0000000000000002 T dlclose >> 0000000000000002 T __stack_chk_fail >> 0000000000000003 T catclose >> 0000000000000003 T dirfd >> @@ -84,6 +83,7 @@ >> 0000000000000005 T catopen >> 0000000000000005 T creall >> 0000000000000005 T dladdr >> +0000000000000005 T dlclose >> 0000000000000005 T dlinfo >> 0000000000000005 T __fbufsize >> 0000000000000005 T __freadptrinc >> @@ -328,7 +328,6 @@ >> 000000000000000b T recv >> 000000000000000b T send >> 000000000000000b T setprotoent >> -000000000000000b T tfind >> 000000000000000b T __xstat >> 000000000000000b W __xstat64 >> 000000000000000c T __acquire_ptc >> @@ -417,6 +416,7 @@ >> 000000000000000e T tcflow >> 000000000000000e T tcflush >> 000000000000000e T tcsendbreak >> +000000000000000e T tfind >> 000000000000000f T dcgettext >> 000000000000000f T execv >> 000000000000000f T execvp >> @@ -986,8 +986,6 @@ >> 0000000000000032 T pthread_rwlock_init >> 0000000000000032 T putchar_unlocked >> 0000000000000032 T sem_init >> -0000000000000032 T __stdio_exit >> -0000000000000032 W __stdio_exit_needed >> 0000000000000032 T wcschr >> 0000000000000033 T pthread_rwlock_tryrdlock >> 0000000000000033 T pthread_setcanceltype >> @@ -1011,6 +1009,8 @@ >> 0000000000000035 T pthread_sigmask >> 0000000000000035 T pwritev >> 0000000000000035 W pwritev64 >> +0000000000000035 T __stdio_exit >> +0000000000000035 W __stdio_exit_needed >> 0000000000000035 W thrd_detach >> 0000000000000035 T __tre_mem_destroy >> 0000000000000035 T tsearch >> >> As you see, not a single label was eliminated. >> >> >> The visible small differences in size for a few functions are caused >> by the need to always use "near" jumps (not "short" ones) >> for tail call optimizations now, since they now jump across sections: >> >> Before: >> 00000000000274a6 : >> 274a6: eb c8 jmp 27470 <__reset_tls+0x1f0> >> After: >> 000000000002795f : >> 2795f: e9 c5 ff ff ff jmpq 27929 <__reset_tls+0x1f0> > > I see. That's probably not a big deal. > > Did you see any symbols disappear when adding --gc-sections? Yes, I do. $ nm --size-sort busybox_unstripped >busybox_unstripped.nm $ nm --size-sort busybox_unstripped--gc-sections >busybox_unstripped--gc-sections.nm $ diff -u busybox_unstripped.nm busybox_unstripped--gc-sections.nm | grep '^[^ @]' --- busybox_unstripped.nm 2015-10-28 10:48:16.362304813 +0100 +++ busybox_unstripped--gc-sections.nm 2015-10-28 10:48:26.056294599 +0100 -0000000000000001 t reinit_unicode_for_ash -0000000000000001 t reinit_unicode_for_hush -0000000000000007 T xmalloc_sockaddr2host -0000000000000008 b cur.1926 -0000000000000008 b dummy -0000000000000008 b dummy_file -0000000000000008 b end.1927 -0000000000000008 b lock.1928 -0000000000000008 T xstrtoi_range -0000000000000008 T xstrtoll_range -000000000000000a T bb_internal_getpwnam_r -000000000000000a T ipneigh_main -000000000000000c T xsocket_stream -000000000000000e T xgid2group -0000000000000010 T selinux_or_die -0000000000000011 T xatoi_range_sfx -0000000000000011 T xatou_range_sfx -0000000000000012 T xstrtoi -0000000000000013 T xatoll_range_sfx -0000000000000015 T replace -0000000000000017 T xatoi_sfx -0000000000000017 T xspawn -0000000000000018 T replace_underscores -000000000000001a T bb_iswspace -000000000000001b T bb_internal_setpwent -000000000000001b T xgetgrgid -000000000000001c T llist_rev -000000000000001c T xstrtoll -000000000000001d T xread_char -000000000000001e T monotonic_ns -0000000000000021 T xatoll_sfx -0000000000000021 T xmalloc_fgetline_str -0000000000000022 T bb_iswpunct -0000000000000023 T bb_iswalnum -000000000000002f T bb_internal_endpwent -000000000000002f T isrv_want_wr -0000000000000033 T bb_delete_module -000000000000003c T index_in_str_array -000000000000003e T rewind -0000000000000043 T is_suffixed_with -000000000000004b T moderror -0000000000000054 T executable_exists -000000000000005a T rta_addattr_l -0000000000000062 T string_to_llist -0000000000000088 T bb_init_module -00000000000000ae T bb_herror_msg -00000000000000c3 T parse_cmdline_module_options -000000000000010d T __simple_malloc