From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) by sourceware.org (Postfix) with ESMTPS id 3B06A3858291 for ; Mon, 13 Feb 2023 02:04:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3B06A3858291 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-ej1-x630.google.com with SMTP id jg8so28421679ejc.6 for ; Sun, 12 Feb 2023 18:04:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=ISGAjElv1SK95MpikqjqDIEnF9NnJqZrJO+XDP3l7Ug=; b=QqgbDsS0dXDzALZ/cY7uj/05qqciiIkQux83NYlF5UMNzB94F2TJl1HQocTTsZ+UTS QJT4i/dT8MJ4hZnDXcnG4KVeLddBnTCWhirje/GHFwU0fQbOx0hBatvwRZqTjglV0oyc TjWIE8QwQeaInv1PmjqysPuBPnLaNiLO8hUv4WCe9fAlSv3Kbxap8lSmD0LqQHW0lsJc H7iEDKN8Poe5NZuzfgxcgFNjIQuPXZB+LL6bA20wKH8hjqHdQJ+SQlEX2yg9q/A0Jr+w MPwZWWlob0lEZYvuWEtgRBVwjd5TO7fXp2D3kdfqvzIJrKcw1vZqP9zHdKRrYInRHYnP CWXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=ISGAjElv1SK95MpikqjqDIEnF9NnJqZrJO+XDP3l7Ug=; b=iGQMIzbbPajv1NTfFYPqEhNQPcc0dOvMWFAmaHlvsUfV6lXkgYITY3wSX/fIkcUj8E mYdGEDzqx1mX4nbr0Y6Xrp62zFbe9dTr4llX+Wq2Wp9oDL6MiEZiInND6maVu2FsRYl3 HRM49+kwyrmPs+pYG7aahsqI7bZ4AwYTWnOeWatFWE+kkGvuhazanpFf8AyLAk4LWhkr ONE8G0NN8aesDd8icCWythyUWGAZ7re2oYU0/ouSWA4LqCFiTCY+SIQPbIy+8NJsPLP4 jyUPsrnr3GswZUdi8pGZqYEK1hapYfmZDJcmm3Rcv8GIUuI6qPMncnC2aRC9pZtSLJY5 Jcsw== X-Gm-Message-State: AO0yUKVV/vx5oboQoDmRQK88JaPz7e+eO0SmqyaB2ScJYsYZMrplMs/J T1v50QPq1esPhI0fUOu6/L/10U/87uWvCVn+guY/cv+oFrm8+sRY1Nk= X-Google-Smtp-Source: AK7set+PSBBMIG1Kj9s3CfDkxKqvTi4VFMjAy+c1hrZyubWzzpJ1cg4BIEHJOxlBAWt74BKahTU2c6pdH5XSuE71Yt8= X-Received: by 2002:a17:906:fb87:b0:8a5:c8bd:4ac4 with SMTP id lr7-20020a170906fb8700b008a5c8bd4ac4mr3801919ejb.15.1676253840500; Sun, 12 Feb 2023 18:04:00 -0800 (PST) MIME-Version: 1.0 From: Zach 1 Date: Sun, 12 Feb 2023 18:03:49 -0800 Message-ID: Subject: Using the kernel thread pointer on aarch64 (tpidr_el1) To: gcc-help@gcc.gnu.org Content-Type: multipart/alternative; boundary="000000000000b76b0c05f48b426e" X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE,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: --000000000000b76b0c05f48b426e Content-Type: text/plain; charset="UTF-8" Hi, On AArch64, GCC seems to use tpidr_el0 (user-mode accessible) to access the thread pointer for loading thread-local variables by default. I can't find any option to change this to tpidr_el1 (or tpidr_el2/tpidr_el3). This is necessary for using thread-local variables in kernel code. Clang has the `-mtp` option for AArch64 ( https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-mtp) that controls this, but it seems GCC does not? Does any such option exist, and if not is there any chance to add support for it? Thanks for any help. Zach --000000000000b76b0c05f48b426e--