From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A56653858C60; Sun, 28 Jan 2024 00:45:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A56653858C60 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1706402737; bh=dmpeMkhclpMODANky6ywgA21FB9nSMx+xivhRt0/mMI=; h=From:To:Subject:Date:From; b=H+5uKMmD7xb+Ti1mYNwn/So2mrFUYVhmolFN92Pvnsp7knpZNrznHPpbHKBqZVQYW fzmyH+Qwi4npjafh3Z89/1tywWGiOeAcVWeW1FjFtQY0fbttMLU2qbFsY9k9mbERNW /8vb3mO8PO6yhW6qFljslRG+c+Bn6p/bDPOimSnk= From: "luofengwc at qq dot com" To: glibc-bugs@sourceware.org Subject: [Bug libc/31302] New: glibc issue about reloc-type R_X86_64_TPOFF64 when llvm build golang project with cgo, Date: Sun, 28 Jan 2024 00:45:35 +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.38 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: luofengwc at qq dot com X-Bugzilla-Status: UNCONFIRMED 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 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=3D31302 Bug ID: 31302 Summary: glibc issue about reloc-type R_X86_64_TPOFF64 when llvm build golang project with cgo, Product: glibc Version: 2.38 Status: UNCONFIRMED Severity: normal Priority: P2 Component: libc Assignee: unassigned at sourceware dot org Reporter: luofengwc at qq dot com CC: drepper.fsp at gmail dot com Target Milestone: --- hi i want to report glibc issue when i use llvm=EF=BC=8C the following is d= etail: when clang build golang on x86 arch, and use cgo function, build to static linked exec, exec will segment fault.=20 this is demo.go: package main // #cgo LDFLAGS: -ldl // #include // #include import "C" import ( "fmt" ) func main() { fmt.Printf("This is go demo\n") C.CString("libsystemd-login.so.0") return } build static exec command : export CC=3Dclang CGO_ENABLED=3D1 CGO_CFLAGS=3D"-fstack-protector-strong -fPIE" CGO_CPPFLAGS=3D"-fstack-protector-strong -fPIE" CGO_LDFLAGS_ALLOW=3D'-Wl,-z,relro,-z,now' CGO_LDFLAGS=3D"-Wl,-z,relro,-z,now -Wl,-z,noexecstack" go build -buildmode=3Dpie -o demo -ldflags '-buildid=3D= none -tmpdir=3D. -extldflags=3D-ftrapv -extldflags=3D-Wl,-z,relro,-z,now -linkmode=3Dexternal -extldflags=3D-static-pie' demo.go and gdb segment fault stack, indicate crash in glibc Program received signal SIGSEGV, Segmentation fault. 0x00007ffff7e835dc in _dl_signal_error () (gdb) bt #0 0x00007ffff7e835dc in _dl_signal_error () #1 0x00007ffff7ebf6f3 in _dl_allocate_static_tls () #2 0x00007ffff7e843d0 in _dl_relocate_static_pie () #3 0x00007ffff7e46b59 in __libc_start_main_impl () #4 0x00007ffff7dc4665 in _start () when debug, i found clang change the sym relocate type from R_X86_64_GOTTPO= FF to R_X86_64_TPOFF64 readelf -a glibc/dl-error.o | grep R_X86_64_GOTTPOFF readelf -a demo | grep R_X86_64_TPOFF64 i want to know why glibc does not match this relocation type. thank you --=20 You are receiving this mail because: You are on the CC list for the bug.=