On Wed, 24 Oct 2018, Martin Sebor wrote:

> On 10/24/2018 06:22 AM, Joseph Myers wrote:
> > On Wed, 24 Oct 2018, Martin Sebor wrote:
> > 
> > > But if you do want to avoid the attribute on declarations of
> > > these functions regardless it should be safe to add it after
> > > the declaration in the .c file, like so:
> > > 
> > > __hidden_ver1 (strcmp, __GI_strcmp, __redirect_strcmp)
> > >   __attribute__ ((visibility ("hidden"), copy (strcmp)));
> > 
> > The obvious question there is whether the glibc patch should use copy
> > (local) as well as copy (name) in the definition of __hidden_ver1.
> 
> I tried copy(local) but it breaks where local isn't declared.
> I think errno_location was the first one I saw where it referred
> to __GI__something_or_other that was previously only defined via
> an asm.

In that case maybe it should go in the .c files (the patch should define 
some common attribute_copy macro in some internal header, to avoid lots of 
places needing to duplicate conditionals for whether it's supported).

Whether nonnull attributes should be disabled when building glibc is a 
separate question which would involve reviewing lots of functions with 
such attributes against 
<https://sourceware.org/glibc/wiki/Style_and_Conventions#Invalid_pointers> 
to see whether there are checks for NULL that are actually appropriate 
under current glibc conventions but might be optimized away given such 
attributes.  So it should clearly be kept separate from fixes to use copy 
attributes to get better attribute consistency fot aliases.

-- 
Joseph S. Myers
jos...@codesourcery.com

Reply via email to