From patchwork Fri Oct 20 17:19:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ben Wolsieffer X-Patchwork-Id: 1852721 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=hefring-com.20230601.gappssmtp.com header.i=@hefring-com.20230601.gappssmtp.com header.a=rsa-sha256 header.s=20230601 header.b=zLas3p49; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=uclibc-ng.org (client-ip=2a00:1828:2000:679::23; helo=helium.openadk.org; envelope-from=devel-bounces@uclibc-ng.org; receiver=patchwork.ozlabs.org) Received: from helium.openadk.org (helium.openadk.org [IPv6:2a00:1828:2000:679::23]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SBrx308ctz23jq for ; Sat, 21 Oct 2023 04:21:56 +1100 (AEDT) Received: from helium.openadk.org (localhost [IPv6:::1]) by helium.openadk.org (Postfix) with ESMTP id 341C53520E11; Fri, 20 Oct 2023 19:21:42 +0200 (CEST) Authentication-Results: helium.openadk.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=hefring-com.20230601.gappssmtp.com header.i=@hefring-com.20230601.gappssmtp.com header.a=rsa-sha256 header.s=20230601 header.b=zLas3p49; dkim-atps=neutral Received: from mail-qk1-f182.google.com (mail-qk1-f182.google.com [209.85.222.182]) by helium.openadk.org (Postfix) with ESMTPS id 8D0C93520E0C for ; Fri, 20 Oct 2023 19:19:46 +0200 (CEST) Received: by mail-qk1-f182.google.com with SMTP id af79cd13be357-777754138bdso61116585a.1 for ; Fri, 20 Oct 2023 10:19:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hefring-com.20230601.gappssmtp.com; s=20230601; t=1697822384; x=1698427184; darn=uclibc-ng.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=TPqcRn1b1Y3AiNKvfBs86GQlE++D0+05P209KE5rf1I=; b=zLas3p49t5jWrBw92WRzUMVTm4N/LLOh6LM9FUMBx5vCFuP2DsF65rJ08+J1f42pwY pFH6rlVsNAgBL3vyzx3DpmwHsj5C5lL5BTyCg6eTTYVyjOFIyL0VtqvCd2GpFerMql5N wt/3J66sO3Eb5d6W3vmg2EC8xEpdHkow6JwrLzTkZ2zVjxiyILtbm08L6d+QQRfTqf51 wUspbSax5WoGkzMj8X/CfgPcw+g9wL/kAfYqOpBS7GUVBdeW37iIkmYa+CDzocL+ilIe iZvGlEgKWYZ8bQQHQh2YApHyCCAtg1Mnqnpj9Udx2x8D5GeknQpEZtNIsd5qZJ1SB6VE Kozw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697822384; x=1698427184; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=TPqcRn1b1Y3AiNKvfBs86GQlE++D0+05P209KE5rf1I=; b=ua7NMgyKcwDKkj1Jv7V7lOiW619XnfZhdJPN1cLXdKTCze7KqQNrIDGIPsOZUMwXjR SBkyd4HfhLZoE5wHazizbROdqoHLqB8fg+ltAIKfIOwXlnLeCyb8JRmx1OgP2GoYPCX+ tnp1FjZQOyfuzsEpMREInly0+Rte/PKZ27zNf31SOQqcYi+YSqWq/7W0IXmUBJj8bX15 Y1zkqBzpdWUVfTZhbE/jGnBdbosALQopat4VGy/5Ax5yX/gRLZIfAwTkPaZ+xt0FTE+Y gYwis4fxSozAZzK6r4rofiJ+gdAoy1RvuiBCRBVeGGM0W1RIzy0Wzmz5rHLVg+Pzn70C m7ew== X-Gm-Message-State: AOJu0YzxCoqTEcdv1FfWoWMNPN3JsSJCyoWt4J1pnRxV8s5aBk2dWqmb 0WiuymgtQ4jDjTDUbVDTHzFUqpi7bicA3IgRvIE= X-Google-Smtp-Source: AGHT+IFFdJVOxkK6DNUBYWS/fTtwObdWiVRVoeVP/AI5uQgMBsWgigdxlrxhqE9i65O83AFoIeTk5w== X-Received: by 2002:a05:620a:190d:b0:773:af20:43f7 with SMTP id bj13-20020a05620a190d00b00773af2043f7mr2622169qkb.54.1697822384148; Fri, 20 Oct 2023 10:19:44 -0700 (PDT) Received: from localhost.localdomain ([50.212.55.89]) by smtp.gmail.com with ESMTPSA id c3-20020a05620a134300b0076f058f5834sm754966qkl.61.2023.10.20.10.19.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 10:19:43 -0700 (PDT) From: Ben Wolsieffer To: devel@uclibc-ng.org Date: Fri, 20 Oct 2023 13:19:01 -0400 Message-ID: <20231020171900.1654392-2-ben.wolsieffer@hefring.com> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 Message-ID-Hash: 2R3RPJSUHMDCB45UZOEQT4W4F5VW5CCR X-Message-ID-Hash: 2R3RPJSUHMDCB45UZOEQT4W4F5VW5CCR X-MailFrom: ben.wolsieffer@hefring.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Ben Wolsieffer X-Mailman-Version: 3.3.3 Precedence: list Subject: [uclibc-ng-devel] [PATCH] arm: elf-fdpic.h: avoid void pointer subtraction List-Id: uClibc-ng Development Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: elf-fdpic.h is included by link.h. When a C++ program includes , we get the following build failure: <...>/usr/include/bits/elf-fdpic.h: In function ‘void* __reloc_pointer(void*, const elf32_fdpic_loadmap*)’: <...>/usr/include/bits/elf-fdpic.h:94:54: error: invalid use of ‘void’ 94 | unsigned long offset = p - (void*)map->segs[c].p_vaddr; | ^~~~~~~ void pointer addition and subtraction is not allowed in C++ as it has undetermined size, however in C with language extension it is possible because sizeof void is treated as one byte. This patch was previously applied to Blackfin, FR-V and C6x, but not ARM. Signed-off-by: Ben Wolsieffer --- libc/sysdeps/linux/arm/bits/elf-fdpic.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libc/sysdeps/linux/arm/bits/elf-fdpic.h b/libc/sysdeps/linux/arm/bits/elf-fdpic.h index 3d6db54af..f2ef9aeca 100644 --- a/libc/sysdeps/linux/arm/bits/elf-fdpic.h +++ b/libc/sysdeps/linux/arm/bits/elf-fdpic.h @@ -91,7 +91,7 @@ __reloc_pointer (void *p, /* This should be computed as part of the pointer comparison above, but we want to use the carry in the comparison, so we can't convert it to an integer type beforehand. */ - unsigned long offset = p - (void*)map->segs[c].p_vaddr; + unsigned long offset = (char*)p - (char*)map->segs[c].p_vaddr; /* We only check for one-past-the-end for the last segment, assumed to be the data segment, because other cases are ambiguous in the absence of padding between segments, and