From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dedi548.your-server.de (dedi548.your-server.de [85.10.215.148]) by sourceware.org (Postfix) with ESMTPS id AAFE13858D3C for ; Tue, 12 Sep 2023 12:58:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AAFE13858D3C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embedded-brains.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embedded-brains.de Received: from sslproxy05.your-server.de ([78.46.172.2]) by dedi548.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qg2yI-000Kxb-O0; Tue, 12 Sep 2023 14:58:26 +0200 Received: from [82.100.198.138] (helo=mail.embedded-brains.de) by sslproxy05.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qg2yI-000IYd-Jk; Tue, 12 Sep 2023 14:58:26 +0200 Received: from localhost (localhost [127.0.0.1]) by mail.embedded-brains.de (Postfix) with ESMTP id 4116748015D; Tue, 12 Sep 2023 14:58:26 +0200 (CEST) Received: from mail.embedded-brains.de ([127.0.0.1]) by localhost (zimbra.eb.localhost [127.0.0.1]) (amavis, port 10032) with ESMTP id Bn4UqmaGRUdb; Tue, 12 Sep 2023 14:58:26 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mail.embedded-brains.de (Postfix) with ESMTP id 00D06480224; Tue, 12 Sep 2023 14:58:26 +0200 (CEST) X-Virus-Scanned: amavis at zimbra.eb.localhost Received: from mail.embedded-brains.de ([127.0.0.1]) by localhost (zimbra.eb.localhost [127.0.0.1]) (amavis, port 10026) with ESMTP id D9-YLxE2Jj7v; Tue, 12 Sep 2023 14:58:25 +0200 (CEST) Received: from [10.10.171.34] (unknown [10.10.171.34]) by mail.embedded-brains.de (Postfix) with ESMTPSA id C24F148015D; Tue, 12 Sep 2023 14:58:25 +0200 (CEST) Message-ID: <57bfc9fd-e7b2-40b0-aeac-0447d6d0245e@embedded-brains.de> Date: Tue, 12 Sep 2023 14:58:25 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: How to define a symbol with absolute address for AArch64? Content-Language: en-US To: Richard Earnshaw , binutils References: <2d247374-92a2-463b-ba23-8a6dc36d13c0@embedded-brains.de> <580f9122-f63d-628e-4503-dfcefbb1b304@foss.arm.com> From: Sebastian Huber In-Reply-To: <580f9122-f63d-628e-4503-dfcefbb1b304@foss.arm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Authenticated-Sender: smtp-embedded@poldi-networks.de X-Virus-Scanned: Clear (ClamAV 0.103.8/27029/Tue Sep 12 09:38:51 2023) X-Spam-Status: No, score=-5.2 required=5.0 tests=BAYES_00,KAM_DMARC_STATUS,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: On 12.09.23 13:21, Richard Earnshaw wrote: >=20 >=20 > On 12/09/2023 11:02, Sebastian Huber wrote: >> Hello, >> >> I would like to define a global symbol with an absolute address in an=20 >> assembly/C source file for the AArch64 target. This works for all=20 >> other architectures I tried so far, but not for AArch64: >> >> extern char abs_symbol[]; >> extern char abs_symbol_2[]; >> >> __asm__( >> =C2=A0=C2=A0 "\t.globl abs_symbol\n" >> =C2=A0=C2=A0 "\t.set abs_symbol, 0x123\n" >> ); >> >> unsigned long f_abs_symbol(void) >> { >> =C2=A0=C2=A0 return (unsigned long)abs_symbol; >> } >> >> unsigned long f_abs_symbol_2(void) >> { >> =C2=A0=C2=A0 return (unsigned long)abs_symbol_2; >> } >> >> unsigned long _start(void) >> { >> =C2=A0=C2=A0 return f_abs_symbol() + f_abs_symbol_2(); >> } >> >> aarch64-rtems6-gcc abs.c -Wl,--gc-sections -Wl,--defsym=3Dabs_symbol_2= =3D291 >=20 > Have you tried -mcmodel=3Dlarge?=C2=A0 With that I get: I get the same result with -mcmodel=3Dlarge. With -mcmodel=3Dtiny I get: aarch64-rtems6-gcc abs.c -Wl,--gc-sections -Wl,--defsym=3Dabs_symbol_2=3D= 291=20 -mcmodel=3Dtiny /tmp/ccKUnvyq.o: in function `f_abs_symbol_2': abs.c:(.text+0x8): relocation truncated to fit: R_AARCH64_ADR_PREL_LO21=20 against symbol `abs_symbol_2' defined in *ABS* section in a.out collect2: error: ld returned 1 exit status Is this a tool bug? Is there some way to make this working with -mcmodel=3Dsmall? --=20 embedded brains GmbH Herr Sebastian HUBER Dornierstr. 4 82178 Puchheim Germany email: sebastian.huber@embedded-brains.de phone: +49-89-18 94 741 - 16 fax: +49-89-18 94 741 - 08 Registergericht: Amtsgericht M=C3=BCnchen Registernummer: HRB 157899 Vertretungsberechtigte Gesch=C3=A4ftsf=C3=BChrer: Peter Rasmussen, Thomas= D=C3=B6rfler Unsere Datenschutzerkl=C3=A4rung finden Sie hier: https://embedded-brains.de/datenschutzerklaerung/