From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) by sourceware.org (Postfix) with ESMTPS id CC8663858D37 for ; Tue, 21 Mar 2023 11:05:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CC8663858D37 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f50.google.com with SMTP id u11-20020a05600c19cb00b003edcc414997so4331636wmq.3 for ; Tue, 21 Mar 2023 04:05:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679396709; h=content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:references:cc:to:subject :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=/GdF1WsNT3TvCu7KwaWc78T/93hC6dYGacQzysCXN7U=; b=oW8qSto/IF0HT+6BIIKCktMB2+Ur4DUyYYID+XMJsRQ/CH8Y0dTdlN1bzxzXKFTOUp I5ZlQ6Cd6WLK+qFG6kpI+RF2aSgujP6PSVaJbP+hNcS6i7WDnCzeGPwVHDwcl9KOCBkc tfI5DAPtPVpxgU/fmpbsVR4ZNeDzL83grcCQAE7kjTis+c7puhLQY86dxsNDjhdJCrB+ BzmseX+bFzthsE7KMHZ4l0N2r+ZnuD717/4SY6t89NRnXvTw3ZwP34MQC3ppBfTO+0Uf m44ce7sHPGa2JyX/sBr6Ee/V35mCV1JqmVqx571VPabGfoSuUa3ClvMvB/vTJe5++sIA uZhQ== X-Gm-Message-State: AO0yUKWYFGjcT69TQLuSRwX0qoOZuNcR43+Pc6XDkZ86K8LiE5l8DRml TsqsCCN5oVE9csI155isd9M= X-Google-Smtp-Source: AK7set/YogmXAOvSgkcn1GR5qEjj8/evl0q6GmG8VYfZr9IA9EnVOikeyjzQXzn9BozAVT33hphtEA== X-Received: by 2002:a05:600c:2293:b0:3ed:a80e:6dfa with SMTP id 19-20020a05600c229300b003eda80e6dfamr1762928wmf.40.1679396709168; Tue, 21 Mar 2023 04:05:09 -0700 (PDT) Received: from ?IPv6:2001:8a0:f93c:5900::1fe? ([2001:8a0:f93c:5900::1fe]) by smtp.gmail.com with ESMTPSA id h20-20020a1ccc14000000b003dc522dd25esm13140789wmb.30.2023.03.21.04.05.08 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 21 Mar 2023 04:05:08 -0700 (PDT) Subject: Re: [PATCH] Modify align-c/align-c++ test case for AIX To: Ulrich Weigand , Aditya Kamath1 , "tom@tromey.com" Cc: "gdb-patches@sourceware.org" , Sangamesh Mallayya , "simon.marchi@efficios.com" References: <87edpwmzpz.fsf@tromey.com> <3636157c35660e96f2da98eb70cbac597d0a092c.camel@de.ibm.com> <87r0tqchea.fsf@tromey.com> <87zg8bave2.fsf@tromey.com> <61289f79c8c08ebe15112711954e1b05d49c92be.camel@de.ibm.com> From: Pedro Alves Message-ID: Date: Tue, 21 Mar 2023 11:05:14 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <61289f79c8c08ebe15112711954e1b05d49c92be.camel@de.ibm.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,KAM_DMARC_STATUS,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=no 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 2023-03-21 7:41 a.m., Ulrich Weigand via Gdb-patches wrote: > Aditya Kamath1 wrote: > >> So clearly, linker optimises out unused global variables. More about the >> same can be read in the documentation >> {https://www.ibm.com/docs/en/aix/7.1?topic=l-ld-command } > > I see the -Wl,-bnogc option there, this makes sense. > > I'm not sure why "-lodm -lcfg" should be necessary as well, this > doesn't really appear related to me. Can you try without those? > > >> So I was thinking if we can pass these to our site.exp file if the target is AIX: >> >> set CC_FOR_TARGET "/opt/freeware/bin/gcc" >> set CXX_FOR_TARGET "/opt/freeware/bin/g++" >> set CXXFLAGS_FOR_TARGET "-O0 -w -g -gdwarf -maix64" >> set CFLAGS_FOR_TARGET "-O0 -w -g -gdwarf -maix64" >> >> with the options -Wl,-bnogc -lodm -lcfg. >> >> We also use -maix32 for testing in 32 bit mode as well. >> >> I think this would be a better patch and in AIX we will not be seeing >> so many failures as we see now instead of the initial proposed ifdef patch. >> Only thing is we need to add this in a file which I am not aware of such >> that if the target is AIX we need to add these flags in the site.exp >> file so that while running test cases we get this file to pass these flags >> during the compilation of them. > > If the -bnogc flag is always necessary with the AIX linker, this > should be handled automatically by the test instead of via site.exp. > > I'm assuming this is only needed with test files that use global > variables unused in the source code, but used by the debugger. > I think it would be best to explicitly add the flag to those tests > where it is needed. I'm wondering whether __attribute__((used)) on the global variable makes any difference. IIRC with LLVM it prevents link-time stripping on Mach-O and PE/COFF, but I don't know about XCOFF + GCC. (It doesn't on ELF, you need 'retain' for that.) Pedro Alves > > For example, for the align-c tests, you can change the beginning > of run_alignment_test in gdb.base/align.exp.tcl to something like: > > set flags {debug} > if { "$lang" == "c++" } { > lappend flags "additional_flags=-std=c++11" > } > if { [istarget *-*-aix*] } { > # Disable linker garbage collection to avoid optimizing > # out global variables unused in the test source code. > lappend flags "ldflags=-Wl,-bnogc" > } > standard_testfile $filename > if {[prepare_for_testing "failed to prepare" "$testfile" $srcfile $flags]} { > return -1 > } > > Bye, > Ulrich >