From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <ffmpeg-devel-bounces@ffmpeg.org> Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id D48C04DA51 for <ffmpegdev@gitmailbox.com>; Fri, 28 Feb 2025 01:14:21 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4A30F68DCC2; Fri, 28 Feb 2025 03:14:18 +0200 (EET) Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8155768DA84 for <ffmpeg-devel@ffmpeg.org>; Fri, 28 Feb 2025 03:14:11 +0200 (EET) Received: by mail.gandi.net (Postfix) with ESMTPSA id EFB4244213 for <ffmpeg-devel@ffmpeg.org>; Fri, 28 Feb 2025 01:14:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1740705251; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=w9REyuHT84oeX4nWWlS1Mb9OY1asNfuzIgRTo/MksYA=; b=BNjJTVhm+n4sUjO6WzdIXg6Ggdf2hqm9rL9CJ3lu72dm9cYclJtOaV/idwFxp1WQ1dT340 C48hW2W79EYIk2R2BzUqdj2o980f/zK7SWkeEsVHJTkNXI1jrehVawG49cnjnxo9BzJKFg B/w2fz3/ExjNLudqEQ1GgXwnReSdJA7m9ecvf3yzM6MfQRfcFyaWddF3ueOEgzXj94QM7F wa0Z/3jTnh/wD1FPeer2KmQUfN3QykLP9G80Yb4LfOimyl4SEPmHDrncE2v1vFkuT9a7c8 lImd7kzx3Xrkl4BBo2FDwVEfMiAd3enG3CdwHl//Cqh7hyPhRCEj8Rp1xeOOGA== Date: Fri, 28 Feb 2025 02:14:09 +0100 From: Michael Niedermayer <michael@niedermayer.cc> To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org> Message-ID: <20250228011409.GN4991@pb2> References: <20250225213717.3373852-1-prka@google.com> <20250226194437.121075-1-prka@google.com> MIME-Version: 1.0 In-Reply-To: <20250226194437.121075-1-prka@google.com> X-GND-State: clean X-GND-Score: -90 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdekledtfecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfitefpfffkpdcuggftfghnshhusghstghrihgsvgenuceurghilhhouhhtmecufedtudenucesvcftvggtihhpihgvnhhtshculddquddttddmnegfrhhlucfvnfffucdluddtmdenucfjughrpeffhffvuffkfhggtggujgesghdtreertddtvdenucfhrhhomhepofhitghhrggvlhcupfhivgguvghrmhgrhigvrhcuoehmihgthhgrvghlsehnihgvuggvrhhmrgihvghrrdgttgeqnecuggftrfgrthhtvghrnhepueejieffkeegteethfekvdejheektdevfeevtddviedtvdekhfejvdefvdduueevnecuffhomhgrihhnpehthhgvghhrvggvnhhplhgrtggvrdhnvghtnecukfhppeeguddrieeirdeijedruddufeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeeguddrieeirdeijedruddufedphhgvlhhopehlohgtrghlhhhoshhtpdhmrghilhhfrhhomhepmhhitghhrggvlhesnhhivgguvghrmhgrhigvrhdrtggtpdhnsggprhgtphhtthhopedupdhrtghpthhtohepfhhfmhhpvghgqdguvghvvghlsehffhhmphgvghdrohhrgh X-GND-Sasl: michael@niedermayer.cc Subject: Re: [FFmpeg-devel] [PATCH] Mark C globals with small code model X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches <ffmpeg-devel.ffmpeg.org> List-Unsubscribe: <https://ffmpeg.org/mailman/options/ffmpeg-devel>, <mailto:ffmpeg-devel-request@ffmpeg.org?subject=unsubscribe> List-Archive: <https://ffmpeg.org/pipermail/ffmpeg-devel> List-Post: <mailto:ffmpeg-devel@ffmpeg.org> List-Help: <mailto:ffmpeg-devel-request@ffmpeg.org?subject=help> List-Subscribe: <https://ffmpeg.org/mailman/listinfo/ffmpeg-devel>, <mailto:ffmpeg-devel-request@ffmpeg.org?subject=subscribe> Reply-To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org> Content-Type: multipart/mixed; boundary="===============2437127058204022145==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" <ffmpeg-devel-bounces@ffmpeg.org> Archived-At: <https://master.gitmailbox.com/ffmpegdev/20250228011409.GN4991@pb2/> List-Archive: <https://master.gitmailbox.com/ffmpegdev/> List-Post: <mailto:ffmpegdev@gitmailbox.com> --===============2437127058204022145== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="hub17ppRPupoDoTD" Content-Disposition: inline --hub17ppRPupoDoTD Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Feb 26, 2025 at 07:44:37PM +0000, Pranav Kant via ffmpeg-devel wrot= e: > 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=3Dmedium) 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. >=20 > This patch should not have any affect on builds that use small code > model, which is the default mode. >=20 > [1] https://eli.thegreenplace.net/2012/01/03/understanding-the-x64-code-m= odels >=20 > 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: =2E/libavutil/attributes_internal.h:43:5: warning: "ARCH_X86_64" is not def= ined, evaluates to 0 [-Wundef] 43 | #if ARCH_X86_64 && defined(__ELF__) && __has_attribute(model) | ^~~~~~~~~~~ [...] --=20 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. --hub17ppRPupoDoTD Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEKAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCZ8EN3gAKCRBhHseHBAsP q+zoAKCB7iYjrXocqQI/3coYciFiNNw62wCfYx0ysQ8dU2MZTbwWd8Ko5WLwBKY= =WTZG -----END PGP SIGNATURE----- --hub17ppRPupoDoTD-- --===============2437127058204022145== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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". --===============2437127058204022145==--