Bug 100985 - [9 Regression] Aarch64 acle.h "extern "C" {" mismatch "}" in 9.4.0
Summary: [9 Regression] Aarch64 acle.h "extern "C" {" mismatch "}" in 9.4.0
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 9.4.0
: P3 normal
Target Milestone: 9.5
Assignee: Not yet assigned to anyone
URL:
Keywords: rejects-valid
: 103846 106382 (view as bug list)
Depends on:
Blocks:
 
Reported: 2021-06-09 06:55 UTC by Kevin Zhao
Modified: 2022-07-21 11:07 UTC (History)
4 users (show)

See Also:
Host:
Target: aarch64-*-*
Build:
Known to work: 9.3.0
Known to fail: 9.4.0
Last reconfirmed: 2021-12-27 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kevin Zhao 2021-06-09 06:55:00 UTC
Build rocksdb with GCC 9.4.0:
# git clone https://github.com/facebook/rocksdb.git
# cd rocksdb
# make static_lib

Log as below:
====================================================
$DEBUG_LEVEL is 0
  CC       util/crc32c.o
util/crc32c.cc:371:1: error: template with C linkage
  371 | template<void (*CRC32)(uint64_t*, uint8_t const**)>
      | ^~~~~~~~
In file included from ./util/crc32c_arm64.h:16,
                 from util/crc32c.cc:21:
/usr/lib/gcc/aarch64-linux-gnu/9/include/arm_acle.h:33:1: note: ‘extern "C"’ linkage started here
   33 | extern "C" {
      | ^~~~~~~~~~
util/crc32c.cc:503:13: error: conflicting declaration of ‘std::string rocksdb::crc32c::IsFastCrc32Supported()’ with ‘C’ linkage
  503 | std::string IsFastCrc32Supported() {
      |             ^~~~~~~~~~~~~~~~~~~~
In file included from util/crc32c.cc:12:
./util/crc32c.h:20:20: note: previous declaration with ‘C++’ linkage
   20 | extern std::string IsFastCrc32Supported();
      |                    ^~~~~~~~~~~~~~~~~~~~
util/crc32c.cc:1277:10: error: conflicting declaration of ‘uint32_t rocksdb::crc32c::Extend(uint32_t, const char*, size_t)’ with ‘C’ linkage
 1277 | uint32_t Extend(uint32_t crc, const char* buf, size_t size) {
      |          ^~~~~~
In file included from util/crc32c.cc:12:
./util/crc32c.h:25:17: note: previous declaration with ‘C++’ linkage
   25 | extern uint32_t Extend(uint32_t init_crc, const char* data, size_t n);
      |                 ^~~~~~
util/crc32c.cc:1283:1: error: expected ‘}’ at end of input
 1283 | }  // namespace ROCKSDB_NAMESPACE
      | ^
In file included from ./util/crc32c_arm64.h:16,
                 from util/crc32c.cc:21:
/usr/lib/gcc/aarch64-linux-gnu/9/include/arm_acle.h:33:12: note: to match this ‘{’
   33 | extern "C" {
      |            ^
Makefile:2272: recipe for target 'util/crc32c.o' failed
make: *** [util/crc32c.o] Error 1
===========================================================

The latest patch of GCC 9.4.0 release: https://github.com/gcc-mirror/gcc/commit/6f06be1769d45359940c60517f9d55bedd3cb1f4#diff-64cabf812b3706ffd3c5ab7c6048c3617a406f029631d0427d3cfb896fd8dbf3R32 introduce a lonely induce that build issue:
#ifdef __cplusplus
extern "C" {
#endif
Comment 1 Alex Coplan 2021-06-09 08:36:46 UTC
Confirmed by inspection of the source on the head of the 9 branch.
Comment 2 Jonathan Wakely 2021-12-27 16:17:32 UTC
*** Bug 103846 has been marked as a duplicate of this bug. ***
Comment 3 GCC Commits 2021-12-27 16:21:55 UTC
The releases/gcc-9 branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:

https://gcc.gnu.org/g:8c92fcb13a4979232787f0476bf7469ccbb03617

commit r9-9888-g8c92fcb13a4979232787f0476bf7469ccbb03617
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Mon Dec 27 16:20:24 2021 +0000

    aarch64: Fix mismatched extern "C" block [PR100985]
    
    gcc/ChangeLog:
    
            PR target/100985
            * config/aarch64/arm_acle.h: Remove unclosed extern "C" block.
Comment 4 Jonathan Wakely 2021-12-27 16:28:03 UTC
This should be fixed for gcc-9.5.0
Comment 5 Jonathan Wakely 2022-07-21 11:07:28 UTC
*** Bug 106382 has been marked as a duplicate of this bug. ***