From patchwork Mon Aug 26 20:58:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stafford Horne X-Patchwork-Id: 1153454 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=uclibc-ng.org (client-ip=89.238.66.15; helo=helium.openadk.org; envelope-from=devel-bounces@uclibc-ng.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="fm/B9d7J"; dkim-atps=neutral Received: from helium.openadk.org (helium.openadk.org [89.238.66.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46HPWG2P1Fz9sN4 for ; Tue, 27 Aug 2019 06:59:04 +1000 (AEST) Received: from helium.openadk.org (localhost [IPv6:::1]) by helium.openadk.org (Postfix) with ESMTP id 5F75110090; Mon, 26 Aug 2019 22:58:57 +0200 (CEST) X-Original-To: devel@uclibc-ng.org Delivered-To: devel@helium.openadk.org Received: from mail-pf1-f194.google.com (mail-pf1-f194.google.com [209.85.210.194]) by helium.openadk.org (Postfix) with ESMTPS id 4512B10065 for ; Mon, 26 Aug 2019 22:58:50 +0200 (CEST) Received: by mail-pf1-f194.google.com with SMTP id b24so12606272pfp.1 for ; Mon, 26 Aug 2019 13:58:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=PweBDBiBMaek7T2S0YBm53t2NqMtLYrNB0olVThukTs=; b=fm/B9d7JvQ+x0GoomYAy6awHPnkrHLGvpbvKzuu2KxlYzQd+uGt5onTE6fH3h3rTf9 gImgbBc0q6PFTol/uVoonWTObCV3eR5gEM83T5T/QnzMJHY0uTE9FOayJrVNYAFrfNvg kklsAAwxQD82MU3JpmnZ4cikM9+mmutn6u6LUUSF8bgl+W64ZCS2QRVg7R4GbBZqBpyx YRLJv4fmmivazrij2QtfOsaMavYjPaL9pG+tZ7/PQjBLNH1jkK5I+Q9UV1Tq0hmMABS4 At2CiLR3zaZoptG22nEAqjoslBl+HKcVmeOrvRB6XKZ1bezt6m+FEG32SkF1smchf3WV q37A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=PweBDBiBMaek7T2S0YBm53t2NqMtLYrNB0olVThukTs=; b=E3fOCXJDKJGcA69TyJjDuGqn/lrlDiDi/Ylw42XQBoKC8cwa9gIe2oWEbBVQfuTWOY U6pvLqGUTJSpgPdRfq0OkOYuekKgH9Gnl+LalM1OWN8zhX9BvMqPyFGUX3vL/aE6bSaB bVroyfxu8tpHN4sHYbpbKgBYDVfkRAIOrdQVTCKfP3lU0esxom+xEnT8m9KEv6tHNjON itE9fucsC0JtHEl9MMql4i+gO5tvLlU5G6ctik99YUBCQK8CZ26rM6fkFLgPMTgl/HIG VPoxyiDz7uLP3kgf+dYU31d517qdGGpZq3FWmT4fuv9KOqH52mrKY18OcYzBit0VR/oS mqpA== X-Gm-Message-State: APjAAAVRBX8h57Y+oCl2FKOMoFSnMebQA2On++K0UEHBHe7MnrfTo++U 8HhNdk0AEoEBfNfovIf928/piOgV X-Google-Smtp-Source: APXvYqwn1ypK8giB1fuQkg4g6j39lQNZdVYkwMm0wmbQfMc6CtrL5Sx3Pz2PZ6iP0F8Dg/XX95p8jw== X-Received: by 2002:a65:5c4b:: with SMTP id v11mr8003608pgr.62.1566853129769; Mon, 26 Aug 2019 13:58:49 -0700 (PDT) Received: from localhost (g75.222-224-160.ppp.wakwak.ne.jp. [222.224.160.75]) by smtp.gmail.com with ESMTPSA id r75sm17900253pfc.18.2019.08.26.13.58.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Aug 2019 13:58:49 -0700 (PDT) From: Stafford Horne To: uclibc-ng Devel Date: Tue, 27 Aug 2019 05:58:44 +0900 Message-Id: <20190826205844.31878-1-shorne@gmail.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Subject: [uclibc-ng-devel] [PATCH] or1k: Fix compiling with PIC and latest binutils use PLT for __syscall_error X-BeenThere: devel@uclibc-ng.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: uClibc-ng Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: devel-bounces@uclibc-ng.org Sender: "devel" This symbol was causing a build failure with the new toolchain. It looks like it has always been wrong. The main issue was checking for PIC rather than __PIC__. Remove all PSEUDO_* macros and ther SYSCALL_ERROR_NAME macro as they are not needed by uclibc-ng, they are used in glibc for building up syscalls there, but not here. Fixes error: /opt/shorne/software/or1k-linux/bin/../lib/gcc/or1k-linux/9.0.1/../../../../or1k-linux/bin/ld: libc/libc_so.a(or1k_clone.os): pc-relative relocation against dynamic symbol __syscall_error /opt/shorne/software/or1k-linux/bin/../lib/gcc/or1k-linux/9.0.1/../../../../or1k-linux/bin/ld: final link failed: bad value Signed-off-by: Stafford Horne --- libc/sysdeps/linux/or1k/or1k_clone.S | 8 +++++-- libc/sysdeps/linux/or1k/sysdep.h | 32 ---------------------------- 2 files changed, 6 insertions(+), 34 deletions(-) diff --git a/libc/sysdeps/linux/or1k/or1k_clone.S b/libc/sysdeps/linux/or1k/or1k_clone.S index a2c16ac9e..2de873a02 100644 --- a/libc/sysdeps/linux/or1k/or1k_clone.S +++ b/libc/sysdeps/linux/or1k/or1k_clone.S @@ -71,7 +71,11 @@ L(oldpid): l.ori r3, r11, 0 L(error): - l.j SYSCALL_ERROR_NAME +#ifdef __PIC__ + l.j plt(__syscall_error) +#else + l.j __syscall_error +#endif l.ori r3,r11,0 -PSEUDO_END (__or1k_clone) +END (__or1k_clone) diff --git a/libc/sysdeps/linux/or1k/sysdep.h b/libc/sysdeps/linux/or1k/sysdep.h index 4dba3f2a0..782981c55 100644 --- a/libc/sysdeps/linux/or1k/sysdep.h +++ b/libc/sysdeps/linux/or1k/sysdep.h @@ -43,38 +43,6 @@ License along with the GNU C Library; if not, see l.sys 1; \ l.nop -#define PSEUDO(name, syscall_name, args) \ - ENTRY (name); \ - DO_CALL(syscall_name); \ - /* if -4096 < ret < 0 holds, it's an error */ \ - l.sfgeui r11, 0xf001; \ - l.bf L(pseudo_end); \ - l.nop - -#define PSEUDO_NOERRNO(name, syscall_name, args) \ - ENTRY (name); \ - DO_CALL(syscall_name) - -#define PSEUDO_END(name) \ -L(pseudo_end): \ - l.j SYSCALL_ERROR_NAME; \ - l.ori r3,r11,0; \ - END (name) - -#define PSEUDO_END_NOERRNO(name) \ - END (name) - -#ifndef PIC -/* For static code, on error jump to __syscall_error directly. */ -# define SYSCALL_ERROR_NAME __syscall_error -#elif NOT_IN_libc -/* Use the internal name for libc/libpthread shared objects. */ -# define SYSCALL_ERROR_NAME __GI___syscall_error -#else -/* Otherwise, on error do a full PLT jump. */ -# define SYSCALL_ERROR_NAME plt(__syscall_error) -#endif - /* Make use of .size directive. */ #define ASM_SIZE_DIRECTIVE(name) .size name,.-name;