Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH] configure: Disable linker warnings for common symbols
@ 2024-02-23 19:08 Andreas Rheinhardt
  2024-02-25 12:54 ` Andreas Rheinhardt
  0 siblings, 1 reply; 2+ messages in thread
From: Andreas Rheinhardt @ 2024-02-23 19:08 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Andreas Rheinhardt

Common symbols are not part of ISO-C and therefore not used
by FFmpeg at all. Yet linker warnings to ensure it stays
that way are nevertheless wrong, because the existence of
common symbols does not imply that there is a bug in our code.

More precisely, Clang's ASAN implementation uses a common symbol
___asan_globals_registered when used on Elf targets with
the -fsanitize-address-globals-dead-stripping option;
said option is the default since Clang 17 [1].
This leads to 1883 warnings about ___asan_globals_registered
when linking here.
(Even without that option there were warnings like
_ZN14__interception10real_vforkE being overridden.)

Said warning is also unnecessary: The proper way to ensure
that our code is free of common symbols is to let the compiler
enforce this. But this is already the default since GCC 10
and Clang 11, so there is no risk of introducing our own
common symbols.

[1]: https://reviews.llvm.org/D152604

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
There is btw a second incompatibility between our configure script
and Clang ASAN: Since version 16 it defaults to
-fsanitize-address-use-odr-indicator and with this option set,
it creates a __odr_asan_gen_FOO symbol for every object FOO
in addition to the symbol FOO itself; configure therefore sets
extern_prefix (used for ASM name mangling) to "__odr_asan_gen_".

 configure | 1 -
 1 file changed, 1 deletion(-)

diff --git a/configure b/configure
index 197f762b58..108816bd1e 100755
--- a/configure
+++ b/configure
@@ -7337,7 +7337,6 @@ void (^block)(void);
 EOF
 
 # add some linker flags
-check_ldflags -Wl,--warn-common
 check_ldflags -Wl,-rpath-link=:libpostproc:libswresample:libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil
 enabled rpath && add_ldexeflags -Wl,-rpath,$libdir && add_ldsoflags -Wl,-rpath,$libdir
 test_ldflags -Wl,-Bsymbolic && append SHFLAGS -Wl,-Bsymbolic
-- 
2.40.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [FFmpeg-devel] [PATCH] configure: Disable linker warnings for common symbols
  2024-02-23 19:08 [FFmpeg-devel] [PATCH] configure: Disable linker warnings for common symbols Andreas Rheinhardt
@ 2024-02-25 12:54 ` Andreas Rheinhardt
  0 siblings, 0 replies; 2+ messages in thread
From: Andreas Rheinhardt @ 2024-02-25 12:54 UTC (permalink / raw)
  To: ffmpeg-devel

Andreas Rheinhardt:
> Common symbols are not part of ISO-C and therefore not used
> by FFmpeg at all. Yet linker warnings to ensure it stays
> that way are nevertheless wrong, because the existence of
> common symbols does not imply that there is a bug in our code.
> 
> More precisely, Clang's ASAN implementation uses a common symbol
> ___asan_globals_registered when used on Elf targets with
> the -fsanitize-address-globals-dead-stripping option;
> said option is the default since Clang 17 [1].
> This leads to 1883 warnings about ___asan_globals_registered
> when linking here.
> (Even without that option there were warnings like
> _ZN14__interception10real_vforkE being overridden.)
> 
> Said warning is also unnecessary: The proper way to ensure
> that our code is free of common symbols is to let the compiler
> enforce this. But this is already the default since GCC 10
> and Clang 11, so there is no risk of introducing our own
> common symbols.
> 
> [1]: https://reviews.llvm.org/D152604
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
> There is btw a second incompatibility between our configure script
> and Clang ASAN: Since version 16 it defaults to
> -fsanitize-address-use-odr-indicator and with this option set,
> it creates a __odr_asan_gen_FOO symbol for every object FOO
> in addition to the symbol FOO itself; configure therefore sets
> extern_prefix (used for ASM name mangling) to "__odr_asan_gen_".
> 
>  configure | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/configure b/configure
> index 197f762b58..108816bd1e 100755
> --- a/configure
> +++ b/configure
> @@ -7337,7 +7337,6 @@ void (^block)(void);
>  EOF
>  
>  # add some linker flags
> -check_ldflags -Wl,--warn-common
>  check_ldflags -Wl,-rpath-link=:libpostproc:libswresample:libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil
>  enabled rpath && add_ldexeflags -Wl,-rpath,$libdir && add_ldsoflags -Wl,-rpath,$libdir
>  test_ldflags -Wl,-Bsymbolic && append SHFLAGS -Wl,-Bsymbolic

Will apply this patch tomorrow unless there are objections.

- Andreas

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-02-25 12:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-23 19:08 [FFmpeg-devel] [PATCH] configure: Disable linker warnings for common symbols Andreas Rheinhardt
2024-02-25 12:54 ` Andreas Rheinhardt

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git