diff options
author | pmuldoon <pmuldoon@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-10-27 17:21:42 +0000 |
---|---|---|
committer | pmuldoon <pmuldoon@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-10-27 17:21:42 +0000 |
commit | ab103e33b2aae243b231eba689e0b99418fa1663 (patch) | |
tree | 93d1166de8622ded3678c7599baa864b75cb5e25 /gcc | |
parent | fddbd0194b01f44c5b5f16379fd5405dcf6d71c0 (diff) | |
download | gcc-ab103e33b2aae243b231eba689e0b99418fa1663.tar.gz |
Let GDB reuse GCC's parser.
2014-10-27 Phil Muldoon <pmuldoon@redhat.com>
Jan Kratochvil <jan.kratochvil@redhat.com>
Tom Tromey <tromey@redhat.com>
* aclocal.m4: New file.
* callbacks.cc: New file.
* callbacks.hh: New file.
* cc1plugin-config.h.in: New file.
* configure: New file.
* configure.ac: New file.
* connection.cc: New file.
* connection.hh: New file.
* findcomp.cc: New file.
* findcomp.hh: New file.
* libcc1.cc: New file.
* libcc1plugin.sym: New file.
* libcc1.sym: New file.
* Makefile.am: New file.
* Makefile.in: New file.
* marshall.cc: New file.
* marshall.hh: New file.
* names.cc: New file.
* names.hh: New file.
* plugin.cc: New file.
* rpc.hh: New file.
* status.hh: New file.
2014-10-27 Phil Muldoon <pmuldoon@redhat.com>
Jan Kratochvil <jan.kratochvil@redhat.com>
Tom Tromey <tromey@redhat.com>
* gcc-c-fe.def: New file.
* gcc-c-interface.h: New file.
* gcc-interface.h: New file.
2014-10-27 Phil Muldoon <pmuldoon@redhat.com>
Tom Tromey <tromey@redhat.com>
* c-tree.h (enum c_oracle_request): New.
(c_binding_oracle_function): New typedef.
(c_binding_oracle, c_pushtag, c_bind): Declare.
* c-decl.c (c_binding_oracle): New global.
(I_SYMBOL_CHECKED): New macro.
(i_symbol_binding): New function.
(I_SYMBOL_BINDING, I_SYMBOL_DECL): Redefine.
(I_TAG_CHECKED): New macro.
(i_tag_binding): New function.
(I_TAG_BINDING, I_TAG_DECL): Redefine.
(I_LABEL_CHECKED): New macro.
(i_label_binding): New function.
(I_LABEL_BINDING, I_LABEL_DECL): Redefine.
(c_print_identifier): Save and restore c_binding_oracle.
(c_pushtag, c_bind): New functions.
2014-10-27 Phil Muldoon <pmuldoon@redhat.com>
Tom Tromey <tromey@redhat.com>
* aclocal.m4, configure: Rebuild.
* Makefile.in (aclocal_deps): Add gcc-plugin.m4.
* configure.ac: Use GCC_ENABLE_PLUGINS.
* stor-layout.c (finish_bitfield_layout): Now public. Change
argument type to 'tree'.
(finish_record_layout): Update.
* stor-layout.h (finish_bitfield_layout): Declare.
2014-10-27 Tom Tromey <tromey@redhat.com>
* gcc-plugin.m4: New file.
2014-10-27 Phil Muldoon <pmuldoon@redhat.com>
Tom Tromey <tromey@redhat.com>
* Makefile.def: Add libcc1 to host_modules.
* configure.ac (host_tools): Add libcc1.
* Makefile.in, configure: Rebuild.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@216748 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 11 | ||||
-rw-r--r-- | gcc/Makefile.in | 1 | ||||
-rw-r--r-- | gcc/aclocal.m4 | 89 | ||||
-rw-r--r-- | gcc/c/ChangeLog | 19 | ||||
-rw-r--r-- | gcc/c/c-decl.c | 164 | ||||
-rw-r--r-- | gcc/c/c-tree.h | 24 | ||||
-rwxr-xr-x | gcc/configure | 172 | ||||
-rw-r--r-- | gcc/configure.ac | 100 | ||||
-rw-r--r-- | gcc/stor-layout.c | 12 | ||||
-rw-r--r-- | gcc/stor-layout.h | 1 |
10 files changed, 299 insertions, 294 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8cdd603221f..f588f032841 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2014-10-27 Phil Muldoon <pmuldoon@redhat.com> + Tom Tromey <tromey@redhat.com> + + * aclocal.m4, configure: Rebuild. + * Makefile.in (aclocal_deps): Add gcc-plugin.m4. + * configure.ac: Use GCC_ENABLE_PLUGINS. + * stor-layout.c (finish_bitfield_layout): Now public. Change + argument type to 'tree'. + (finish_record_layout): Update. + * stor-layout.h (finish_bitfield_layout): Declare. + 2014-10-27 Alan Lawrence <alan.lawrence@arm.com> * config/aarch64/aarch64.c (TARGET_GIMPLE_FOLD_BUILTIN): Define again. diff --git a/gcc/Makefile.in b/gcc/Makefile.in index e2100ffe2e6..a74df1fd1ae 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -1673,6 +1673,7 @@ aclocal_deps = \ $(srcdir)/../config/codeset.m4 \ $(srcdir)/../config/extensions.m4 \ $(srcdir)/../config/gettext-sister.m4 \ + $(srcdir)/../config/gcc-plugin.m4 \ $(srcdir)/../config/iconv.m4 \ $(srcdir)/../config/lcmessage.m4 \ $(srcdir)/../config/lib-ld.m4 \ diff --git a/gcc/aclocal.m4 b/gcc/aclocal.m4 index 1bcf9056584..cb6a48beb37 100644 --- a/gcc/aclocal.m4 +++ b/gcc/aclocal.m4 @@ -11,94 +11,6 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. -# AM_AUX_DIR_EXPAND -*- Autoconf -*- - -# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets -# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to -# `$srcdir', `$srcdir/..', or `$srcdir/../..'. -# -# Of course, Automake must honor this variable whenever it calls a -# tool from the auxiliary directory. The problem is that $srcdir (and -# therefore $ac_aux_dir as well) can be either absolute or relative, -# depending on how configure is run. This is pretty annoying, since -# it makes $ac_aux_dir quite unusable in subdirectories: in the top -# source directory, any form will work fine, but in subdirectories a -# relative path needs to be adjusted first. -# -# $ac_aux_dir/missing -# fails when called from a subdirectory if $ac_aux_dir is relative -# $top_srcdir/$ac_aux_dir/missing -# fails if $ac_aux_dir is absolute, -# fails when called from a subdirectory in a VPATH build with -# a relative $ac_aux_dir -# -# The reason of the latter failure is that $top_srcdir and $ac_aux_dir -# are both prefixed by $srcdir. In an in-source build this is usually -# harmless because $srcdir is `.', but things will broke when you -# start a VPATH build or use an absolute $srcdir. -# -# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, -# iff we strip the leading $srcdir from $ac_aux_dir. That would be: -# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` -# and then we would define $MISSING as -# MISSING="\${SHELL} $am_aux_dir/missing" -# This will work as long as MISSING is not called from configure, because -# unfortunately $(top_srcdir) has no meaning in configure. -# However there are other variables, like CC, which are often used in -# configure, and could therefore not use this "fixed" $ac_aux_dir. -# -# Another solution, used here, is to always expand $ac_aux_dir to an -# absolute PATH. The drawback is that using absolute paths prevent a -# configured tree to be moved without reconfiguration. - -AC_DEFUN([AM_AUX_DIR_EXPAND], -[dnl Rely on autoconf to set up CDPATH properly. -AC_PREREQ([2.50])dnl -# expand $ac_aux_dir to an absolute path -am_aux_dir=`cd $ac_aux_dir && pwd` -]) - -# Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005, 2008 -# Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 6 - -# AM_PROG_CC_C_O -# -------------- -# Like AC_PROG_CC_C_O, but changed for automake. -AC_DEFUN([AM_PROG_CC_C_O], -[AC_REQUIRE([AC_PROG_CC_C_O])dnl -AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -AC_REQUIRE_AUX_FILE([compile])dnl -# FIXME: we rely on the cache variable name because -# there is no other way. -set dummy $CC -am_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']` -eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o -if test "$am_t" != yes; then - # Losing compiler, so override with the script. - # FIXME: It is wrong to rewrite CC. - # But if we don't then we get into trouble of one sort or another. - # A longer-term fix would be to have automake use am__CC in this case, - # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" - CC="$am_aux_dir/compile $CC" -fi -dnl Make sure AC_PROG_CC is never called again, or it will override our -dnl setting of CC. -m4_define([AC_PROG_CC], - [m4_fatal([AC_PROG_CC cannot be called after AM_PROG_CC_C_O])]) -]) - m4_include([../libtool.m4]) m4_include([../ltoptions.m4]) m4_include([../ltsugar.m4]) @@ -108,6 +20,7 @@ m4_include([../config/acx.m4]) m4_include([../config/codeset.m4]) m4_include([../config/depstand.m4]) m4_include([../config/dfp.m4]) +m4_include([../config/gcc-plugin.m4]) m4_include([../config/gettext-sister.m4]) m4_include([../config/iconv.m4]) m4_include([../config/lcmessage.m4]) diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 8eeb02bbb7a..dcc5548a905 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,22 @@ +2014-10-27 Phil Muldoon <pmuldoon@redhat.com> + Tom Tromey <tromey@redhat.com> + + * c-tree.h (enum c_oracle_request): New. + (c_binding_oracle_function): New typedef. + (c_binding_oracle, c_pushtag, c_bind): Declare. + * c-decl.c (c_binding_oracle): New global. + (I_SYMBOL_CHECKED): New macro. + (i_symbol_binding): New function. + (I_SYMBOL_BINDING, I_SYMBOL_DECL): Redefine. + (I_TAG_CHECKED): New macro. + (i_tag_binding): New function. + (I_TAG_BINDING, I_TAG_DECL): Redefine. + (I_LABEL_CHECKED): New macro. + (i_label_binding): New function. + (I_LABEL_BINDING, I_LABEL_DECL): Redefine. + (c_print_identifier): Save and restore c_binding_oracle. + (c_pushtag, c_bind): New functions. + 2014-10-27 Andrew MacLeod <amacleod@redhat.com> * c-typeck.c: Adjust include files. diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index 7d1840e5b61..d0105ff122b 100644 --- a/gcc/c/c-decl.c +++ b/gcc/c/c-decl.c @@ -220,21 +220,6 @@ struct GTY((chain_next ("%h.prev"))) c_binding { #define B_IN_FILE_SCOPE(b) ((b)->depth == 1 /*file_scope->depth*/) #define B_IN_EXTERNAL_SCOPE(b) ((b)->depth == 0 /*external_scope->depth*/) -#define I_SYMBOL_BINDING(node) \ - (((struct lang_identifier *) IDENTIFIER_NODE_CHECK(node))->symbol_binding) -#define I_SYMBOL_DECL(node) \ - (I_SYMBOL_BINDING(node) ? I_SYMBOL_BINDING(node)->decl : 0) - -#define I_TAG_BINDING(node) \ - (((struct lang_identifier *) IDENTIFIER_NODE_CHECK(node))->tag_binding) -#define I_TAG_DECL(node) \ - (I_TAG_BINDING(node) ? I_TAG_BINDING(node)->decl : 0) - -#define I_LABEL_BINDING(node) \ - (((struct lang_identifier *) IDENTIFIER_NODE_CHECK(node))->label_binding) -#define I_LABEL_DECL(node) \ - (I_LABEL_BINDING(node) ? I_LABEL_BINDING(node)->decl : 0) - /* Each C symbol points to three linked lists of c_binding structures. These describe the values of the identifier in the three different namespaces defined by the language. */ @@ -250,6 +235,96 @@ struct GTY(()) lang_identifier { extern char C_SIZEOF_STRUCT_LANG_IDENTIFIER_isnt_accurate [(sizeof(struct lang_identifier) == C_SIZEOF_STRUCT_LANG_IDENTIFIER) ? 1 : -1]; +/* The binding oracle; see c-tree.h. */ +void (*c_binding_oracle) (enum c_oracle_request, tree identifier); + +/* This flag is set on an identifier if we have previously asked the + binding oracle for this identifier's symbol binding. */ +#define I_SYMBOL_CHECKED(node) \ + (TREE_LANG_FLAG_4 (IDENTIFIER_NODE_CHECK (node))) + +static inline struct c_binding* * +i_symbol_binding (tree node) +{ + struct lang_identifier *lid + = (struct lang_identifier *) IDENTIFIER_NODE_CHECK (node); + + if (lid->symbol_binding == NULL + && c_binding_oracle != NULL + && !I_SYMBOL_CHECKED (node)) + { + /* Set the "checked" flag first, to avoid infinite recursion + when the binding oracle calls back into gcc. */ + I_SYMBOL_CHECKED (node) = 1; + c_binding_oracle (C_ORACLE_SYMBOL, node); + } + + return &lid->symbol_binding; +} + +#define I_SYMBOL_BINDING(node) (*i_symbol_binding (node)) + +#define I_SYMBOL_DECL(node) \ + (I_SYMBOL_BINDING(node) ? I_SYMBOL_BINDING(node)->decl : 0) + +/* This flag is set on an identifier if we have previously asked the + binding oracle for this identifier's tag binding. */ +#define I_TAG_CHECKED(node) \ + (TREE_LANG_FLAG_5 (IDENTIFIER_NODE_CHECK (node))) + +static inline struct c_binding ** +i_tag_binding (tree node) +{ + struct lang_identifier *lid + = (struct lang_identifier *) IDENTIFIER_NODE_CHECK (node); + + if (lid->tag_binding == NULL + && c_binding_oracle != NULL + && !I_TAG_CHECKED (node)) + { + /* Set the "checked" flag first, to avoid infinite recursion + when the binding oracle calls back into gcc. */ + I_TAG_CHECKED (node) = 1; + c_binding_oracle (C_ORACLE_TAG, node); + } + + return &lid->tag_binding; +} + +#define I_TAG_BINDING(node) (*i_tag_binding (node)) + +#define I_TAG_DECL(node) \ + (I_TAG_BINDING(node) ? I_TAG_BINDING(node)->decl : 0) + +/* This flag is set on an identifier if we have previously asked the + binding oracle for this identifier's label binding. */ +#define I_LABEL_CHECKED(node) \ + (TREE_LANG_FLAG_6 (IDENTIFIER_NODE_CHECK (node))) + +static inline struct c_binding ** +i_label_binding (tree node) +{ + struct lang_identifier *lid + = (struct lang_identifier *) IDENTIFIER_NODE_CHECK (node); + + if (lid->label_binding == NULL + && c_binding_oracle != NULL + && !I_LABEL_CHECKED (node)) + { + /* Set the "checked" flag first, to avoid infinite recursion + when the binding oracle calls back into gcc. */ + I_LABEL_CHECKED (node) = 1; + c_binding_oracle (C_ORACLE_LABEL, node); + } + + return &lid->label_binding; +} + +#define I_LABEL_BINDING(node) (*i_label_binding (node)) + +#define I_LABEL_DECL(node) \ + (I_LABEL_BINDING(node) ? I_LABEL_BINDING(node)->decl : 0) + /* The resulting tree type. */ union GTY((desc ("TREE_CODE (&%h.generic) == IDENTIFIER_NODE"), @@ -618,6 +693,15 @@ decl_jump_unsafe (tree decl) void c_print_identifier (FILE *file, tree node, int indent) { + void (*save) (enum c_oracle_request, tree identifier); + + /* Temporarily hide any binding oracle. Without this, calls to + debug_tree from the debugger will end up calling into the oracle, + making for a confusing debug session. As the oracle isn't needed + here for normal operation, it's simplest to suppress it. */ + save = c_binding_oracle; + c_binding_oracle = NULL; + print_node (file, "symbol", I_SYMBOL_DECL (node), indent + 4); print_node (file, "tag", I_TAG_DECL (node), indent + 4); print_node (file, "label", I_LABEL_DECL (node), indent + 4); @@ -628,6 +712,8 @@ c_print_identifier (FILE *file, tree node, int indent) fprintf (file, "rid " HOST_PTR_PRINTF " \"%s\"", (void *) rid, IDENTIFIER_POINTER (rid)); } + + c_binding_oracle = save; } /* Establish a binding between NAME, an IDENTIFIER_NODE, and DECL, @@ -1494,6 +1580,54 @@ pushtag (location_t loc, tree name, tree type) } } } + +/* An exported interface to pushtag. This is used by the gdb plugin's + binding oracle to introduce a new tag binding. */ + +void +c_pushtag (location_t loc, tree name, tree type) +{ + pushtag (loc, name, type); +} + +/* An exported interface to bind a declaration. LOC is the location + to use. DECL is the declaration to bind. The decl's name is used + to determine how it is bound. If DECL is a VAR_DECL, then + IS_GLOBAL determines whether the decl is put into the global (file + and external) scope or the current function's scope; if DECL is not + a VAR_DECL then it is always put into the file scope. */ + +void +c_bind (location_t loc, tree decl, bool is_global) +{ + struct c_scope *scope; + bool nested = false; + + if (TREE_CODE (decl) != VAR_DECL || current_function_scope == NULL) + { + /* Types and functions are always considered to be global. */ + scope = file_scope; + DECL_EXTERNAL (decl) = 1; + TREE_PUBLIC (decl) = 1; + } + else if (is_global) + { + /* Also bind it into the external scope. */ + bind (DECL_NAME (decl), decl, external_scope, true, false, loc); + nested = true; + scope = file_scope; + DECL_EXTERNAL (decl) = 1; + TREE_PUBLIC (decl) = 1; + } + else + { + DECL_CONTEXT (decl) = current_function_decl; + TREE_PUBLIC (decl) = 0; + scope = current_function_scope; + } + + bind (DECL_NAME (decl), decl, scope, false, nested, loc); +} /* Subroutine of compare_decls. Allow harmless mismatches in return and argument types provided that the type modes match. This function diff --git a/gcc/c/c-tree.h b/gcc/c/c-tree.h index 5ff9d9ccce9..cf9497360b7 100644 --- a/gcc/c/c-tree.h +++ b/gcc/c/c-tree.h @@ -673,12 +673,36 @@ extern int current_function_returns_abnormally; extern enum machine_mode c_default_pointer_mode; /* In c-decl.c */ + +/* Tell the binding oracle what kind of binding we are looking for. */ + +enum c_oracle_request +{ + C_ORACLE_SYMBOL, + C_ORACLE_TAG, + C_ORACLE_LABEL +}; + +/* If this is non-NULL, then it is a "binding oracle" which can lazily + create bindings when needed by the C compiler. The oracle is told + the name and type of the binding to create. It can call pushdecl + or the like to ensure the binding is visible; or do nothing, + leaving the binding untouched. c-decl.c takes note of when the + oracle has been called and will not call it again if it fails to + create a given binding. */ + +typedef void c_binding_oracle_function (enum c_oracle_request, tree identifier); + +extern c_binding_oracle_function *c_binding_oracle; + extern void c_finish_incomplete_decl (tree); extern void c_write_global_declarations (void); extern tree c_omp_reduction_id (enum tree_code, tree); extern tree c_omp_reduction_decl (tree); extern tree c_omp_reduction_lookup (tree, tree); extern tree c_check_omp_declare_reduction_r (tree *, int *, void *); +extern void c_pushtag (location_t, tree, tree); +extern void c_bind (location_t, tree, bool); /* In c-errors.c */ extern void pedwarn_c90 (location_t, int opt, const char *, ...) diff --git a/gcc/configure b/gcc/configure index 16f128f6a31..4022332f5f0 100755 --- a/gcc/configure +++ b/gcc/configure @@ -27931,7 +27931,7 @@ $as_echo "#define HAVE_cloog 1" >>confdefs.h fi # Check for plugin support -# Check whether --enable-plugin was given. + # Check whether --enable-plugin was given. if test "${enable_plugin+set}" = set; then : enableval=$enable_plugin; enable_plugin=$enableval else @@ -27939,64 +27939,64 @@ else fi -pluginlibs= + pluginlibs= -case "${host}" in - *-*-darwin*) - if test x$build = x$host; then - export_sym_check="nm${exeext} -g" - elif test x$host = x$target; then - export_sym_check="$gcc_cv_nm -g" - else - export_sym_check= - fi - ;; - *) - if test x$build = x$host; then - export_sym_check="objdump${exeext} -T" - elif test x$host = x$target; then - export_sym_check="$gcc_cv_objdump -T" - else - export_sym_check= - fi - ;; -esac + case "${host}" in + *-*-darwin*) + if test x$build = x$host; then + export_sym_check="nm${exeext} -g" + elif test x$host = x$target; then + export_sym_check="$gcc_cv_nm -g" + else + export_sym_check= + fi + ;; + *) + if test x$build = x$host; then + export_sym_check="objdump${exeext} -T" + elif test x$host = x$target; then + export_sym_check="$gcc_cv_objdump -T" + else + export_sym_check= + fi + ;; + esac -if test x"$enable_plugin" = x"yes"; then + if test x"$enable_plugin" = x"yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for exported symbols" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for exported symbols" >&5 $as_echo_n "checking for exported symbols... " >&6; } - if test "x$export_sym_check" != x; then - echo "int main() {return 0;} int foobar() {return 0;}" > conftest.c - ${CC} ${CFLAGS} ${LDFLAGS} conftest.c -o conftest$ac_exeext > /dev/null 2>&1 - if $export_sym_check conftest$ac_exeext | grep -q foobar > /dev/null; then - : # No need to use a flag - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 + if test "x$export_sym_check" != x; then + echo "int main() {return 0;} int foobar() {return 0;}" > conftest.c + ${CC} ${CFLAGS} ${LDFLAGS} conftest.c -o conftest$ac_exeext > /dev/null 2>&1 + if $export_sym_check conftest$ac_exeext | grep -q foobar > /dev/null; then + : # No need to use a flag + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -rdynamic" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -rdynamic" >&5 $as_echo_n "checking for -rdynamic... " >&6; } - ${CC} ${CFLAGS} ${LDFLAGS} -rdynamic conftest.c -o conftest$ac_exeext > /dev/null 2>&1 - if $export_sym_check conftest$ac_exeext | grep -q foobar > /dev/null; then - plugin_rdynamic=yes - pluginlibs="-rdynamic" - else - plugin_rdynamic=no - enable_plugin=no - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $plugin_rdynamic" >&5 + ${CC} ${CFLAGS} ${LDFLAGS} -rdynamic conftest.c -o conftest$ac_exeext > /dev/null 2>&1 + if $export_sym_check conftest$ac_exeext | grep -q foobar > /dev/null; then + plugin_rdynamic=yes + pluginlibs="-rdynamic" + else + plugin_rdynamic=no + enable_plugin=no + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $plugin_rdynamic" >&5 $as_echo "$plugin_rdynamic" >&6; } - fi - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unable to check" >&5 + fi + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unable to check" >&5 $as_echo "unable to check" >&6; } - fi + fi - # Check -ldl - saved_LIBS="$LIBS" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5 + # Check -ldl + saved_LIBS="$LIBS" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5 $as_echo_n "checking for library containing dlopen... " >&6; } if test "${ac_cv_search_dlopen+set}" = set; then : $as_echo_n "(cached) " >&6 @@ -28052,28 +28052,28 @@ if test "$ac_res" != no; then : fi - if test x"$ac_cv_search_dlopen" = x"-ldl"; then - pluginlibs="$pluginlibs -ldl" - fi - LIBS="$saved_LIBS" - - # Check that we can build shared objects with -fPIC -shared - saved_LDFLAGS="$LDFLAGS" - saved_CFLAGS="$CFLAGS" - case "${host}" in - *-*-darwin*) - CFLAGS=`echo $CFLAGS | sed s/-mdynamic-no-pic//g` - CFLAGS="$CFLAGS -fPIC" - LDFLAGS="$LDFLAGS -shared -undefined dynamic_lookup" - ;; - *) - CFLAGS="$CFLAGS -fPIC" - LDFLAGS="$LDFLAGS -fPIC -shared" - ;; - esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -fPIC -shared" >&5 + if test x"$ac_cv_search_dlopen" = x"-ldl"; then + pluginlibs="$pluginlibs -ldl" + fi + LIBS="$saved_LIBS" + + # Check that we can build shared objects with -fPIC -shared + saved_LDFLAGS="$LDFLAGS" + saved_CFLAGS="$CFLAGS" + case "${host}" in + *-*-darwin*) + CFLAGS=`echo $CFLAGS | sed s/-mdynamic-no-pic//g` + CFLAGS="$CFLAGS -fPIC" + LDFLAGS="$LDFLAGS -shared -undefined dynamic_lookup" + ;; + *) + CFLAGS="$CFLAGS -fPIC" + LDFLAGS="$LDFLAGS -fPIC -shared" + ;; + esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -fPIC -shared" >&5 $as_echo_n "checking for -fPIC -shared... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ extern int X; int @@ -28093,22 +28093,22 @@ $as_echo "no" >&6; }; have_pic_shared=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - if test x"$have_pic_shared" != x"yes" -o x"$ac_cv_search_dlopen" = x"no"; then - pluginlibs= - enable_plugin=no - fi - LDFLAGS="$saved_LDFLAGS" - CFLAGS="$saved_CFLAGS" - - # If plugin support had been requested but not available, fail. - if test x"$enable_plugin" = x"no" ; then - if test x"$default_plugin" != x"yes"; then - as_fn_error " -Building GCC with plugin support requires a host that supports --fPIC, -shared, -ldl and -rdynamic." "$LINENO" 5 - fi - fi -fi + if test x"$have_pic_shared" != x"yes" -o x"$ac_cv_search_dlopen" = x"no"; then + pluginlibs= + enable_plugin=no + fi + LDFLAGS="$saved_LDFLAGS" + CFLAGS="$saved_CFLAGS" + + # If plugin support had been requested but not available, fail. + if test x"$enable_plugin" = x"no" ; then + if test x"$default_plugin" != x"yes"; then + as_fn_error " + Building GCC with plugin support requires a host that supports + -fPIC, -shared, -ldl and -rdynamic." "$LINENO" 5 + fi + fi + fi diff --git a/gcc/configure.ac b/gcc/configure.ac index 35ce9eeb45a..02bb3066795 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -5548,105 +5548,7 @@ if test "x${CLOOGLIBS}" != "x" ; then AC_DEFINE(HAVE_cloog, 1, [Define if cloog is in use.]) fi -# Check for plugin support -AC_ARG_ENABLE(plugin, -[AS_HELP_STRING([--enable-plugin], [enable plugin support])], -enable_plugin=$enableval, -enable_plugin=yes; default_plugin=yes) - -pluginlibs= - -case "${host}" in - *-*-darwin*) - if test x$build = x$host; then - export_sym_check="nm${exeext} -g" - elif test x$host = x$target; then - export_sym_check="$gcc_cv_nm -g" - else - export_sym_check= - fi - ;; - *) - if test x$build = x$host; then - export_sym_check="objdump${exeext} -T" - elif test x$host = x$target; then - export_sym_check="$gcc_cv_objdump -T" - else - export_sym_check= - fi - ;; -esac - -if test x"$enable_plugin" = x"yes"; then - - AC_MSG_CHECKING([for exported symbols]) - if test "x$export_sym_check" != x; then - echo "int main() {return 0;} int foobar() {return 0;}" > conftest.c - ${CC} ${CFLAGS} ${LDFLAGS} conftest.c -o conftest$ac_exeext > /dev/null 2>&1 - if $export_sym_check conftest$ac_exeext | grep -q foobar > /dev/null; then - : # No need to use a flag - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([yes]) - AC_MSG_CHECKING([for -rdynamic]) - ${CC} ${CFLAGS} ${LDFLAGS} -rdynamic conftest.c -o conftest$ac_exeext > /dev/null 2>&1 - if $export_sym_check conftest$ac_exeext | grep -q foobar > /dev/null; then - plugin_rdynamic=yes - pluginlibs="-rdynamic" - else - plugin_rdynamic=no - enable_plugin=no - fi - AC_MSG_RESULT([$plugin_rdynamic]) - fi - else - AC_MSG_RESULT([unable to check]) - fi - - # Check -ldl - saved_LIBS="$LIBS" - AC_SEARCH_LIBS([dlopen], [dl]) - if test x"$ac_cv_search_dlopen" = x"-ldl"; then - pluginlibs="$pluginlibs -ldl" - fi - LIBS="$saved_LIBS" - - # Check that we can build shared objects with -fPIC -shared - saved_LDFLAGS="$LDFLAGS" - saved_CFLAGS="$CFLAGS" - case "${host}" in - *-*-darwin*) - CFLAGS=`echo $CFLAGS | sed s/-mdynamic-no-pic//g` - CFLAGS="$CFLAGS -fPIC" - LDFLAGS="$LDFLAGS -shared -undefined dynamic_lookup" - ;; - *) - CFLAGS="$CFLAGS -fPIC" - LDFLAGS="$LDFLAGS -fPIC -shared" - ;; - esac - AC_MSG_CHECKING([for -fPIC -shared]) - AC_TRY_LINK( - [extern int X;],[return X == 0;], - [AC_MSG_RESULT([yes]); have_pic_shared=yes], - [AC_MSG_RESULT([no]); have_pic_shared=no]) - if test x"$have_pic_shared" != x"yes" -o x"$ac_cv_search_dlopen" = x"no"; then - pluginlibs= - enable_plugin=no - fi - LDFLAGS="$saved_LDFLAGS" - CFLAGS="$saved_CFLAGS" - - # If plugin support had been requested but not available, fail. - if test x"$enable_plugin" = x"no" ; then - if test x"$default_plugin" != x"yes"; then - AC_MSG_ERROR([ -Building GCC with plugin support requires a host that supports --fPIC, -shared, -ldl and -rdynamic.]) - fi - fi -fi - +GCC_ENABLE_PLUGINS AC_SUBST(pluginlibs) AC_SUBST(enable_plugin) if test x"$enable_plugin" = x"yes"; then diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c index 9f0064bb861..fcfabf3bc1a 100644 --- a/gcc/stor-layout.c +++ b/gcc/stor-layout.c @@ -1959,10 +1959,10 @@ finish_bitfield_representative (tree repr, tree field) } /* Compute and set FIELD_DECLs for the underlying objects we should - use for bitfield access for the structure laid out with RLI. */ + use for bitfield access for the structure T. */ -static void -finish_bitfield_layout (record_layout_info rli) +void +finish_bitfield_layout (tree t) { tree field, prev; tree repr = NULL_TREE; @@ -1971,10 +1971,10 @@ finish_bitfield_layout (record_layout_info rli) we could use the underlying type as hint for the representative if the bitfield would fit and the representative would not exceed the union in size. */ - if (TREE_CODE (rli->t) != RECORD_TYPE) + if (TREE_CODE (t) != RECORD_TYPE) return; - for (prev = NULL_TREE, field = TYPE_FIELDS (rli->t); + for (prev = NULL_TREE, field = TYPE_FIELDS (t); field; field = DECL_CHAIN (field)) { if (TREE_CODE (field) != FIELD_DECL) @@ -2061,7 +2061,7 @@ finish_record_layout (record_layout_info rli, int free_p) finalize_type_size (rli->t); /* Compute bitfield representatives. */ - finish_bitfield_layout (rli); + finish_bitfield_layout (rli->t); /* Propagate TYPE_PACKED to variants. With C++ templates, handle_packed_attribute is too early to do this. */ diff --git a/gcc/stor-layout.h b/gcc/stor-layout.h index f7c52670a93..ec3bbb8368f 100644 --- a/gcc/stor-layout.h +++ b/gcc/stor-layout.h @@ -35,6 +35,7 @@ extern tree rli_size_so_far (record_layout_info); extern void normalize_rli (record_layout_info); extern void place_field (record_layout_info, tree); extern void compute_record_mode (tree); +extern void finish_bitfield_layout (tree); extern void finish_record_layout (record_layout_info, int); extern unsigned int element_precision (const_tree); extern void finalize_size_functions (void); |