Makefile.def (target_modules): Add libssp.

* Makefile.def (target_modules): Add libssp.
	* configure.in (target_libraries): Add target-libssp.
	* configure: Rebuilt.
	* Makefile.in: Rebuilt.
gcc/
	* gcc.c (LINK_SSP_SPEC): Define.
	(link_ssp_spec): New variable.
	(LINK_COMMAND_SPEC): Add %(link_ssp).
	(static_specs): Add link_ssp_spec.
	* configure.ac (TARGET_LIBC_PROVIDES_SSP): New test.
	* configure: Rebuilt.
	* config.in: Rebuilt.

	* config/rs6000/linux.h (TARGET_THREAD_SSP_OFFSET): Define.
	* config/rs6000/linux64.h (TARGET_THREAD_SSP_OFFSET): Likewise.
	* config/i386/linux.h (TARGET_THREAD_SSP_OFFSET): Likewise.
	* config/i386/linux64.h (TARGET_THREAD_SSP_OFFSET): Likewise.
	* config/rs6000/rs6000.md (stack_protect_set, stack_protect_test):
	If TARGET_THREAD_SSP_OFFSET is defined, use -0x7010(13) resp.
	-0x7008(2) instead of reading __stack_chk_guard variable.
	* config/i386/i386.md (UNSPEC_SP_SET, UNSPEC_SP_TEST): Change
	number.
	(UNSPEC_SP_TLS_SET, UNSPEC_SP_TLS_TEST): New constants.
	(stack_protect_set, stack_protect_test): Use *_tls* patterns
	if TARGET_THREAD_SSP_OFFSET is defined.
	(stack_tls_protect_set_si, stack_tls_protect_set_di,
	stack_tls_protect_test_si, stack_tls_protect_test_di): New insns.

	Revert:
	2005-06-27  Richard Henderson  <rth@redhat.com>
	* libgcc-std.ver (GCC_4.1.0): New.
	* libgcc.h (__stack_chk_guard): Declare.
	(__stack_chk_fail, __stack_chk_fail_local): Declare.
	* libgcc2.c (L_stack_chk, L_stack_chk_local): New.
	* mklibgcc.in (lib2funcs): Add them.

From-SVN: r101531
This commit is contained in:
Jakub Jelinek 2005-07-02 10:52:21 +02:00 committed by Jakub Jelinek
parent f60d648137
commit 7700825281
50 changed files with 10800 additions and 155 deletions

View File

@ -1,3 +1,10 @@
2005-07-02 Jakub Jelinek <jakub@redhat.com>
* Makefile.def (target_modules): Add libssp.
* configure.in (target_libraries): Add target-libssp.
* configure: Rebuilt.
* Makefile.in: Rebuilt.
2005-07-01 Zack Weinberg <zackw@panix.com> 2005-07-01 Zack Weinberg <zackw@panix.com>
* MAINTAINERS: Change email address. Resign from maintainership. * MAINTAINERS: Change email address. Resign from maintainership.

View File

@ -115,6 +115,7 @@ host_modules= { module= gnattools; };
target_modules = { module= libstdc++-v3; lib_path=.libs; raw_cxx=true; }; target_modules = { module= libstdc++-v3; lib_path=.libs; raw_cxx=true; };
target_modules = { module= libmudflap; lib_path=.libs; }; target_modules = { module= libmudflap; lib_path=.libs; };
target_modules = { module= libssp; lib_path=.libs; };
target_modules = { module= newlib; }; target_modules = { module= newlib; };
target_modules = { module= libgfortran; }; target_modules = { module= libgfortran; };
target_modules = { module= libobjc; }; target_modules = { module= libobjc; };

View File

@ -480,7 +480,7 @@ PICFLAG_FOR_TARGET =
# This is the list of directories that may be needed in RPATH_ENVVAR # This is the list of directories that may be needed in RPATH_ENVVAR
# so that prorgams built for the target machine work. # so that prorgams built for the target machine work.
TARGET_LIB_PATH = $(TARGET_LIB_PATH_libstdc++-v3)$(TARGET_LIB_PATH_libmudflap)$(HOST_LIB_PATH_gcc) TARGET_LIB_PATH = $(TARGET_LIB_PATH_libstdc++-v3)$(TARGET_LIB_PATH_libmudflap)$(TARGET_LIB_PATH_libssp)$(HOST_LIB_PATH_gcc)
@if target-libstdc++-v3 @if target-libstdc++-v3
TARGET_LIB_PATH_libstdc++-v3 = $$r/$(TARGET_SUBDIR)/libstdc++-v3/.libs: TARGET_LIB_PATH_libstdc++-v3 = $$r/$(TARGET_SUBDIR)/libstdc++-v3/.libs:
@ -490,6 +490,10 @@ TARGET_LIB_PATH_libstdc++-v3 = $$r/$(TARGET_SUBDIR)/libstdc++-v3/.libs:
TARGET_LIB_PATH_libmudflap = $$r/$(TARGET_SUBDIR)/libmudflap/.libs: TARGET_LIB_PATH_libmudflap = $$r/$(TARGET_SUBDIR)/libmudflap/.libs:
@endif target-libmudflap @endif target-libmudflap
@if target-libssp
TARGET_LIB_PATH_libssp = $$r/$(TARGET_SUBDIR)/libssp/.libs:
@endif target-libssp
# This is the list of directories that may be needed in RPATH_ENVVAR # This is the list of directories that may be needed in RPATH_ENVVAR
@ -731,6 +735,7 @@ configure-host: \
configure-target: \ configure-target: \
maybe-configure-target-libstdc++-v3 \ maybe-configure-target-libstdc++-v3 \
maybe-configure-target-libmudflap \ maybe-configure-target-libmudflap \
maybe-configure-target-libssp \
maybe-configure-target-newlib \ maybe-configure-target-newlib \
maybe-configure-target-libgfortran \ maybe-configure-target-libgfortran \
maybe-configure-target-libobjc \ maybe-configure-target-libobjc \
@ -834,6 +839,7 @@ all-host: \
all-target: \ all-target: \
maybe-all-target-libstdc++-v3 \ maybe-all-target-libstdc++-v3 \
maybe-all-target-libmudflap \ maybe-all-target-libmudflap \
maybe-all-target-libssp \
maybe-all-target-newlib \ maybe-all-target-newlib \
maybe-all-target-libgfortran \ maybe-all-target-libgfortran \
maybe-all-target-libobjc \ maybe-all-target-libobjc \
@ -933,6 +939,7 @@ info-host: \
info-target: \ info-target: \
maybe-info-target-libstdc++-v3 \ maybe-info-target-libstdc++-v3 \
maybe-info-target-libmudflap \ maybe-info-target-libmudflap \
maybe-info-target-libssp \
maybe-info-target-newlib \ maybe-info-target-newlib \
maybe-info-target-libgfortran \ maybe-info-target-libgfortran \
maybe-info-target-libobjc \ maybe-info-target-libobjc \
@ -1027,6 +1034,7 @@ dvi-host: \
dvi-target: \ dvi-target: \
maybe-dvi-target-libstdc++-v3 \ maybe-dvi-target-libstdc++-v3 \
maybe-dvi-target-libmudflap \ maybe-dvi-target-libmudflap \
maybe-dvi-target-libssp \
maybe-dvi-target-newlib \ maybe-dvi-target-newlib \
maybe-dvi-target-libgfortran \ maybe-dvi-target-libgfortran \
maybe-dvi-target-libobjc \ maybe-dvi-target-libobjc \
@ -1121,6 +1129,7 @@ html-host: \
html-target: \ html-target: \
maybe-html-target-libstdc++-v3 \ maybe-html-target-libstdc++-v3 \
maybe-html-target-libmudflap \ maybe-html-target-libmudflap \
maybe-html-target-libssp \
maybe-html-target-newlib \ maybe-html-target-newlib \
maybe-html-target-libgfortran \ maybe-html-target-libgfortran \
maybe-html-target-libobjc \ maybe-html-target-libobjc \
@ -1215,6 +1224,7 @@ TAGS-host: \
TAGS-target: \ TAGS-target: \
maybe-TAGS-target-libstdc++-v3 \ maybe-TAGS-target-libstdc++-v3 \
maybe-TAGS-target-libmudflap \ maybe-TAGS-target-libmudflap \
maybe-TAGS-target-libssp \
maybe-TAGS-target-newlib \ maybe-TAGS-target-newlib \
maybe-TAGS-target-libgfortran \ maybe-TAGS-target-libgfortran \
maybe-TAGS-target-libobjc \ maybe-TAGS-target-libobjc \
@ -1309,6 +1319,7 @@ install-info-host: \
install-info-target: \ install-info-target: \
maybe-install-info-target-libstdc++-v3 \ maybe-install-info-target-libstdc++-v3 \
maybe-install-info-target-libmudflap \ maybe-install-info-target-libmudflap \
maybe-install-info-target-libssp \
maybe-install-info-target-newlib \ maybe-install-info-target-newlib \
maybe-install-info-target-libgfortran \ maybe-install-info-target-libgfortran \
maybe-install-info-target-libobjc \ maybe-install-info-target-libobjc \
@ -1403,6 +1414,7 @@ installcheck-host: \
installcheck-target: \ installcheck-target: \
maybe-installcheck-target-libstdc++-v3 \ maybe-installcheck-target-libstdc++-v3 \
maybe-installcheck-target-libmudflap \ maybe-installcheck-target-libmudflap \
maybe-installcheck-target-libssp \
maybe-installcheck-target-newlib \ maybe-installcheck-target-newlib \
maybe-installcheck-target-libgfortran \ maybe-installcheck-target-libgfortran \
maybe-installcheck-target-libobjc \ maybe-installcheck-target-libobjc \
@ -1497,6 +1509,7 @@ mostlyclean-host: \
mostlyclean-target: \ mostlyclean-target: \
maybe-mostlyclean-target-libstdc++-v3 \ maybe-mostlyclean-target-libstdc++-v3 \
maybe-mostlyclean-target-libmudflap \ maybe-mostlyclean-target-libmudflap \
maybe-mostlyclean-target-libssp \
maybe-mostlyclean-target-newlib \ maybe-mostlyclean-target-newlib \
maybe-mostlyclean-target-libgfortran \ maybe-mostlyclean-target-libgfortran \
maybe-mostlyclean-target-libobjc \ maybe-mostlyclean-target-libobjc \
@ -1591,6 +1604,7 @@ clean-host: \
clean-target: \ clean-target: \
maybe-clean-target-libstdc++-v3 \ maybe-clean-target-libstdc++-v3 \
maybe-clean-target-libmudflap \ maybe-clean-target-libmudflap \
maybe-clean-target-libssp \
maybe-clean-target-newlib \ maybe-clean-target-newlib \
maybe-clean-target-libgfortran \ maybe-clean-target-libgfortran \
maybe-clean-target-libobjc \ maybe-clean-target-libobjc \
@ -1685,6 +1699,7 @@ distclean-host: \
distclean-target: \ distclean-target: \
maybe-distclean-target-libstdc++-v3 \ maybe-distclean-target-libstdc++-v3 \
maybe-distclean-target-libmudflap \ maybe-distclean-target-libmudflap \
maybe-distclean-target-libssp \
maybe-distclean-target-newlib \ maybe-distclean-target-newlib \
maybe-distclean-target-libgfortran \ maybe-distclean-target-libgfortran \
maybe-distclean-target-libobjc \ maybe-distclean-target-libobjc \
@ -1779,6 +1794,7 @@ maintainer-clean-host: \
maintainer-clean-target: \ maintainer-clean-target: \
maybe-maintainer-clean-target-libstdc++-v3 \ maybe-maintainer-clean-target-libstdc++-v3 \
maybe-maintainer-clean-target-libmudflap \ maybe-maintainer-clean-target-libmudflap \
maybe-maintainer-clean-target-libssp \
maybe-maintainer-clean-target-newlib \ maybe-maintainer-clean-target-newlib \
maybe-maintainer-clean-target-libgfortran \ maybe-maintainer-clean-target-libgfortran \
maybe-maintainer-clean-target-libobjc \ maybe-maintainer-clean-target-libobjc \
@ -1932,6 +1948,7 @@ do-check: unstage \
maybe-check-gnattools \ maybe-check-gnattools \
maybe-check-target-libstdc++-v3 \ maybe-check-target-libstdc++-v3 \
maybe-check-target-libmudflap \ maybe-check-target-libmudflap \
maybe-check-target-libssp \
maybe-check-target-newlib \ maybe-check-target-newlib \
maybe-check-target-libgfortran \ maybe-check-target-libgfortran \
maybe-check-target-libobjc \ maybe-check-target-libobjc \
@ -2118,6 +2135,7 @@ install-host: \
install-target: \ install-target: \
maybe-install-target-libstdc++-v3 \ maybe-install-target-libstdc++-v3 \
maybe-install-target-libmudflap \ maybe-install-target-libmudflap \
maybe-install-target-libssp \
maybe-install-target-newlib \ maybe-install-target-newlib \
maybe-install-target-libgfortran \ maybe-install-target-libgfortran \
maybe-install-target-libobjc \ maybe-install-target-libobjc \
@ -27935,6 +27953,341 @@ maintainer-clean-target-libmudflap:
# There's only one multilib.out. Cleverer subdirs shouldn't need it copied.
@if target-libssp
$(TARGET_SUBDIR)/libssp/multilib.out: multilib.out
$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libssp ; \
rm -f $(TARGET_SUBDIR)/libssp/Makefile || : ; \
cp multilib.out $(TARGET_SUBDIR)/libssp/multilib.out
@endif target-libssp
.PHONY: configure-target-libssp maybe-configure-target-libssp
maybe-configure-target-libssp:
@if target-libssp
maybe-configure-target-libssp: configure-target-libssp
configure-target-libssp: $(TARGET_SUBDIR)/libssp/multilib.out
@test ! -f $(TARGET_SUBDIR)/libssp/Makefile || exit 0; \
$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libssp ; \
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(NORMAL_TARGET_EXPORTS) \
echo Configuring in $(TARGET_SUBDIR)/libssp; \
cd "$(TARGET_SUBDIR)/libssp" || exit 1; \
case $(srcdir) in \
/* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
*) topdir=`echo $(TARGET_SUBDIR)/libssp/ | \
sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
esac; \
srcdiroption="--srcdir=$${topdir}/libssp"; \
libsrcdir="$$s/libssp"; \
rm -f no-such-file || : ; \
CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \
$(TARGET_CONFIGARGS) $${srcdiroption} \
|| exit 1
@endif target-libssp
.PHONY: all-target-libssp maybe-all-target-libssp
maybe-all-target-libssp:
@if target-libssp
TARGET-target-libssp=all
maybe-all-target-libssp: all-target-libssp
all-target-libssp: configure-target-libssp
@r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(NORMAL_TARGET_EXPORTS) \
(cd $(TARGET_SUBDIR)/libssp && \
$(MAKE) $(TARGET_FLAGS_TO_PASS) $(TARGET-target-libssp))
@endif target-libssp
.PHONY: check-target-libssp maybe-check-target-libssp
maybe-check-target-libssp:
@if target-libssp
maybe-check-target-libssp: check-target-libssp
check-target-libssp:
@r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(NORMAL_TARGET_EXPORTS) \
(cd $(TARGET_SUBDIR)/libssp && \
$(MAKE) $(TARGET_FLAGS_TO_PASS) check)
@endif target-libssp
.PHONY: install-target-libssp maybe-install-target-libssp
maybe-install-target-libssp:
@if target-libssp
maybe-install-target-libssp: install-target-libssp
install-target-libssp: installdirs
@r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(NORMAL_TARGET_EXPORTS) \
(cd $(TARGET_SUBDIR)/libssp && \
$(MAKE) $(TARGET_FLAGS_TO_PASS) install)
@endif target-libssp
# Other targets (info, dvi, etc.)
.PHONY: maybe-info-target-libssp info-target-libssp
maybe-info-target-libssp:
@if target-libssp
maybe-info-target-libssp: info-target-libssp
info-target-libssp: \
configure-target-libssp
@[ -f $(TARGET_SUBDIR)/libssp/Makefile ] || exit 0 ; \
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(NORMAL_TARGET_EXPORTS) \
echo "Doing info in $(TARGET_SUBDIR)/libssp" ; \
for flag in $(EXTRA_TARGET_FLAGS); do \
eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
done; \
(cd $(TARGET_SUBDIR)/libssp && \
$(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
"CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
"RANLIB=$${RANLIB}" \
"DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
info) \
|| exit 1
@endif target-libssp
.PHONY: maybe-dvi-target-libssp dvi-target-libssp
maybe-dvi-target-libssp:
@if target-libssp
maybe-dvi-target-libssp: dvi-target-libssp
dvi-target-libssp: \
configure-target-libssp
@[ -f $(TARGET_SUBDIR)/libssp/Makefile ] || exit 0 ; \
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(NORMAL_TARGET_EXPORTS) \
echo "Doing dvi in $(TARGET_SUBDIR)/libssp" ; \
for flag in $(EXTRA_TARGET_FLAGS); do \
eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
done; \
(cd $(TARGET_SUBDIR)/libssp && \
$(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
"CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
"RANLIB=$${RANLIB}" \
"DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
dvi) \
|| exit 1
@endif target-libssp
.PHONY: maybe-html-target-libssp html-target-libssp
maybe-html-target-libssp:
@if target-libssp
maybe-html-target-libssp: html-target-libssp
html-target-libssp: \
configure-target-libssp
@[ -f $(TARGET_SUBDIR)/libssp/Makefile ] || exit 0 ; \
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(NORMAL_TARGET_EXPORTS) \
echo "Doing html in $(TARGET_SUBDIR)/libssp" ; \
for flag in $(EXTRA_TARGET_FLAGS); do \
eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
done; \
(cd $(TARGET_SUBDIR)/libssp && \
$(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
"CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
"RANLIB=$${RANLIB}" \
"DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
html) \
|| exit 1
@endif target-libssp
.PHONY: maybe-TAGS-target-libssp TAGS-target-libssp
maybe-TAGS-target-libssp:
@if target-libssp
maybe-TAGS-target-libssp: TAGS-target-libssp
TAGS-target-libssp: \
configure-target-libssp
@[ -f $(TARGET_SUBDIR)/libssp/Makefile ] || exit 0 ; \
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(NORMAL_TARGET_EXPORTS) \
echo "Doing TAGS in $(TARGET_SUBDIR)/libssp" ; \
for flag in $(EXTRA_TARGET_FLAGS); do \
eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
done; \
(cd $(TARGET_SUBDIR)/libssp && \
$(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
"CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
"RANLIB=$${RANLIB}" \
"DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
TAGS) \
|| exit 1
@endif target-libssp
.PHONY: maybe-install-info-target-libssp install-info-target-libssp
maybe-install-info-target-libssp:
@if target-libssp
maybe-install-info-target-libssp: install-info-target-libssp
install-info-target-libssp: \
configure-target-libssp \
info-target-libssp
@[ -f $(TARGET_SUBDIR)/libssp/Makefile ] || exit 0 ; \
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(NORMAL_TARGET_EXPORTS) \
echo "Doing install-info in $(TARGET_SUBDIR)/libssp" ; \
for flag in $(EXTRA_TARGET_FLAGS); do \
eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
done; \
(cd $(TARGET_SUBDIR)/libssp && \
$(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
"CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
"RANLIB=$${RANLIB}" \
"DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
install-info) \
|| exit 1
@endif target-libssp
.PHONY: maybe-installcheck-target-libssp installcheck-target-libssp
maybe-installcheck-target-libssp:
@if target-libssp
maybe-installcheck-target-libssp: installcheck-target-libssp
installcheck-target-libssp: \
configure-target-libssp
@[ -f $(TARGET_SUBDIR)/libssp/Makefile ] || exit 0 ; \
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(NORMAL_TARGET_EXPORTS) \
echo "Doing installcheck in $(TARGET_SUBDIR)/libssp" ; \
for flag in $(EXTRA_TARGET_FLAGS); do \
eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
done; \
(cd $(TARGET_SUBDIR)/libssp && \
$(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
"CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
"RANLIB=$${RANLIB}" \
"DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
installcheck) \
|| exit 1
@endif target-libssp
.PHONY: maybe-mostlyclean-target-libssp mostlyclean-target-libssp
maybe-mostlyclean-target-libssp:
@if target-libssp
maybe-mostlyclean-target-libssp: mostlyclean-target-libssp
mostlyclean-target-libssp:
@[ -f $(TARGET_SUBDIR)/libssp/Makefile ] || exit 0 ; \
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(NORMAL_TARGET_EXPORTS) \
echo "Doing mostlyclean in $(TARGET_SUBDIR)/libssp" ; \
for flag in $(EXTRA_TARGET_FLAGS); do \
eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
done; \
(cd $(TARGET_SUBDIR)/libssp && \
$(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
"CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
"RANLIB=$${RANLIB}" \
"DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
mostlyclean) \
|| exit 1
@endif target-libssp
.PHONY: maybe-clean-target-libssp clean-target-libssp
maybe-clean-target-libssp:
@if target-libssp
maybe-clean-target-libssp: clean-target-libssp
clean-target-libssp:
@[ -f $(TARGET_SUBDIR)/libssp/Makefile ] || exit 0 ; \
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(NORMAL_TARGET_EXPORTS) \
echo "Doing clean in $(TARGET_SUBDIR)/libssp" ; \
for flag in $(EXTRA_TARGET_FLAGS); do \
eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
done; \
(cd $(TARGET_SUBDIR)/libssp && \
$(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
"CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
"RANLIB=$${RANLIB}" \
"DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
clean) \
|| exit 1
@endif target-libssp
.PHONY: maybe-distclean-target-libssp distclean-target-libssp
maybe-distclean-target-libssp:
@if target-libssp
maybe-distclean-target-libssp: distclean-target-libssp
distclean-target-libssp:
@[ -f $(TARGET_SUBDIR)/libssp/Makefile ] || exit 0 ; \
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(NORMAL_TARGET_EXPORTS) \
echo "Doing distclean in $(TARGET_SUBDIR)/libssp" ; \
for flag in $(EXTRA_TARGET_FLAGS); do \
eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
done; \
(cd $(TARGET_SUBDIR)/libssp && \
$(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
"CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
"RANLIB=$${RANLIB}" \
"DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
distclean) \
|| exit 1
@endif target-libssp
.PHONY: maybe-maintainer-clean-target-libssp maintainer-clean-target-libssp
maybe-maintainer-clean-target-libssp:
@if target-libssp
maybe-maintainer-clean-target-libssp: maintainer-clean-target-libssp
maintainer-clean-target-libssp:
@[ -f $(TARGET_SUBDIR)/libssp/Makefile ] || exit 0 ; \
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(NORMAL_TARGET_EXPORTS) \
echo "Doing maintainer-clean in $(TARGET_SUBDIR)/libssp" ; \
for flag in $(EXTRA_TARGET_FLAGS); do \
eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
done; \
(cd $(TARGET_SUBDIR)/libssp && \
$(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
"CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
"RANLIB=$${RANLIB}" \
"DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
maintainer-clean) \
|| exit 1
@endif target-libssp
# There's only one multilib.out. Cleverer subdirs shouldn't need it copied. # There's only one multilib.out. Cleverer subdirs shouldn't need it copied.
@if target-newlib @if target-newlib
$(TARGET_SUBDIR)/newlib/multilib.out: multilib.out $(TARGET_SUBDIR)/newlib/multilib.out: multilib.out
@ -34567,6 +34920,8 @@ configure-target-libstdc++-v3: maybe-all-gcc
configure-target-libmudflap: maybe-all-gcc configure-target-libmudflap: maybe-all-gcc
configure-target-libssp: maybe-all-gcc
configure-target-newlib: maybe-all-gcc configure-target-newlib: maybe-all-gcc
configure-target-libgfortran: maybe-all-gcc configure-target-libgfortran: maybe-all-gcc

1
configure vendored
View File

@ -900,6 +900,7 @@ target_libraries="target-libiberty \
target-newlib \ target-newlib \
target-libstdc++-v3 \ target-libstdc++-v3 \
target-libmudflap \ target-libmudflap \
target-libssp \
target-libgfortran \ target-libgfortran \
${libgcj} \ ${libgcj} \
target-libobjc \ target-libobjc \

View File

@ -147,6 +147,7 @@ target_libraries="target-libiberty \
target-newlib \ target-newlib \
target-libstdc++-v3 \ target-libstdc++-v3 \
target-libmudflap \ target-libmudflap \
target-libssp \
target-libgfortran \ target-libgfortran \
${libgcj} \ ${libgcj} \
target-libobjc \ target-libobjc \

View File

@ -1,3 +1,36 @@
2005-07-02 Jakub Jelinek <jakub@redhat.com>
* gcc.c (LINK_SSP_SPEC): Define.
(link_ssp_spec): New variable.
(LINK_COMMAND_SPEC): Add %(link_ssp).
(static_specs): Add link_ssp_spec.
* configure.ac (TARGET_LIBC_PROVIDES_SSP): New test.
* configure: Rebuilt.
* config.in: Rebuilt.
* config/rs6000/linux.h (TARGET_THREAD_SSP_OFFSET): Define.
* config/rs6000/linux64.h (TARGET_THREAD_SSP_OFFSET): Likewise.
* config/i386/linux.h (TARGET_THREAD_SSP_OFFSET): Likewise.
* config/i386/linux64.h (TARGET_THREAD_SSP_OFFSET): Likewise.
* config/rs6000/rs6000.md (stack_protect_set, stack_protect_test):
If TARGET_THREAD_SSP_OFFSET is defined, use -0x7010(13) resp.
-0x7008(2) instead of reading __stack_chk_guard variable.
* config/i386/i386.md (UNSPEC_SP_SET, UNSPEC_SP_TEST): Change
number.
(UNSPEC_SP_TLS_SET, UNSPEC_SP_TLS_TEST): New constants.
(stack_protect_set, stack_protect_test): Use *_tls* patterns
if TARGET_THREAD_SSP_OFFSET is defined.
(stack_tls_protect_set_si, stack_tls_protect_set_di,
stack_tls_protect_test_si, stack_tls_protect_test_di): New insns.
Revert:
2005-06-27 Richard Henderson <rth@redhat.com>
* libgcc-std.ver (GCC_4.1.0): New.
* libgcc.h (__stack_chk_guard): Declare.
(__stack_chk_fail, __stack_chk_fail_local): Declare.
* libgcc2.c (L_stack_chk, L_stack_chk_local): New.
* mklibgcc.in (lib2funcs): Add them.
2005-07-01 Richard Henderson <rth@redhat.com> 2005-07-01 Richard Henderson <rth@redhat.com>
* config/i386/linux-unwind.h (x86_64_fallback_frame_state): Cast to * config/i386/linux-unwind.h (x86_64_fallback_frame_state): Cast to

View File

@ -1270,6 +1270,12 @@
#endif #endif
/* Define if your target C library provides stack protector support */
#ifndef USED_FOR_TARGET
#undef TARGET_LIBC_PROVIDES_SSP
#endif
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */ /* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#ifndef USED_FOR_TARGET #ifndef USED_FOR_TARGET
#undef TIME_WITH_SYS_TIME #undef TIME_WITH_SYS_TIME

View File

@ -81,8 +81,6 @@
(UNSPEC_FLDCW 25) (UNSPEC_FLDCW 25)
(UNSPEC_REP 26) (UNSPEC_REP 26)
(UNSPEC_EH_RETURN 27) (UNSPEC_EH_RETURN 27)
(UNSPEC_SP_SET 28)
(UNSPEC_SP_TEST 29)
; For SSE/MMX support: ; For SSE/MMX support:
(UNSPEC_FIX_NOTRUNC 30) (UNSPEC_FIX_NOTRUNC 30)
@ -140,6 +138,12 @@
(UNSPEC_FPREM_U 89) (UNSPEC_FPREM_U 89)
(UNSPEC_FPREM1_F 90) (UNSPEC_FPREM1_F 90)
(UNSPEC_FPREM1_U 91) (UNSPEC_FPREM1_U 91)
; SSP patterns
(UNSPEC_SP_SET 100)
(UNSPEC_SP_TEST 101)
(UNSPEC_SP_TLS_SET 102)
(UNSPEC_SP_TLS_TEST 103)
]) ])
(define_constants (define_constants
@ -19613,10 +19617,19 @@
(match_operand 1 "memory_operand" "")] (match_operand 1 "memory_operand" "")]
"" ""
{ {
#ifdef TARGET_THREAD_SSP_OFFSET
if (TARGET_64BIT)
emit_insn (gen_stack_tls_protect_set_di (operands[0],
GEN_INT (TARGET_THREAD_SSP_OFFSET)));
else
emit_insn (gen_stack_tls_protect_set_si (operands[0],
GEN_INT (TARGET_THREAD_SSP_OFFSET)));
#else
if (TARGET_64BIT) if (TARGET_64BIT)
emit_insn (gen_stack_protect_set_di (operands[0], operands[1])); emit_insn (gen_stack_protect_set_di (operands[0], operands[1]));
else else
emit_insn (gen_stack_protect_set_si (operands[0], operands[1])); emit_insn (gen_stack_protect_set_si (operands[0], operands[1]));
#endif
DONE; DONE;
}) })
@ -19638,6 +19651,24 @@
"mov{q}\t{%1, %2|%2, %1}\;mov{q}\t{%2, %0|%0, %2}\;xor{l}\t%k2, %k2" "mov{q}\t{%1, %2|%2, %1}\;mov{q}\t{%2, %0|%0, %2}\;xor{l}\t%k2, %k2"
[(set_attr "type" "multi")]) [(set_attr "type" "multi")])
(define_insn "stack_tls_protect_set_si"
[(set (match_operand:SI 0 "memory_operand" "=m")
(unspec:SI [(match_operand:SI 1 "const_int_operand" "i")] UNSPEC_SP_TLS_SET))
(set (match_scratch:SI 2 "=&r") (const_int 0))
(clobber (reg:CC FLAGS_REG))]
""
"mov{l}\t{%%gs:%P1, %2|%2, DWORD PTR %%gs:%P1}\;mov{l}\t{%2, %0|%0, %2}\;xor{l}\t%2, %2"
[(set_attr "type" "multi")])
(define_insn "stack_tls_protect_set_di"
[(set (match_operand:DI 0 "memory_operand" "=m")
(unspec:DI [(match_operand:DI 1 "const_int_operand" "i")] UNSPEC_SP_TLS_SET))
(set (match_scratch:DI 2 "=&r") (const_int 0))
(clobber (reg:CC FLAGS_REG))]
"TARGET_64BIT"
"mov{q}\t{%%fs:%P1, %2|%2, QWORD PTR %%fs:%P1}\;mov{q}\t{%2, %0|%0, %2}\;xor{l}\t%k2, %k2"
[(set_attr "type" "multi")])
(define_expand "stack_protect_test" (define_expand "stack_protect_test"
[(match_operand 0 "memory_operand" "") [(match_operand 0 "memory_operand" "")
(match_operand 1 "memory_operand" "") (match_operand 1 "memory_operand" "")
@ -19649,10 +19680,19 @@
ix86_compare_op1 = operands[1]; ix86_compare_op1 = operands[1];
ix86_compare_emitted = flags; ix86_compare_emitted = flags;
#ifdef TARGET_THREAD_SSP_OFFSET
if (TARGET_64BIT)
emit_insn (gen_stack_tls_protect_test_di (flags, operands[0],
GEN_INT (TARGET_THREAD_SSP_OFFSET)));
else
emit_insn (gen_stack_tls_protect_test_si (flags, operands[0],
GEN_INT (TARGET_THREAD_SSP_OFFSET)));
#else
if (TARGET_64BIT) if (TARGET_64BIT)
emit_insn (gen_stack_protect_test_di (flags, operands[0], operands[1])); emit_insn (gen_stack_protect_test_di (flags, operands[0], operands[1]));
else else
emit_insn (gen_stack_protect_test_si (flags, operands[0], operands[1])); emit_insn (gen_stack_protect_test_si (flags, operands[0], operands[1]));
#endif
emit_jump_insn (gen_beq (operands[2])); emit_jump_insn (gen_beq (operands[2]));
DONE; DONE;
}) })
@ -19677,6 +19717,26 @@
"mov{q}\t{%1, %3|%3, %1}\;xor{q}\t{%2, %3|%3, %2}" "mov{q}\t{%1, %3|%3, %1}\;xor{q}\t{%2, %3|%3, %2}"
[(set_attr "type" "multi")]) [(set_attr "type" "multi")])
(define_insn "stack_tls_protect_test_si"
[(set (match_operand:CCZ 0 "flags_reg_operand" "")
(unspec:CCZ [(match_operand:SI 1 "memory_operand" "m")
(match_operand:SI 2 "const_int_operand" "i")]
UNSPEC_SP_TLS_TEST))
(clobber (match_scratch:SI 3 "=r"))]
""
"mov{l}\t{%1, %3|%3, %1}\;xor{l}\t{%%gs:%P2, %3|%3, DWORD PTR %%gs:%P2}"
[(set_attr "type" "multi")])
(define_insn "stack_tls_protect_test_di"
[(set (match_operand:CCZ 0 "flags_reg_operand" "")
(unspec:CCZ [(match_operand:DI 1 "memory_operand" "m")
(match_operand:DI 2 "const_int_operand" "i")]
UNSPEC_SP_TLS_TEST))
(clobber (match_scratch:DI 3 "=r"))]
"TARGET_64BIT"
"mov{q}\t{%1, %3|%3, %1}\;xor{q}\t{%%fs:%P2, %3|%3, QWORD PTR %%fs:%P2}"
[(set_attr "type" "multi")])
(include "sse.md") (include "sse.md")
(include "mmx.md") (include "mmx.md")
(include "sync.md") (include "sync.md")

View File

@ -185,3 +185,8 @@ Boston, MA 02110-1301, USA. */
/* This macro may be overridden in i386/k*bsd-gnu.h. */ /* This macro may be overridden in i386/k*bsd-gnu.h. */
#define REG_NAME(reg) reg #define REG_NAME(reg) reg
#ifdef TARGET_LIBC_PROVIDES_SSP
/* i386 glibc provides __stack_chk_guard in %gs:0x14. */
#define TARGET_THREAD_SSP_OFFSET 0x14
#endif

View File

@ -73,3 +73,9 @@ Boston, MA 02110-1301, USA. */
/* This macro may be overridden in i386/k*bsd-gnu.h. */ /* This macro may be overridden in i386/k*bsd-gnu.h. */
#define REG_NAME(reg) reg #define REG_NAME(reg) reg
#ifdef TARGET_LIBC_PROVIDES_SSP
/* i386 glibc provides __stack_chk_guard in %gs:0x14,
x86_64 glibc provides it in %fs:0x28. */
#define TARGET_THREAD_SSP_OFFSET (TARGET_64BIT ? 0x28 : 0x14)
#endif

View File

@ -113,3 +113,8 @@
#define TARGET_HAS_F_SETLKW #define TARGET_HAS_F_SETLKW
#define MD_UNWIND_SUPPORT "config/rs6000/linux-unwind.h" #define MD_UNWIND_SUPPORT "config/rs6000/linux-unwind.h"
#ifdef TARGET_LIBC_PROVIDES_SSP
/* ppc32 glibc provides __stack_chk_guard in -0x7008(2). */
#define TARGET_THREAD_SSP_OFFSET -0x7008
#endif

View File

@ -547,3 +547,9 @@ while (0)
#endif #endif
#define MD_UNWIND_SUPPORT "config/rs6000/linux-unwind.h" #define MD_UNWIND_SUPPORT "config/rs6000/linux-unwind.h"
#ifdef TARGET_LIBC_PROVIDES_SSP
/* ppc32 glibc provides __stack_chk_guard in -0x7008(2),
ppc64 glibc provides it at -0x7010(13). */
#define TARGET_THREAD_SSP_OFFSET (TARGET_64BIT ? -0x7010 : -0x7008)
#endif

View File

@ -10764,6 +10764,11 @@
(match_operand 1 "memory_operand" "")] (match_operand 1 "memory_operand" "")]
"" ""
{ {
#ifdef TARGET_THREAD_SSP_OFFSET
rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
operands[1] = gen_rtx_MEM (Pmode, addr);
#endif
if (TARGET_64BIT) if (TARGET_64BIT)
emit_insn (gen_stack_protect_setdi (operands[0], operands[1])); emit_insn (gen_stack_protect_setdi (operands[0], operands[1]));
else else
@ -10795,6 +10800,11 @@
(match_operand 2 "" "")] (match_operand 2 "" "")]
"" ""
{ {
#ifdef TARGET_THREAD_SSP_OFFSET
rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
operands[1] = gen_rtx_MEM (Pmode, addr);
#endif
rs6000_compare_op0 = operands[0]; rs6000_compare_op0 = operands[0];
rs6000_compare_op1 = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, operands[1]), rs6000_compare_op1 = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, operands[1]),
UNSPEC_SP_TEST); UNSPEC_SP_TEST);

48
gcc/configure vendored
View File

@ -15514,6 +15514,54 @@ _ACEOF
fi fi
# Test for stack protector support in target C library.
case "$target" in
*-*-linux*)
echo "$as_me:$LINENO: checking __stack_chk_fail in target GNU C library" >&5
echo $ECHO_N "checking __stack_chk_fail in target GNU C library... $ECHO_C" >&6
if test "${gcc_cv_libc_provides_ssp+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
gcc_cv_libc_provides_ssp=no
if test x$host != x$target || test "x$TARGET_SYSTEM_ROOT" != x; then
if test "x$with_sysroot" = x; then
glibc_header_dir="${exec_prefix}/${target_noncanonical}/sys-include"
elif test "x$with_sysroot" = xyes; then
glibc_header_dir="${exec_prefix}/${target_noncanonical}/sys-root/usr/include"
else
glibc_header_dir="${with_sysroot}/usr/include"
fi
else
glibc_header_dir=/usr/include
fi
# glibc 2.4 and later provides __stack_chk_fail and
# either __stack_chk_guard, or TLS access to stack guard canary.
if test -f $glibc_header_dir/features.h \
&& $EGREP '^[ ]*#[ ]*define[ ]+__GNU_LIBRARY__[ ]+([1-9][0-9]|[6-9])' \
$glibc_header_dir/features.h > /dev/null; then
if $EGREP '^[ ]*#[ ]*define[ ]+__GLIBC__[ ]+([1-9][0-9]|[3-9])' \
$glibc_header_dir/features.h > /dev/null; then
gcc_cv_libc_provides_ssp=yes
elif $EGREP '^[ ]*#[ ]*define[ ]+__GLIBC__[ ]+2' \
$glibc_header_dir/features.h > /dev/null \
&& $EGREP '^[ ]*#[ ]*define[ ]+__GLIBC_MINOR__[ ]+([1-9][0-9]|[4-9])' \
$glibc_header_dir/features.h > /dev/null; then
gcc_cv_libc_provides_ssp=yes
fi
fi
fi
echo "$as_me:$LINENO: result: $gcc_cv_libc_provides_ssp" >&5
echo "${ECHO_T}$gcc_cv_libc_provides_ssp" >&6 ;;
*) gcc_cv_libc_provides_ssp=no ;;
esac
if test x$gcc_cv_libc_provides_ssp = xyes; then
cat >>confdefs.h <<\_ACEOF
#define TARGET_LIBC_PROVIDES_SSP 1
_ACEOF
fi
# Find out what GC implementation we want, or may, use. # Find out what GC implementation we want, or may, use.
# Check whether --with-gc or --without-gc was given. # Check whether --with-gc or --without-gc was given.

View File

@ -2972,6 +2972,45 @@ if test x$with_sysroot = x && test x$host = x$target \
[Define to PREFIX/include if cpp should also search that directory.]) [Define to PREFIX/include if cpp should also search that directory.])
fi fi
# Test for stack protector support in target C library.
case "$target" in
*-*-linux*)
AC_CACHE_CHECK(__stack_chk_fail in target GNU C library,
gcc_cv_libc_provides_ssp,
[gcc_cv_libc_provides_ssp=no
if test x$host != x$target || test "x$TARGET_SYSTEM_ROOT" != x; then
if test "x$with_sysroot" = x; then
glibc_header_dir="${exec_prefix}/${target_noncanonical}/sys-include"
elif test "x$with_sysroot" = xyes; then
glibc_header_dir="${exec_prefix}/${target_noncanonical}/sys-root/usr/include"
else
glibc_header_dir="${with_sysroot}/usr/include"
fi
else
glibc_header_dir=/usr/include
fi
# glibc 2.4 and later provides __stack_chk_fail and
# either __stack_chk_guard, or TLS access to stack guard canary.
if test -f $glibc_header_dir/features.h \
&& $EGREP '^@<:@ @:>@*#[ ]*define[ ]+__GNU_LIBRARY__[ ]+([1-9][0-9]|[6-9])' \
$glibc_header_dir/features.h > /dev/null; then
if $EGREP '^@<:@ @:>@*#[ ]*define[ ]+__GLIBC__[ ]+([1-9][0-9]|[3-9])' \
$glibc_header_dir/features.h > /dev/null; then
gcc_cv_libc_provides_ssp=yes
elif $EGREP '^@<:@ @:>@*#[ ]*define[ ]+__GLIBC__[ ]+2' \
$glibc_header_dir/features.h > /dev/null \
&& $EGREP '^@<:@ @:>@*#[ ]*define[ ]+__GLIBC_MINOR__[ ]+([1-9][0-9]|[4-9])' \
$glibc_header_dir/features.h > /dev/null; then
gcc_cv_libc_provides_ssp=yes
fi
fi]) ;;
*) gcc_cv_libc_provides_ssp=no ;;
esac
if test x$gcc_cv_libc_provides_ssp = xyes; then
AC_DEFINE(TARGET_LIBC_PROVIDES_SSP, 1,
[Define if your target C library provides stack protector support])
fi
# Find out what GC implementation we want, or may, use. # Find out what GC implementation we want, or may, use.
AC_ARG_WITH(gc, AC_ARG_WITH(gc,
[ --with-gc={page,zone} choose the garbage collection mechanism to use [ --with-gc={page,zone} choose the garbage collection mechanism to use

View File

@ -668,6 +668,14 @@ proper position among the other output files. */
#define LINK_GCC_C_SEQUENCE_SPEC "%G %L %G" #define LINK_GCC_C_SEQUENCE_SPEC "%G %L %G"
#endif #endif
#ifndef LINK_SSP_SPEC
#ifdef TARGET_LIBC_PROVIDES_SSP
#define LINK_SSP_SPEC "%{fstack-protector:}"
#else
#define LINK_SSP_SPEC "%{fstack-protector:-lssp_nonshared -lssp }"
#endif
#endif
#ifndef LINK_PIE_SPEC #ifndef LINK_PIE_SPEC
#ifdef HAVE_LD_PIE #ifdef HAVE_LD_PIE
#define LINK_PIE_SPEC "%{pie:-pie} " #define LINK_PIE_SPEC "%{pie:-pie} "
@ -689,7 +697,7 @@ proper position among the other output files. */
%{s} %{t} %{u*} %{x} %{z} %{Z} %{!A:%{!nostdlib:%{!nostartfiles:%S}}}\ %{s} %{t} %{u*} %{x} %{z} %{Z} %{!A:%{!nostdlib:%{!nostartfiles:%S}}}\
%{static:} %{L*} %(mfwrap) %(link_libgcc) %o %(mflib)\ %{static:} %{L*} %(mfwrap) %(link_libgcc) %o %(mflib)\
%{fprofile-arcs|fprofile-generate|coverage:-lgcov}\ %{fprofile-arcs|fprofile-generate|coverage:-lgcov}\
%{!nostdlib:%{!nodefaultlibs:%(link_gcc_c_sequence)}}\ %{!nostdlib:%{!nodefaultlibs:%(link_ssp)%(link_gcc_c_sequence)}}\
%{!A:%{!nostdlib:%{!nostartfiles:%E}}} %{T*} }}}}}}" %{!A:%{!nostdlib:%{!nostartfiles:%E}}} %{T*} }}}}}}"
#endif #endif
@ -719,6 +727,7 @@ static const char *cpp_spec = CPP_SPEC;
static const char *cc1_spec = CC1_SPEC; static const char *cc1_spec = CC1_SPEC;
static const char *cc1plus_spec = CC1PLUS_SPEC; static const char *cc1plus_spec = CC1PLUS_SPEC;
static const char *link_gcc_c_sequence_spec = LINK_GCC_C_SEQUENCE_SPEC; static const char *link_gcc_c_sequence_spec = LINK_GCC_C_SEQUENCE_SPEC;
static const char *link_ssp_spec = LINK_SSP_SPEC;
static const char *asm_spec = ASM_SPEC; static const char *asm_spec = ASM_SPEC;
static const char *asm_final_spec = ASM_FINAL_SPEC; static const char *asm_final_spec = ASM_FINAL_SPEC;
static const char *link_spec = LINK_SPEC; static const char *link_spec = LINK_SPEC;
@ -1516,6 +1525,7 @@ static struct spec_list static_specs[] =
INIT_STATIC_SPEC ("cc1_options", &cc1_options), INIT_STATIC_SPEC ("cc1_options", &cc1_options),
INIT_STATIC_SPEC ("cc1plus", &cc1plus_spec), INIT_STATIC_SPEC ("cc1plus", &cc1plus_spec),
INIT_STATIC_SPEC ("link_gcc_c_sequence", &link_gcc_c_sequence_spec), INIT_STATIC_SPEC ("link_gcc_c_sequence", &link_gcc_c_sequence_spec),
INIT_STATIC_SPEC ("link_ssp", &link_ssp_spec),
INIT_STATIC_SPEC ("endfile", &endfile_spec), INIT_STATIC_SPEC ("endfile", &endfile_spec),
INIT_STATIC_SPEC ("link", &link_spec), INIT_STATIC_SPEC ("link", &link_spec),
INIT_STATIC_SPEC ("lib", &lib_spec), INIT_STATIC_SPEC ("lib", &lib_spec),

View File

@ -252,10 +252,3 @@ GCC_4.0.0 {
__mulxc3 __mulxc3
__multc3 __multc3
} }
%inherit GCC_4.1.0 GCC_4.0.0
GCC_4.1.0 {
# stack smash handler symbols
__stack_chk_guard
__stack_chk_fail
}

View File

@ -2015,141 +2015,3 @@ func_ptr __DTOR_LIST__[2];
#endif #endif
#endif /* no INIT_SECTION_ASM_OP and not CTOR_LISTS_DEFINED_EXTERNALLY */ #endif /* no INIT_SECTION_ASM_OP and not CTOR_LISTS_DEFINED_EXTERNALLY */
#endif /* L_ctors */ #endif /* L_ctors */
#ifdef L_stack_chk
#ifndef TARGET_LIBC_PROVIDES_SSP
#ifndef inhibit_libc
# include <string.h>
# include <unistd.h>
# include <fcntl.h>
# ifdef HAVE_PATHS_H
# include <paths.h>
# endif
# ifndef _PATH_TTY
# define _PATH_TTY "/dev/tty"
# endif
# ifdef HAVE_SYSLOG_H
# include <syslog.h>
# endif
#endif
void *__stack_chk_guard = 0;
static void __attribute__ ((constructor))
__guard_setup (void)
{
unsigned char *p;
if (__stack_chk_guard != 0)
return;
#ifndef inhibit_libc
{
int fd = open ("/dev/urandom", O_RDONLY);
if (fd != -1)
{
ssize_t size = read (fd, &__stack_chk_guard,
sizeof (__stack_chk_guard));
close (fd);
if (size == sizeof(__stack_chk_guard))
return;
}
}
#endif
/* If a random generator can't be used, the protector switches the guard
to the "terminator canary". */
p = (unsigned char *)&__stack_chk_guard;
p[sizeof(__stack_chk_guard)-1] = 255;
p[sizeof(__stack_chk_guard)-2] = '\n';
p[0] = 0;
}
void
__stack_chk_fail (void)
{
#ifndef inhibit_libc
# ifdef __GNU_LIBRARY__
extern char * __progname;
# else
static const char __progname[] = "";
# endif
int fd;
/* Print error message directly to the tty. This avoids Bad Things
happening if stderr is redirected. */
fd = open (_PATH_TTY, O_WRONLY);
if (fd != -1)
{
static const char msg1[] = "*** stack smashing detected ***: ";
static const char msg2[] = " terminated\n";
size_t progname_len, len;
char *buf, *p;
progname_len = strlen (__progname);
len = sizeof(msg1)-1 + progname_len + sizeof(msg2)-1 + 1;
p = buf = alloca (len);
memcpy (p, msg1, sizeof(msg1)-1);
p += sizeof(msg1)-1;
memcpy (p, __progname, progname_len);
p += progname_len;
memcpy (p, msg2, sizeof(msg2));
while (len > 0)
{
ssize_t wrote = write (fd, buf, len);
if (wrote < 0)
break;
len -= wrote;
}
close (fd);
}
# ifdef HAVE_SYSLOG_H
/* Only send the error to syslog if there was no tty available. */
else
syslog (LOG_CRIT, "stack smashing detected: terminated");
# endif /* HAVE_SYSLOG_H */
#endif /* inhibit_libc */
/* Try very hard to exit. Note that signals may be blocked preventing
the first two options from working. The use of volatile is here to
prevent optimizers from "knowing" that __builtin_trap is called first,
and that it doesn't return, and so "obviously" the rest of the code
is dead. */
{
volatile int state;
for (state = 0; ; state++)
switch (state)
{
case 0:
__builtin_trap ();
break;
case 1:
*(volatile int *)-1L = 0;
break;
case 2:
_exit (127);
break;
}
}
}
#endif /* TARGET_LIBC_PROVIDES_SSP */
#endif /* L_stack_chk */
#ifdef L_stack_chk_local
#ifndef TARGET_LIBC_PROVIDES_SSP
/* Some targets can avoid loading a GP for calls to hidden functions.
Using this entry point may avoid the load of a GP entirely for the
function, making the overall code smaller. */
void
__stack_chk_fail_local (void)
{
__stack_chk_fail ();
}
#endif /* TARGET_LIBC_PROVIDES_SSP */
#endif /* L_stack_chk_local */

View File

@ -390,11 +390,6 @@ extern int __parityDI2 (UDWtype);
extern void __enable_execute_stack (void *); extern void __enable_execute_stack (void *);
extern void *__stack_chk_guard;
extern void __stack_chk_fail (void) __attribute__ ((__noreturn__));
extern void __stack_chk_fail_local (void)
__attribute__ ((__noreturn__)) ATTRIBUTE_HIDDEN;
#ifndef HIDE_EXPORTS #ifndef HIDE_EXPORTS
#pragma GCC visibility pop #pragma GCC visibility pop
#endif #endif

View File

@ -63,7 +63,7 @@ lib2funcs='_muldi3 _negdi2 _lshrdi3 _ashldi3 _ashrdi3
_ffssi2 _ffsdi2 _clz _clzsi2 _clzdi2 _ctzsi2 _ctzdi2 _popcount_tab _ffssi2 _ffsdi2 _clz _clzsi2 _clzdi2 _ctzsi2 _ctzdi2 _popcount_tab
_popcountsi2 _popcountdi2 _paritysi2 _paritydi2 _powisf2 _powidf2 _popcountsi2 _popcountdi2 _paritysi2 _paritydi2 _powisf2 _powidf2
_powixf2 _powitf2 _mulsc3 _muldc3 _mulxc3 _multc3 _divsc3 _divdc3 _powixf2 _powitf2 _mulsc3 _muldc3 _mulxc3 _multc3 _divsc3 _divdc3
_divxc3 _divtc3 _stack_chk _stack_chk_local' _divxc3 _divtc3'
# Disable SHLIB_LINK if shared libgcc not enabled. # Disable SHLIB_LINK if shared libgcc not enabled.
if [ "@enable_shared@" = "no" ]; then if [ "@enable_shared@" = "no" ]; then

1
libssp/.cvsignore Normal file
View File

@ -0,0 +1 @@
autom4te.cache

3
libssp/ChangeLog Normal file
View File

@ -0,0 +1,3 @@
2005-07-02 Jakub Jelinek <jakub@redhat.com>
* ALL: First release as more than just a single file.

92
libssp/Makefile.am Normal file
View File

@ -0,0 +1,92 @@
## Makefile for the toplevel directory of the libssp library.
##
## Copyright (C) 2005
## Free Software Foundation, Inc.
##
AUTOMAKE_OPTIONS = 1.9.5 foreign
ACLOCAL_AMFLAGS = -I .. -I ../config
MAINT_CHARSET = latin1
# May be used by various substitution variables.
gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
if LIBSSP_USE_SYMVER
version_arg = -Wl,--version-script=$(srcdir)/ssp.map
version_dep = $(srcdir)/ssp.map
else
version_arg =
version_dep =
endif
AM_CFLAGS = -Wall
toolexeclib_LTLIBRARIES = libssp.la libssp_nonshared.la
nobase_include_HEADERS = ssp/ssp.h ssp/string.h ssp/stdio.h ssp/unistd.h
libssp_la_SOURCES = \
ssp.c gets-chk.c memcpy-chk.c memmove-chk.c mempcpy-chk.c \
memset-chk.c snprintf-chk.c sprintf-chk.c stpcpy-chk.c \
strcat-chk.c strcpy-chk.c strncat-chk.c strncpy-chk.c \
vsnprintf-chk.c vsprintf-chk.c
libssp_la_LIBADD =
libssp_la_DEPENDENCIES = $(version_dep) $(libssp_la_LIBADD)
libssp_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
$(version_arg)
libssp_nonshared_la_SOURCES = \
ssp-local.c
libssp_nonshared_la_CFLAGS = -prefer-pic
libssp_nonshared_la_LIBADD =
libssp_nonshared_la_DEPENDENCIES = $(libssp_nonshared_la_LIBADD)
libssp_nonshared_la_LDFLAGS = -static
# XXX hack alert
# From libffi/Makefile.am
# Work around what appears to be a GNU make bug handling MAKEFLAGS
# values defined in terms of make variables, as is the case for CC and
# friends when we are called from the top level Makefile.
AM_MAKEFLAGS = \
"AR_FLAGS=$(AR_FLAGS)" \
"CC_FOR_BUILD=$(CC_FOR_BUILD)" \
"CFLAGS=$(CFLAGS)" \
"CXXFLAGS=$(CXXFLAGS)" \
"CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \
"CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \
"INSTALL=$(INSTALL)" \
"INSTALL_DATA=$(INSTALL_DATA)" \
"INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
"INSTALL_SCRIPT=$(INSTALL_SCRIPT)" \
"JC1FLAGS=$(JC1FLAGS)" \
"LDFLAGS=$(LDFLAGS)" \
"LIBCFLAGS=$(LIBCFLAGS)" \
"LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" \
"MAKE=$(MAKE)" \
"MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \
"PICFLAG=$(PICFLAG)" \
"PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" \
"SHELL=$(SHELL)" \
"RUNTESTFLAGS=$(RUNTESTFLAGS)" \
"exec_prefix=$(exec_prefix)" \
"infodir=$(infodir)" \
"libdir=$(libdir)" \
"prefix=$(prefix)" \
"includedir=$(includedir)" \
"AR=$(AR)" \
"AS=$(AS)" \
"CC=$(CC)" \
"CXX=$(CXX)" \
"LD=$(LD)" \
"LIBCFLAGS=$(LIBCFLAGS)" \
"NM=$(NM)" \
"PICFLAG=$(PICFLAG)" \
"RANLIB=$(RANLIB)" \
"DESTDIR=$(DESTDIR)"
MAKEOVERRIDES=
## ################################################################

755
libssp/Makefile.in Normal file
View File

@ -0,0 +1,755 @@
# Makefile.in generated by automake 1.9.5 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in 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.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
SOURCES = $(libssp_la_SOURCES) $(libssp_nonshared_la_SOURCES)
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = .
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
DIST_COMMON = $(am__configure_deps) $(nobase_include_HEADERS) \
$(srcdir)/../compile $(srcdir)/../config.guess \
$(srcdir)/../config.sub $(srcdir)/../depcomp \
$(srcdir)/../install-sh $(srcdir)/../ltmain.sh \
$(srcdir)/../missing $(srcdir)/../mkinstalldirs \
$(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/config.h.in $(top_srcdir)/configure \
$(top_srcdir)/ssp/ssp.h.in ChangeLog
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../libtool.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno configure.status.lineno
mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
CONFIG_HEADER = config.h
CONFIG_CLEAN_FILES = ssp/ssp.h
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
am__installdirs = "$(DESTDIR)$(toolexeclibdir)" \
"$(DESTDIR)$(includedir)"
toolexeclibLTLIBRARIES_INSTALL = $(INSTALL)
LTLIBRARIES = $(toolexeclib_LTLIBRARIES)
am_libssp_la_OBJECTS = ssp.lo gets-chk.lo memcpy-chk.lo memmove-chk.lo \
mempcpy-chk.lo memset-chk.lo snprintf-chk.lo sprintf-chk.lo \
stpcpy-chk.lo strcat-chk.lo strcpy-chk.lo strncat-chk.lo \
strncpy-chk.lo vsnprintf-chk.lo vsprintf-chk.lo
libssp_la_OBJECTS = $(am_libssp_la_OBJECTS)
am_libssp_nonshared_la_OBJECTS = libssp_nonshared_la-ssp-local.lo
libssp_nonshared_la_OBJECTS = $(am_libssp_nonshared_la_OBJECTS)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I.
depcomp = $(SHELL) $(top_srcdir)/../depcomp
am__depfiles_maybe = depfiles
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(libssp_la_SOURCES) $(libssp_nonshared_la_SOURCES)
DIST_SOURCES = $(libssp_la_SOURCES) $(libssp_nonshared_la_SOURCES)
MULTISRCTOP =
MULTIBUILDTOP =
MULTIDIRS =
MULTISUBDIR =
MULTIDO = true
MULTICLEAN = true
nobase_includeHEADERS_INSTALL = $(install_sh_DATA)
HEADERS = $(nobase_include_HEADERS)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
am__remove_distdir = \
{ test ! -d $(distdir) \
|| { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
&& rm -fr $(distdir); }; }
DIST_ARCHIVES = $(distdir).tar.gz
GZIP_ENV = --best
distuninstallcheck_listfiles = find . -type f -print
distcleancheck_listfiles = find . -type f -print
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBSSP_USE_SYMVER_FALSE = @LIBSSP_USE_SYMVER_FALSE@
LIBSSP_USE_SYMVER_TRUE = @LIBSSP_USE_SYMVER_TRUE@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
ac_ct_CC = @ac_ct_CC@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
enable_shared = @enable_shared@
enable_static = @enable_static@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
multi_basedir = @multi_basedir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
ssp_have_usable_vsnprintf = @ssp_have_usable_vsnprintf@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
toolexecdir = @toolexecdir@
toolexeclibdir = @toolexeclibdir@
AUTOMAKE_OPTIONS = 1.9.5 foreign
ACLOCAL_AMFLAGS = -I .. -I ../config
MAINT_CHARSET = latin1
# May be used by various substitution variables.
gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
@LIBSSP_USE_SYMVER_FALSE@version_arg =
@LIBSSP_USE_SYMVER_TRUE@version_arg = -Wl,--version-script=$(srcdir)/ssp.map
@LIBSSP_USE_SYMVER_FALSE@version_dep =
@LIBSSP_USE_SYMVER_TRUE@version_dep = $(srcdir)/ssp.map
AM_CFLAGS = -Wall
toolexeclib_LTLIBRARIES = libssp.la libssp_nonshared.la
nobase_include_HEADERS = ssp/ssp.h ssp/string.h ssp/stdio.h ssp/unistd.h
libssp_la_SOURCES = \
ssp.c gets-chk.c memcpy-chk.c memmove-chk.c mempcpy-chk.c \
memset-chk.c snprintf-chk.c sprintf-chk.c stpcpy-chk.c \
strcat-chk.c strcpy-chk.c strncat-chk.c strncpy-chk.c \
vsnprintf-chk.c vsprintf-chk.c
libssp_la_LIBADD =
libssp_la_DEPENDENCIES = $(version_dep) $(libssp_la_LIBADD)
libssp_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
$(version_arg)
libssp_nonshared_la_SOURCES = \
ssp-local.c
libssp_nonshared_la_CFLAGS = -prefer-pic
libssp_nonshared_la_LIBADD =
libssp_nonshared_la_DEPENDENCIES = $(libssp_nonshared_la_LIBADD)
libssp_nonshared_la_LDFLAGS = -static
# XXX hack alert
# From libffi/Makefile.am
# Work around what appears to be a GNU make bug handling MAKEFLAGS
# values defined in terms of make variables, as is the case for CC and
# friends when we are called from the top level Makefile.
AM_MAKEFLAGS = \
"AR_FLAGS=$(AR_FLAGS)" \
"CC_FOR_BUILD=$(CC_FOR_BUILD)" \
"CFLAGS=$(CFLAGS)" \
"CXXFLAGS=$(CXXFLAGS)" \
"CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \
"CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \
"INSTALL=$(INSTALL)" \
"INSTALL_DATA=$(INSTALL_DATA)" \
"INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
"INSTALL_SCRIPT=$(INSTALL_SCRIPT)" \
"JC1FLAGS=$(JC1FLAGS)" \
"LDFLAGS=$(LDFLAGS)" \
"LIBCFLAGS=$(LIBCFLAGS)" \
"LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" \
"MAKE=$(MAKE)" \
"MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \
"PICFLAG=$(PICFLAG)" \
"PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" \
"SHELL=$(SHELL)" \
"RUNTESTFLAGS=$(RUNTESTFLAGS)" \
"exec_prefix=$(exec_prefix)" \
"infodir=$(infodir)" \
"libdir=$(libdir)" \
"prefix=$(prefix)" \
"includedir=$(includedir)" \
"AR=$(AR)" \
"AS=$(AS)" \
"CC=$(CC)" \
"CXX=$(CXX)" \
"LD=$(LD)" \
"LIBCFLAGS=$(LIBCFLAGS)" \
"NM=$(NM)" \
"PICFLAG=$(PICFLAG)" \
"RANLIB=$(RANLIB)" \
"DESTDIR=$(DESTDIR)"
MAKEOVERRIDES =
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
am--refresh:
@:
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \
cd $(srcdir) && $(AUTOMAKE) --foreign \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --foreign Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
echo ' $(SHELL) ./config.status'; \
$(SHELL) ./config.status;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(srcdir) && $(AUTOCONF)
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
config.h: stamp-h1
@if test ! -f $@; then \
rm -f stamp-h1; \
$(MAKE) stamp-h1; \
else :; fi
stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
@rm -f stamp-h1
cd $(top_builddir) && $(SHELL) ./config.status config.h
$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_srcdir) && $(AUTOHEADER)
rm -f stamp-h1
touch $@
distclean-hdr:
-rm -f config.h stamp-h1
ssp/ssp.h: $(top_builddir)/config.status $(top_srcdir)/ssp/ssp.h.in
cd $(top_builddir) && $(SHELL) ./config.status $@
install-toolexeclibLTLIBRARIES: $(toolexeclib_LTLIBRARIES)
@$(NORMAL_INSTALL)
test -z "$(toolexeclibdir)" || $(mkdir_p) "$(DESTDIR)$(toolexeclibdir)"
@list='$(toolexeclib_LTLIBRARIES)'; for p in $$list; do \
if test -f $$p; then \
f=$(am__strip_dir) \
echo " $(LIBTOOL) --mode=install $(toolexeclibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(toolexeclibdir)/$$f'"; \
$(LIBTOOL) --mode=install $(toolexeclibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(toolexeclibdir)/$$f"; \
else :; fi; \
done
uninstall-toolexeclibLTLIBRARIES:
@$(NORMAL_UNINSTALL)
@set -x; list='$(toolexeclib_LTLIBRARIES)'; for p in $$list; do \
p=$(am__strip_dir) \
echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(toolexeclibdir)/$$p'"; \
$(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(toolexeclibdir)/$$p"; \
done
clean-toolexeclibLTLIBRARIES:
-test -z "$(toolexeclib_LTLIBRARIES)" || rm -f $(toolexeclib_LTLIBRARIES)
@list='$(toolexeclib_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
test "$$dir" != "$$p" || dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
libssp.la: $(libssp_la_OBJECTS) $(libssp_la_DEPENDENCIES)
$(LINK) -rpath $(toolexeclibdir) $(libssp_la_LDFLAGS) $(libssp_la_OBJECTS) $(libssp_la_LIBADD) $(LIBS)
libssp_nonshared.la: $(libssp_nonshared_la_OBJECTS) $(libssp_nonshared_la_DEPENDENCIES)
$(LINK) -rpath $(toolexeclibdir) $(libssp_nonshared_la_LDFLAGS) $(libssp_nonshared_la_OBJECTS) $(libssp_nonshared_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gets-chk.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libssp_nonshared_la-ssp-local.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memcpy-chk.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memmove-chk.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mempcpy-chk.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memset-chk.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/snprintf-chk.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sprintf-chk.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssp.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stpcpy-chk.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strcat-chk.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strcpy-chk.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strncat-chk.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strncpy-chk.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vsnprintf-chk.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vsprintf-chk.Plo@am__quote@
.c.o:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
.c.lo:
@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
libssp_nonshared_la-ssp-local.lo: ssp-local.c
@am__fastdepCC_TRUE@ if $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libssp_nonshared_la_CFLAGS) $(CFLAGS) -MT libssp_nonshared_la-ssp-local.lo -MD -MP -MF "$(DEPDIR)/libssp_nonshared_la-ssp-local.Tpo" -c -o libssp_nonshared_la-ssp-local.lo `test -f 'ssp-local.c' || echo '$(srcdir)/'`ssp-local.c; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libssp_nonshared_la-ssp-local.Tpo" "$(DEPDIR)/libssp_nonshared_la-ssp-local.Plo"; else rm -f "$(DEPDIR)/libssp_nonshared_la-ssp-local.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ssp-local.c' object='libssp_nonshared_la-ssp-local.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libssp_nonshared_la_CFLAGS) $(CFLAGS) -c -o libssp_nonshared_la-ssp-local.lo `test -f 'ssp-local.c' || echo '$(srcdir)/'`ssp-local.c
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool
# GNU Make needs to see an explicit $(MAKE) variable in the command it
# runs to enable its job server during parallel builds. Hence the
# comments below.
all-multi:
$(MULTIDO) $(AM_MAKEFLAGS) DO=all multi-do # $(MAKE)
install-multi:
$(MULTIDO) $(AM_MAKEFLAGS) DO=install multi-do # $(MAKE)
mostlyclean-multi:
$(MULTICLEAN) $(AM_MAKEFLAGS) DO=mostlyclean multi-clean # $(MAKE)
clean-multi:
$(MULTICLEAN) $(AM_MAKEFLAGS) DO=clean multi-clean # $(MAKE)
distclean-multi:
$(MULTICLEAN) $(AM_MAKEFLAGS) DO=distclean multi-clean # $(MAKE)
maintainer-clean-multi:
$(MULTICLEAN) $(AM_MAKEFLAGS) DO=maintainer-clean multi-clean # $(MAKE)
uninstall-info-am:
install-nobase_includeHEADERS: $(nobase_include_HEADERS)
@$(NORMAL_INSTALL)
test -z "$(includedir)" || $(mkdir_p) "$(DESTDIR)$(includedir)"
@$(am__vpath_adj_setup) \
list='$(nobase_include_HEADERS)'; for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
$(am__vpath_adj) \
echo " $(nobase_includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includedir)/$$f'"; \
$(nobase_includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includedir)/$$f"; \
done
uninstall-nobase_includeHEADERS:
@$(NORMAL_UNINSTALL)
@$(am__vpath_adj_setup) \
list='$(nobase_include_HEADERS)'; for p in $$list; do \
$(am__vpath_adj) \
echo " rm -f '$(DESTDIR)$(includedir)/$$f'"; \
rm -f "$(DESTDIR)$(includedir)/$$f"; \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
$(am__remove_distdir)
mkdir $(distdir)
$(mkdir_p) $(distdir)/.. $(distdir)/../config $(distdir)/ssp
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkdir_p) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
-find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
|| chmod -R a+r $(distdir)
dist-gzip: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
dist-bzip2: distdir
tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
$(am__remove_distdir)
dist-tarZ: distdir
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
$(am__remove_distdir)
dist-shar: distdir
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
$(am__remove_distdir)
dist-zip: distdir
-rm -f $(distdir).zip
zip -rq $(distdir).zip $(distdir)
$(am__remove_distdir)
dist dist-all: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
# This target untars the dist file and tries a VPATH configuration. Then
# it guarantees that the distribution is self-contained by making another
# tarfile.
distcheck: dist
case '$(DIST_ARCHIVES)' in \
*.tar.gz*) \
GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
*.tar.bz2*) \
bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
*.tar.Z*) \
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
*.shar.gz*) \
GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
*.zip*) \
unzip $(distdir).zip ;;\
esac
chmod -R a-w $(distdir); chmod a+w $(distdir)
mkdir $(distdir)/_build
mkdir $(distdir)/_inst
chmod a-w $(distdir)
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
&& cd $(distdir)/_build \
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
$(DISTCHECK_CONFIGURE_FLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
&& $(MAKE) $(AM_MAKEFLAGS) check \
&& $(MAKE) $(AM_MAKEFLAGS) install \
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
distuninstallcheck \
&& chmod -R a-w "$$dc_install_base" \
&& ({ \
(cd ../.. && umask 077 && mkdir "$$dc_destdir") \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
} || { rm -rf "$$dc_destdir"; exit 1; }) \
&& rm -rf "$$dc_destdir" \
&& $(MAKE) $(AM_MAKEFLAGS) dist \
&& rm -rf $(DIST_ARCHIVES) \
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck
$(am__remove_distdir)
@(echo "$(distdir) archives ready for distribution: "; \
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}'
distuninstallcheck:
@cd $(distuninstallcheck_dir) \
&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
|| { echo "ERROR: files left after uninstall:" ; \
if test -n "$(DESTDIR)"; then \
echo " (check DESTDIR support)"; \
fi ; \
$(distuninstallcheck_listfiles) ; \
exit 1; } >&2
distcleancheck: distclean
@if test '$(srcdir)' = . ; then \
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
exit 1 ; \
fi
@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left in build directory after distclean:" ; \
$(distcleancheck_listfiles) ; \
exit 1; } >&2
check-am: all-am
check: check-am
all-am: Makefile $(LTLIBRARIES) all-multi $(HEADERS) config.h
installdirs:
for dir in "$(DESTDIR)$(toolexeclibdir)" "$(DESTDIR)$(includedir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am clean-multi
clean-am: clean-generic clean-libtool clean-toolexeclibLTLIBRARIES \
mostlyclean-am
distclean: distclean-am distclean-multi
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-hdr distclean-libtool distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am: install-nobase_includeHEADERS
install-exec-am: install-multi install-toolexeclibLTLIBRARIES
install-info: install-info-am
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am maintainer-clean-multi
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf $(top_srcdir)/autom4te.cache
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am mostlyclean-multi
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-info-am uninstall-nobase_includeHEADERS \
uninstall-toolexeclibLTLIBRARIES
.PHONY: CTAGS GTAGS all all-am all-multi am--refresh check check-am \
clean clean-generic clean-libtool clean-multi \
clean-toolexeclibLTLIBRARIES ctags dist dist-all dist-bzip2 \
dist-gzip dist-shar dist-tarZ dist-zip distcheck distclean \
distclean-compile distclean-generic distclean-hdr \
distclean-libtool distclean-multi distclean-tags \
distcleancheck distdir distuninstallcheck dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-exec install-exec-am install-info \
install-info-am install-man install-multi \
install-nobase_includeHEADERS install-strip \
install-toolexeclibLTLIBRARIES installcheck installcheck-am \
installdirs maintainer-clean maintainer-clean-generic \
maintainer-clean-multi mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool mostlyclean-multi pdf \
pdf-am ps ps-am tags uninstall uninstall-am uninstall-info-am \
uninstall-nobase_includeHEADERS \
uninstall-toolexeclibLTLIBRARIES
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

919
libssp/aclocal.m4 vendored Normal file
View File

@ -0,0 +1,919 @@
# generated automatically by aclocal 1.9.5 -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
# 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.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
# Copyright (C) 2002, 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.
# AM_AUTOMAKE_VERSION(VERSION)
# ----------------------------
# Automake X.Y traces this macro to ensure aclocal.m4 has been
# generated from the m4 files accompanying Automake X.Y.
AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"])
# AM_SET_CURRENT_AUTOMAKE_VERSION
# -------------------------------
# Call AM_AUTOMAKE_VERSION so it can be traced.
# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
[AM_AUTOMAKE_VERSION([1.9.5])])
# 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`
])
# AM_CONDITIONAL -*- Autoconf -*-
# Copyright (C) 1997, 2000, 2001, 2003, 2004, 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.
# serial 7
# AM_CONDITIONAL(NAME, SHELL-CONDITION)
# -------------------------------------
# Define a conditional.
AC_DEFUN([AM_CONDITIONAL],
[AC_PREREQ(2.52)dnl
ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
AC_SUBST([$1_TRUE])
AC_SUBST([$1_FALSE])
if $2; then
$1_TRUE=
$1_FALSE='#'
else
$1_TRUE='#'
$1_FALSE=
fi
AC_CONFIG_COMMANDS_PRE(
[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
AC_MSG_ERROR([[conditional "$1" was never defined.
Usually this means the macro was only invoked conditionally.]])
fi])])
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 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.
# serial 8
# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
# written in clear, in which case automake, when reading aclocal.m4,
# will think it sees a *use*, and therefore will trigger all it's
# C support machinery. Also note that it means that autoscan, seeing
# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
# _AM_DEPENDENCIES(NAME)
# ----------------------
# See how the compiler implements dependency checking.
# NAME is "CC", "CXX", "GCJ", or "OBJC".
# We try a few techniques and use that to set a single cache variable.
#
# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
# dependency, and given that the user is not expected to run this macro,
# just rely on AC_PROG_CC.
AC_DEFUN([_AM_DEPENDENCIES],
[AC_REQUIRE([AM_SET_DEPDIR])dnl
AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
AC_REQUIRE([AM_MAKE_INCLUDE])dnl
AC_REQUIRE([AM_DEP_TRACK])dnl
ifelse([$1], CC, [depcc="$CC" am_compiler_list=],
[$1], CXX, [depcc="$CXX" am_compiler_list=],
[$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
[$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
[depcc="$$1" am_compiler_list=])
AC_CACHE_CHECK([dependency style of $depcc],
[am_cv_$1_dependencies_compiler_type],
[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
# We make a subdir and do the tests there. Otherwise we can end up
# making bogus files that we don't know about and never remove. For
# instance it was reported that on HP-UX the gcc test will end up
# making a dummy file named `D' -- because `-MD' means `put the output
# in D'.
mkdir conftest.dir
# Copy depcomp to subdir because otherwise we won't find it if we're
# using a relative directory.
cp "$am_depcomp" conftest.dir
cd conftest.dir
# We will build objects and dependencies in a subdirectory because
# it helps to detect inapplicable dependency modes. For instance
# both Tru64's cc and ICC support -MD to output dependencies as a
# side effect of compilation, but ICC will put the dependencies in
# the current directory while Tru64 will put them in the object
# directory.
mkdir sub
am_cv_$1_dependencies_compiler_type=none
if test "$am_compiler_list" = ""; then
am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
fi
for depmode in $am_compiler_list; do
# Setup a source with many dependencies, because some compilers
# like to wrap large dependency lists on column 80 (with \), and
# we should not choose a depcomp mode which is confused by this.
#
# We need to recreate these files for each test, as the compiler may
# overwrite some of them when testing with obscure command lines.
# This happens at least with the AIX C compiler.
: > sub/conftest.c
for i in 1 2 3 4 5 6; do
echo '#include "conftst'$i'.h"' >> sub/conftest.c
# Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
# Solaris 8's {/usr,}/bin/sh.
touch sub/conftst$i.h
done
echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
case $depmode in
nosideeffect)
# after this tag, mechanisms are not by side-effect, so they'll
# only be used when explicitly requested
if test "x$enable_dependency_tracking" = xyes; then
continue
else
break
fi
;;
none) break ;;
esac
# We check with `-c' and `-o' for the sake of the "dashmstdout"
# mode. It turns out that the SunPro C++ compiler does not properly
# handle `-M -o', and we need to detect this.
if depmode=$depmode \
source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
$SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
>/dev/null 2>conftest.err &&
grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
${MAKE-make} -s -f confmf > /dev/null 2>&1; then
# icc doesn't choke on unknown options, it will just issue warnings
# or remarks (even with -Werror). So we grep stderr for any message
# that says an option was ignored or not supported.
# When given -MP, icc 7.0 and 7.1 complain thusly:
# icc: Command line warning: ignoring option '-M'; no argument required
# The diagnosis changed in icc 8.0:
# icc: Command line remark: option '-MP' not supported
if (grep 'ignoring option' conftest.err ||
grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
am_cv_$1_dependencies_compiler_type=$depmode
break
fi
fi
done
cd ..
rm -rf conftest.dir
else
am_cv_$1_dependencies_compiler_type=none
fi
])
AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
AM_CONDITIONAL([am__fastdep$1], [
test "x$enable_dependency_tracking" != xno \
&& test "$am_cv_$1_dependencies_compiler_type" = gcc3])
])
# AM_SET_DEPDIR
# -------------
# Choose a directory name for dependency files.
# This macro is AC_REQUIREd in _AM_DEPENDENCIES
AC_DEFUN([AM_SET_DEPDIR],
[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
])
# AM_DEP_TRACK
# ------------
AC_DEFUN([AM_DEP_TRACK],
[AC_ARG_ENABLE(dependency-tracking,
[ --disable-dependency-tracking speeds up one-time build
--enable-dependency-tracking do not reject slow dependency extractors])
if test "x$enable_dependency_tracking" != xno; then
am_depcomp="$ac_aux_dir/depcomp"
AMDEPBACKSLASH='\'
fi
AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
AC_SUBST([AMDEPBACKSLASH])
])
# Generate code to set up dependency tracking. -*- Autoconf -*-
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 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.
#serial 3
# _AM_OUTPUT_DEPENDENCY_COMMANDS
# ------------------------------
AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
[for mf in $CONFIG_FILES; do
# Strip MF so we end up with the name of the file.
mf=`echo "$mf" | sed -e 's/:.*$//'`
# Check whether this is an Automake generated Makefile or not.
# We used to match only the files named `Makefile.in', but
# some people rename them; so instead we look at the file content.
# Grep'ing the first line is not enough: some people post-process
# each Makefile.in and add a new line on top of each file to say so.
# So let's grep whole file.
if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
dirpart=`AS_DIRNAME("$mf")`
else
continue
fi
# Extract the definition of DEPDIR, am__include, and am__quote
# from the Makefile without running `make'.
DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
test -z "$DEPDIR" && continue
am__include=`sed -n 's/^am__include = //p' < "$mf"`
test -z "am__include" && continue
am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
# When using ansi2knr, U may be empty or an underscore; expand it
U=`sed -n 's/^U = //p' < "$mf"`
# Find all dependency output files, they are included files with
# $(DEPDIR) in their names. We invoke sed twice because it is the
# simplest approach to changing $(DEPDIR) to its actual value in the
# expansion.
for file in `sed -n "
s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
# Make sure the directory exists.
test -f "$dirpart/$file" && continue
fdir=`AS_DIRNAME(["$file"])`
AS_MKDIR_P([$dirpart/$fdir])
# echo "creating $dirpart/$file"
echo '# dummy' > "$dirpart/$file"
done
done
])# _AM_OUTPUT_DEPENDENCY_COMMANDS
# AM_OUTPUT_DEPENDENCY_COMMANDS
# -----------------------------
# This macro should only be invoked once -- use via AC_REQUIRE.
#
# This code is only required when automatic dependency tracking
# is enabled. FIXME. This creates each `.P' file that we will
# need in order to bootstrap the dependency handling code.
AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
[AC_CONFIG_COMMANDS([depfiles],
[test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
[AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
])
# Do all the work for Automake. -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 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.
# serial 12
# This macro actually does too much. Some checks are only needed if
# your package does certain things. But this isn't really a big deal.
# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
# AM_INIT_AUTOMAKE([OPTIONS])
# -----------------------------------------------
# The call with PACKAGE and VERSION arguments is the old style
# call (pre autoconf-2.50), which is being phased out. PACKAGE
# and VERSION should now be passed to AC_INIT and removed from
# the call to AM_INIT_AUTOMAKE.
# We support both call styles for the transition. After
# the next Automake release, Autoconf can make the AC_INIT
# arguments mandatory, and then we can depend on a new Autoconf
# release and drop the old call support.
AC_DEFUN([AM_INIT_AUTOMAKE],
[AC_PREREQ([2.58])dnl
dnl Autoconf wants to disallow AM_ names. We explicitly allow
dnl the ones we care about.
m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
AC_REQUIRE([AC_PROG_INSTALL])dnl
# test to see if srcdir already configured
if test "`cd $srcdir && pwd`" != "`pwd`" &&
test -f $srcdir/config.status; then
AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
fi
# test whether we have cygpath
if test -z "$CYGPATH_W"; then
if (cygpath --version) >/dev/null 2>/dev/null; then
CYGPATH_W='cygpath -w'
else
CYGPATH_W=echo
fi
fi
AC_SUBST([CYGPATH_W])
# Define the identity of the package.
dnl Distinguish between old-style and new-style calls.
m4_ifval([$2],
[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
AC_SUBST([PACKAGE], [$1])dnl
AC_SUBST([VERSION], [$2])],
[_AM_SET_OPTIONS([$1])dnl
AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
_AM_IF_OPTION([no-define],,
[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
# Some tools Automake needs.
AC_REQUIRE([AM_SANITY_CHECK])dnl
AC_REQUIRE([AC_ARG_PROGRAM])dnl
AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
AM_MISSING_PROG(AUTOCONF, autoconf)
AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
AM_MISSING_PROG(AUTOHEADER, autoheader)
AM_MISSING_PROG(MAKEINFO, makeinfo)
AM_PROG_INSTALL_SH
AM_PROG_INSTALL_STRIP
AC_REQUIRE([AM_PROG_MKDIR_P])dnl
# We need awk for the "check" target. The system "awk" is bad on
# some platforms.
AC_REQUIRE([AC_PROG_AWK])dnl
AC_REQUIRE([AC_PROG_MAKE_SET])dnl
AC_REQUIRE([AM_SET_LEADING_DOT])dnl
_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
[_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
[_AM_PROG_TAR([v7])])])
_AM_IF_OPTION([no-dependencies],,
[AC_PROVIDE_IFELSE([AC_PROG_CC],
[_AM_DEPENDENCIES(CC)],
[define([AC_PROG_CC],
defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
AC_PROVIDE_IFELSE([AC_PROG_CXX],
[_AM_DEPENDENCIES(CXX)],
[define([AC_PROG_CXX],
defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
])
])
# When config.status generates a header, we must update the stamp-h file.
# This file resides in the same directory as the config header
# that is generated. The stamp files are numbered to have different names.
# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
# loop where config.status creates the headers, so we can generate
# our stamp files there.
AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
[# Compute $1's index in $config_headers.
_am_stamp_count=1
for _am_header in $config_headers :; do
case $_am_header in
$1 | $1:* )
break ;;
* )
_am_stamp_count=`expr $_am_stamp_count + 1` ;;
esac
done
echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
# 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.
# AM_PROG_INSTALL_SH
# ------------------
# Define $install_sh.
AC_DEFUN([AM_PROG_INSTALL_SH],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
install_sh=${install_sh-"$am_aux_dir/install-sh"}
AC_SUBST(install_sh)])
# Add --enable-maintainer-mode option to configure. -*- Autoconf -*-
# From Jim Meyering
# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 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.
# serial 4
AC_DEFUN([AM_MAINTAINER_MODE],
[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
dnl maintainer-mode is disabled by default
AC_ARG_ENABLE(maintainer-mode,
[ --enable-maintainer-mode enable make rules and dependencies not useful
(and sometimes confusing) to the casual installer],
USE_MAINTAINER_MODE=$enableval,
USE_MAINTAINER_MODE=no)
AC_MSG_RESULT([$USE_MAINTAINER_MODE])
AM_CONDITIONAL(MAINTAINER_MODE, [test $USE_MAINTAINER_MODE = yes])
MAINT=$MAINTAINER_MODE_TRUE
AC_SUBST(MAINT)dnl
]
)
AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
# Check to see how 'make' treats includes. -*- Autoconf -*-
# Copyright (C) 2001, 2002, 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.
# serial 3
# AM_MAKE_INCLUDE()
# -----------------
# Check to see how make treats includes.
AC_DEFUN([AM_MAKE_INCLUDE],
[am_make=${MAKE-make}
cat > confinc << 'END'
am__doit:
@echo done
.PHONY: am__doit
END
# If we don't find an include directive, just comment out the code.
AC_MSG_CHECKING([for style of include used by $am_make])
am__include="#"
am__quote=
_am_result=none
# First try GNU make style include.
echo "include confinc" > confmf
# We grep out `Entering directory' and `Leaving directory'
# messages which can occur if `w' ends up in MAKEFLAGS.
# In particular we don't look at `^make:' because GNU make might
# be invoked under some other name (usually "gmake"), in which
# case it prints its new name instead of `make'.
if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
am__include=include
am__quote=
_am_result=GNU
fi
# Now try BSD make style include.
if test "$am__include" = "#"; then
echo '.include "confinc"' > confmf
if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
am__include=.include
am__quote="\""
_am_result=BSD
fi
fi
AC_SUBST([am__include])
AC_SUBST([am__quote])
AC_MSG_RESULT([$_am_result])
rm -f confinc confmf
])
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
# Copyright (C) 1997, 1999, 2000, 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.
# serial 4
# AM_MISSING_PROG(NAME, PROGRAM)
# ------------------------------
AC_DEFUN([AM_MISSING_PROG],
[AC_REQUIRE([AM_MISSING_HAS_RUN])
$1=${$1-"${am_missing_run}$2"}
AC_SUBST($1)])
# AM_MISSING_HAS_RUN
# ------------------
# Define MISSING if not defined so far and test if it supports --run.
# If it does, set am_missing_run to use it, otherwise, to nothing.
AC_DEFUN([AM_MISSING_HAS_RUN],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
# Use eval to expand $SHELL
if eval "$MISSING --run true"; then
am_missing_run="$MISSING --run "
else
am_missing_run=
AC_MSG_WARN([`missing' script is too old or missing])
fi
])
# Copyright (C) 2003, 2004, 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.
# AM_PROG_MKDIR_P
# ---------------
# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise.
#
# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories
# created by `make install' are always world readable, even if the
# installer happens to have an overly restrictive umask (e.g. 077).
# This was a mistake. There are at least two reasons why we must not
# use `-m 0755':
# - it causes special bits like SGID to be ignored,
# - it may be too restrictive (some setups expect 775 directories).
#
# Do not use -m 0755 and let people choose whatever they expect by
# setting umask.
#
# We cannot accept any implementation of `mkdir' that recognizes `-p'.
# Some implementations (such as Solaris 8's) are not thread-safe: if a
# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c'
# concurrently, both version can detect that a/ is missing, but only
# one can create it and the other will error out. Consequently we
# restrict ourselves to GNU make (using the --version option ensures
# this.)
AC_DEFUN([AM_PROG_MKDIR_P],
[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
# We used to keeping the `.' as first argument, in order to
# allow $(mkdir_p) to be used without argument. As in
# $(mkdir_p) $(somedir)
# where $(somedir) is conditionally defined. However this is wrong
# for two reasons:
# 1. if the package is installed by a user who cannot write `.'
# make install will fail,
# 2. the above comment should most certainly read
# $(mkdir_p) $(DESTDIR)$(somedir)
# so it does not work when $(somedir) is undefined and
# $(DESTDIR) is not.
# To support the latter case, we have to write
# test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
# so the `.' trick is pointless.
mkdir_p='mkdir -p --'
else
# On NextStep and OpenStep, the `mkdir' command does not
# recognize any option. It will interpret all options as
# directories to create, and then abort because `.' already
# exists.
for d in ./-p ./--version;
do
test -d $d && rmdir $d
done
# $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
if test -f "$ac_aux_dir/mkinstalldirs"; then
mkdir_p='$(mkinstalldirs)'
else
mkdir_p='$(install_sh) -d'
fi
fi
AC_SUBST([mkdir_p])])
# Copyright (C) 1998, 1999, 2000, 2001, 2003, 2004, 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.
# serial 5
# AM_ENABLE_MULTILIB([MAKEFILE], [REL-TO-TOP-SRCDIR])
# ---------------------------------------------------
# Add --enable-multilib to configure.
AC_DEFUN([AM_ENABLE_MULTILIB],
[# Default to --enable-multilib
AC_ARG_ENABLE(multilib,
[ --enable-multilib build many library versions (default)],
[case "$enableval" in
yes) multilib=yes ;;
no) multilib=no ;;
*) AC_MSG_ERROR([bad value $enableval for multilib option]) ;;
esac],
[multilib=yes])
# We may get other options which we leave undocumented:
# --with-target-subdir, --with-multisrctop, --with-multisubdir
# See config-ml.in if you want the gory details.
if test "$srcdir" = "."; then
if test "$with_target_subdir" != "."; then
multi_basedir="$srcdir/$with_multisrctop../$2"
else
multi_basedir="$srcdir/$with_multisrctop$2"
fi
else
multi_basedir="$srcdir/$2"
fi
AC_SUBST(multi_basedir)
AC_OUTPUT_COMMANDS([
# Only add multilib support code if we just rebuilt the top-level
# Makefile.
case " $CONFIG_FILES " in
*" ]m4_default([$1],Makefile)[ "*)
ac_file=]m4_default([$1],Makefile)[ . ${multi_basedir}/config-ml.in
;;
esac],
[
srcdir="$srcdir"
host="$host"
target="$target"
with_multisubdir="$with_multisubdir"
with_multisrctop="$with_multisrctop"
with_target_subdir="$with_target_subdir"
ac_configure_args="${multilib_arg} ${ac_configure_args}"
multi_basedir="$multi_basedir"
CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
CC="$CC"])])dnl
# Helper functions for option handling. -*- Autoconf -*-
# Copyright (C) 2001, 2002, 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.
# serial 3
# _AM_MANGLE_OPTION(NAME)
# -----------------------
AC_DEFUN([_AM_MANGLE_OPTION],
[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
# _AM_SET_OPTION(NAME)
# ------------------------------
# Set option NAME. Presently that only means defining a flag for this option.
AC_DEFUN([_AM_SET_OPTION],
[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
# _AM_SET_OPTIONS(OPTIONS)
# ----------------------------------
# OPTIONS is a space-separated list of Automake options.
AC_DEFUN([_AM_SET_OPTIONS],
[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
# -------------------------------------------
# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
AC_DEFUN([_AM_IF_OPTION],
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
# Check to make sure that the build environment is sane. -*- Autoconf -*-
# Copyright (C) 1996, 1997, 2000, 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.
# serial 4
# AM_SANITY_CHECK
# ---------------
AC_DEFUN([AM_SANITY_CHECK],
[AC_MSG_CHECKING([whether build environment is sane])
# Just in case
sleep 1
echo timestamp > conftest.file
# Do `set' in a subshell so we don't clobber the current shell's
# arguments. Must try -L first in case configure is actually a
# symlink; some systems play weird games with the mod time of symlinks
# (eg FreeBSD returns the mod time of the symlink's containing
# directory).
if (
set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
if test "$[*]" = "X"; then
# -L didn't work.
set X `ls -t $srcdir/configure conftest.file`
fi
rm -f conftest.file
if test "$[*]" != "X $srcdir/configure conftest.file" \
&& test "$[*]" != "X conftest.file $srcdir/configure"; then
# If neither matched, then we have a broken ls. This can happen
# if, for instance, CONFIG_SHELL is bash and it inherits a
# broken ls alias from the environment. This has actually
# happened. Such a system could not be considered "sane".
AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
alias in your environment])
fi
test "$[2]" = conftest.file
)
then
# Ok.
:
else
AC_MSG_ERROR([newly created file is older than distributed files!
Check your system clock])
fi
AC_MSG_RESULT(yes)])
# 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.
# AM_PROG_INSTALL_STRIP
# ---------------------
# One issue with vendor `install' (even GNU) is that you can't
# specify the program used to strip binaries. This is especially
# annoying in cross-compiling environments, where the build's strip
# is unlikely to handle the host's binaries.
# Fortunately install-sh will honor a STRIPPROG variable, so we
# always use install-sh in `make install-strip', and initialize
# STRIPPROG with the value of the STRIP variable (set by the user).
AC_DEFUN([AM_PROG_INSTALL_STRIP],
[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
# Installed binaries are usually stripped using `strip' when the user
# run `make install-strip'. However `strip' might not be the right
# tool to use in cross-compilation environments, therefore Automake
# will honor the `STRIP' environment variable to overrule this program.
dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
if test "$cross_compiling" != no; then
AC_CHECK_TOOL([STRIP], [strip], :)
fi
INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
AC_SUBST([INSTALL_STRIP_PROGRAM])])
# Check how to create a tarball. -*- Autoconf -*-
# Copyright (C) 2004, 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.
# serial 2
# _AM_PROG_TAR(FORMAT)
# --------------------
# Check how to create a tarball in format FORMAT.
# FORMAT should be one of `v7', `ustar', or `pax'.
#
# Substitute a variable $(am__tar) that is a command
# writing to stdout a FORMAT-tarball containing the directory
# $tardir.
# tardir=directory && $(am__tar) > result.tar
#
# Substitute a variable $(am__untar) that extract such
# a tarball read from stdin.
# $(am__untar) < result.tar
AC_DEFUN([_AM_PROG_TAR],
[# Always define AMTAR for backward compatibility.
AM_MISSING_PROG([AMTAR], [tar])
m4_if([$1], [v7],
[am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
[m4_case([$1], [ustar],, [pax],,
[m4_fatal([Unknown tar format])])
AC_MSG_CHECKING([how to create a $1 tar archive])
# Loop over all known methods to create a tar archive until one works.
_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
_am_tools=${am_cv_prog_tar_$1-$_am_tools}
# Do not fold the above two line into one, because Tru64 sh and
# Solaris sh will not grok spaces in the rhs of `-'.
for _am_tool in $_am_tools
do
case $_am_tool in
gnutar)
for _am_tar in tar gnutar gtar;
do
AM_RUN_LOG([$_am_tar --version]) && break
done
am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
am__untar="$_am_tar -xf -"
;;
plaintar)
# Must skip GNU tar: if it does not support --format= it doesn't create
# ustar tarball either.
(tar --version) >/dev/null 2>&1 && continue
am__tar='tar chf - "$$tardir"'
am__tar_='tar chf - "$tardir"'
am__untar='tar xf -'
;;
pax)
am__tar='pax -L -x $1 -w "$$tardir"'
am__tar_='pax -L -x $1 -w "$tardir"'
am__untar='pax -r'
;;
cpio)
am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
am__untar='cpio -i -H $1 -d'
;;
none)
am__tar=false
am__tar_=false
am__untar=false
;;
esac
# If the value was cached, stop now. We just wanted to have am__tar
# and am__untar set.
test -n "${am_cv_prog_tar_$1}" && break
# tar/untar a dummy directory, and stop if the command works
rm -rf conftest.dir
mkdir conftest.dir
echo GrepMe > conftest.dir/file
AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
rm -rf conftest.dir
if test -s conftest.tar; then
AM_RUN_LOG([$am__untar <conftest.tar])
grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
fi
done
rm -rf conftest.dir
AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
AC_MSG_RESULT([$am_cv_prog_tar_$1])])
AC_SUBST([am__tar])
AC_SUBST([am__untar])
]) # _AM_PROG_TAR
m4_include([../config/depstand.m4])
m4_include([../config/lead-dot.m4])
m4_include([../libtool.m4])

85
libssp/config.h.in Normal file
View File

@ -0,0 +1,85 @@
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define to 1 if you have the <alloca.h> header file. */
#undef HAVE_ALLOCA_H
/* Define to 1 if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
/* __attribute__((visibility ("hidden"))) supported */
#undef HAVE_HIDDEN_VISIBILITY
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the <limits.h> header file. */
#undef HAVE_LIMITS_H
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the `mempcpy' function. */
#undef HAVE_MEMPCPY
/* Define to 1 if you have the <paths.h> header file. */
#undef HAVE_PATHS_H
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdio.h> header file. */
#undef HAVE_STDIO_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the `strncat' function. */
#undef HAVE_STRNCAT
/* Define to 1 if you have the `strncpy' function. */
#undef HAVE_STRNCPY
/* Define to 1 if you have the <syslog.h> header file. */
#undef HAVE_SYSLOG_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* vsnprintf is present and works */
#undef HAVE_USABLE_VSNPRINTF
/* Name of package */
#undef PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Version number of package */
#undef VERSION

6631
libssp/configure vendored Executable file

File diff suppressed because it is too large Load Diff

158
libssp/configure.ac Normal file
View File

@ -0,0 +1,158 @@
# Process this file with autoconf to produce a configure script, like so:
# aclocal && autoconf && autoheader && automake
AC_PREREQ(2.59)
AC_INIT(libssp, 1.0)
AC_CONFIG_SRCDIR(ssp.c)
AC_CANONICAL_SYSTEM
AM_INIT_AUTOMAKE
AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
AC_ARG_ENABLE(version-specific-runtime-libs,
[ --enable-version-specific-runtime-libs Specify that runtime libraries should be installed in a compiler-specific directory ],
[case "$enableval" in
yes) version_specific_libs=yes ;;
no) version_specific_libs=no ;;
*) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
esac],
[version_specific_libs=no])
AC_MSG_RESULT($version_specific_libs)
AM_MAINTAINER_MODE
AC_EXEEXT
AM_ENABLE_MULTILIB(, ..)
target_alias=${target_alias-$host_alias}
AC_SUBST(target_alias)
AC_CONFIG_HEADERS(config.h)
AC_LANG_C
# The same as in boehm-gc and libstdc++. Have to borrow it from there.
# We must force CC to /not/ be precious variables; otherwise
# the wrong, non-multilib-adjusted value will be used in multilibs.
# As a side effect, we have to subst CFLAGS ourselves.
m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
m4_define([_AC_ARG_VAR_PRECIOUS],[])
AC_PROG_CC
m4_rename([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
AC_SUBST(CFLAGS)
if test "x$GCC" != "xyes"; then
AC_MSG_ERROR([libssp must be built with GCC])
fi
AC_PROG_CPP
AC_MSG_CHECKING([whether -fstack-protector works])
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -fstack-protector -Werror"
AC_TRY_COMPILE([
void __attribute__((noinline)) bar (char *x)
{
__builtin_memset (x, 0, 64);
}],[char buf[64]; bar (buf);],
[AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)])
CFLAGS="$save_CFLAGS"
AC_MSG_CHECKING([whether hidden visibility is supported])
AC_TRY_COMPILE([
void __attribute__((visibility ("hidden"))) bar (void) {}],,
[ssp_hidden=yes],[ssp_hidden=no])
AC_MSG_RESULT($ssp_hidden)
if test x$ssp_hidden = xyes; then
AC_DEFINE([HAVE_HIDDEN_VISIBILITY],[1],[__attribute__((visibility ("hidden"))) supported])
fi
AC_MSG_CHECKING([whether symbol versioning is supported])
cat > conftest.map <<EOF
FOO_1.0 {
global: *foo*; bar; local: *;
};
EOF
save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -shared -Wl,--version-script,./conftest.map"
AC_TRY_LINK([int foo;],[],[ssp_use_symver=yes],[ssp_use_symver=no])
LDFLAGS="$save_LDFLAGS"
AC_MSG_RESULT($ssp_use_symver)
AM_CONDITIONAL(LIBSSP_USE_SYMVER, [test "x$ssp_use_symver" = xyes])
AC_CHECK_HEADERS(alloca.h paths.h syslog.h string.h unistd.h fcntl.h stdio.h limits.h)
AC_CHECK_FUNCS(mempcpy strncpy strncat)
AC_MSG_CHECKING([whether vsnprintf is usable])
AC_RUN_IFELSE(AC_LANG_PROGRAM([
#include <stdarg.h>
#include <string.h>
#include <stdio.h>
int foo (char *buf, size_t n, const char *fmt, ...)
{
va_list ap;
int ret;
va_start (ap, fmt);
ret = vsnprintf (buf, n, fmt, ap);
va_end (ap);
return ret;
}],
[char buf@<:@8@:>@; memset (buf, 'A', sizeof (buf));
if (foo (buf, 4, ".%s.", "CDEFG") != 7)
return 1;
return memcmp (buf, ".CD\0AAAA", sizeof (buf)) != 0;]),
[ssp_have_usable_vsnprintf=define],
[ssp_have_usable_vsnprintf=undef],
[ssp_have_usable_vsnprintf=undef])
if test "x$ssp_have_usable_vsnprintf" = xdefine; then
AC_MSG_RESULT(yes)
AC_DEFINE([HAVE_USABLE_VSNPRINTF],[1],[vsnprintf is present and works])
else
AC_MSG_RESULT(no)
fi
AC_SUBST(ssp_have_usable_vsnprintf)
AM_PROG_LIBTOOL
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
# Calculate toolexeclibdir
# Also toolexecdir, though it's only used in toolexeclibdir
case ${version_specific_libs} in
yes)
# Need the gcc compiler version to know where to install libraries
# and header files if --enable-version-specific-runtime-libs option
# is selected.
toolexecdir='$(libdir)/gcc/$(target_alias)'
toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)'
;;
no)
if test -n "$with_cross_host" &&
test x"$with_cross_host" != x"no"; then
# Install a library built with a cross compiler in tooldir, not libdir.
toolexecdir='$(exec_prefix)/$(target_alias)'
toolexeclibdir='$(toolexecdir)/lib'
else
toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
toolexeclibdir='$(libdir)'
fi
multi_os_directory=`$CC -print-multi-os-directory`
case $multi_os_directory in
.) ;; # Avoid trailing /.
*) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
esac
;;
esac
AC_SUBST(toolexecdir)
AC_SUBST(toolexeclibdir)
if test ${multilib} = yes; then
multilib_arg="--enable-multilib"
else
multilib_arg=
fi
AC_CONFIG_FILES([Makefile ssp/ssp.h])
AC_OUTPUT

88
libssp/gets-chk.c Normal file
View File

@ -0,0 +1,88 @@
/* Checking gets.
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.
In addition to the permissions in the GNU General Public License, the
Free Software Foundation gives you unlimited permission to link the
compiled version of this file into combinations with other programs,
and to distribute those combinations without any restriction coming
from the use of this file. (The General Public License restrictions
do apply in other respects; for example, they cover modification of
the file, and distribution when not linked into a combine
executable.)
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
/* As a special exception, if you link this library with files compiled with
GCC to produce an executable, this does not cause the resulting executable
to be covered by the GNU General Public License. This exception does not
however invalidate any other reasons why the executable file might be
covered by the GNU General Public License. */
#include "config.h"
#include <ssp/ssp.h>
#include <stdarg.h>
#ifdef HAVE_STDLIB_H
# include <stdlib.h>
#endif
#ifdef HAVE_ALLOCA_H
# include <alloca.h>
#endif
#ifdef HAVE_LIMITS_H
# include <limits.h>
#endif
#ifdef HAVE_STDIO_H
# include <stdio.h>
#endif
#ifdef HAVE_STRING_H
# include <string.h>
#endif
extern void __chk_fail (void) __attribute__((__noreturn__));
char *
__gets_chk (char *s, size_t slen)
{
char *ret, *buf;
if (slen >= (size_t) INT_MAX)
return gets (s);
if (slen <= 8192)
buf = alloca (slen + 1);
else
buf = malloc (slen + 1);
if (buf == NULL)
return gets (s);
ret = fgets (buf, (int) (slen + 1), stdin);
if (ret != NULL)
{
size_t len = strlen (buf);
if (len > 0 && buf[len - 1] == '\n')
--len;
if (len == slen)
__chk_fail ();
memcpy (s, buf, len);
s[len] = '\0';
ret = s;
}
if (slen > 8192)
free (buf);
return ret;
}

6
libssp/libtool-version Normal file
View File

@ -0,0 +1,6 @@
# This file is used to maintain libtool version info for libssp. See
# the libtool manual to understand the meaning of the fields. This is
# a separate file so that version updates don't involve re-running
# automake.
# CURRENT:REVISION:AGE
0:0:0

51
libssp/memcpy-chk.c Normal file
View File

@ -0,0 +1,51 @@
/* Checking memcpy.
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.
In addition to the permissions in the GNU General Public License, the
Free Software Foundation gives you unlimited permission to link the
compiled version of this file into combinations with other programs,
and to distribute those combinations without any restriction coming
from the use of this file. (The General Public License restrictions
do apply in other respects; for example, they cover modification of
the file, and distribution when not linked into a combine
executable.)
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
/* As a special exception, if you link this library with files compiled with
GCC to produce an executable, this does not cause the resulting executable
to be covered by the GNU General Public License. This exception does not
however invalidate any other reasons why the executable file might be
covered by the GNU General Public License. */
#include "config.h"
#include <ssp/ssp.h>
#ifdef HAVE_STRING_H
# include <string.h>
#endif
extern void __chk_fail (void) __attribute__((__noreturn__));
void *
__memcpy_chk (void *__restrict__ dest, const void *__restrict__ src,
size_t len, size_t slen)
{
if (len > slen)
__chk_fail ();
return memcpy (dest, src, len);
}

52
libssp/memmove-chk.c Normal file
View File

@ -0,0 +1,52 @@
/* Checking memmove.
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.
In addition to the permissions in the GNU General Public License, the
Free Software Foundation gives you unlimited permission to link the
compiled version of this file into combinations with other programs,
and to distribute those combinations without any restriction coming
from the use of this file. (The General Public License restrictions
do apply in other respects; for example, they cover modification of
the file, and distribution when not linked into a combine
executable.)
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
/* As a special exception, if you link this library with files compiled with
GCC to produce an executable, this does not cause the resulting executable
to be covered by the GNU General Public License. This exception does not
however invalidate any other reasons why the executable file might be
covered by the GNU General Public License. */
#include "config.h"
#include <ssp/ssp.h>
#ifdef HAVE_STRING_H
# include <string.h>
#endif
extern void __chk_fail (void) __attribute__((__noreturn__));
#ifdef HAVE_MEMPCPY
void *
__memmove_chk (void *dest, const void *src, size_t len, size_t slen)
{
if (len > slen)
__chk_fail ();
return memmove (dest, src, len);
}
#endif

53
libssp/mempcpy-chk.c Normal file
View File

@ -0,0 +1,53 @@
/* Checking mempcpy.
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.
In addition to the permissions in the GNU General Public License, the
Free Software Foundation gives you unlimited permission to link the
compiled version of this file into combinations with other programs,
and to distribute those combinations without any restriction coming
from the use of this file. (The General Public License restrictions
do apply in other respects; for example, they cover modification of
the file, and distribution when not linked into a combine
executable.)
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
/* As a special exception, if you link this library with files compiled with
GCC to produce an executable, this does not cause the resulting executable
to be covered by the GNU General Public License. This exception does not
however invalidate any other reasons why the executable file might be
covered by the GNU General Public License. */
#include "config.h"
#include <ssp/ssp.h>
#ifdef HAVE_STRING_H
# include <string.h>
#endif
extern void __chk_fail (void) __attribute__((__noreturn__));
#ifdef HAVE_MEMPCPY
void *
__mempcpy_chk (void *__restrict__ dest, const void *__restrict__ src,
size_t len, size_t slen)
{
if (len > slen)
__chk_fail ();
return memcpy (dest, src, len) + len;
}
#endif

50
libssp/memset-chk.c Normal file
View File

@ -0,0 +1,50 @@
/* Checking memset.
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.
In addition to the permissions in the GNU General Public License, the
Free Software Foundation gives you unlimited permission to link the
compiled version of this file into combinations with other programs,
and to distribute those combinations without any restriction coming
from the use of this file. (The General Public License restrictions
do apply in other respects; for example, they cover modification of
the file, and distribution when not linked into a combine
executable.)
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
/* As a special exception, if you link this library with files compiled with
GCC to produce an executable, this does not cause the resulting executable
to be covered by the GNU General Public License. This exception does not
however invalidate any other reasons why the executable file might be
covered by the GNU General Public License. */
#include "config.h"
#include <ssp/ssp.h>
#ifdef HAVE_STRING_H
# include <string.h>
#endif
extern void __chk_fail (void) __attribute__((__noreturn__));
void *
__memset_chk (void *dest, int val, size_t len, size_t slen)
{
if (len > slen)
__chk_fail ();
return memset (dest, val, len);
}

62
libssp/snprintf-chk.c Normal file
View File

@ -0,0 +1,62 @@
/* Checking snprintf.
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.
In addition to the permissions in the GNU General Public License, the
Free Software Foundation gives you unlimited permission to link the
compiled version of this file into combinations with other programs,
and to distribute those combinations without any restriction coming
from the use of this file. (The General Public License restrictions
do apply in other respects; for example, they cover modification of
the file, and distribution when not linked into a combine
executable.)
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
/* As a special exception, if you link this library with files compiled with
GCC to produce an executable, this does not cause the resulting executable
to be covered by the GNU General Public License. This exception does not
however invalidate any other reasons why the executable file might be
covered by the GNU General Public License. */
#include "config.h"
#include <ssp/ssp.h>
#include <stdarg.h>
#ifdef HAVE_STDIO_H
# include <stdio.h>
#endif
extern void __chk_fail (void) __attribute__((__noreturn__));
#ifdef HAVE_USABLE_VSNPRINTF
int
__snprintf_chk (char *s, size_t n, int flags __attribute__((unused)),
size_t slen, const char *format, ...)
{
va_list arg;
int done;
if (n > slen)
__chk_fail ();
va_start (arg, format);
done = vsnprintf (s, n, format, arg);
va_end (arg);
return done;
}
#endif

68
libssp/sprintf-chk.c Normal file
View File

@ -0,0 +1,68 @@
/* Checking sprintf.
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.
In addition to the permissions in the GNU General Public License, the
Free Software Foundation gives you unlimited permission to link the
compiled version of this file into combinations with other programs,
and to distribute those combinations without any restriction coming
from the use of this file. (The General Public License restrictions
do apply in other respects; for example, they cover modification of
the file, and distribution when not linked into a combine
executable.)
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
/* As a special exception, if you link this library with files compiled with
GCC to produce an executable, this does not cause the resulting executable
to be covered by the GNU General Public License. This exception does not
however invalidate any other reasons why the executable file might be
covered by the GNU General Public License. */
#include "config.h"
#include <ssp/ssp.h>
#include <stdarg.h>
#ifdef HAVE_LIMITS_H
# include <limits.h>
#endif
#ifdef HAVE_STDIO_H
# include <stdio.h>
#endif
extern void __chk_fail (void) __attribute__((__noreturn__));
#ifdef HAVE_USABLE_VSNPRINTF
int
__sprintf_chk (char *s, int flags __attribute__((unused)),
size_t slen, const char *format, ...)
{
va_list arg;
int done;
va_start (arg, format);
if (slen > (size_t) INT_MAX)
done = vsprintf (s, format, arg);
else
{
done = vsnprintf (s, slen, format, arg);
if (done >= 0 && (size_t) done >= slen)
__chk_fail ();
}
va_end (arg);
return done;
}
#endif

51
libssp/ssp-local.c Normal file
View File

@ -0,0 +1,51 @@
/* Stack protector support.
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.
In addition to the permissions in the GNU General Public License, the
Free Software Foundation gives you unlimited permission to link the
compiled version of this file into combinations with other programs,
and to distribute those combinations without any restriction coming
from the use of this file. (The General Public License restrictions
do apply in other respects; for example, they cover modification of
the file, and distribution when not linked into a combine
executable.)
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
/* As a special exception, if you link this library with files compiled with
GCC to produce an executable, this does not cause the resulting executable
to be covered by the GNU General Public License. This exception does not
however invalidate any other reasons why the executable file might be
covered by the GNU General Public License. */
#include "config.h"
extern void __stack_chk_fail (void);
/* Some targets can avoid loading a GP for calls to hidden functions.
Using this entry point may avoid the load of a GP entirely for the
function, making the overall code smaller. */
#ifdef HAVE_HIDDEN_VISIBILITY
void
__attribute__((visibility ("hidden")))
__stack_chk_fail_local (void)
{
__stack_chk_fail ();
}
#endif

178
libssp/ssp.c Normal file
View File

@ -0,0 +1,178 @@
/* Stack protector support.
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.
In addition to the permissions in the GNU General Public License, the
Free Software Foundation gives you unlimited permission to link the
compiled version of this file into combinations with other programs,
and to distribute those combinations without any restriction coming
from the use of this file. (The General Public License restrictions
do apply in other respects; for example, they cover modification of
the file, and distribution when not linked into a combine
executable.)
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
/* As a special exception, if you link this library with files compiled with
GCC to produce an executable, this does not cause the resulting executable
to be covered by the GNU General Public License. This exception does not
however invalidate any other reasons why the executable file might be
covered by the GNU General Public License. */
#include "config.h"
#ifdef HAVE_ALLOCA_H
# include <alloca.h>
#endif
#ifdef HAVE_STRING_H
# include <string.h>
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#ifdef HAVE_FCNTL_H
# include <fcntl.h>
#endif
#ifdef HAVE_PATHS_H
# include <paths.h>
#endif
#ifndef _PATH_TTY
# define _PATH_TTY "/dev/tty"
#endif
#ifdef HAVE_SYSLOG_H
# include <syslog.h>
#endif
void *__stack_chk_guard = 0;
static void __attribute__ ((constructor))
__guard_setup (void)
{
unsigned char *p;
int fd;
if (__stack_chk_guard != 0)
return;
fd = open ("/dev/urandom", O_RDONLY);
if (fd != -1)
{
ssize_t size = read (fd, &__stack_chk_guard,
sizeof (__stack_chk_guard));
close (fd);
if (size == sizeof(__stack_chk_guard) && __stack_chk_guard != 0)
return;
}
/* If a random generator can't be used, the protector switches the guard
to the "terminator canary". */
p = (unsigned char *) &__stack_chk_guard;
p[sizeof(__stack_chk_guard)-1] = 255;
p[sizeof(__stack_chk_guard)-2] = '\n';
p[0] = 0;
}
static void
fail (const char *msg1, size_t msg1len, const char *msg3)
{
#ifdef __GNU_LIBRARY__
extern char * __progname;
#else
static const char __progname[] = "";
#endif
int fd;
/* Print error message directly to the tty. This avoids Bad Things
happening if stderr is redirected. */
fd = open (_PATH_TTY, O_WRONLY);
if (fd != -1)
{
static const char msg2[] = " terminated\n";
size_t progname_len, len;
char *buf, *p;
progname_len = strlen (__progname);
len = msg1len + progname_len + sizeof(msg2)-1 + 1;
p = buf = alloca (len);
memcpy (p, msg1, msg1len);
p += msg1len;
memcpy (p, __progname, progname_len);
p += progname_len;
memcpy (p, msg2, sizeof(msg2));
while (len > 0)
{
ssize_t wrote = write (fd, buf, len);
if (wrote < 0)
break;
buf += wrote;
len -= wrote;
}
close (fd);
}
#ifdef HAVE_SYSLOG_H
/* Only send the error to syslog if there was no tty available. */
else
syslog (LOG_CRIT, msg3);
#endif /* HAVE_SYSLOG_H */
/* Try very hard to exit. Note that signals may be blocked preventing
the first two options from working. The use of volatile is here to
prevent optimizers from "knowing" that __builtin_trap is called first,
and that it doesn't return, and so "obviously" the rest of the code
is dead. */
{
volatile int state;
for (state = 0; ; state++)
switch (state)
{
case 0:
__builtin_trap ();
break;
case 1:
*(volatile int *)-1L = 0;
break;
case 2:
_exit (127);
break;
}
}
}
void
__stack_chk_fail (void)
{
const char *msg = "*** stack smashing detected ***: ";
fail (msg, strlen (msg), "stack smashing detected: terminated");
}
void
__chk_fail (void)
{
const char *msg = "*** buffer overflow detected ***: ";
fail (msg, strlen (msg), "buffer overflow detected: terminated");
}
#ifdef HAVE_HIDDEN_VISIBILITY
void
__attribute__((visibility ("hidden")))
__stack_chk_fail_local (void)
{
__stack_chk_fail ();
}
#endif

9
libssp/ssp.map Normal file
View File

@ -0,0 +1,9 @@
LIBSSP_1.0 {
global:
__stack_chk_fail; __stack_chk_guard; __chk_fail;
__gets_chk; __memcpy_chk; __memmove_chk; __mempcpy_chk; __memset_chk;
__snprintf_chk; __sprintf_chk; __stpcpy_chk; __strcat_chk; __strcpy_chk;
__strncat_chk; __strncpy_chk; __vsnprintf_chk; __vsprintf_chk;
local:
*;
};

66
libssp/ssp/ssp.h.in Normal file
View File

@ -0,0 +1,66 @@
/* Object size checking support macros.
Copyright (C) 2004, 2005 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.
In addition to the permissions in the GNU General Public License, the
Free Software Foundation gives you unlimited permission to link the
compiled version of this file into combinations with other programs,
and to distribute those combinations without any restriction coming
from the use of this file. (The General Public License restrictions
do apply in other respects; for example, they cover modification of
the file, and distribution when not linked into a combine
executable.)
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
/* As a special exception, if you link this library with files compiled with
GCC to produce an executable, this does not cause the resulting executable
to be covered by the GNU General Public License. This exception does not
however invalidate any other reasons why the executable file might be
covered by the GNU General Public License. */
#ifndef _SSP_H
#define _SSP_H 1
#if _FORTIFY_SOURCE > 0 && __OPTIMIZE__ > 0 \
&& defined __GNUC__ \
&& (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) \
&& !defined __cplusplus
# if _FORTIFY_SOURCE == 1
# define __SSP_FORTIFY_LEVEL 1
# elif _FORTIFY_SOURCE > 1
# define __SSP_FORTIFY_LEVEL 2
# endif
#endif
#if __SSP_FORTIFY_LEVEL > 0
# include <stddef.h>
# define __ssp_bos(ptr) __builtin_object_size (ptr, __SSP_FORTIFY_LEVEL > 1)
# define __ssp_bos0(ptr) __builtin_object_size (ptr, 0)
# define __SSP_REDIRECT(name, proto, alias) \
name proto __asm__ (__SSP_ASMNAME (#alias))
# define __SSP_ASMNAME(cname) __SSP_ASMNAME2 (__USER_LABEL_PREFIX__, cname)
# define __SSP_ASMNAME2(prefix, cname) __SSP_ASMNAME3 (prefix) cname
# define __SSP_ASMNAME3(prefix) #prefix
# @ssp_have_usable_vsnprintf@ __SSP_HAVE_VSNPRINTF
extern void __chk_fail (void) __attribute__((__noreturn__));
#endif
#endif /* _SSP_H */

101
libssp/ssp/stdio.h Normal file
View File

@ -0,0 +1,101 @@
/* Checking macros for stdio functions.
Copyright (C) 2004, 2005 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.
In addition to the permissions in the GNU General Public License, the
Free Software Foundation gives you unlimited permission to link the
compiled version of this file into combinations with other programs,
and to distribute those combinations without any restriction coming
from the use of this file. (The General Public License restrictions
do apply in other respects; for example, they cover modification of
the file, and distribution when not linked into a combine
executable.)
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
/* As a special exception, if you link this library with files compiled with
GCC to produce an executable, this does not cause the resulting executable
to be covered by the GNU General Public License. This exception does not
however invalidate any other reasons why the executable file might be
covered by the GNU General Public License. */
#ifndef _SSP_STDIO_H
#define _SSP_STDIO_H 1
#include <ssp.h>
#include_next <stdio.h>
#if __SSP_FORTIFY_LEVEL > 0
#include <stdarg.h>
#undef sprintf
#undef vsprintf
#undef snprintf
#undef vsnprintf
#undef gets
#undef fgets
extern int __sprintf_chk (char *__restrict__ __s, int __flag, size_t __slen,
__const char *__restrict__ __format, ...);
extern int __vsprintf_chk (char *__restrict__ __s, int __flag, size_t __slen,
__const char *__restrict__ __format,
va_list __ap);
#define sprintf(str, ...) \
__builtin___sprintf_chk (str, 0, __ssp_bos (str), \
__VA_ARGS__)
#define vsprintf(str, fmt, ap) \
__builtin___vsprintf_chk (str, 0, __ssp_bos (str), fmt, ap)
extern int __snprintf_chk (char *__restrict__ __s, size_t __n, int __flag,
size_t __slen, __const char *__restrict__ __format,
...);
extern int __vsnprintf_chk (char *__restrict__ __s, size_t __n, int __flag,
size_t __slen, __const char *__restrict__ __format,
va_list __ap);
#define snprintf(str, len, ...) \
__builtin___snprintf_chk (str, len, 0, __ssp_bos (str), __VA_ARGS__)
#define vsnprintf(str, len, fmt, ap) \
__builtin___vsnprintf_chk (str, len, 0, __ssp_bos (str), fmt, ap)
extern char *__gets_chk (char *__str, size_t);
extern char *__SSP_REDIRECT (__gets_alias, (char *__str), gets);
extern inline __attribute__((__always_inline__)) char *
gets (char *__str)
{
if (__ssp_bos (__str) != (size_t) -1)
return __gets_chk (__str, __ssp_bos (__str));
return __gets_alias (__str);
}
extern char *__SSP_REDIRECT (__fgets_alias,
(char *__restrict__ __s, int __n,
FILE *__restrict__ __stream), fgets);
extern inline __attribute__((__always_inline__)) char *
fgets (char *__restrict__ __s, int __n, FILE *__restrict__ __stream)
{
if (__ssp_bos (__s) != (size_t) -1 && (size_t) __n > __ssp_bos (__s))
__chk_fail ();
return __fgets_alias (__s, __n, __stream);
}
#endif /* __SSP_FORTIFY_LEVEL > 0 */
#endif /* _SSP_STDIO_H */

168
libssp/ssp/string.h Normal file
View File

@ -0,0 +1,168 @@
/* Checking macros for string functions.
Copyright (C) 2004, 2005 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.
In addition to the permissions in the GNU General Public License, the
Free Software Foundation gives you unlimited permission to link the
compiled version of this file into combinations with other programs,
and to distribute those combinations without any restriction coming
from the use of this file. (The General Public License restrictions
do apply in other respects; for example, they cover modification of
the file, and distribution when not linked into a combine
executable.)
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
/* As a special exception, if you link this library with files compiled with
GCC to produce an executable, this does not cause the resulting executable
to be covered by the GNU General Public License. This exception does not
however invalidate any other reasons why the executable file might be
covered by the GNU General Public License. */
#ifndef _SSP_STRING_H
#define _SSP_STRING_H 1
#include <ssp.h>
#include_next <string.h>
#if __SSP_FORTIFY_LEVEL > 0
#undef memcpy
#undef memmove
#undef memset
#undef strcat
#undef strcpy
#undef strncat
#undef strncpy
#undef mempcpy
#undef stpcpy
#undef bcopy
#undef bzero
#define memcpy(dest, src, len) \
((__ssp_bos0 (dest) != (size_t) -1) \
? __builtin___memcpy_chk (dest, src, len, __ssp_bos0 (dest)) \
: __memcpy_ichk (dest, src, len))
static inline __attribute__((__always_inline__)) void *
__memcpy_ichk (void *__restrict__ __dest, const void *__restrict__ __src,
size_t __len)
{
return __builtin___memcpy_chk (__dest, __src, __len, __ssp_bos0 (__dest));
}
#define memmove(dest, src, len) \
((__ssp_bos0 (dest) != (size_t) -1) \
? __builtin___memmove_chk (dest, src, len, __ssp_bos0 (dest)) \
: __memmove_ichk (dest, src, len))
static inline __attribute__((__always_inline__)) void *
__memmove_ichk (void *__dest, const void *__src, size_t __len)
{
return __builtin___memmove_chk (__dest, __src, __len, __ssp_bos0 (__dest));
}
#define mempcpy(dest, src, len) \
((__ssp_bos0 (dest) != (size_t) -1) \
? __builtin___mempcpy_chk (dest, src, len, __ssp_bos0 (dest)) \
: __mempcpy_ichk (dest, src, len))
static inline __attribute__((__always_inline__)) void *
__mempcpy_ichk (void *__restrict__ __dest, const void *__restrict__ __src,
size_t __len)
{
return __builtin___mempcpy_chk (__dest, __src, __len, __ssp_bos0 (__dest));
}
#define memset(dest, ch, len) \
((__ssp_bos0 (dest) != (size_t) -1) \
? __builtin___memset_chk (dest, ch, len, __ssp_bos0 (dest)) \
: __memset_ichk (dest, ch, len))
static inline __attribute__((__always_inline__)) void *
__memset_ichk (void *__dest, int __ch, size_t __len)
{
return __builtin___memset_chk (__dest, __ch, __len, __ssp_bos0 (__dest));
}
#define bcopy(src, dest, len) ((void) \
((__ssp_bos0 (dest) != (size_t) -1) \
? __builtin___memmove_chk (dest, src, len, __ssp_bos0 (dest)) \
: __memmove_ichk (dest, src, len)))
#define bzero(dest, len) ((void) \
((__ssp_bos0 (dest) != (size_t) -1) \
? __builtin___memset_chk (dest, '\0', len, __ssp_bos0 (dest)) \
: __memset_ichk (dest, '\0', len)))
#define strcpy(dest, src) \
((__ssp_bos (dest) != (size_t) -1) \
? __builtin___strcpy_chk (dest, src, __ssp_bos (dest)) \
: __strcpy_ichk (dest, src))
static inline __attribute__((__always_inline__)) char *
__strcpy_ichk (char *__restrict__ __dest, const char *__restrict__ __src)
{
return __builtin___strcpy_chk (__dest, __src, __ssp_bos (__dest));
}
#define stpcpy(dest, src) \
((__ssp_bos (dest) != (size_t) -1) \
? __builtin___stpcpy_chk (dest, src, __ssp_bos (dest)) \
: __stpcpy_ichk (dest, src))
static inline __attribute__((__always_inline__)) char *
__stpcpy_ichk (char *__restrict__ __dest, const char *__restrict__ __src)
{
return __builtin___stpcpy_chk (__dest, __src, __ssp_bos (__dest));
}
#define strncpy(dest, src, len) \
((__ssp_bos (dest) != (size_t) -1) \
? __builtin___strncpy_chk (dest, src, len, __ssp_bos (dest)) \
: __strncpy_ichk (dest, src, len))
static inline __attribute__((__always_inline__)) char *
__strncpy_ichk (char *__restrict__ __dest, const char *__restrict__ __src,
size_t __len)
{
return __builtin___strncpy_chk (__dest, __src, __len, __ssp_bos (__dest));
}
#define strcat(dest, src) \
((__ssp_bos (dest) != (size_t) -1) \
? __builtin___strcat_chk (dest, src, __ssp_bos (dest)) \
: __strcat_ichk (dest, src))
static inline __attribute__((__always_inline__)) char *
__strcat_ichk (char *__restrict__ __dest, const char *__restrict__ __src)
{
return __builtin___strcat_chk (__dest, __src, __ssp_bos (__dest));
}
#define strncat(dest, src, len) \
((__ssp_bos (dest) != (size_t) -1) \
? __builtin___strncat_chk (dest, src, len, __ssp_bos (dest)) \
: __strncat_ichk (dest, src, len))
static inline __attribute__((__always_inline__)) char *
__strncat_ichk (char *__restrict__ __dest, const char *__restrict__ __src,
size_t __len)
{
return __builtin___strncat_chk (__dest, __src, __len, __ssp_bos (__dest));
}
#endif /* __SSP_FORTIFY_LEVEL > 0 */
#endif /* _SSP_STRING_H */

85
libssp/ssp/unistd.h Normal file
View File

@ -0,0 +1,85 @@
/* Checking macros for unistd functions.
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.
In addition to the permissions in the GNU General Public License, the
Free Software Foundation gives you unlimited permission to link the
compiled version of this file into combinations with other programs,
and to distribute those combinations without any restriction coming
from the use of this file. (The General Public License restrictions
do apply in other respects; for example, they cover modification of
the file, and distribution when not linked into a combine
executable.)
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
/* As a special exception, if you link this library with files compiled with
GCC to produce an executable, this does not cause the resulting executable
to be covered by the GNU General Public License. This exception does not
however invalidate any other reasons why the executable file might be
covered by the GNU General Public License. */
#ifndef _SSP_UNISTD_H
#define _SSP_UNISTD_H 1
#include <ssp.h>
#include_next <unistd.h>
#if __SSP_FORTIFY_LEVEL > 0
#undef read
#undef readlink
#undef getcwd
extern ssize_t __SSP_REDIRECT (__read_alias, (int __fd, void *__buf,
size_t __nbytes), read);
extern inline __attribute__((__always_inline__)) ssize_t
read (int __fd, void *__buf, size_t __nbytes)
{
if (__ssp_bos0 (__buf) != (size_t) -1 && __nbytes > __ssp_bos0 (__buf))
__chk_fail ();
return __read_alias (__fd, __buf, __nbytes);
}
extern int __SSP_REDIRECT (__readlink_alias,
(const char *__restrict__ __path,
char *__restrict__ __buf, size_t __len),
readlink);
extern inline __attribute__((__always_inline__)) int
readlink (const char *__restrict__ __path, char *__restrict__ __buf,
size_t __len)
{
if (__ssp_bos (__buf) != (size_t) -1 && __len > __ssp_bos (__buf))
__chk_fail ();
return __readlink_alias (__path, __buf, __len);
}
extern char *__SSP_REDIRECT (__getcwd_alias,
(char *__buf, size_t __size), getcwd);
extern inline __attribute__((__always_inline__)) char *
getcwd (char *__buf, size_t __size)
{
if (__ssp_bos (__buf) != (size_t) -1 && __size > __ssp_bos (__buf))
__chk_fail ();
return __getcwd_alias (__buf, __size);
}
#endif /* __SSP_FORTIFY_LEVEL > 0 */
#endif /* _SSP_UNISTD_H */

52
libssp/stpcpy-chk.c Normal file
View File

@ -0,0 +1,52 @@
/* Checking stpcpy.
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.
In addition to the permissions in the GNU General Public License, the
Free Software Foundation gives you unlimited permission to link the
compiled version of this file into combinations with other programs,
and to distribute those combinations without any restriction coming
from the use of this file. (The General Public License restrictions
do apply in other respects; for example, they cover modification of
the file, and distribution when not linked into a combine
executable.)
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
/* As a special exception, if you link this library with files compiled with
GCC to produce an executable, this does not cause the resulting executable
to be covered by the GNU General Public License. This exception does not
however invalidate any other reasons why the executable file might be
covered by the GNU General Public License. */
#include "config.h"
#include <ssp/ssp.h>
#ifdef HAVE_STRING_H
# include <string.h>
#endif
extern void __chk_fail (void) __attribute__((__noreturn__));
char *
__stpcpy_chk (char *__restrict__ dest, const char *__restrict__ src,
size_t slen)
{
size_t len = strlen (src);
if (len >= slen)
__chk_fail ();
return memcpy (dest, src, len + 1) + len;
}

73
libssp/strcat-chk.c Normal file
View File

@ -0,0 +1,73 @@
/* Checking strcat.
Copyright (C) 1991, 1997, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.
In addition to the permissions in the GNU General Public License, the
Free Software Foundation gives you unlimited permission to link the
compiled version of this file into combinations with other programs,
and to distribute those combinations without any restriction coming
from the use of this file. (The General Public License restrictions
do apply in other respects; for example, they cover modification of
the file, and distribution when not linked into a combine
executable.)
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
/* As a special exception, if you link this library with files compiled with
GCC to produce an executable, this does not cause the resulting executable
to be covered by the GNU General Public License. This exception does not
however invalidate any other reasons why the executable file might be
covered by the GNU General Public License. */
#include "config.h"
#include <ssp/ssp.h>
#ifdef HAVE_STRING_H
# include <string.h>
#endif
extern void __chk_fail (void) __attribute__((__noreturn__));
char *
__strcat_chk (char *__restrict__ dest, const char *__restrict__ src,
size_t slen)
{
char *s1 = dest;
const char *s2 = src;
char c;
do
{
if (slen-- == 0)
__chk_fail ();
c = *s1++;
}
while (c != '\0');
++slen;
s1 -= 2;
do
{
if (slen-- == 0)
__chk_fail ();
c = *s2++;
*++s1 = c;
}
while (c != '\0');
return dest;
}

52
libssp/strcpy-chk.c Normal file
View File

@ -0,0 +1,52 @@
/* Checking strcpy.
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.
In addition to the permissions in the GNU General Public License, the
Free Software Foundation gives you unlimited permission to link the
compiled version of this file into combinations with other programs,
and to distribute those combinations without any restriction coming
from the use of this file. (The General Public License restrictions
do apply in other respects; for example, they cover modification of
the file, and distribution when not linked into a combine
executable.)
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
/* As a special exception, if you link this library with files compiled with
GCC to produce an executable, this does not cause the resulting executable
to be covered by the GNU General Public License. This exception does not
however invalidate any other reasons why the executable file might be
covered by the GNU General Public License. */
#include "config.h"
#include <ssp/ssp.h>
#ifdef HAVE_STRING_H
# include <string.h>
#endif
extern void __chk_fail (void) __attribute__((__noreturn__));
char *
__strcpy_chk (char *__restrict__ dest, const char *__restrict__ src,
size_t slen)
{
size_t len = strlen (src);
if (len >= slen)
__chk_fail ();
return memcpy (dest, src, len + 1);
}

120
libssp/strncat-chk.c Normal file
View File

@ -0,0 +1,120 @@
/* Checking strncat.
Copyright (C) 1991, 1997, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.
In addition to the permissions in the GNU General Public License, the
Free Software Foundation gives you unlimited permission to link the
compiled version of this file into combinations with other programs,
and to distribute those combinations without any restriction coming
from the use of this file. (The General Public License restrictions
do apply in other respects; for example, they cover modification of
the file, and distribution when not linked into a combine
executable.)
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
/* As a special exception, if you link this library with files compiled with
GCC to produce an executable, this does not cause the resulting executable
to be covered by the GNU General Public License. This exception does not
however invalidate any other reasons why the executable file might be
covered by the GNU General Public License. */
#include "config.h"
#include <ssp/ssp.h>
#ifdef HAVE_STRING_H
# include <string.h>
#endif
extern void __chk_fail (void) __attribute__((__noreturn__));
char *
__strncat_chk (char *__restrict__ dest, const char *__restrict__ src,
size_t n, size_t slen)
{
char c;
char *s = dest;
do
{
if (slen-- == 0)
__chk_fail ();
c = *dest++;
}
while (c != '\0');
++slen;
dest -= 2;
if (n >= 4)
{
size_t n4 = n >> 2;
do
{
if (slen-- == 0)
__chk_fail ();
c = *src++;
*++dest = c;
if (c == '\0')
return s;
if (slen-- == 0)
__chk_fail ();
c = *src++;
*++dest = c;
if (c == '\0')
return s;
if (slen-- == 0)
__chk_fail ();
c = *src++;
*++dest = c;
if (c == '\0')
return s;
if (slen-- == 0)
__chk_fail ();
c = *src++;
*++dest = c;
if (c == '\0')
return s;
if (slen-- == 0)
__chk_fail ();
c = *src++;
*++dest = c;
if (c == '\0')
return s;
} while (--n4 > 0);
n &= 3;
}
while (n > 0)
{
if (slen-- == 0)
__chk_fail ();
c = *src++;
*++dest = c;
if (c == '\0')
return s;
n--;
}
if (c != '\0')
{
if (slen-- == 0)
__chk_fail ();
*++dest = '\0';
}
return s;
}

53
libssp/strncpy-chk.c Normal file
View File

@ -0,0 +1,53 @@
/* Checking strncpy.
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.
In addition to the permissions in the GNU General Public License, the
Free Software Foundation gives you unlimited permission to link the
compiled version of this file into combinations with other programs,
and to distribute those combinations without any restriction coming
from the use of this file. (The General Public License restrictions
do apply in other respects; for example, they cover modification of
the file, and distribution when not linked into a combine
executable.)
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
/* As a special exception, if you link this library with files compiled with
GCC to produce an executable, this does not cause the resulting executable
to be covered by the GNU General Public License. This exception does not
however invalidate any other reasons why the executable file might be
covered by the GNU General Public License. */
#include "config.h"
#include <ssp/ssp.h>
#ifdef HAVE_STRING_H
# include <string.h>
#endif
extern void __chk_fail (void) __attribute__((__noreturn__));
#ifdef HAVE_STRNCPY
char *
__strncpy_chk (char *__restrict__ dest, const char *__restrict__ src,
size_t len, size_t slen)
{
if (len > slen)
__chk_fail ();
return strncpy (dest, src, len);
}
#endif

55
libssp/vsnprintf-chk.c Normal file
View File

@ -0,0 +1,55 @@
/* Checking vsnprintf.
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.
In addition to the permissions in the GNU General Public License, the
Free Software Foundation gives you unlimited permission to link the
compiled version of this file into combinations with other programs,
and to distribute those combinations without any restriction coming
from the use of this file. (The General Public License restrictions
do apply in other respects; for example, they cover modification of
the file, and distribution when not linked into a combine
executable.)
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
/* As a special exception, if you link this library with files compiled with
GCC to produce an executable, this does not cause the resulting executable
to be covered by the GNU General Public License. This exception does not
however invalidate any other reasons why the executable file might be
covered by the GNU General Public License. */
#include "config.h"
#include <ssp/ssp.h>
#include <stdarg.h>
#ifdef HAVE_STDIO_H
# include <stdio.h>
#endif
extern void __chk_fail (void) __attribute__((__noreturn__));
#ifdef HAVE_USABLE_VSNPRINTF
int
__vsnprintf_chk (char *s, size_t n, int flags __attribute__((unused)),
size_t slen, const char *format, va_list arg)
{
if (n > slen)
__chk_fail ();
return vsnprintf (s, n, format, arg);
}
#endif

65
libssp/vsprintf-chk.c Normal file
View File

@ -0,0 +1,65 @@
/* Checking vsprintf.
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.
In addition to the permissions in the GNU General Public License, the
Free Software Foundation gives you unlimited permission to link the
compiled version of this file into combinations with other programs,
and to distribute those combinations without any restriction coming
from the use of this file. (The General Public License restrictions
do apply in other respects; for example, they cover modification of
the file, and distribution when not linked into a combine
executable.)
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
/* As a special exception, if you link this library with files compiled with
GCC to produce an executable, this does not cause the resulting executable
to be covered by the GNU General Public License. This exception does not
however invalidate any other reasons why the executable file might be
covered by the GNU General Public License. */
#include "config.h"
#include <ssp/ssp.h>
#include <stdarg.h>
#ifdef HAVE_LIMITS_H
# include <limits.h>
#endif
#ifdef HAVE_STDIO_H
# include <stdio.h>
#endif
extern void __chk_fail (void) __attribute__((__noreturn__));
#ifdef HAVE_USABLE_VSNPRINTF
int
__vsprintf_chk (char *s, int flags __attribute__((unused)),
size_t slen, const char *format, va_list arg)
{
int done;
if (slen > (size_t) INT_MAX)
done = vsprintf (s, format, arg);
else
{
done = vsnprintf (s, slen, format, arg);
if (done >= 0 && (size_t) done >= slen)
__chk_fail ();
}
return done;
}
#endif