From patchwork Wed Oct 27 18:15:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John David Anglin X-Patchwork-Id: 46710 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 128D53858439 for ; Wed, 27 Oct 2021 18:18:57 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from cmx-mtlrgo002.bell.net (mta-mtl-002.bell.net [209.71.208.12]) by sourceware.org (Postfix) with ESMTP id C9DB5385842F for ; Wed, 27 Oct 2021 18:15:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C9DB5385842F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=bell.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=bell.net X-RG-CM-BuS: 0 X-RG-CM-SC: 0 X-RG-CM: Clean X-Originating-IP: [67.71.8.137] X-RG-Env-Sender: dave.anglin@bell.net X-RG-Rigid: 60C894590A01BE8A X-CM-Envelope: MS4xfECaKMmaQ1BbNgm+vaj3cqg/yF6P2+zZMAUOUN6Z1eqdmAsfXpmSXsJggxVfEu1jjw4qMljc30zGa4vb5sKBNZEUIVoyukTgrKNw5gd5l7RZUaCDm0QM KnNs57Yus29QVn9dPwClFRxLky2a1PHDJZya5xYsCVrzOW0Qwuk4zi4gtG75ObbMgJKBYJICyTuKQp/xRdc79pF6LOKtwHBJLDl1Uro6W2bdypDrDLCyx5b/ fpMECuCR6YDj8g3m8skgZw== X-CM-Analysis: v=2.4 cv=ENdlb3VC c=1 sm=1 tr=0 ts=61799759 a=jrdA9tB8yuRqUzQ1EpSZjA==:117 a=jrdA9tB8yuRqUzQ1EpSZjA==:17 a=IkcTkHD0fZMA:10 a=mDV3o1hIAAAA:8 a=DItcIZo_kRQ6sLRuwmIA:9 a=QEXdDO2ut3YA:10 a=_FVE-zBwftR9WsbkzFJk:22 Received: from [192.168.2.49] (67.71.8.137) by cmx-mtlrgo002.bell.net (5.8.716.03) (authenticated as dave.anglin@bell.net) id 60C894590A01BE8A; Wed, 27 Oct 2021 14:15:53 -0400 Message-ID: Date: Wed, 27 Oct 2021 14:15:52 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 Content-Language: en-US To: GCC Patches From: John David Anglin Subject: [committed] hppa: Fix warnings building linux-atomic.c and fptr.c on hppa64-linux X-Spam-Status: No, score=-9.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" This change fixes a couple of warnings observed building libgcc on hppa64-linux. The hppa64-linux target uses OPDs and doesn't require any special code to canonicalize function pointers for comparison. I removed inclusion of pa/t-linux from tmake_file and adjusted pa/t-linux64 to fix this issue. I defined types u8, u16 and u64 in linux-atomic.s to fix the type mismatch warning from linux-atomic.c. Tested on hppa-unknown-linux-gnu and hppa64-unknown-linux-gnu. Committed to active branches. Dave --- Fix warnings building linux-atomic.c and fptr.c on hppa64-linux The file fptr.c is specific to 32-bit hppa-linux and should not be included in LIB2ADD on hppa64-linux. There is a builtin type mismatch in linux-atomic.c using the type long long unsigned int for 64-bit atomic operations on hppa64-linux. 2021-10-27 John David Anglin libgcc/ChangeLog: * config.host (hppa*64*-*-linux*): Don't add pa/t-linux to tmake_file. * config/pa/linux-atomic.c: Define u8, u16 and u64 types. Use them in FETCH_AND_OP_2, OP_AND_FETCH_2, COMPARE_AND_SWAP_2, SYNC_LOCK_TEST_AND_SET_2 and SYNC_LOCK_RELEASE_1 macros. * config/pa/t-linux64 (LIB1ASMSRC): New define. (LIB1ASMFUNCS): Revise. (HOST_LIBGCC2_CFLAGS): Add "-DLINUX=1". diff --git a/libgcc/config.host b/libgcc/config.host index 6c34b13d611..85de83da766 100644 --- a/libgcc/config.host +++ b/libgcc/config.host @@ -619,7 +619,7 @@ h8300-*-linux*) tm_file="$tm_file h8300/h8300-lib.h" ;; hppa*64*-*-linux*) - tmake_file="$tmake_file pa/t-linux pa/t-linux64" + tmake_file="$tmake_file pa/t-linux64" extra_parts="crtbegin.o crtbeginS.o crtbeginT.o crtend.o crtendS.o" ;; hppa*-*-linux*) diff --git a/libgcc/config/pa/linux-atomic.c b/libgcc/config/pa/linux-atomic.c index c882b55a127..500a3652499 100644 --- a/libgcc/config/pa/linux-atomic.c +++ b/libgcc/config/pa/linux-atomic.c @@ -28,6 +28,14 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #define EBUSY 16 #define ENOSYS 251 +typedef unsigned char u8; +typedef short unsigned int u16; +#ifdef __LP64__ +typedef long unsigned int u64; +#else +typedef long long unsigned int u64; +#endif + /* PA-RISC 2.0 supports out-of-order execution for loads and stores. Thus, we need to synchonize memory accesses. For more info, see: "Advanced Performance Features of the 64-bit PA-8000" by Doug Hunt. @@ -117,26 +125,26 @@ __kernel_cmpxchg2 (volatile void *mem, const void *oldval, const void *newval, return tmp; \ } -FETCH_AND_OP_2 (add, , +, long long unsigned int, 8, 3) -FETCH_AND_OP_2 (sub, , -, long long unsigned int, 8, 3) -FETCH_AND_OP_2 (or, , |, long long unsigned int, 8, 3) -FETCH_AND_OP_2 (and, , &, long long unsigned int, 8, 3) -FETCH_AND_OP_2 (xor, , ^, long long unsigned int, 8, 3) -FETCH_AND_OP_2 (nand, ~, &, long long unsigned int, 8, 3) - -FETCH_AND_OP_2 (add, , +, short unsigned int, 2, 1) -FETCH_AND_OP_2 (sub, , -, short unsigned int, 2, 1) -FETCH_AND_OP_2 (or, , |, short unsigned int, 2, 1) -FETCH_AND_OP_2 (and, , &, short unsigned int, 2, 1) -FETCH_AND_OP_2 (xor, , ^, short unsigned int, 2, 1) -FETCH_AND_OP_2 (nand, ~, &, short unsigned int, 2, 1) - -FETCH_AND_OP_2 (add, , +, unsigned char, 1, 0) -FETCH_AND_OP_2 (sub, , -, unsigned char, 1, 0) -FETCH_AND_OP_2 (or, , |, unsigned char, 1, 0) -FETCH_AND_OP_2 (and, , &, unsigned char, 1, 0) -FETCH_AND_OP_2 (xor, , ^, unsigned char, 1, 0) -FETCH_AND_OP_2 (nand, ~, &, unsigned char, 1, 0) +FETCH_AND_OP_2 (add, , +, u64, 8, 3) +FETCH_AND_OP_2 (sub, , -, u64, 8, 3) +FETCH_AND_OP_2 (or, , |, u64, 8, 3) +FETCH_AND_OP_2 (and, , &, u64, 8, 3) +FETCH_AND_OP_2 (xor, , ^, u64, 8, 3) +FETCH_AND_OP_2 (nand, ~, &, u64, 8, 3) + +FETCH_AND_OP_2 (add, , +, u16, 2, 1) +FETCH_AND_OP_2 (sub, , -, u16, 2, 1) +FETCH_AND_OP_2 (or, , |, u16, 2, 1) +FETCH_AND_OP_2 (and, , &, u16, 2, 1) +FETCH_AND_OP_2 (xor, , ^, u16, 2, 1) +FETCH_AND_OP_2 (nand, ~, &, u16, 2, 1) + +FETCH_AND_OP_2 (add, , +, u8, 1, 0) +FETCH_AND_OP_2 (sub, , -, u8, 1, 0) +FETCH_AND_OP_2 (or, , |, u8, 1, 0) +FETCH_AND_OP_2 (and, , &, u8, 1, 0) +FETCH_AND_OP_2 (xor, , ^, u8, 1, 0) +FETCH_AND_OP_2 (nand, ~, &, u8, 1, 0) #define OP_AND_FETCH_2(OP, PFX_OP, INF_OP, TYPE, WIDTH, INDEX) \ TYPE HIDDEN \ @@ -154,26 +162,26 @@ FETCH_AND_OP_2 (nand, ~, &, unsigned char, 1, 0) return PFX_OP (tmp INF_OP val); \ } -OP_AND_FETCH_2 (add, , +, long long unsigned int, 8, 3) -OP_AND_FETCH_2 (sub, , -, long long unsigned int, 8, 3) -OP_AND_FETCH_2 (or, , |, long long unsigned int, 8, 3) -OP_AND_FETCH_2 (and, , &, long long unsigned int, 8, 3) -OP_AND_FETCH_2 (xor, , ^, long long unsigned int, 8, 3) -OP_AND_FETCH_2 (nand, ~, &, long long unsigned int, 8, 3) - -OP_AND_FETCH_2 (add, , +, short unsigned int, 2, 1) -OP_AND_FETCH_2 (sub, , -, short unsigned int, 2, 1) -OP_AND_FETCH_2 (or, , |, short unsigned int, 2, 1) -OP_AND_FETCH_2 (and, , &, short unsigned int, 2, 1) -OP_AND_FETCH_2 (xor, , ^, short unsigned int, 2, 1) -OP_AND_FETCH_2 (nand, ~, &, short unsigned int, 2, 1) - -OP_AND_FETCH_2 (add, , +, unsigned char, 1, 0) -OP_AND_FETCH_2 (sub, , -, unsigned char, 1, 0) -OP_AND_FETCH_2 (or, , |, unsigned char, 1, 0) -OP_AND_FETCH_2 (and, , &, unsigned char, 1, 0) -OP_AND_FETCH_2 (xor, , ^, unsigned char, 1, 0) -OP_AND_FETCH_2 (nand, ~, &, unsigned char, 1, 0) +OP_AND_FETCH_2 (add, , +, u64, 8, 3) +OP_AND_FETCH_2 (sub, , -, u64, 8, 3) +OP_AND_FETCH_2 (or, , |, u64, 8, 3) +OP_AND_FETCH_2 (and, , &, u64, 8, 3) +OP_AND_FETCH_2 (xor, , ^, u64, 8, 3) +OP_AND_FETCH_2 (nand, ~, &, u64, 8, 3) + +OP_AND_FETCH_2 (add, , +, u16, 2, 1) +OP_AND_FETCH_2 (sub, , -, u16, 2, 1) +OP_AND_FETCH_2 (or, , |, u16, 2, 1) +OP_AND_FETCH_2 (and, , &, u16, 2, 1) +OP_AND_FETCH_2 (xor, , ^, u16, 2, 1) +OP_AND_FETCH_2 (nand, ~, &, u16, 2, 1) + +OP_AND_FETCH_2 (add, , +, u8, 1, 0) +OP_AND_FETCH_2 (sub, , -, u8, 1, 0) +OP_AND_FETCH_2 (or, , |, u8, 1, 0) +OP_AND_FETCH_2 (and, , &, u8, 1, 0) +OP_AND_FETCH_2 (xor, , ^, u8, 1, 0) +OP_AND_FETCH_2 (nand, ~, &, u8, 1, 0) #define FETCH_AND_OP_WORD(OP, PFX_OP, INF_OP) \ unsigned int HIDDEN \ @@ -254,9 +262,9 @@ typedef unsigned char bool; return (failure == 0); \ } -COMPARE_AND_SWAP_2 (long long unsigned int, 8, 3) -COMPARE_AND_SWAP_2 (short unsigned int, 2, 1) -COMPARE_AND_SWAP_2 (unsigned char, 1, 0) +COMPARE_AND_SWAP_2 (u64, 8, 3) +COMPARE_AND_SWAP_2 (u16, 2, 1) +COMPARE_AND_SWAP_2 (u8, 1, 0) unsigned int HIDDEN __sync_val_compare_and_swap_4 (volatile void *ptr, unsigned int oldval, @@ -304,9 +312,9 @@ TYPE HIDDEN \ return oldval; \ } -SYNC_LOCK_TEST_AND_SET_2 (long long unsigned int, 8, 3) -SYNC_LOCK_TEST_AND_SET_2 (short unsigned int, 2, 1) -SYNC_LOCK_TEST_AND_SET_2 (unsigned char, 1, 0) +SYNC_LOCK_TEST_AND_SET_2 (u64, 8, 3) +SYNC_LOCK_TEST_AND_SET_2 (u16, 2, 1) +SYNC_LOCK_TEST_AND_SET_2 (u8, 1, 0) unsigned int HIDDEN __sync_lock_test_and_set_4 (volatile void *ptr, unsigned int val) @@ -336,9 +344,9 @@ __sync_lock_test_and_set_4 (volatile void *ptr, unsigned int val) } while (failure != 0); \ } -SYNC_LOCK_RELEASE_1 (long long unsigned int, 8, 3) -SYNC_LOCK_RELEASE_1 (short unsigned int, 2, 1) -SYNC_LOCK_RELEASE_1 (unsigned char, 1, 0) +SYNC_LOCK_RELEASE_1 (u64, 8, 3) +SYNC_LOCK_RELEASE_1 (u16, 2, 1) +SYNC_LOCK_RELEASE_1 (u8, 1, 0) void HIDDEN __sync_lock_release_4 (volatile void *ptr) diff --git a/libgcc/config/pa/t-linux64 b/libgcc/config/pa/t-linux64 index 1d0a6ada1a1..026b48b02e5 100644 --- a/libgcc/config/pa/t-linux64 +++ b/libgcc/config/pa/t-linux64 @@ -1,8 +1,8 @@ # Plug millicode routines into libgcc.a We want these on both native and # cross compiles. -# FIXME: Explain. -LIB1ASMFUNCS := $(filter-out _dyncall, $(LIB1ASMFUNCS)) +LIB1ASMSRC = pa/milli64.S +LIB1ASMFUNCS = _divI _divU _remI _remU _div_const _mulI -LIB2ADD_ST = $(srcdir)/config/pa/linux-atomic.c +HOST_LIBGCC2_CFLAGS += -Dpa64=1 -DELF=1 -DLINUX=1 -HOST_LIBGCC2_CFLAGS += -Dpa64=1 -DELF=1 +LIB2ADD_ST = $(srcdir)/config/pa/linux-atomic.c