From patchwork Thu Dec 28 14:58:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 18588 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp2041486dyb; Thu, 28 Dec 2023 07:00:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IHocgNrqCWaOSouvbojJXlgTRCzWggdrvFUfo7iNtm931Ks5zBnSylEvCUQal6qR95WqaNp X-Received: by 2002:a0c:f74f:0:b0:680:7a49:34f5 with SMTP id e15-20020a0cf74f000000b006807a4934f5mr772528qvo.62.1703775605083; Thu, 28 Dec 2023 07:00:05 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1703775605; cv=pass; d=google.com; s=arc-20160816; b=JM98DdClvQM2soCAzU28FS9Dx8XIXpSJXdrISV1uyjIynepR81NkNW3idn/8MfoLxZ 7aSykaKIZOhEfM4iPtTfquvUkYRZoaymrFXBWFSE2w0TZXXPosFKd6uqoyISM7dEBIM+ aw5PeR+T4LoCXKAGuy+VMTGfxVjLpjlbW7gHHWebcwBxwqNqy3F/kuCaTuoLmvwuw9QQ NHliU/gx4yOcfjNkd8SyFwfZ36KN3AAYu+Xy89muTLryNqO2CM0EyFCieigOkqceflv7 5ztR7DTwrmNzMnuQNqKfwiVqHaa6SimbkEkb9rGbDwaugAizgoiBmGIRx1kO+ljjech/ ZrWA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:to:from:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=M2QFs2nj5H+uMFEU5VCRGg0N0GibAfF4yP1s6RdvzE4=; fh=NLxAvL/bDfPg4AGOtxqvQlND8vazkZrNzKLY8+LAbBY=; b=J+M2BDMQzXJ3fficv3PXQY94TiEJfvyUwGzEFsfEGTTLSd0fO2JvpBdgd7YkkPH7Cc 9fSfOBtraub9Sw2QlTwVyUZeydU5mzRUS8+HRdZGvMDQKL/TCshC4v1xByZF0O+g2988 kjZg3iD+Z0mTccRG2ovRlRxKBOv7RCASHxrxR56OH0pOb8XGLuG48JZQwg7cDHl8pIyP tG1PADME3f3JzgVDFtj3My2M+z0RCPUmT7UkmqFYCwCSV3un4YIM4X58ueKXBIsVde5F P/WUL6ZmZA1kc3YWe0jj0T/x2Sbxr2P1IxwRHi/QELECVY78wytdowkxazGxgTJQz3Sg 5Juw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=XbXjh9PQ; arc=pass (i=1); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id q18-20020ae9e412000000b0077f4299af1esi15976204qkc.630.2023.12.28.07.00.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Dec 2023 07:00:05 -0800 (PST) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=XbXjh9PQ; arc=pass (i=1); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D345E385770C for ; Thu, 28 Dec 2023 14:59:58 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by sourceware.org (Postfix) with ESMTPS id F225F3858298 for ; Thu, 28 Dec 2023 14:58:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F225F3858298 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org F225F3858298 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::631 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703775492; cv=none; b=vAIKhJUdAstrPTg5tJ3cV4ouREFWI1U1qKb2MBNt+71iEMd4HQ4q8SNAeWwt+8FlaOR16x1onZOzHvU0ufmczrwfwWqdf1RKiZkOAZz/uh4UHNbLoVj5GK1WjotlOus+RTJyZNubZC+dJrRhWxh5VF7WrfHjETHVGsXzfb4Llck= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703775492; c=relaxed/simple; bh=DU4xE+gs5PKAojnwbZ3/i129VbohiiNvs0UNKZOkd58=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=witN7dBxoDBG2JpMKgEIMSjhQ/ZR67SyxElZJnsD/Bxgr1TJf3jdEFMWQINjqgA7WiTBC8EYipLMKXpjpTczoxMKByZM8g/lWeXSdUBEPbc/YiblhGfjTyKFAvnpHIm+p+YUZ62p1ccAijeGc3ag7/fQ7uyjm7X3mqiR3wXYFeI= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-1d3f8af8297so23914005ad.2 for ; Thu, 28 Dec 2023 06:58:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703775488; x=1704380288; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=M2QFs2nj5H+uMFEU5VCRGg0N0GibAfF4yP1s6RdvzE4=; b=XbXjh9PQvKvfnVOzliqy7uO6Ssh+/Xs2JZfA5jj0W44Icz2T3BOqEKyWxKP8Loj8d2 mCDSu4DKIM7ejAnKePU+4l45PRxJJYJHY0ahpoO8E40iLF/kOQ3aAMu7bk8K22q87hzb C7htb8/igOZAmFpTZll20hfiOtcd86QSW+WSkqJJUiviy4fqZyJCk6xqOLQpo13Aec9v GYfy1cwX6MPOGC5huuehN1sulQnoOUCpZLbgUtCsdotlwpMcaF4P1rGTberIb2wPDWCQ ZAKPZJwNnJPVgAH80XvoMr2m/wGEmwsWmZBlL0qjac/WqDd/8zoDnE4Hgmmlb9Ri4sFj xwGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703775488; x=1704380288; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=M2QFs2nj5H+uMFEU5VCRGg0N0GibAfF4yP1s6RdvzE4=; b=EYVNiHN3oPa5e9j/0HeJsvUlCS9HBPuvetGrq9Cd+WvWM9KIOzqsS3Fg+WTHEhDebb OlZKMouC+XVQU7G/v9nqOWI78Jl5SE0GEdRcviUerdxnwxu5gc2Ehq6Ufv84v3lpGrtG FDmHGSvHrpfIUXNFEEmKDaAo19Ei93hggM+bXl7LdjSr2Hee5c7JDbQUVJUhTsVD9dUB 5xlALfntNTa2TfaE7rKZyg73KWbyCgR3UnH54zVbNnx63fDmuYCAg6rsSR/Zp5KstrA9 4rjImEYi+Ftio4WD2NDAKXyuid5yOHUh3benm2lwP8vvcpBGWRignfm4FEraYAfOw+uJ jZuw== X-Gm-Message-State: AOJu0YxYWbDdD9G1pqk96gPzuOBNw551p393EcqPHjDv0iGKP9D8pE+o FN4CnAnhn3IUqzm5AICsl/xPFRcV4gg= X-Received: by 2002:a17:902:e88c:b0:1d0:ae84:6107 with SMTP id w12-20020a170902e88c00b001d0ae846107mr5514446plg.38.1703775488484; Thu, 28 Dec 2023 06:58:08 -0800 (PST) Received: from gnu-cfl-3.localdomain ([172.56.169.119]) by smtp.gmail.com with ESMTPSA id u17-20020a170903125100b001cfa0c04553sm13891708plh.116.2023.12.28.06.58.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Dec 2023 06:58:06 -0800 (PST) Received: from gnu-cfl-3.. (localhost [IPv6:::1]) by gnu-cfl-3.localdomain (Postfix) with ESMTP id AEE6C7402E2 for ; Thu, 28 Dec 2023 06:58:04 -0800 (PST) From: "H.J. Lu" To: binutils@sourceware.org Subject: [PATCH 0/4] Support APX relocations Date: Thu, 28 Dec 2023 06:58:00 -0800 Message-ID: <20231228145804.658337-1-hjl.tools@gmail.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-Spam-Status: No, score=-3018.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1786538208726252105 X-GMAIL-MSGID: 1786538208726252105 Implement 3 APX relocations in ld and gold: #define R_X86_64_CODE_4_GOTPCRELX 43 #define R_X86_64_CODE_4_GOTTPOFF 44 #define R_X86_64_CODE_4_GOTPC32_TLSDESC 45 H.J. Lu (4): x86-64: Add R_X86_64_CODE_4_GOTPCRELX gold: Handle R_X86_64_CODE_4_GOTPCRELX x86-64: Add R_X86_64_CODE_4_GOTTPOFF/R_X86_64_CODE_4_GOTPC32_TLSDESC Gold: Handle R_X86_64_CODE_4_GOTPC32_TLSDESC/R_X86_64_CODE_4_GOTTPOFF bfd/bfd-in2.h | 3 + bfd/elf64-x86-64.c | 196 ++++++++++++++++-- bfd/libbfd.h | 3 + bfd/reloc.c | 6 + elfcpp/x86_64.h | 14 +- gas/config/tc-i386.c | 38 +++- gas/config/tc-i386.h | 6 +- .../gas/i386/ilp32/x86-64-localpic.d | 4 +- gas/testsuite/gas/i386/x86-64-gotpcrel.d | 12 ++ gas/testsuite/gas/i386/x86-64-gotpcrel.s | 19 ++ gas/testsuite/gas/i386/x86-64-gottpoff.d | 19 ++ gas/testsuite/gas/i386/x86-64-gottpoff.s | 15 ++ gas/testsuite/gas/i386/x86-64-localpic.d | 4 +- gas/testsuite/gas/i386/x86-64-localpic.s | 2 + gas/testsuite/gas/i386/x86-64-tlsdesc.d | 17 ++ gas/testsuite/gas/i386/x86-64-tlsdesc.s | 13 ++ gas/testsuite/gas/i386/x86-64.exp | 3 + gas/write.h | 3 +- gold/testsuite/Makefile.am | 11 + gold/testsuite/Makefile.in | 17 ++ gold/testsuite/x86_64_gd_to_le.s | 1 + gold/testsuite/x86_64_gd_to_le.sh | 1 + gold/testsuite/x86_64_ie_to_le.s | 17 ++ gold/testsuite/x86_64_ie_to_le.sh | 29 +++ gold/testsuite/x86_64_mov_to_lea.sh | 16 ++ gold/testsuite/x86_64_mov_to_lea1.s | 1 + gold/testsuite/x86_64_mov_to_lea2.s | 1 + gold/testsuite/x86_64_mov_to_lea3.s | 1 + gold/testsuite/x86_64_mov_to_lea4.s | 1 + gold/testsuite/x86_64_mov_to_lea5.s | 1 + gold/x86_64.cc | 193 +++++++++++++---- include/elf/x86-64.h | 12 +- ld/testsuite/ld-x86-64/apx-load1.s | 51 +++++ ld/testsuite/ld-x86-64/apx-load1a.d | 54 +++++ ld/testsuite/ld-x86-64/apx-load1b.d | 55 +++++ ld/testsuite/ld-x86-64/apx-load1c.d | 47 +++++ ld/testsuite/ld-x86-64/apx-load1d.d | 47 +++++ ld/testsuite/ld-x86-64/tlsbindesc.dd | 49 +++++ ld/testsuite/ld-x86-64/tlsbindesc.rd | 36 ++-- ld/testsuite/ld-x86-64/tlsbindesc.s | 39 ++++ ld/testsuite/ld-x86-64/x86-64.exp | 4 + 41 files changed, 967 insertions(+), 94 deletions(-) create mode 100644 gas/testsuite/gas/i386/x86-64-gottpoff.d create mode 100644 gas/testsuite/gas/i386/x86-64-gottpoff.s create mode 100644 gas/testsuite/gas/i386/x86-64-tlsdesc.d create mode 100644 gas/testsuite/gas/i386/x86-64-tlsdesc.s create mode 100644 gold/testsuite/x86_64_ie_to_le.s create mode 100755 gold/testsuite/x86_64_ie_to_le.sh create mode 100644 ld/testsuite/ld-x86-64/apx-load1.s create mode 100644 ld/testsuite/ld-x86-64/apx-load1a.d create mode 100644 ld/testsuite/ld-x86-64/apx-load1b.d create mode 100644 ld/testsuite/ld-x86-64/apx-load1c.d create mode 100644 ld/testsuite/ld-x86-64/apx-load1d.d