From: Pranav Kant via ffmpeg-devel <ffmpeg-devel@ffmpeg.org>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Cc: Pranav Kant <prka@google.com>
Subject: Re: [FFmpeg-devel] [PATCH] Mark C globals with small code model
Date: Thu, 6 Mar 2025 18:13:32 -0800
Message-ID: <CAPvNhs+082vqAtUrqs8YHuH6XVcDiBCsMVHyN5_y=tWRfoXLfQ@mail.gmail.com> (raw)
In-Reply-To: <20250228011409.GN4991@pb2>
I uploaded a new patch (v3) that addresses these concerns.
On Thu, Feb 27, 2025 at 5:14 PM Michael Niedermayer <michael@niedermayer.cc>
wrote:
> On Wed, Feb 26, 2025 at 07:44:37PM +0000, Pranav Kant via ffmpeg-devel
> wrote:
> > By default, all globals in C/C++ compiled by clang are allocated
> > in non-large data sections. See [1] for background on code models.
> > For PIC (Position independent code), this is fine as long as binary is
> > small but as binary size increases, users maybe want to use medium/large
> > code models (-mcmodel=medium) which moves data in to large sections.
> > As data in these large sections cannot be accessed using PIC code
> > anymore (as it may be too far away), compiler ends up using a different
> > instruction sequence when building C/C++ code -- using GOT to access
> > these globals (which can be relaxed by linker at link time if binary
> > ends up being smaller). However, assembly files continue to access these
> > globals defined in C/C++ files using older (and invalid instruction
> > sequence). So, we mark all such globals with an attribute that forces
> > them to be allocated in small sections allowing them to validly be
> > accessed from the assembly code.
> >
> > This patch should not have any affect on builds that use small code
> > model, which is the default mode.
> >
> > [1]
> https://eli.thegreenplace.net/2012/01/03/understanding-the-x64-code-models
> >
> > Signed-off-by: Pranav Kant <prka@google.com>
> > ---
> > libavcodec/ac3dsp.c | 2 ++
> > libavcodec/cabac.c | 2 ++
> > libavcodec/x86/constants.c | 8 ++++++++
> > libavutil/attributes_internal.h | 15 +++++++++++++++
> > 4 files changed, 27 insertions(+)
>
> This produces many warnings:
>
> CC libavcodec/svq1.o
> In file included from libavcodec/svq1.h:40,
> from libavcodec/svq1.c:35:
> ./libavutil/attributes_internal.h:43:5: warning: "ARCH_X86_64" is not
> defined, evaluates to 0 [-Wundef]
> 43 | #if ARCH_X86_64 && defined(__ELF__) && __has_attribute(model)
> | ^~~~~~~~~~~
>
> [...]
>
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> If you fake or manipulate statistics in a paper in physics you will never
> get a job again.
> If you fake or manipulate statistics in a paper in medicin you will get
> a job for life at the pharma industry.
> _______________________________________________
> 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".
>
_______________________________________________
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".
next prev parent reply other threads:[~2025-03-07 2:13 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-25 21:37 Pranav Kant via ffmpeg-devel
2025-02-25 23:03 ` Andreas Rheinhardt
2025-02-26 19:44 ` Pranav Kant via ffmpeg-devel
2025-02-26 19:45 ` Pranav Kant via ffmpeg-devel
2025-02-27 3:36 ` James Zern via ffmpeg-devel
2025-02-28 1:14 ` Michael Niedermayer
2025-03-07 2:13 ` Pranav Kant via ffmpeg-devel [this message]
2025-03-03 20:56 ` [FFmpeg-devel] [PATCH v3] " Pranav Kant via ffmpeg-devel
2025-02-28 2:31 ` [FFmpeg-devel] [PATCH] " Lynne
2025-03-07 2:14 ` Pranav Kant via ffmpeg-devel
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAPvNhs+082vqAtUrqs8YHuH6XVcDiBCsMVHyN5_y=tWRfoXLfQ@mail.gmail.com' \
--to=ffmpeg-devel@ffmpeg.org \
--cc=prka@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
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