From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS22989 209.51.188.0/24 X-Spam-Status: No, score=-4.6 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id BA4711F45E for ; Thu, 20 Feb 2020 20:15:22 +0000 (UTC) Received: from localhost ([::1]:48820 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j4sED-00084b-Or for normalperson@yhbt.net; Thu, 20 Feb 2020 15:15:21 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40400) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j4sE9-00082N-FK for bug-gnulib@gnu.org; Thu, 20 Feb 2020 15:15:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j4sE8-00080j-BB for bug-gnulib@gnu.org; Thu, 20 Feb 2020 15:15:17 -0500 Received: from smtp.polymtl.ca ([132.207.4.11]:40902) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j4sE7-0007s3-Vf for bug-gnulib@gnu.org; Thu, 20 Feb 2020 15:15:16 -0500 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 01KKF5PJ016427 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 20 Feb 2020 15:15:09 -0500 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 01KKF5PJ016427 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=polymtl.ca; s=default; t=1582229710; bh=YUyF9PEvDimTR8FJbe/zKYdfT2IY6cYlb9Qmqp58MVo=; h=To:From:Subject:Date:From; b=hUAI3+yUWzZmGtL/ZiEsEcHi4t4C4WZ2ckTLMJ954eyX9LatSqzLzNeRtTrKBGR2c 1OPbT1Kvbygk4sGbgUzkCV+E+xCwFjrq0isS3koAYTIqft9nboM3VZdgVtsWzTDfJr Yc7SpkVdsU2m6eSrkWunAEAHsosMQgJ/yZdowdUI= Received: from [172.16.0.95] (192-222-181-218.qc.cable.ebox.net [192.222.181.218]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id B61951E5FA for ; Thu, 20 Feb 2020 15:15:04 -0500 (EST) To: bug-gnulib@gnu.org From: Simon Marchi Subject: Missing extern "C" in count-one-bits.h? Message-ID: Date: Thu, 20 Feb 2020 15:15:03 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Language: tl Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Thu, 20 Feb 2020 20:15:05 +0000 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 132.207.4.11 X-BeenThere: bug-gnulib@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Gnulib discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Sender: "bug-gnulib" Hi, I recently imported the count-one-bits module in GDB. I just noticed this while trying to build gdb with clang++-9: arch/arm-get-next-pcs.o:arm-get-next-pcs.c:function thumb_get_next_pcs_raw(arm_get_next_pcs*): error: undefined reference to 'count_one_bits(unsigned int)' Everything works fine when building with gcc-9. This is in the gcc build: $ readelf --syms gnulib/import/count-one-bits.o | grep count_one_bits 164: 0000000000000000 24 FUNC GLOBAL DEFAULT 50 count_one_bits $ readelf --syms gdb/arch/arm-get-next-pcs.o | grep count_one_bits 770: 0000000000000000 24 FUNC WEAK DEFAULT 281 _Z14count_one_bitsj This is in the clang build: $ readelf --syms gnulib/import/count-one-bits.o | grep count_one_bits 6: 0000000000000000 64 FUNC GLOBAL DEFAULT 2 count_one_bits $ readelf --syms gdb/arch/arm-get-next-pcs.o | grep count_one_bits 109: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND _Z14count_one_bitsj The disagreement between the symbol names between count-one-bits.o and arm-get-next-pcs.o seems to show that there is a missing `extern "C"` in the count-one-bits.h header? And apparently, gcc decided to compile the definition in the header and include it in arm-get-next-pcs.o, while clang did not. Is that the compiler's choice, or is it because the macros and preprocessor conditionals in count-one-bits.h evaluated to something different for the two compilers? Simon