This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit 80cd0677158b7ea4394d8e1594c7a1c984184f5b
Author:     Kacper Michajłow <[email protected]>
AuthorDate: Sat Mar 28 01:20:49 2026 +0100
Commit:     Kacper Michajłow <[email protected]>
CommitDate: Sun Mar 29 23:00:06 2026 +0200

    avutil/x86util: don't produce empty object files on win{32,64}
    
    In cases when preprocesor would remove all code, nasm would produce
    empty object files. This is technically not wrong, but often cause
    issues with various tooling:
    
    * NASM fails to emit CodeView debug info when there is no code [1]
    * Older VS2022 builds hangs on empty files [2]
    * GNU binutils `strip` errors when there is no sections [3]
    error: the input file '.o' has no sections
    
    Workaround those issues by adding dummy byte in COMDAT section,
    which is then dropped by linker, as the `__x86util_notref` symbol is not
    referenced from C. [4] IMAGE_COMDAT_SELECT_ANY (2) is used to allow
    multiple symbol definition.
    
    This is limited to win{32,64} as this is the target where issues were
    observed.
    
    [1] https://github.com/netwide-assembler/nasm/issues/216
    [2] 
https://developercommunity.visualstudio.com/t/MSVC-Hangs-when-compiling-ffmpeg-When-l/10233953
    [3] https://trac.ffmpeg.org/ticket/6711
    [4] https://www.nasm.us/docs/3.01/nasm09.html#section-9.6.1
    
    Signed-off-by: Kacper Michajłow <[email protected]>
---
 libavutil/x86/x86util.asm | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/libavutil/x86/x86util.asm b/libavutil/x86/x86util.asm
index 836f6afcb8..bb60493c09 100644
--- a/libavutil/x86/x86util.asm
+++ b/libavutil/x86/x86util.asm
@@ -1022,3 +1022,15 @@
     pxor  %1, %2
 %endif
 %endmacro
+
+; NASM panics when emitting CodeView debug info for an empty translation unit.
+; GNU binutils `strip` and some other tools such as older MSVC linker also fail
+; on such files. Emit a dummy byte in a COMDAT section to work around this.
+; The linker will discard it since __x86util_notref is not referenced anywhere.
+%ifidn __OUTPUT_FORMAT__,win64
+    section .text$1 comdat=2:__x86util_notref
+        db 0
+%elifidn __OUTPUT_FORMAT__,win32
+    section .text$1 comdat=2:__x86util_notref
+        db 0
+%endif

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to