From db41156a28c3d612a713f7d0fae283169494a187 Mon Sep 17 00:00:00 2001 From: Johann Date: Thu, 2 Apr 2020 10:59:01 +0900 Subject: [PATCH] x86inc.asm: only set visibility for chromium builds Reapply and update a4b47b89f. This restores the previous version's behavior avoiding issues with builds that may split sources on directory boundaries; protected visibility may work in this case. BUG=webm:1679 Change-Id: I36011727485847dd11f06782bc6beddedc39019c --- third_party/x86inc/README.libvpx_new | 1 + third_party/x86inc/x86inc.asm_new | 18 ++++++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/third_party/x86inc/README.libvpx_new b/third_party/x86inc/README.libvpx_new index 3fc1fb6f4..e6a816607 100644 --- a/third_party/x86inc/README.libvpx_new +++ b/third_party/x86inc/README.libvpx_new @@ -15,3 +15,4 @@ Manage name mangling (prefixing with '_') manually because 'PREFIX' does not Copy PIC 'GLOBAL' macros from x86_abi_support.asm Use .text instead of .rodata on macho to avoid broken tables in PIC mode. Use .text with no alignment for aout. +Only use 'hidden' visibility with Chromium. diff --git a/third_party/x86inc/x86inc.asm_new b/third_party/x86inc/x86inc.asm_new index 9b6b2c793..7b97141f0 100644 --- a/third_party/x86inc/x86inc.asm_new +++ b/third_party/x86inc/x86inc.asm_new @@ -208,7 +208,17 @@ %endif ; End PIC macros from vpx_ports/x86_abi_support.asm. -%define HAVE_PRIVATE_EXTERN 1 +; libvpx explicitly sets visibilty in shared object builds. Avoid setting +; visibility to hidden as it may break builds that split sources on e.g., +; directory boundaries. +%ifdef CHROMIUM + %define VISIBILITY hidden + %define HAVE_PRIVATE_EXTERN 1 +%else + %define VISIBILITY + %define HAVE_PRIVATE_EXTERN 0 +%endif + %ifdef __NASM_VER__ %use smartalign %if __NASM_VERSION_ID__ < 0x020e0000 ; 2.14 @@ -839,7 +849,7 @@ BRANCH_INSTR jz, je, jnz, jne, jl, jle, jnl, jnle, jg, jge, jng, jnge, ja, jae, %xdefine current_function_section __SECT__ %if FORMAT_ELF %if %1 - global %2:function hidden + global %2:function VISIBILITY %else global %2:function %endif @@ -864,7 +874,7 @@ BRANCH_INSTR jz, je, jnz, jne, jl, jle, jnl, jnle, jg, jge, jng, jnge, ja, jae, ; Create a global symbol from a local label with the correct name mangling and type %macro cglobal_label 1 %if FORMAT_ELF - global current_function %+ %1:function hidden + global current_function %+ %1:function VISIBILITY %elif FORMAT_MACHO && HAVE_PRIVATE_EXTERN global current_function %+ %1:private_extern %else @@ -891,7 +901,7 @@ BRANCH_INSTR jz, je, jnz, jne, jl, jle, jnl, jnle, jg, jge, jng, jnge, ja, jae, %macro const 1-2+ %xdefine %1 mangle(private_prefix %+ _ %+ %1) %if FORMAT_ELF - global %1:data hidden + global %1:data VISIBILITY %elif FORMAT_MACHO && HAVE_PRIVATE_EXTERN global %1:private_extern %else -- 2.40.0