From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by sourceware.org (Postfix) with ESMTPS id BFBDC3858D32 for ; Mon, 16 Jan 2023 13:29:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BFBDC3858D32 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-x62f.google.com with SMTP id d3so30314463plr.10 for ; Mon, 16 Jan 2023 05:29:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=tpnIshYFPOnkRsybS9qwewwOl/p9oBJ+jEwSnIy1kpY=; b=cENO4ZPOtCJoRJRJTt7WZGtfQGhIOdkYeQJ6a7uo6++cpuTLkxva036hBe6bnkT9wX FfZT6XNdQzdK+6N9/g0C8JjOBG8RFMWR+txdLXJafXEHC7qwudB7VNO7vYuiU0mbsVqJ g1R3rN7HiXHAwlXfCgp35UGQsqrYsGaxRtA4GzImm81ySfsFLXlwSkTVA/uPJXBApkRR sN4NyemLy8n2impqUAlWA6XD6982WPaMfS1Zz9ZJGc8jYODMe3rBTKjjo0uuYj7JtGKV fxi61Ew/8cVj7gmzlPBJLmUAKO0qGKSIiPKTwotVhzGuYr3yXZBrkumFTEbwwrl8XcN6 bk2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=tpnIshYFPOnkRsybS9qwewwOl/p9oBJ+jEwSnIy1kpY=; b=V1QrWkn4Gcim01jEQfUDi7+PzknJGKVXI+eKaL20HgqzAzm9aaIEybEO+IRzHpQNmx 0WTXT8GeytgsHRFpBGzsLgkkMCExBERlOVu/ZFV7MuvbM9tDDVM2J0vYzBk5Dm2qyzsz iPR9uKgrvm4Jrnpbj0g6fW89T/G837rKK1y8ZTsFERaFrlaayLrp53JBszO/Ve29iIq8 90ABMSI0qCKANe4jB0rjPQvNKG6gIN5gUHIIpWMwKL88iFRAW0cQ2ZNOo6V9WTwRePDi +xdqu/uhaV6VcGouUAp4KXKFHFjobME6jXScjW5FTtassZARWlJeCqCbC5LrWsZjqvX7 WotQ== X-Gm-Message-State: AFqh2krIkNR5DR2h55bXLPOXqhHxilEbcfK985Wzf58A8ZxquluwWsk5 PM1Wa1BNtgAXpb++pCSbNpOv2Y5Eq8s= X-Google-Smtp-Source: AMrXdXsenmCfDL6Acnha4JDcBQuaWsF5Y0TBF3t/M9P6d2GY1Wqn5RwFKPRVuSfKj1h2B7a/hNJLmg== X-Received: by 2002:a05:6a20:d006:b0:af:c491:c7d2 with SMTP id hu6-20020a056a20d00600b000afc491c7d2mr84589158pzb.29.1673875797794; Mon, 16 Jan 2023 05:29:57 -0800 (PST) Received: from squeak.grove.modra.org ([2406:3400:51d:8cc0:303a:c9dc:cd1d:96a1]) by smtp.gmail.com with ESMTPSA id q18-20020a170902bd9200b00186b7443082sm19336954pls.195.2023.01.16.05.29.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Jan 2023 05:29:57 -0800 (PST) Received: by squeak.grove.modra.org (Postfix, from userid 1000) id EC08F1140A04; Mon, 16 Jan 2023 23:59:54 +1030 (ACDT) Date: Mon, 16 Jan 2023 23:59:54 +1030 From: Alan Modra To: binutils@sourceware.org Cc: Mark Harmstone Subject: Correct ld-pe/aarch64.d test output Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-3035.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: "foo" is at 0x2010. This corrects the expected output for .long and .word referencing foo, showing a problem with relocation handling. Mark, the relocation special functions you added look like they only work for gas. They are also used by the linker when linking to another output format (which may not be supported by aarch64), and by objdump, eg. gas/testsuite/gas/aarch64/inst-directive. I've been poking at them over the last few days, and realized I don't know enough about what exactly goes into the addend fields stored in aarch64-pe relocatable object files to be able to fix the problems. Is is really a sensible addend with no symbol value confounding? Someone with access to existing aarch64-pe assemblers and linkers will need to do some digging, particularly in the case where a relocation is emitted against defined symbols like "foo" in ld-pe/aarch64a.s. I've also been looking again at bfd_perform_relocation and bfd_install_relocation. These functions grew the way they are to be compatible with old COFF and AOUT object file formats emitted by other linkers, and no one has been game to remove the hacks. One possibility that I may look into implementing is a flag in the reloc howto that asks for sane behaviour. * testsuite/ld-pe/aarch64.d: Correct expected output. diff --git a/ld/testsuite/ld-pe/aarch64.d b/ld/testsuite/ld-pe/aarch64.d index cc3daf9e9cd..eea52e10fe2 100644 --- a/ld/testsuite/ld-pe/aarch64.d +++ b/ld/testsuite/ld-pe/aarch64.d @@ -10,41 +10,41 @@ Disassembly of section .text: 0000000000002010 : 2010: 12345678 and w24, w19, #0xfffff003 2014: 12345678 and w24, w19, #0xfffff003 - 2018: 00002000 udf #8192 - 201c: 00002000 udf #8192 + 2018: 00002010 udf #8208 + 201c: 00002010 udf #8208 2020: 00002220 udf #8736 2024: 00002220 udf #8736 - 2028: 00002001 udf #8193 - 202c: 00002001 udf #8193 + 2028: 00002011 udf #8209 + 202c: 00002011 udf #8209 2030: 00002221 udf #8737 2034: 00002221 udf #8737 - 2038: 00001fff udf #8191 - 203c: 00001fff udf #8191 + 2038: 0000200f udf #8207 + 203c: 0000200f udf #8207 2040: 0000221f udf #8735 2044: 0000221f udf #8735 2048: 9abcdef0 .inst 0x9abcdef0 ; undefined 204c: 12345678 and w24, w19, #0xfffff003 2050: 9abcdef0 .inst 0x9abcdef0 ; undefined 2054: 12345678 and w24, w19, #0xfffff003 - 2058: 00002000 udf #8192 + 2058: 00002010 udf #8208 205c: 00000000 udf #0 - 2060: 00002000 udf #8192 + 2060: 00002010 udf #8208 2064: 00000000 udf #0 2068: 00002220 udf #8736 206c: 00000000 udf #0 2070: 00002220 udf #8736 2074: 00000000 udf #0 - 2078: 00002001 udf #8193 + 2078: 00002011 udf #8209 207c: 00000000 udf #0 - 2080: 00002001 udf #8193 + 2080: 00002011 udf #8209 2084: 00000000 udf #0 2088: 00002221 udf #8737 208c: 00000000 udf #0 2090: 00002221 udf #8737 2094: 00000000 udf #0 - 2098: 00001fff udf #8191 + 2098: 0000200f udf #8207 209c: 00000000 udf #0 - 20a0: 00001fff udf #8191 + 20a0: 0000200f udf #8207 20a4: 00000000 udf #0 20a8: 0000221f udf #8735 20ac: 00000000 udf #0 -- Alan Modra Australia Development Lab, IBM