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:    nonaka
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed May 29 00:25:00 +0000 2024
>Closed-Date:    Wed May 07 04:16:41 +0000 2025
>Last-Modified:  Wed May 07 04:16:41 +0000 2025
>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.

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: port-amd64-maintainer->nonaka
Responsible-Changed-By: riastradh@NetBSD.org
Responsible-Changed-When: Fri, 11 Apr 2025 21:55:20 +0000
Responsible-Changed-Why:
Could I trouble you to take a look at this?  It looks like you put in
this code.


From: "NONAKA Kimihiro" <nonaka@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/58298 CVS commit: src/sys/arch/x86/x86
Date: Sat, 12 Apr 2025 19:31:44 +0000

 Module Name:	src
 Committed By:	nonaka
 Date:		Sat Apr 12 19:31:44 UTC 2025

 Modified Files:
 	src/sys/arch/x86/x86: hyperv.c

 Log Message:
 PR/58298: Convert hyperv_hypercall_page to naked function.


 To generate a diff of this commit:
 cvs rdiff -u -r1.16 -r1.17 src/sys/arch/x86/x86/hyperv.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Wed, 07 May 2025 04:16:41 +0000
State-Changed-Why:
Awesome, thanks!  If this is low-risk maybe we should pull it up to
9 and 10, but it's not important enough for me to investigate that.


>Unformatted:

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-2025 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.