NetBSD Problem Report #58298

From www@netbsd.org  Wed May 29 00:23:29 2024
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id B01691A923A
	for <gnats-bugs@gnats.NetBSD.org>; Wed, 29 May 2024 00:23:29 +0000 (UTC)
Message-Id: <20240529002328.46CCA1A923C@mollari.NetBSD.org>
Date: Wed, 29 May 2024 00:23:28 +0000 (UTC)
From: campbell+netbsd@mumble.net
Reply-To: campbell+netbsd@mumble.net
To: gnats-bugs@NetBSD.org
Subject: hyperv.c triggers warning: ignoring changed section attributes for .text
X-Send-Pr-Version: www-1.0

>Number:         58298
>Category:       port-amd64
>Synopsis:       hyperv.c triggers warning: ignoring changed section attributes for .text
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-amd64-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed May 29 00:25:00 +0000 2024
>Originator:     Taylor R Campbell
>Release:        current, 10, 9, ...
>Organization:
.section .the,"netbsd",@foundation
>Environment:
>Description:
When compiling sys/arch/x86/x86/hyperv.c, the assembler complains:

/tmp//ccK3SGfU.s: Assembler messages:
/tmp//ccK3SGfU.s:5117: Warning: ignoring changed section attributes for .text

The relevant definition is:

        .section        .text,"aw" // line 5117
        .align 4096
        .type   hyperv_hypercall_page, @object
        .size   hyperv_hypercall_page, 4096
hyperv_hypercall_page:
        .string "\314"
        .zero   4094

This comes from:

static char hyperv_hypercall_page[PAGE_SIZE]
    __section(".text") __aligned(PAGE_SIZE) = { 0xcc };
>How-To-Repeat:
compile amd64/GENERIC
>Fix:
Yes, please!

This warning is confusing -- in parallel builds, attribution is not obvious -- and while the underlying symptom appears to be harmless for now, it seems dicey.

Can we convince gcc to emit the object with `.text' instead of `.section .text,"aw"' or something?  Or maybe call it .text.hypercall and use a linker script to make sure it's in the same segment as .text?

I tried putting const on hyperv_hypercall_page (and propagating it to the users), but this just changed it to `.section .text,"a"' with the same warning.

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2024 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.