From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2053.outbound.protection.outlook.com [40.107.104.53]) by sourceware.org (Postfix) with ESMTPS id 97B39385828A for ; Wed, 29 Jun 2022 08:20:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 97B39385828A ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=D7z5QAJOaqdrnt4GXBkULbGUZSOCV5sDrZcXDRhSd7dV+3vb5t10k8CbnkA+i5FSLOg1VWsiUsnc9lZDaT9c7ZaqhLvR1SVgUXzwgjINMSsOx3FvkDw52rkHf7cvLE7qbsNF9IqQIsTSE0vb0QYaJ/ghLlHwag4bcrk/6nwvc/pNieqRED3RDidjGWp0Z8rVI5wDIz2129D6d073gQTJT471FuNBg2XPJ8A0BrArYUY7kI6uOea5NBuAAmlk+x3bYb+yecgQGaM6A+p3R7vgX7UHfRJsrWJ1Sia7awaIRliVAxhp6hsG6KyiHfdVOVz2IzR3sVIdMhpTzK8NpL4lqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=vJXkGcbixoySTU1IV17/JKoz1mNv1jJUs+k1AiP9C18=; b=efjvwe7xpPGT1kKUL4kpliIjnkuZF8gV6HaZSxTwcUJb/FRq7VCzn6l85Il+KnrwqFPqtHg7zKSlWWZLFk0GetIkJslLK7XzBpSoZpFOHAmGxG1ITuok1V9kFQ+jJHZRSmxwM0Ny7L08jZ8yc7DCx2e6fsufSGXt2wRRa6SQq0cchR+OuRkCa8rbfOzuVySS4nzx13x0Bxo1+rwn7of5Vlcm7c2305yZDMPmu5NnfMzvRxQUEvE1jCtb9FvIn4S7Hr6Fmy+kOyQmq2XNnYQx3e7TKnUtEoK4haXES/D0cyMATMkSmrlIdSVG+yQcjkB3XExuY3w1yd8UYkAlZCMVpA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none Received: from VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) by DU2PR04MB8808.eurprd04.prod.outlook.com (2603:10a6:10:2e3::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5373.18; Wed, 29 Jun 2022 08:20:08 +0000 Received: from VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::dfa:a64a:432f:e26b]) by VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::dfa:a64a:432f:e26b%7]) with mapi id 15.20.5395.014; Wed, 29 Jun 2022 08:20:08 +0000 Message-ID: <0c74179c-6b0d-d4e0-40bc-bdc245aad57d@suse.com> Date: Wed, 29 Jun 2022 10:20:06 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Content-Language: en-US To: Binutils Cc: Nick Clifton , Marcus Shawcroft , Richard Earnshaw From: Jan Beulich Subject: [PATCH] Arm64: re-work PR gas/27217 fix Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: FR3P281CA0014.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:1d::7) To VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8daea554-54fb-4afc-a3d7-08da59a82d80 X-MS-TrafficTypeDiagnostic: DU2PR04MB8808:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RkKlF+NXE93Qth0ZhifLGxtNNeauND7L3AdBse67VwHudYjb6CRFXbjOSnTsqZYKQPhNPgi22gvMfwg93j6REVUFX6mj62acoMvlpXM1Ft4a5Chmi3zxtR4NobLW7A8XQ8HaKiQlzlb7oVwXAp/fd1somNjt06ptCTMP0HMYVCzTaLLEBzpeXivmouA0W1rXXJ3QW/01LxybOzacm+Gl8OESR6mBDbmybSQd2k9oB0JGnaRATMMQOEqJPw98/l4501QG4AFumpSNThGabl41R8fM/Pw88oHs/HVMFeZS+Cy1tXUNAVC1O2CpnEIXHG1qeo5qFrkVJJM+yM3IXVl40YITeqXVhq+HFNmoRG4rvoH6HklMmTFeHVNblMoRJwbbkkPmW5SW2RKTUIEkhvcdCXU9xBQfDnSE7MBMf2/t+R7JwvDllnLq92qbllOJ8hnC7RAn8fwhi6Mg4IRhUV32P+sL5X4ZuqcojMKdomJrWVL6YIUba7o4pSkhKIl3FONzogRd98MG9yihi2N6j1ZpUgfMiuqVDVhESGrBx5EWZhbImQDYOfcFpya/Tgpkvfa8zQQTR876CD/1IS4LDowwPOXA+7vUXuwco0in3Bu5+SNdSYPoljb4T+17sQVDynmro3pQ/X0m49+dz3veUjX96q700VJzgfs76SF1VnHP6kLiWCoS9Y4JGYQuDNpeH1pVBYIi8H48FMA5KKJrBqnM7/wFapf661SgT3GN3YwQhU9+0M4udfqC0yJv+aosUMGu9axoq+iQscIRk9T8SCbpQI8qdbkGCZQ9G/FY7qwP5gGhAkCI8g2/E38bzLxLpjVXvM1tmqyivRldPfJygMJIvQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VE1PR04MB6560.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(346002)(39860400002)(376002)(136003)(366004)(396003)(31696002)(26005)(86362001)(6506007)(6512007)(66946007)(8676002)(4326008)(66476007)(83380400001)(6486002)(8936002)(66556008)(478600001)(6916009)(5660300002)(54906003)(38100700002)(36756003)(2616005)(41300700001)(2906002)(186003)(316002)(31686004)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?U3J4c3pwYVZzakF6SHY4cFRLYVNkNE1mU2lFMUw5dlBUSVd4dEJNWWpJbGhI?= =?utf-8?B?dVpZZU9sdG9BRHVXM2hETVhMb1Bmb2thWE9leWpSQVN5ZTZ6ZFV0bEZ3TTlF?= =?utf-8?B?WWVEVVErTVRqbGk0OGJBMUVEUzdybjdqWWF4eDZwODZGa0kxbVJMNmIzSFo5?= =?utf-8?B?dnEvOHoxNEdQUHBjTmFtWVVkMjMzQmw1SU5nN01RUDBUVGl2TksxSWtZMXdV?= =?utf-8?B?c1lmMWRXMmVTazd6ajNmWnRTVTc2d05sMFBqK1NUUjk1dEZITjhiQzMvNEJS?= =?utf-8?B?WWU2cERKRzUrMmVNd3dHMXd1VUVwWTA3UCtEeVpsMUc0bVFEVlVHNmV0N3o4?= =?utf-8?B?aTUyRGticHVRazF2SWxmbDJXWjhqZGRTNE9CZlBXekwzeXpESDlqTGRCUGFG?= =?utf-8?B?RWE1SDk5V2VmSFNpaDRCbUNJNU8xd1lxN0x5dGxvYWtjNHZrZkpSL28wcmxQ?= =?utf-8?B?MHNzclBNUWo4T21yQkhiN2p0QkMwU0FySGdzdHFQWkVQTit3ekc3alF0dEpU?= =?utf-8?B?VTFsOG9UaURSS25GbXpEWHhqUk41bGo5NU10bkNhSEt5ekdoNFhLa2trMzh6?= =?utf-8?B?b0JjVGhoSWQ2ZkFhR1JkaklKMEZTSlF0bS83QUJhUy9NeFlhNkh0ZWZheW1o?= =?utf-8?B?TkZHR202TGVTMzFZUVBqQzBzY09mNjF3UHZhN0lyY0VsdmYrUFZnaHlQVGxE?= =?utf-8?B?bHQyekVtM2hTZXF4d3RYZWFCbmlRd0JrMnhXVFBoZWZyL3dXOUkreVgyaXF1?= =?utf-8?B?ZXR1NjFKNW5DdTlXZ3ArSnRlSENLRi9vTmJYT2xSUzFJV1VMcVRSS3VhcFQ4?= =?utf-8?B?YkNqc1dhYnBrYVpMQmxpMXFsZGhmcTJ2SDNXb29mOEhlVmxrdU90c3dHclhB?= =?utf-8?B?YU9UUHcreXg0dmZLSG1UWllpempESjlZeWhkOWtxTm1KTHU1Qms1N1NGN3Vt?= =?utf-8?B?SG1KaUxHREd0SVZkU2p5WmVndWlqTG5iaGo4bVplTHh5SWxnZktDZThNWjNp?= =?utf-8?B?bER4dlZVRnJjdUdKektZWFFoa0w5WWJ3bXU5eGJheFY3UER4bEdpRWdOL29l?= =?utf-8?B?UWpDLzB2ZU0rdFFrbHVkbDJScjhBcnRJdnNlVGlCVTZQWlJpWld3SXlsSDhT?= =?utf-8?B?eFkxOGRhWThWcXBSN3NUcHdPL3hWeVRUTHJhOHZLL0VYTUFIRHZpbXlGVDBs?= =?utf-8?B?dW1yTEkrODBpN2crdkEvaTREVWF4YnZud2VIem5Ob1M0bmVXL3lGVkZJYmM4?= =?utf-8?B?ZmlOblR2Zjd5VHpmUm5UYlZJdGU3d0Z0dlFKWm9DUFlsaWZQaWJtTDFON3pE?= =?utf-8?B?TFU1VFBseTJobkVjNDh3VlMxcGF4c0wrOGNHV29uZUZTZHFsNVUxbUNiMVpp?= =?utf-8?B?M0JONzNXaXdrMUNuMmRwYzNaR1VBOUc2RFIwVHE2dk9UMFg5WVVQVEhOcEIv?= =?utf-8?B?NjNtWURLTnE2eE9EdmFjemoxYVRGc0Z2RnQ5SlZtVWlvYTVDSGdFVXM4azdV?= =?utf-8?B?Q0xUaGZ0RVFETU05TTNKZktNY0ZjWkxhSCtWbVllVk42UzVpbmVVMFExMkNX?= =?utf-8?B?dkRTQjdZTUd3S2UyVkpRc25WeU5GNlNxZ21mTU56eU52SXN1a1NhK1JlTkda?= =?utf-8?B?ZGVkOXk4ZUt0N2hTVHdaOU9rZmsrcGMySlB5L2dYei91Q2xvd2VYVFY3Y3FC?= =?utf-8?B?U3VuVExGVERGNG03SHorc3ZWQkdzWnordW9JYXQzd2c2WENVK2toU2RxY0Iw?= =?utf-8?B?MkszMjhLMUg5ZEl3Z25hNlQ0c2duQkJFZ2ZyM3BEVmgwSGE3VWxQZU5hTGRS?= =?utf-8?B?K3RDaWs3Z3BqakJZRDd2QzJNMzQ4eTBrNldXRjBRU3NYRmNqOUpiV3JqdlBq?= =?utf-8?B?RmpvTzUrUGk0U2sxeEJjYWxkYU5ZVDhRUEw2NDlORkZnU1F5QmdJaVBSSUVX?= =?utf-8?B?ekJBbitRTStCOTE1bm1ocGozS1Z1Z2ZWSUhySTltMmRzbDFjTW42eExrSXhq?= =?utf-8?B?T0FYZGVZM1hBQk5iMWJyeENTZy90YmtncGVTVTJSTGs3empCa1U0RnYzYWVn?= =?utf-8?B?V2MrQWNCbTV3SE1rbUUvczV0MjJpeVZWRTY3WXpyUU4rQkFSNUpnK0dhZWRZ?= =?utf-8?Q?8ppbJdCFKPhlW6cq8nN5xKCcS?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8daea554-54fb-4afc-a3d7-08da59a82d80 X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6560.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jun 2022 08:20:08.0379 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: FodOyGJ95Sa1fWbkg3V4hxsGOczxtKx09rvPjhC/hzyZwgzipL4CvnPkhbvfTvDtwiwo1tM5kslVfNY/4YQJLg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8808 X-Spam-Status: No, score=-3030.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, 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.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jun 2022 08:20:14 -0000 The original approach has resulted in anomalies when . is involved in an operand of one of the affected insns. We cannot leave . unresolved, or else it'll be resolved at the end of assembly, then pointing to the address of a section rather than at the insn of interest. Undo part of the original change and instead check whether a relocation cannot be omitted in md_apply_fix(). By resolving the expressions again, equates (see the adjustment of the respective testcase) will now be evaluated, and hence relocations against absolute addresses be emitted. This ought to be okay as long as the equates aren't global (and hence can't be overridden). If a need for such arises, quite likely the only way to address this would be to invent yet another expression evaluation mode, leaving everything _except_ . un-evaluated. There's a further anomaly in how transitive equates are handled. In .set x, 0x12345678 .eqv bar, x foo: adrp x0, x add x0, x0, :lo12:x adrp x0, bar add x0, x0, :lo12:bar the first two relocations are now against *ABS*:0x12345678 (as said above), whereas the latter two relocations would be against x. (Before the change here, the first two relocations are against x and the latter two against bar.) But this is an issue seen elsewhere as well, and would likely require adjustments in the target-independent parts of the assembler instead of trying to hack around this for every target. --- a/gas/config/tc-aarch64.c +++ b/gas/config/tc-aarch64.c @@ -565,25 +565,18 @@ static bool in_aarch64_get_expression = #define ALLOW_ABSENT false #define REJECT_ABSENT true -/* Fifth argument to aarch64_get_expression. */ -#define NORMAL_RESOLUTION false - /* Return TRUE if the string pointed by *STR is successfully parsed as an valid expression; *EP will be filled with the information of such an expression. Otherwise return FALSE. If ALLOW_IMMEDIATE_PREFIX is true then skip a '#' at the start. - If REJECT_ABSENT is true then trat missing expressions as an error. - If DEFER_RESOLUTION is true, then do not resolve expressions against - constant symbols. Necessary if the expression is part of a fixup - that uses a reloc that must be emitted. */ + If REJECT_ABSENT is true then trat missing expressions as an error. */ static bool aarch64_get_expression (expressionS * ep, char ** str, bool allow_immediate_prefix, - bool reject_absent, - bool defer_resolution) + bool reject_absent) { char *save_in; segT seg; @@ -603,10 +596,7 @@ aarch64_get_expression (expressionS * e save_in = input_line_pointer; input_line_pointer = *str; in_aarch64_get_expression = true; - if (defer_resolution) - seg = deferred_expression (ep); - else - seg = expression (ep); + seg = expression (ep); in_aarch64_get_expression = false; if (ep->X_op == O_illegal || (reject_absent && ep->X_op == O_absent)) @@ -1035,8 +1025,7 @@ parse_typed_reg (char **ccp, aarch64_reg atype.defined |= NTA_HASINDEX; - aarch64_get_expression (&exp, &str, GE_NO_PREFIX, REJECT_ABSENT, - NORMAL_RESOLUTION); + aarch64_get_expression (&exp, &str, GE_NO_PREFIX, REJECT_ABSENT); if (exp.X_op != O_constant) { @@ -1239,8 +1228,7 @@ parse_vector_reg_list (char **ccp, aarch { expressionS exp; - aarch64_get_expression (&exp, &str, GE_NO_PREFIX, REJECT_ABSENT, - NORMAL_RESOLUTION); + aarch64_get_expression (&exp, &str, GE_NO_PREFIX, REJECT_ABSENT); if (exp.X_op != O_constant) { set_first_syntax_error (_("constant expression required.")); @@ -2187,8 +2175,7 @@ parse_immediate_expression (char **str, return false; } - aarch64_get_expression (exp, str, GE_OPT_PREFIX, REJECT_ABSENT, - NORMAL_RESOLUTION); + aarch64_get_expression (exp, str, GE_OPT_PREFIX, REJECT_ABSENT); if (exp->X_op == O_absent) { @@ -2422,8 +2409,7 @@ parse_big_immediate (char **str, int64_t return false; } - aarch64_get_expression (&inst.reloc.exp, &ptr, GE_OPT_PREFIX, REJECT_ABSENT, - NORMAL_RESOLUTION); + aarch64_get_expression (&inst.reloc.exp, &ptr, GE_OPT_PREFIX, REJECT_ABSENT); if (inst.reloc.exp.X_op == O_constant) *imm = inst.reloc.exp.X_add_number; @@ -3320,8 +3306,7 @@ parse_shift (char **str, aarch64_opnd_in p++; exp_has_prefix = 1; } - (void) aarch64_get_expression (&exp, &p, GE_NO_PREFIX, ALLOW_ABSENT, - NORMAL_RESOLUTION); + aarch64_get_expression (&exp, &p, GE_NO_PREFIX, ALLOW_ABSENT); } if (kind == AARCH64_MOD_MUL_VL) /* For consistency, give MUL VL the same shift amount as an implicit @@ -3385,7 +3370,7 @@ parse_shifter_operand_imm (char **str, a /* Accept an immediate expression. */ if (! aarch64_get_expression (&inst.reloc.exp, &p, GE_OPT_PREFIX, - REJECT_ABSENT, NORMAL_RESOLUTION)) + REJECT_ABSENT)) return false; /* Accept optional LSL for arithmetic immediate values. */ @@ -3509,8 +3494,7 @@ parse_shifter_operand_reloc (char **str, /* Next, we parse the expression. */ if (! aarch64_get_expression (&inst.reloc.exp, str, GE_NO_PREFIX, - REJECT_ABSENT, - aarch64_force_reloc (entry->add_type) == 1)) + REJECT_ABSENT)) return false; /* Record the relocation type (use the ADD variant here). */ @@ -3656,8 +3640,7 @@ parse_address_main (char **str, aarch64_ } /* #:: */ - if (! aarch64_get_expression (exp, &p, GE_NO_PREFIX, REJECT_ABSENT, - aarch64_force_reloc (ty) == 1)) + if (! aarch64_get_expression (exp, &p, GE_NO_PREFIX, REJECT_ABSENT)) { set_syntax_error (_("invalid relocation expression")); return false; @@ -3673,8 +3656,7 @@ parse_address_main (char **str, aarch64_ /* =immediate; need to generate the literal in the literal pool. */ inst.gen_lit_pool = 1; - if (!aarch64_get_expression (exp, &p, GE_NO_PREFIX, REJECT_ABSENT, - NORMAL_RESOLUTION)) + if (!aarch64_get_expression (exp, &p, GE_NO_PREFIX, REJECT_ABSENT)) { set_syntax_error (_("invalid address")); return false; @@ -3780,8 +3762,7 @@ parse_address_main (char **str, aarch64_ /* We now have the group relocation table entry corresponding to the name in the assembler source. Next, we parse the expression. */ - if (! aarch64_get_expression (exp, &p, GE_NO_PREFIX, REJECT_ABSENT, - aarch64_force_reloc (entry->ldst_type) == 1)) + if (! aarch64_get_expression (exp, &p, GE_NO_PREFIX, REJECT_ABSENT)) { set_syntax_error (_("invalid relocation expression")); return false; @@ -3794,8 +3775,7 @@ parse_address_main (char **str, aarch64_ } else { - if (! aarch64_get_expression (exp, &p, GE_OPT_PREFIX, REJECT_ABSENT, - NORMAL_RESOLUTION)) + if (! aarch64_get_expression (exp, &p, GE_OPT_PREFIX, REJECT_ABSENT)) { set_syntax_error (_("invalid expression in the address")); return false; @@ -3851,8 +3831,7 @@ parse_address_main (char **str, aarch64_ operand->addr.offset.regno = reg->number; operand->addr.offset.is_reg = 1; } - else if (! aarch64_get_expression (exp, &p, GE_OPT_PREFIX, REJECT_ABSENT, - NORMAL_RESOLUTION)) + else if (! aarch64_get_expression (exp, &p, GE_OPT_PREFIX, REJECT_ABSENT)) { /* [Xn],#expr */ set_syntax_error (_("invalid expression in the address")); @@ -3980,8 +3959,7 @@ parse_half (char **str, int *internal_fi else *internal_fixup_p = 1; - if (! aarch64_get_expression (&inst.reloc.exp, &p, GE_NO_PREFIX, REJECT_ABSENT, - aarch64_force_reloc (inst.reloc.type) == 1)) + if (! aarch64_get_expression (&inst.reloc.exp, &p, GE_NO_PREFIX, REJECT_ABSENT)) return false; *str = p; @@ -4023,8 +4001,7 @@ parse_adrp (char **str) inst.reloc.type = BFD_RELOC_AARCH64_ADR_HI21_PCREL; inst.reloc.pc_rel = 1; - if (! aarch64_get_expression (&inst.reloc.exp, &p, GE_NO_PREFIX, REJECT_ABSENT, - aarch64_force_reloc (inst.reloc.type) == 1)) + if (! aarch64_get_expression (&inst.reloc.exp, &p, GE_NO_PREFIX, REJECT_ABSENT)) return false; *str = p; return true; @@ -6696,8 +6673,7 @@ parse_operands (char *str, const aarch64 goto failure; str = saved; po_misc_or_fail (aarch64_get_expression (&inst.reloc.exp, &str, - GE_OPT_PREFIX, REJECT_ABSENT, - NORMAL_RESOLUTION)); + GE_OPT_PREFIX, REJECT_ABSENT)); /* The MOV immediate alias will be fixed up by fix_mov_imm_insn later. fix_mov_imm_insn will try to determine a machine instruction (MOVZ, MOVN or ORR) for it and will issue an error @@ -8824,7 +8800,8 @@ md_apply_fix (fixS * fixP, valueT * valP /* Note whether this will delete the relocation. */ - if (fixP->fx_addsy == 0 && !fixP->fx_pcrel) + if (fixP->fx_addsy == 0 && !fixP->fx_pcrel + && aarch64_force_reloc (fixP->fx_r_type) <= 0) fixP->fx_done = 1; /* Process the relocations. */ --- a/gas/testsuite/gas/aarch64/pr27217.d +++ b/gas/testsuite/gas/aarch64/pr27217.d @@ -7,9 +7,9 @@ Disassembly of section \.text: 0+000 <.*>: -[ ]+0:[ ]+90000000[ ]+adrp[ ]+x0, 12345678[ ]+ -[ ]+0:[ ]+R_AARCH64(|_P32)_ADR_PREL_PG_HI21[ ]+bar +[ ]+0:[ ]+90000000[ ]+adrp[ ]+x0, [0-9]*[ ]+<.*> +[ ]+0:[ ]+R_AARCH64(|_P32)_ADR_PREL_PG_HI21[ ]+\*ABS\*\+0x12345678 [ ]+4:[ ]+91000000[ ]+add[ ]+x0, x0, #0x0 -[ ]+4:[ ]+R_AARCH64(|_P32)_ADD_ABS_LO12_NC[ ]+bar +[ ]+4:[ ]+R_AARCH64(|_P32)_ADD_ABS_LO12_NC[ ]+\*ABS\*\+0x12345678 [ ]+8:[ ]+d65f03c0[ ]+ret #pass