glibc/inet
Adhemerval Zanella 6b7067460f Handle clang -Wignored-attributes on weak aliases
Clang issues a warning for double alias redirection, indicating that thei
original symbol is used even if a weak definition attempts to override it.

For instance, in the construction:

  int __internal_impl (...) {}
  weak_alias (__internal_impl, external_impl);
  #if SOMETHING
  weak_alias (external_impl, another_external_impl)
  #endif

Clang warns that another_external_impl always resolves to __internal_impl,
even if external_impl is a weak reference. Using the internal symbol for
both aliases resolves this warning.

This issue also occurs with certain libc_hidden_def usage:

  int __internal_impl (...) {}
  weak_alias (__internal_impl, __internal_alias)
  libc_hidden_weak (__internal_alias)

In this case, using a strong_alias is sufficient to avoid the warning
(since the alias is internal, there is no need to use a weak alias).

However, for the constructions like:

  int __internal_impl (...) {}
  weak_alias (__internal_impl, __internal_alias)
  libc_hidden_def (__internal_alias)
  weak_alias (__internal_impl, external_alias)
  libc_hidden_def (external_alias)

Clang warns that the internal external_alias will always resolve to
__GI___internal_impl, even if a weak definition of __GI_internal_impl is
overridden.  For this case, a new macro named static_weak_alias is used
to create a strong alias for SHARED, or a weak_alias otherwise.

With these changes, there is no need to check and enable the
-Wno-ignored-attributes suppression when using clang.

Checked with a build on affected ABIs, and a full check on aarch64,
armhf, i686, and x86_64.

Reviewed-by: Sam James <sam@gentoo.org>
2025-12-09 08:58:10 -03:00
..
arpa Add _FORTIFY_SOURCE support for inet_ntop 2025-03-21 09:35:42 +01:00
bits Enable --enable-fortify-source with clang 2025-11-21 13:13:11 -03:00
netinet inet: Add common IPv6 packet header macros 2025-01-13 10:54:38 -03:00
protocols
rpc
Makefile Handle clang -Wignored-attributes on weak aliases 2025-12-09 08:58:10 -03:00
Versions
bindresvport.c
bug-if1.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
check_native.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
check_pf.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
deadline.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
etc.rpc
ether_aton.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
ether_aton_r.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
ether_line.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
ether_ntoa.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
ether_ntoa_r.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
getipv4sourcefilter.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
getsourcefilter.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
herrno-loc.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
herrno.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
htonl.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
htons.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
htontest.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
idna.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
idna_name_classify.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
if_index.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
ifaddrs.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
ifaddrs.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
ifreq.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
in6_addr.c Handle clang -Wignored-attributes on weak aliases 2025-12-09 08:58:10 -03:00
inet6_opt.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
inet6_option.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
inet6_rth.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
inet6_scopeid_pton.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
inet_lnaof.c
inet_mkadr.c
inet_net.c nss: Improve network number parsers (bz 32573, 32575) 2025-02-13 16:31:28 -03:00
inet_netof.c
inet_ntoa.c inet: Implement inet_ntoa on top of inet_ntop 2025-06-24 13:34:20 -03:00
net-internal.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
rcmd.c
rexec.c
ruserpass.c Annotate swtich fall-through 2025-10-29 12:54:01 -03:00
setipv4sourcefilter.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
setsourcefilter.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
test-hnto-types.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
test-ifaddrs.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
test-inet6_opt.c
test_ifindex.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
tst-checks-posix.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
tst-checks.c
tst-deadline.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
tst-ether_aton.c
tst-ether_line.c
tst-getni1.c
tst-getni2.c
tst-idna_name_classify.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
tst-if_index-long.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
tst-if_nameindex.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
tst-inet6_rth.c
tst-inet6_scopeid_pton.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
tst-network.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
tst-ntoa.c
tst-sockaddr.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00