unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer via Libc-alpha <libc-alpha@sourceware.org>
To: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
Cc: Adhemerval Zanella via Libc-alpha <libc-alpha@sourceware.org>,
	 Fangrui Song <maskray@google.com>
Subject: Re: [PATCH 4/7] Move libc_freeres_ptrs and libc_subfreeres to weak functions
Date: Mon, 12 Dec 2022 15:05:41 +0100	[thread overview]
Message-ID: <87iligsone.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <f8cd6683-420c-c6ac-4d91-0101f03272ea@linaro.org> (Adhemerval Zanella Netto's message of "Mon, 12 Dec 2022 10:49:41 -0300")

* Adhemerval Zanella Netto:

>> I think you should consider introducing a call_free_static_weak that
>> does something like
>> 
>>   if (&ptr != NULL)
>>     free (ptr);
>> 
>> in the static case, and calls
>> 
>>   free (ptr);
>> 
>> unconditionally for the dynamic case.  And then add attribute_hidden
>> variable declarations to a suitable wrapper header under include/.
>> 
>> This avoids writing all these little helper functions.
>
> We already have call_free_static_weak function that does exactly that,

I don't see call_free_static_weak?

> maybe you are proposing a something like:
>
> # ifdef SHARED
> #  define declare_libc_freeres (name, ptr) \
> static void name (void) { free (ptr); }
> # else 
> #  define declare_libc_freeres (name, ptr) \
> static void name (void) { if (ptr != NULL) free (ptr); }
> # endif

It has to be &ptr != NULL for the weak case, and you also need to create
a weak alias.

Thanks,
Florian


  reply	other threads:[~2022-12-12 14:06 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-15 19:31 [PATCH 0/7] Fixing remaining lld issues Adhemerval Zanella via Libc-alpha
2022-11-15 19:31 ` [PATCH 1/7] configure: Move locale tools early Adhemerval Zanella via Libc-alpha
2022-11-15 19:31 ` [PATCH 2/7] elf: Do not assume symbol order on tst-audit25{a,b} Adhemerval Zanella via Libc-alpha
2022-12-12 12:36   ` Adhemerval Zanella Netto via Libc-alpha
2022-11-15 19:31 ` [PATCH 3/7] stdlib: Move _IO_cleanup to call_function_static_weak Adhemerval Zanella via Libc-alpha
2022-12-12 10:52   ` Florian Weimer via Libc-alpha
2022-12-13 16:52     ` Joseph Myers
2022-11-15 19:31 ` [PATCH 4/7] Move libc_freeres_ptrs and libc_subfreeres to weak functions Adhemerval Zanella via Libc-alpha
2022-12-12 10:55   ` Florian Weimer via Libc-alpha
2022-12-12 13:14     ` Adhemerval Zanella Netto via Libc-alpha
2022-12-12 10:58   ` Florian Weimer via Libc-alpha
2022-12-12 13:16     ` Adhemerval Zanella Netto via Libc-alpha
2022-12-12 11:00   ` Florian Weimer via Libc-alpha
2022-12-12 13:49     ` Adhemerval Zanella Netto via Libc-alpha
2022-12-12 14:05       ` Florian Weimer via Libc-alpha [this message]
2022-12-12 14:16         ` Adhemerval Zanella Netto via Libc-alpha
2022-12-12 15:39           ` Florian Weimer via Libc-alpha
2022-12-12 11:05   ` Andreas Schwab via Libc-alpha
2022-12-12 13:49     ` Adhemerval Zanella Netto via Libc-alpha
2022-12-12 11:08   ` Florian Weimer via Libc-alpha
2022-12-12 13:51     ` Adhemerval Zanella Netto via Libc-alpha
2022-11-15 19:31 ` [PATCH 5/7] libio: Remove the usage of __libc_IO_vtables Adhemerval Zanella via Libc-alpha
2022-12-12 11:40   ` Florian Weimer via Libc-alpha
2022-11-15 19:31 ` [PATCH 6/7] Remove --with-default-link configure option Adhemerval Zanella via Libc-alpha
2022-11-15 19:31 ` [PATCH 7/7] Remove set-hooks.h from generic includes Adhemerval Zanella via Libc-alpha

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

  List information: https://www.gnu.org/software/libc/involved.html

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

  git send-email \
    --in-reply-to=87iligsone.fsf@oldenburg.str.redhat.com \
    --to=libc-alpha@sourceware.org \
    --cc=adhemerval.zanella@linaro.org \
    --cc=fweimer@redhat.com \
    --cc=maskray@google.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.
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 read-only IMAP folder(s) and NNTP newsgroup(s).