On 10/01/2013, at 12:24 AM, Alexander Ivchenko wrote: >> Config/linux-android.h is a better place for this declaration.
I was wrong here. Config/linux-android.h is not a "re-includable" header, and is not fit for function declarations. > > That wouldn't help, I got the following error: > > In file included from ../../.././gcc/tm.h:24:0, > from [..]/src/gcc/libgcc/generic-morestack-thread.c:29: > [..]/src/gcc/libgcc/../gcc/config/linux-android.h:62:1: error: unknown > type name ‘bool’ > extern bool linux_android_has_ifunc_p (void); > ^ > > Anyway, linux-protos.h looks to me as a good thing to have (e.g. for > libc_has_function hook, that is > supposed to be commited in a near future) for declaring linux (and > Android) specific versions of hooks.. OK, I agree. In theory linux_android_has_ifunc_p could've been placed into linux-android-protos.h, but having a separate file (from linux-protos.h) just for 1-2 declarations is not justified. >>> + "It returns true if the target supports GNU indirect functions.\n\ >>> +The support includes the assembler, linker and dynamic linker.\n\ >>> +The default value of this hook is defined as for the host machine.", >> >> Are your sure the last sentence is correct? It seems the default value for >> this hook is based on which libc is being used. Maybe it would be more >> accurate to say "The default value of this hook is based on target's libc."? > > Well yes, you are right that the default value depends on version of > libc, but this version > is checked on the configure time for the host machine > (HAVE_GNU_INDIRECT_FUNCTION), No. And even if that was the case that would be a bug. HAVE_GNU_INDIRECT_FUNCTION is set based on default_gnu_indirect_function variable defined in config.gcc (unless overridden with a configure argument). This variable is set to true for targets that support IFUNCs irrespective of host and host's libc. > --- a/gcc/config.gcc > +++ b/gcc/config.gcc > @@ -637,6 +637,11 @@ case ${target} in > native_system_header_dir=/include > ;; > esac > + case $target in > + *linux*) > + tm_p_file="${tm_p_file} linux-protos.h" > + ;; > + esac > # glibc / uclibc / bionic switch. > # uclibc and bionic aren't usable for GNU/Hurd and neither for GNU/k*BSD. > case $target in > @@ -662,8 +667,10 @@ case ${target} in > # Add Android userspace support to Linux targets. > case $target in > *linux*) > + tmake_file="${tmake_file} t-linux-android" > tm_file="$tm_file linux-android.h" > extra_options="$extra_options linux-android.opt" > + extra_objs="$extra_objs linux-android.o" > ;; > esac > # Enable compilation for Android by default for *android* targets. > Also scan config.gcc for any other occurences of linux-android.h and add same changes there. I believe only arm*-*-linux-* is affected. > --- a/gcc/config/host-linux.c > +++ b/gcc/config/host-linux.c > @@ -23,7 +23,6 @@ > #include "hosthooks.h" > #include "hosthooks-def.h" > > - > /* Linux has a feature called exec-shield-randomize that perturbs the > address of non-fixed mapped segments by a (relatively) small amount. > The feature is intended to make it harder to attack the system with Don't change formatting unless you are editing the code around it. > diff --git a/gcc/config/linux-android.c b/gcc/config/linux-android.c > new file mode 100644 > index 0000000..47cc50a > --- /dev/null > +++ b/gcc/config/linux-android.c ... > +You should have received a copy of the GNU General Public License > +along with GCC; see the file COPYING3. If not see > +<http://www.gnu.org/licenses/>. */ > + > +#include "config.h" > +#include "system.h" > +#include "coretypes.h" > +#include "tm.h" Add '#include "linux-protos.h"'. Remember to update t-linux-android. > + > +/* Android does not support GNU indirect functions. */ > + > +bool > +linux_android_has_ifunc_p (void) > +{ > + return TARGET_ANDROID ? false : HAVE_GNU_INDIRECT_FUNCTION; > +} > Please send one last version for the final review, primarily to double check your changes to arm*-linux-* to avoid breaking it. Thanks! -- Maxim Kuvyrkov