This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Redesign pthread in LIB_SPEC for systems without libpthread

On 17/08/2013, at 3:07 AM, Pavel Chupin wrote:

> It's late to change subj I think to avoid producing new thread but I
> got your point.
> Problem is that all 3 Android compilers (arm, x86, mips) are failed to
> build on trunk due to libgomp and libatomic configure errors like (arm
> example):
> configure:14403:
> /tmp/ndk-pvchupin/build/host-gcc/i686-linux-gnu/build-gcc-4.9-arm-linux-androideabi/./gcc/xgcc
> -B/tmp/ndk-pvchupin/build/host-gcc/i686-linux-gnu/build-gcc-4.9-arm-linux-androideabi/./gcc/
> -B/tmp/ndk-pvchupin/build/host-gcc/i686-linux-gnu/temp-arm-linux-androideabi-4.9/arm-linux-androideabi/bin/
> -B/tmp/ndk-pvchupin/build/host-gcc/i686-linux-gnu/temp-arm-linux-androideabi-4.9/arm-linux-androideabi/lib/
> -isystem /tmp/ndk-pvchupin/build/host-gcc/i686-linux-gnu/temp-arm-linux-androideabi-4.9/arm-linux-androideabi/include
> -isystem /tmp/ndk-pvchupin/build/host-gcc/i686-linux-gnu/temp-arm-linux-androideabi-4.9/arm-linux-androideabi/sys-include
>   -o conftest -g -Os -fno-sync-libcalls  -pthread   conftest.c  >&5
> /tmp/ndk-pvchupin/build/host-gcc/i686-linux-gnu/temp-binutils-2.23-arm-linux-androideabi/bin/arm-linux-androideabi-ld:
> error: cannot find -lpthread
> There is no libpthread library in Bionic, pthreads is integrated into libc.
> My fix removes -lpthread from GNU_USER_TARGET_LIB_SPEC definition
> which is included in both bionic and linux but keeping it in linux

Thanks for the description.  I thought a bit more about the problem, and it might be possible to solve it more concisely:

1. In config/gnu-user.h you define GNU_USER_TARGET_NO_PTHREADS_LIB_SPEC to the main part of GNU_USER_TARGET_LIB_SPEC.  GNU_USER_TARGET_LIB_SPEC now becomes '"%{pthread:-lpthread} " GNU_USER_TARGET_NO_PTHREADS_LIB_SPEC'.
2. In occurrences of LINUX_OR_ANDROID_LD you continue to use GNU_USER_TARGET_LIB_SPEC for the first argument and 'GNU_USER_TARGET_NO_PTHREADS_LIB_SPEC " " ANDROID_LIB_SPEC'  for the second argument.

This way you are operating with named macros instead of verbatim "%{pthread:-lpthread}", and, hopefully, this will be more clear to an outside observer.

> Please see modified patch attached.
> I've built all 3 Android compilers, x86_64 and i686 and ran simple
> test with -pthread.

Thanks for good test coverage.  I assume you have also tested a non-android Linux target?

The patch is OK if adjusted to the comments above (or good arguments provided why your current patch is more straigh-forward).

Thank you,

Maxim Kuvyrkov

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]