From patchwork Thu Mar 7 03:36:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Fangrui Song X-Patchwork-Id: 12232 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 0F644448FE8 for ; Thu, 7 Mar 2019 05:42:08 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E8CD9689BF0; Thu, 7 Mar 2019 05:42:07 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qt1-f195.google.com (mail-qt1-f195.google.com [209.85.160.195]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id BBAFC689BF0 for ; Thu, 7 Mar 2019 05:42:00 +0200 (EET) Received: by mail-qt1-f195.google.com with SMTP id j36so15584424qta.7 for ; Wed, 06 Mar 2019 19:42:00 -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=gDoJg1d4GGqATzgFgRVQYJ5oZz1EK8MSCnOWwO2cszE=; b=cFNTRvu6BnWDmiV/q+/XLpYBAeqzP3/sqCBaP0bF31Gv/U1it2a+TS7nFvTn4oNp/9 lYjju9hGYLfuah/1V3fstYa5saeNTOOOoa8BQykJ4z5FqrlLcAsPzpFq2KKoy9R+/k/c uVSuLaJBKk07XkvVEAtE7zVRNGIIyg0QTsIGeA6nEZzUfSnw6tlGLvPF6jajUgWFRUo6 zJ0Qi0KdCJOSmN3XbpavXKbcAXpl0LWorAc+I9hPbBbTcTYqHHagYfj/sFYPxqUQPG/a HP830XyFhZFKHCXirtHadjYdSOO64jJK9v9UjYD6Exo+XpMqPRGsEI8rhP3xx/KCwvuF DIhA== 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=gDoJg1d4GGqATzgFgRVQYJ5oZz1EK8MSCnOWwO2cszE=; b=JbnM7oO+BjiOoJfrWL+E9vB3nkdvmSNeXBs5jHPCKL3mrqh3/W152SkCA9wylDQVvR ErDl/xnziNzzK/cdmqv3Rjpjj1br6jrkQhT637CXAalQ8NXwkWXUTdPpvkvtI/tyucBR zHrdWYqlJ8veXCoM58oYMh1dEB3XADe4dsyi2L3Gi8pHLblKYpLLq5MX6jL6xtxqButl alwwXWsj4+pOUj/AOx1MUdNlTb7QcSyALHjAky5PuqwVbKCGsn7JazmmvUb1HJm61aRB Jgcnzs54hAGz6TjzR/jorWbBGjWcEAqZGgtstoubgAvUOgTc6A1RlmUqcctpPDONYxQI SReQ== X-Gm-Message-State: APjAAAX2ot14WC2M7av04o3rJjxfP3GPNZZR2PbWHKtFexpSis3h+Jx2 FyasNYvNQqmRqy/9YWa/UjzJE7yiZFNOHy3SGrdXdjh2gYX1kS5j X-Google-Smtp-Source: APXvYqyCCWjxM/2BsPQabmkqB6VCAy4eLMGBe3XpHgIeyMv0546hfYxMqrpooBVdS/tHFtFEVONcnqXzYMS3mJ6VmoI= X-Received: by 2002:ac8:1be6:: with SMTP id m35mr8597078qtk.372.1551929804707; Wed, 06 Mar 2019 19:36:44 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: =?UTF-8?B?RsSBbmctcnXDrCBTw7JuZw==?= Date: Thu, 7 Mar 2019 11:36:33 +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" 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 >: > > 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