From patchwork Tue Aug 20 14:40:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mihailo Stojanovic X-Patchwork-Id: 1150197 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-104592-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=rt-rk.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="LXCwhRAH"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46CYP81TXhz9sBF for ; Wed, 21 Aug 2019 00:40:27 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id; q=dns; s= default; b=L6vAHMpvl0LK8UpiVh7p6QQu+vkFHOtpLY86JTGONP9K0vX0WurC1 DP5OnVf+2Wfokgloic6QL4wANs3gR2L4Y6pvxjLz2U1XcxucrRkQziE23zcPBuz0 n9Un7FLMwbC2vTJlNqS/gUOwE1WmOh8JKO4xiCi/Dyjztvy9f3s1ZE= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id; s=default; bh=tZEZCr2v8yFd7urjVg4eQwOH8Nw=; b=LXCwhRAHMX7qatGFcW52iiVgiQLC hUTJHtHnTANjkGJRCR3Gc/oAsH4caycLTEGQxNovKq0XEWbLQs0QIZT/yCfcKlPa oyCp92wRcSOwwwUSwDkHcUNHMAfgRUPfmRITzxvqplceFbHW0F9x15IPIANvmApa TgyBFr5vGBg499g= Received: (qmail 9493 invoked by alias); 20 Aug 2019 14:40:20 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 9466 invoked by uid 89); 20 Aug 2019 14:40:19 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-19.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mail.rt-rk.com From: Mihailo Stojanovic To: libc-alpha@sourceware.org Cc: Joseph Myers , "Maciej W . Rozycki" , Carlos O'Donell , Dragan Mladjenovic , Mihailo Stojanovic Subject: [PATCH v3] [MIPS] Raise highest supported EI_ABIVERSION value [BZ #24916] Date: Tue, 20 Aug 2019 16:40:11 +0200 Message-Id: <1566312011-4112-1-git-send-email-mihailo.stojanovic@rt-rk.com> Hello everyone, As suggested by Joseph here [1], this bumps the highest valid ABIVERSION value to ABSOLUTE ABI, which was overlooked in [2]. New testcase loads the symbol from the GOT with the "lb" instruction so that the EI_ABIVERSION header field of the shared object is set to ABSOLUTE (it doesn't actually check the value of the symbol), and makes sure that the main executable is executed without "ABI version invalid" error. Cheers, Mihailo [1] https://sourceware.org/ml/libc-alpha/2019-07/msg00548.html [2] https://sourceware.org/ml/libc-alpha/2018-07/msg00131.html [BZ #24916] * sysdeps/mips/Makefile: New test. * sysdeps/mips/tst-undefined-weak-lib.S: Ditto. * sysdeps/mips/tst-undefined-weak.c: Ditto. * sysdeps/unix/sysv/linux/mips/ldsodefs.h: Increment highest valid ABIVERSION value. --- sysdeps/mips/Makefile | 8 +++++++ sysdeps/mips/tst-undefined-weak-lib.S | 41 +++++++++++++++++++++++++++++++++ sysdeps/mips/tst-undefined-weak.c | 28 ++++++++++++++++++++++ sysdeps/unix/sysv/linux/mips/ldsodefs.h | 2 +- 4 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 sysdeps/mips/tst-undefined-weak-lib.S create mode 100644 sysdeps/mips/tst-undefined-weak.c diff --git a/sysdeps/mips/Makefile b/sysdeps/mips/Makefile index 7ac6fa5..eb52966 100644 --- a/sysdeps/mips/Makefile +++ b/sysdeps/mips/Makefile @@ -82,3 +82,11 @@ $(objpfx)tst-mode-switch-2: $(shared-thread-library) endif endif endif + +ifeq ($(subdir),elf) +tests += tst-undefined-weak +modules-names += tst-undefined-weak-lib + +CFLAGS-tst-undefined-weak.c: -O0 +$(objpfx)tst-undefined-weak: $(objpfx)tst-undefined-weak-lib.so +endif diff --git a/sysdeps/mips/tst-undefined-weak-lib.S b/sysdeps/mips/tst-undefined-weak-lib.S new file mode 100644 index 0000000..c6eebac --- /dev/null +++ b/sysdeps/mips/tst-undefined-weak-lib.S @@ -0,0 +1,41 @@ +/* Undefined weak symbol loading shared module. + Copyright (C) 2019 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + + .text + .globl x + .set nomips16 + .set nomicromips + .ent x + .type x, @function +x: + .set noreorder +#ifdef _ABIO32 + .cpload $25 + jr $31 + lb $2,%got(a)($28) +#else + .cpsetup $25,$24,x + lb $2,%got_disp(a)($28) + jr $31 + .cpreturn +#endif + .set reorder + .end x + .size x, .-x + .weak a + .hidden a diff --git a/sysdeps/mips/tst-undefined-weak.c b/sysdeps/mips/tst-undefined-weak.c new file mode 100644 index 0000000..1231da6 --- /dev/null +++ b/sysdeps/mips/tst-undefined-weak.c @@ -0,0 +1,28 @@ +/* Undefined weak symbol loading main executable. + Copyright (C) 2019 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +int *x (void); + +int +do_test (void) +{ + x (); + return 0; +} + +#include diff --git a/sysdeps/unix/sysv/linux/mips/ldsodefs.h b/sysdeps/unix/sysv/linux/mips/ldsodefs.h index 8dde855..28257f8 100644 --- a/sysdeps/unix/sysv/linux/mips/ldsodefs.h +++ b/sysdeps/unix/sysv/linux/mips/ldsodefs.h @@ -34,7 +34,7 @@ extern void _dl_static_init (struct link_map *map); #undef VALID_ELF_ABIVERSION #define VALID_ELF_ABIVERSION(osabi,ver) \ (ver == 0 \ - || (osabi == ELFOSABI_SYSV && ver < 4) \ + || (osabi == ELFOSABI_SYSV && ver < 5) \ || (osabi == ELFOSABI_GNU && ver < LIBC_ABI_MAX)) #endif /* ldsodefs.h */