From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi1-x22e.google.com (mail-oi1-x22e.google.com [IPv6:2607:f8b0:4864:20::22e]) by sourceware.org (Postfix) with ESMTPS id 671CB3858D37 for ; Wed, 24 May 2023 05:08:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 671CB3858D37 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: by mail-oi1-x22e.google.com with SMTP id 5614622812f47-397f6a71ee7so453994b6e.3 for ; Tue, 23 May 2023 22:08:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1684904916; x=1687496916; h=mime-version:user-agent:message-id:date:errors-to:organization :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=QCNJdEVnaN84MgKt1boXE6XwrqgxgVZ6nYGg6Zza9bA=; b=feKrm3oeBmI3cIHBnnLYsMq/n5H+3DPc5bsNgJ13TkDJ/oY14dxFcRSD3IheqRp5W5 HnlmUDz0SAIFEgszOch66H0sLfgTiQzRnnyPn2UyOSVSK21oz83IytkdngYg4Zve5XSW IB1AEFTCiI0OgaxKDYiJWdlqfTnYm4HiZ0Nt6jvIeAWw0vtZfJmwI1Wk8+vz2JIDac9G 9Z50Wq+1r98OFABsHaB5r5Bk7zFL+bAM0YvjrVLnkkXaz1Mep0NLwXbE0uICExoDMRN9 dcVagjsmJ8KmYTKDom4c28TkzgHeAZpzehbu8WS3cV9rxgPHoWgc8VIC0+5MIk3t1bGX Bb9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684904916; x=1687496916; h=mime-version:user-agent:message-id:date:errors-to:organization :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=QCNJdEVnaN84MgKt1boXE6XwrqgxgVZ6nYGg6Zza9bA=; b=OaXvu8/ZYg2KIc1ZeYQtB/fYd/BJRr4xAIqC8O3N7llS1Qa4GpnnpqwwOa3l3YMx5t UzXOBzfvh53Dw+4a0HW5YeVxw1s7lN84LfwR4coGnaVB9P80OOKjMhsQZ/SuXK5LNLt/ vOdIQuDA3bDv64R9SjqLGXGpq9zJJgDnHSyACRlrW5Do3M/2xEf+6dK2GS31RPW6xQCZ BsGpPKL8y3HD6cDa+g1+BF67HV1FUWWs5OldKxO4WD+FXASmxN6PWdhxmGNvGPX4PYxk 7Jtyqu6jDQSMv7rAA5GShoilOMgpQcWNsCAzTz96BnRDhLFcP86+4SVptwaJp4j7hlaa n5KQ== X-Gm-Message-State: AC+VfDzo+Xb2TSJ1a0MfpKK15s4lGNqyea2pJWm1NnAwFybXFdrWJi8b ajHPjcabxXa0dj5I7HppMrAJ2DMaCLPVG7eHyoc= X-Google-Smtp-Source: ACHHUZ77LXk3lZ7PZbUOhEBNeipzToikf8Ko3DGqaMNOBPRy+/c3TH9E9+6qo4E5hvgoxWR2K2nsLg== X-Received: by 2002:a05:6808:94:b0:398:45a4:9c8c with SMTP id s20-20020a056808009400b0039845a49c8cmr835050oic.21.1684904916441; Tue, 23 May 2023 22:08:36 -0700 (PDT) Received: from free.home ([2804:7f1:2080:6383:46d9:ede8:ee97:8cc0]) by smtp.gmail.com with ESMTPSA id r10-20020a4a370a000000b0055516447257sm3656616oor.29.2023.05.23.22.08.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 May 2023 22:08:36 -0700 (PDT) Received: from livre (livre.home [172.31.160.2]) by free.home (8.15.2/8.15.2) with ESMTPS id 34O58R1F3579322 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 24 May 2023 02:08:27 -0300 From: Alexandre Oliva To: gcc-patches@gcc.gnu.org Cc: hainque@adacore.com Subject: [PATCH] Check for sysconf decl on vxworks Organization: Free thinker, does not speak for AdaCore Errors-To: aoliva@lxoliva.fsfla.org Date: Wed, 24 May 2023 02:08:27 -0300 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.84 X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,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 List-Id: The sysconf function is only available in rtp mode on vxworks. In kernel mode, it is not even declared, but the feature test macro in the testsuite doesn't notice its absence because it's a link test, and vxworks kernel mode uses partial linking. This patch introduces an alternate test on vxworks targets to check for a declaration and for an often-used sysconf parameter. Bootstrapped on x86_64-linux-gnu. Also tested on ppc- and x86-vx7r2 with gcc-12. for gcc/testsuite/ChangeLog * lib/target-supports.exp (check_effective_target_sysconf): Check for declaration and _SC_PAGESIZE on vxworks. --- gcc/testsuite/lib/target-supports.exp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index bd9f432e4a761..263ef35a2e4df 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -1146,6 +1146,17 @@ proc check_effective_target_mmap {} { # Return 1 if the target supports sysconf, 0 otherwise. proc check_effective_target_sysconf {} { + # VxWorks has sysconf in rtp mode only, but our way to test can't + # tell kernel mode doesn't, as we're doing partial links for + # kernel modules. We can tell by checking for a declaration, or + # for some sysconf parm, because configurations that don't offer + # sysconf don't have either. + if { [istarget *-*-vxworks*] } { + return [check_no_compiler_messages sysconfdecl assembly { + #include + int f() { return sysconf(_SC_PAGESIZE); } + }]; + } return [check_function_available "sysconf"] } -- Alexandre Oliva, happy hacker https://FSFLA.org/blogs/lxo/ Free Software Activist GNU Toolchain Engineer Disinformation flourishes because many people care deeply about injustice but very few check the facts. Ask me about