From patchwork Wed Apr 4 15:41:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Engestrom X-Patchwork-Id: 10322787 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D994D60390 for ; Wed, 4 Apr 2018 15:42:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CA42928E2E for ; Wed, 4 Apr 2018 15:42:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BED3F28E9C; Wed, 4 Apr 2018 15:42:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 33DF128E2E for ; Wed, 4 Apr 2018 15:42:01 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D0A8789EBD; Wed, 4 Apr 2018 15:41:59 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailapp01.imgtec.com (mailapp01.imgtec.com [195.59.15.196]) by gabe.freedesktop.org (Postfix) with ESMTP id 43D4889C49 for ; Wed, 4 Apr 2018 15:41:59 +0000 (UTC) Received: from hhmail02.hh.imgtec.org (unknown [10.100.10.20]) by Forcepoint Email with ESMTPS id 8D65EA0CD65E5; Wed, 4 Apr 2018 16:41:54 +0100 (IST) Received: from localhost.localdomain (10.60.4.28) by hhmail02.hh.imgtec.org (10.100.10.21) with Microsoft SMTP Server (TLS) id 14.3.382.0; Wed, 4 Apr 2018 16:41:57 +0100 From: Eric Engestrom To: Subject: [PATCH libdrm 01/11] symbols-check: add new meta-script Date: Wed, 4 Apr 2018 16:41:35 +0100 Message-ID: <20180404154145.27607-1-eric.engestrom@imgtec.com> X-Mailer: git-send-email 2.16.2 MIME-Version: 1.0 X-Originating-IP: [10.60.4.28] X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Emil Velikov , Dylan Baker Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Note: copied from Mesa Signed-off-by: Eric Engestrom --- meson.build | 1 + symbols-check | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100755 symbols-check diff --git a/meson.build b/meson.build index a725f05d342bbec4df18..c035a00c6747b8d46a9b 100644 --- a/meson.build +++ b/meson.build @@ -272,6 +272,7 @@ pkg.generate( env_test = environment() env_test.set('NM', find_program('nm').path()) +env_test.set('top_srcdir', meson.source_root()) if with_libkms subdir('libkms') diff --git a/symbols-check b/symbols-check new file mode 100755 index 00000000000000000000..bac466d93dcb45cee0bb --- /dev/null +++ b/symbols-check @@ -0,0 +1,79 @@ +#!/bin/sh +set -eu +set -o pipefail + +# Platform specific symbols +# These will simply be ignored +PLAT_FUNCS=" +__bss_start +_init +_fini +_end +_edata + +# From tegra-symbol-check +__bss_end__ +__bss_start__ +__bss_start +__end__ +_bss_end__ +_edata +_end +_fini +_init +" + +if [ -z "$LIB" ]; then + echo "\$LIB needs to be defined for autotools to be able to run this test" + exit 1 +fi + +# The lib name is passed in with Meson but autotools doesn't support that +# so it needs to be hardcoded and overwritten here +if [ $# -ge 1 ]; then + LIB=$1 +fi + +if ! [ -f "$LIB" ]; then + echo "lib $LIB doesn't exist" + exit 1 +fi + +if [ -z "$NM" ]; then + echo "\$NM is undefined or empty" + exit 1 +elif ! command -v $NM >/dev/null; then + echo "\$NM is not a valid command" + exit 1 +fi + +AVAIL_FUNCS="$($NM -D --format=bsd --defined-only $LIB | awk '{print $3}')" + +NEW_ABI=$(echo "$AVAIL_FUNCS" | while read func; do + echo "$REQ_FUNCS" | grep -q "^$func$" && continue + echo "$PLAT_FUNCS" | grep -q "^$func$" && continue + + echo $func +done) + +REMOVED_ABI=$(echo "$REQ_FUNCS" | while read func; do + echo "$AVAIL_FUNCS" | grep -q "^$func$" && continue + + echo $func +done) + +if [ -n "$NEW_ABI" ]; then + echo "New ABI detected - If intentional, update the test." + echo "$NEW_ABI" +fi + +if [ -n "$REMOVED_ABI" ]; then + echo "ABI break detected - Required symbol(s) no longer exported!" + echo "$REMOVED_ABI" +fi + +if [ -z "$NEW_ABI" ] && [ -z "$REMOVED_ABI" ]; then + exit 0 +else + exit 1 +fi