mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: Patrick Oppenlander <patrick.oppenlander@gmail.com>
Cc: musl@lists.openwall.com
Subject: Re: Some questions
Date: Tue, 1 May 2018 17:05:53 -0400	[thread overview]
Message-ID: <20180501210553.GV1392@brightrain.aerifal.cx> (raw)
In-Reply-To: <CAEg67GmKAhsO2j+9Jdo6HpoJwebWCjqwkd=E1mTuJ7nxR1uSBQ@mail.gmail.com>

On Tue, May 01, 2018 at 10:10:45AM +1000, Patrick Oppenlander wrote:
> On Mon, Apr 30, 2018 at 1:16 PM, Rich Felker <dalias@libc.org> wrote:
> > On Mon, Apr 30, 2018 at 12:52:06PM +1000, Patrick Oppenlander wrote:
> >> - sigisemptyset uses bss. Could be implemented in a similar fashion to
> >> sigemptyset, save bss & would probably be faster.
> >
> > Ahh, yes. I wonder if gcc has any way to force const zero objects into
> > rodata rather than bss..? In any case memcmp is not an efficient way
> > to implement this, so maybe it should be changed.
> 
> Doing this:
> 
> diff --git a/src/signal/sigisemptyset.c b/src/signal/sigisemptyset.c
> index 312c66cf..28f74203 100644
> --- a/src/signal/sigisemptyset.c
> +++ b/src/signal/sigisemptyset.c
> @@ -4,6 +4,6 @@
> 
>  int sigisemptyset(const sigset_t *set)
>  {
> -       static const unsigned long zeroset[_NSIG/8/sizeof(long)];
> +       static const unsigned long zeroset[_NSIG/8/sizeof(long)] = {};
>         return !memcmp(set, &zeroset, _NSIG/8);
>  }
> 
> Makes it go into rodata.
> 
> I agree that it should probably be rewritten to not use memcmp.

I'm just changing it to avoid memcmp. This gets rid of the bss and
makes the code smaller.

Rich


      parent reply	other threads:[~2018-05-01 21:05 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-30  2:52 Patrick Oppenlander
2018-04-30  3:16 ` Rich Felker
2018-04-30  3:55   ` Patrick Oppenlander
2018-04-30 15:35     ` Rich Felker
2018-05-01  2:35       ` Patrick Oppenlander
2018-05-01 21:03         ` Rich Felker
2018-05-01 22:14           ` Patrick Oppenlander
2018-04-30  5:17   ` Patrick Oppenlander
2018-04-30 15:29     ` Rich Felker
2018-05-01  2:32       ` Patrick Oppenlander
2018-04-30  5:29   ` Patrick Oppenlander
2018-04-30 15:31     ` Rich Felker
2018-05-01  2:34       ` Patrick Oppenlander
2018-05-01 15:52         ` Rich Felker
2018-05-01 17:35           ` Rich Felker
2018-05-01 21:49             ` Andre McCurdy
2018-05-01 22:14               ` Szabolcs Nagy
2018-05-02 13:42                 ` Rich Felker
2018-05-01  0:10   ` Patrick Oppenlander
2018-05-01 14:19     ` Szabolcs Nagy
2018-05-01 21:05     ` Rich Felker [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180501210553.GV1392@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --cc=musl@lists.openwall.com \
    --cc=patrick.oppenlander@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).