From patchwork Thu Mar 7 03:53:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Fangrui Song X-Patchwork-Id: 12233 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id EFED5446CD9 for ; Thu, 7 Mar 2019 05:53:33 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id CE6FE68A4E8; Thu, 7 Mar 2019 05:53:33 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qk1-f196.google.com (mail-qk1-f196.google.com [209.85.222.196]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7A82668048D for ; Thu, 7 Mar 2019 05:53:27 +0200 (EET) Received: by mail-qk1-f196.google.com with SMTP id s26so136833qkm.10 for ; Wed, 06 Mar 2019 19:53:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=6LIjB90JXL5INWFQF4tCXJk4xaq2Dj3rYzXn651QhV8=; b=akNfvVlzfBxCHb+iqkEICF2TwlYcvfW6hScqIGj++o6/smiqtp7spINxf80PwhIjhX acCNH6xLLrZP6+Qv/RD7A/m25tc9Dq3bZ+AGkuQ1xaTYcECq8jsqDgzNrLMGS1oCzYVp /+IWJaPuxhsN+PT1p/Qwj6jkeHW5RiVzQG4fHqjHwHdyymAxCjdNnXm7wIDDylBuISvP EX/0udBEpVJRgmK0foHG48Ko1LuE+55e6ktYPryDDY7FQMebCS5JmoovwxlLJM7ysNr6 9HBvF8geBSBuz9p92r4PKu0CCuGW22lMRJM6j/9G4dEnFFq3dkWTvk4P+h19i1WRius2 Lb6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=6LIjB90JXL5INWFQF4tCXJk4xaq2Dj3rYzXn651QhV8=; b=qUJHagZ3YqQRXevPshIPbKgSBJiJQHfVST1C346V4rJYWdavDYOHKThX5v3BzwWDdb EukxkHVyh/4d/DPwhF0tJUyhJpyo9rageNw50tiquPAw0C6Cdr4UKdg8y4EV1HYFBOa/ vsEqpFbKqEyNqxWEIThswrih7sX822TxFiAggT4OO8vFN3Nbyxkm4JGQIzvEs8VtiRG2 JiXbSziilEVpk+RCfUbHDY96KH7fxB8XcArwpUFi4+jl/+q7SMhWR1zSt+Xy0kRnJ5mo AuS7Fyvi3KoSsoYQqAKyjwOi98haU+DPgEWkVpEOtBAopr1aTFoxUt+/F8vmcW3eDKvd IGMA== X-Gm-Message-State: APjAAAX32qntEiCw9U6O9xLWKkM6xHrymfzq1CjsppafsH1oY3fd0Moj EGWSlvf6NPt9k3Vu7YtiImJ7RbeFbbX1V4GszUBaG8RQOiNooA== X-Google-Smtp-Source: APXvYqzlV6UnqglqTnuD6XLFLu3NgwygsM4U86/PBZj7SH3VwkkmYLpPOHqOLdgLPTOr4AV9UcsWSVhcJfn0VnTGSd4= X-Received: by 2002:ae9:c20f:: with SMTP id j15mr7731648qkg.132.1551930805731; Wed, 06 Mar 2019 19:53:25 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: =?UTF-8?B?RsSBbmctcnXDrCBTw7JuZw==?= Date: Thu, 7 Mar 2019 11:53:14 +0800 Message-ID: To: FFmpeg development discussions and patches X-Content-Filtered-By: Mailman/MimeDel 2.1.20 Subject: Re: [FFmpeg-devel] [PATCH] avutil/mem: Mark DECLARE_ASM_ALIGNED as visibility("hidden") for __GNUC__ X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Sorry, wrong signed-off-by line.. (isn't using my usual mail client mutt and i get very sick of the webmail...) On Thu, Mar 7, 2019 at 11:36 AM Fāng-ruì Sòng wrote: > On Wed, Mar 6, 2019 at 4:14 PM Carl Eugen Hoyos > wrote: > >> 2019-02-21 2:37 GMT+01:00, Fāng-ruì Sòng < >> maskray-at-google.com@ffmpeg.org>: >> > Sorry if this doesn't attach to the correct thread as I didn't >> > subscribe to this list and don't know the Message-ID of the thread. >> >> The thread works fine here with gmail but your patch was corrupted, >> you have to attach it. >> >> Carl Eugen >> >> > Sorry. Here is the attached patch (git format-patch -1 --stdout). > From 63d1c46c9796ca4a804cc89573c8f4613716b50d Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Wed, 20 Feb 2019 16:25:46 +0800 Subject: [PATCH] avutil/mem: Mark DECLARE_ASM_ALIGNED as visibility("hidden") for __GNUC__ Inline asm code assumes these DECLARE_ASM_ALIGNED declared global constants are non-preemptive, e.g. libavcodec/x86/cabac.h "lea "MANGLE(ff_h264_cabac_tables)", %0 \n\t" On ELF platforms, when -Wl,-Bsymbolic -Wl,--version-script,libavcodec/libavcodec.ver are removed from the linker command line, the symbol will be considered preemptive and fail to link to a DSO: ld.lld: error: relocation R_X86_64_PC32 cannot be used against symbol ff_h264_cabac_tables; recompile with -fPIC It is better to express the intention explicitly and mark such global constants hidden. It also improves portability as no linker magic is required. DECLARE_ASM_CONST uses the "static" specifier to indicate internal linkage. The visibility annotation is unnecessary. Signed-off-by: Fangrui Song --- libavutil/mem.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libavutil/mem.h b/libavutil/mem.h index 5fb1a02..9afeed0 100644 --- a/libavutil/mem.h +++ b/libavutil/mem.h @@ -100,6 +100,12 @@ * @param v Name of the variable */ +#if defined(__GNUC__) && !(defined(_WIN32) || defined(__CYGWIN__)) + #define DECLARE_HIDDEN __attribute__ ((visibility ("hidden"))) +#else + #define DECLARE_HIDDEN +#endif + #if defined(__INTEL_COMPILER) && __INTEL_COMPILER < 1110 || defined(__SUNPRO_C) #define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v #define DECLARE_ASM_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v @@ -110,7 +116,7 @@ #define DECLARE_ASM_CONST(n,t,v) static const t av_used __attribute__ ((aligned (FFMIN(n, 16)))) v #elif defined(__GNUC__) || defined(__clang__) #define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v - #define DECLARE_ASM_ALIGNED(n,t,v) t av_used __attribute__ ((aligned (n))) v + #define DECLARE_ASM_ALIGNED(n,t,v) t av_used __attribute__ ((aligned (n))) DECLARE_HIDDEN v #define DECLARE_ASM_CONST(n,t,v) static const t av_used __attribute__ ((aligned (n))) v #elif defined(_MSC_VER) #define DECLARE_ALIGNED(n,t,v) __declspec(align(n)) t v -- 2.20.1