|
Message-ID: <CAEg67GmKAhsO2j+9Jdo6HpoJwebWCjqwkd=E1mTuJ7nxR1uSBQ@mail.gmail.com> Date: Tue, 1 May 2018 10:10:45 +1000 From: Patrick Oppenlander <patrick.oppenlander@...il.com> To: musl@...ts.openwall.com Subject: Re: Some questions On Mon, Apr 30, 2018 at 1:16 PM, Rich Felker <dalias@...c.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. Patrick
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.