https://sourceware.org/bugzilla/show_bug.cgi?id=33314

            Bug ID: 33314
           Summary: CPython crashes when built on arm with
                    -mtls-dialect=gnu2 and linked with bfd
           Product: binutils
           Version: 2.46 (HEAD)
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: sam at gentoo dot org
  Target Milestone: ---

With mold, it builds fine and passes the CPython testsuite. I can't test it
with lld as it doesn't seem to support GNU2 TLS for arm.

I can reproduce it with:
```
export CFLAGS_NODIST="-Og -ggdb3 -mtls-dialect=gnu2" ; ../configure
--enable-shared --build=armv7a-unknown-linux-gnueabihf
--host=armv7a-unknown-linux-gnueabihf --target=armv7a-unknown-linux-gnueabihf
&& make -j$(nproc) CPPFLAGS= CFLAGS= LDFLAGS=
```

This works:
```
export CFLAGS_NODIST="-Og -ggdb3 -mtls-dialect=gnu2 -fuse-ld=mold" ;
../configure --enable-shared --build=armv7a-unknown-linux-gnueabihf
--host=armv7a-unknown-linux-gnueabihf --target=armv7a-unknown-linux-gnueabihf
&& make -j$(nproc) CPPFLAGS= CFLAGS= LDFLAGS="-fuse-ld=mold"
```

Backtrace:
```
Program received signal SIGSEGV, Segmentation fault.
_PyFreeList_PopNoStats (fl=0xf7e59fb8 <object_subclasshook_doc+136>) at
../Include/internal/pycore_freelist.h:79
79              fl->freelist = *(void **)obj;
(gdb) bt
#0  _PyFreeList_PopNoStats (fl=0xf7e59fb8 <object_subclasshook_doc+136>) at
../Include/internal/pycore_freelist.h:79
#1  _PyFreeList_Pop (fl=0xf7e59fb8 <object_subclasshook_doc+136>) at
../Include/internal/pycore_freelist.h:88
#2  0xf7bcda50 in new_dict (keys=0xf7f5444c <empty_keys_struct>,
values=values@entry=0x0, used=used@entry=0,
free_values_on_failure=free_values_on_failure@entry=0)
    at ../Objects/dictobject.c:873
#3  0xf7bd1008 in PyDict_New () at ../Objects/dictobject.c:973
#4  0xf7c3a82c in init_interned_dict (interp=interp@entry=0xf7f787f0
<_PyRuntime+51952>) at ../Objects/unicodeobject.c:343
#5  0xf7c5c498 in _PyUnicode_InitGlobalObjects (interp=interp@entry=0xf7f787f0
<_PyRuntime+51952>) at ../Objects/unicodeobject.c:15844
#6  0xf7d3ffc4 in pycore_init_global_objects (interp=interp@entry=0xf7f787f0
<_PyRuntime+51952>) at ../Python/pylifecycle.c:689
#7  0xf7d4067c in pycore_interp_init (tstate=0xf7f94828 <_PyRuntime+166696>) at
../Python/pylifecycle.c:873
#8  0xf7d40978 in pyinit_config (runtime=runtime@entry=0xf7f6bd00 <_PyRuntime>,
tstate_p=tstate_p@entry=0xfffee798, config=config@entry=0xfffee63c) at
../Python/pylifecycle.c:954
#9  0xf7d444d4 in pyinit_core (runtime=0xf7f6bd00 <_PyRuntime>,
runtime@entry=0xf7d44614 <Py_InitializeFromConfig+260>, src_config=0xfffee7fc,
src_config@entry=0xfffee7f4,
    tstate_p=0xfffee798, tstate_p@entry=0xfffee790) at
../Python/pylifecycle.c:1117
#10 0xf7d44614 in Py_InitializeFromConfig (config=config@entry=0xfffee7f4) at
../Python/pylifecycle.c:1437
#11 0xf7d7a5f0 in pymain_init (args=0xfffee95c, args@entry=0xfffee954) at
../Modules/main.c:68
#12 0xf7d7a774 in pymain_main (args=args@entry=0xfffee954) at
../Modules/main.c:793
#13 0xf7d7a8b8 in Py_BytesMain (argc=<optimized out>, argv=<optimized out>) at
../Modules/main.c:826
#14 0x004006b8 in main (argc=<optimized out>, argv=<optimized out>) at
../Programs/python.c:15
```

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Reply via email to