From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B4D5F3858D38; Thu, 18 Apr 2024 15:00:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B4D5F3858D38 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1713452437; bh=5HF5HZBbW9O2eJtoWXUw7LKkvFsXps3VDLr2eHf2yg4=; h=From:To:Subject:Date:From; b=j8sdOWmogH4aDuHagvncwvJiyhklFHBgjZeL38bpL267Hm7btMFc2a6BgwMGdBFJe 15y9s1Qr/qhPeCeHFpbSrfhk+101e8gx5v+P0lLqgQxV8BV07wPW8pLqmkWBBBY+/j ylBatsxIqEIDpb2WiOTbaMF/6xM3AQzSMrW+zi4Y= From: "hjl.tools at gmail dot com" To: glibc-bugs@sourceware.org Subject: [Bug libc/31655] New: clang can't build glibc with stack protector Date: Thu, 18 Apr 2024 15:00:36 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: libc X-Bugzilla-Version: 2.40 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: hjl.tools at gmail dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cc target_milestone cf_gcctarget Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D31655 Bug ID: 31655 Summary: clang can't build glibc with stack protector Product: glibc Version: 2.40 Status: NEW Severity: normal Priority: P2 Component: libc Assignee: unassigned at sourceware dot org Reporter: hjl.tools at gmail dot com CC: adhemerval.zanella at linaro dot org, drepper.fsp at gm= ail dot com, skpgkp2 at gmail dot com Target Milestone: --- Target: x86 On x86, glibc built with stack protector using clang crashed very early: (gdb) bt #0 0x00000000005b3327 in bsearch (__key=3D__key@entry=3D0x7fffffffe540, __base=3D0x6bde70 , __nmemb=3D__nmemb@entry=3D68, __size=3D__size@entry=3D8, __compar=3D__compar@entry=3D0x5b2400 ) at ../bits/stdlib-bsearch.h:22 #1 0x00000000005b220a in intel_check_word (name=3Dname@entry=3D188, value= =3D16711424, has_level_2=3Dhas_level_2@entry=3D0x7fffffffe587, no_level_2_or_3=3Dno_level_2_or_3@entry=3D0x7fffffffe586, cpu_features=3D) at ../sysdeps/x86/dl-cacheinfo.h:217 #2 0x00000000005b1904 in handle_intel (name=3Dname@entry=3D188, cpu_feature= s=3D) at ../sysdeps/x86/dl-cacheinfo.h:279 #3 0x00000000005b0606 in dl_init_cacheinfo (cpu_features=3D) at ../sysdeps/x86/dl-cacheinfo.h:811 #4 init_cpu_features (cpu_features=3D) at ../sysdeps/x86/cpu-features.c:1030 #5 __libc_start_main_impl (main=3D0x4599c0 , argc=3D13, argv=3D0x7fffffffe718, init=3D, fini=3D, rtld_fini=3D0x0, stack_end=3D0x7fffffffe708) at ../csu/libc-start.c:269 #6 0x0000000000401201 in _start () at ../sysdeps/x86_64/start.S:115 (gdb) since the stack-protector canary in TCB hasn't been set up yet. bits/stdlib-bsearch.h has an __extern_inline bsearch which is protected by #ifdef __USE_EXTERN_INLINES # include #endif But __USE_EXTERN_INLINES isn't defined for clang when building glibc on azanella/clang branch: /* Decide whether we can define 'extern inline' functions in headers. */ #if __GNUC_PREREQ (2, 7) && defined __OPTIMIZE__ \ && !defined __OPTIMIZE_SIZE__ && !defined __NO_INLINE__ \ && defined __extern_inline && !(defined __clang__ && defined _LIBC) # define __USE_EXTERN_INLINES 1 #endif As the result, clang can't build glibc with stack protector on x86. --=20 You are receiving this mail because: You are on the CC list for the bug.=