how to make GCC option hook aware

2018-02-17 Thread Andre Groenewald
Hi GCC folks,

I have implemented a function for LANG_HOOKS_HANDLE_OPTION for my toy
language front end to handle options.

The specific option is populated in lang.opt as fdemo-debug

My lang-specs file has the following: {"@demo",  "demo1 %i
%(cc1_options) %{!fsyntax-only:%(invoke_as)}", 0, 1, 0},

Everything compiles and the front end gets invoked. GCC even suggest
the correct the flag when mistyped, but my function
demo_langhook_handle_option doesn't get invoked.

What else do I need to implement to get this working.

Thanks


Error In libssp, But Disabled in Configuration

2018-02-17 Thread R0b0t1
Taking inspiration from
https://github.com/FreddieChopin/bleeding-edge-toolchain, I have a
script which runs:

../../source/${dname}/configure \
--target=${TARGET} \
--enable-languages=c \
--without-headers \
--prefix=`realpath ../../${DIR_PREFIX}` \
--libexecdir=`realpath ../../${DIR_PREFIX}/lib`
--disable-decimal-float \
--disable-libffi \
--disable-libgomp \
--disable-libmudflap \
--disable-libquadmath \
--disable-libssp \
--disable-libstdcxx-pch \
--disable-nls \
--disable-shared \
--disable-threads \
--disable-tls \
--with-newlib \
--with-gnu-as \
--with-gnu-ld \
--with-sysroot=`realpath ../../${DIR_PREFIX}/${TARGET}` \
--with-system-zlib \
--with-gmp=`realpath ../../${DIR_PREFIX}/host/${gmp_dname}` \
--with-mpfr=`realpath ../../${DIR_PREFIX}/host/${mpfr_dname}` \
--with-mpc=`realpath ../../${DIR_PREFIX}/host/${mpc_dname}` \
--with-isl=`realpath ../../${DIR_PREFIX}/host/${isl_dname}` \
--with-pkgversion=${VERSION}

(libssp is disabled as it is provided by newlib.) When compiling GCC,
an attempt to build libssp is made, and this fails with the following:

../../../../source/gcc-7.3.0/libssp/ssp.c: In function ‘__guard_setup’:
../../../../source/gcc-7.3.0/libssp/ssp.c:93:12: warning: implicit
declaration of function ‘open’ [-Wimplicit-function-declaration]
   int fd = open ("/dev/urandom", O_RDONLY);
^~~~
../../../../source/gcc-7.3.0/libssp/ssp.c:93:34: error: ‘O_RDONLY’
undeclared (first use in this function)
   int fd = open ("/dev/urandom", O_RDONLY);
  ^~~~
../../../../source/gcc-7.3.0/libssp/ssp.c:93:34: note: each undeclared
identifier is reported only once for each function it appears in
../../../../source/gcc-7.3.0/libssp/ssp.c:96:7: error: unknown type
name ‘ssize_t’
   ssize_t size = read (fd, &__stack_chk_guard,
   ^~~
../../../../source/gcc-7.3.0/libssp/ssp.c:96:22: warning: implicit
declaration of function ‘read’ [-Wimplicit-function-declaration]
   ssize_t size = read (fd, &__stack_chk_guard,
  ^~~~
../../../../source/gcc-7.3.0/libssp/ssp.c:98:7: warning: implicit
declaration of function ‘close’ [-Wimplicit-function-declaration]
   close (fd);
   ^
../../../../source/gcc-7.3.0/libssp/ssp.c: At top level:
../../../../source/gcc-7.3.0/libssp/ssp.c:113:25: error: unknown type
name ‘size_t’
 fail (const char *msg1, size_t msg1len, const char *msg3)
 ^~
../../../../source/gcc-7.3.0/libssp/ssp.c: In function ‘__stack_chk_fail’:
../../../../source/gcc-7.3.0/libssp/ssp.c:185:3: warning: implicit
declaration of function ‘fail’ [-Wimplicit-function-declaration]
   fail (msg, strlen (msg), "stack smashing detected: terminated");
   ^~~~
../../../../source/gcc-7.3.0/libssp/ssp.c:185:14: warning: implicit
declaration of function ‘strlen’ [-Wimplicit-function-declaration]
   fail (msg, strlen (msg), "stack smashing detected: terminated");
  ^~
../../../../source/gcc-7.3.0/libssp/ssp.c:185:14: warning:
incompatible implicit declaration of built-in function ‘strlen’
../../../../source/gcc-7.3.0/libssp/ssp.c:185:14: note: include
‘’ or provide a declaration of ‘strlen’
../../../../source/gcc-7.3.0/libssp/ssp.c: In function ‘__chk_fail’:
../../../../source/gcc-7.3.0/libssp/ssp.c:192:14: warning:
incompatible implicit declaration of built-in function ‘strlen’
   fail (msg, strlen (msg), "buffer overflow detected: terminated");
  ^~
../../../../source/gcc-7.3.0/libssp/ssp.c:192:14: note: include
‘’ or provide a declaration of ‘strlen’
make[2]: *** [Makefile:487: ssp.lo] Error 1


I've attempted to search for a solution, but they were all more or
less "disable libssp."

Thanks in advance,
 R0b0t1