diff --git a/config/ompi_config_asm.m4 b/config/ompi_config_asm.m4 index 47398f7043..1d2fee077d 100644 --- a/config/ompi_config_asm.m4 +++ b/config/ompi_config_asm.m4 @@ -380,6 +380,37 @@ AC_DEFUN([OMPI_CHECK_ASM_SIZE],[ ])dnl +# OMPI_CHECK_ASM_GNU_STACKEXEC(var) +# ---------------------------------- +# sets shell variable var to the things necessary to +# disable execable stacks with GAS +AC_DEFUN([OMPI_CHECK_ASM_GNU_STACKEXEC], [ + AC_CHECK_PROG([OBJDUMP], [objdump], [objdump]) + AC_CACHE_CHECK([if .note.GNU-stack is needed], + [ompi_cv_asm_gnu_stack_result], + [AS_IF([test "$OBJDUMP" != ""], + [ # first, see if a simple C program has it set + cat >conftest.c < /dev/null && ompi_cv_asm_gnu_stack_result=yes], + [OMPI_LOG_MSG([the failed program was:], 1) + OMPI_LOG_FILE([conftest.c]) + ompi_cv_asm_gnu_stack_result=no]) + if test "$ompi_cv_asm_gnu_stack_result" != "yes" ; then + ompi_cv_asm_gnu_stack_result="no" + fi + rm -f conftest.*], + [ompi_cv_asm_gnu_stack_result="no"])]) + if test "$ompi_cv_asm_gnu_stack_result" = "yes" ; then + ompi_cv_asm_gnu_stack=1 + else + ompi_cv_asm_gnu_stack=0 + fi +])dnl + + dnl ################################################################# dnl dnl OMPI_CHECK_POWERPC_REG @@ -738,6 +769,7 @@ AC_DEFUN([OMPI_CONFIG_ASM],[ else OMPI_CHECK_ASM_TEXT OMPI_CHECK_ASM_GLOBAL + OMPI_CHECK_ASM_GNU_STACKEXEC OMPI_CHECK_ASM_LABEL_SUFFIX OMPI_CHECK_ASM_GSYM OMPI_CHECK_ASM_LSYM @@ -861,7 +893,7 @@ AC_MSG_WARN([significant performance increase.]) OMPI_CHECK_INLINE_CXX_XLC # format: - # config_file-text-global-label_suffix-gsym-lsym-type-size-align_log-ppc_r_reg-64_bit + # config_file-text-global-label_suffix-gsym-lsym-type-size-align_log-ppc_r_reg-64_bit-gnu_stack asm_format="${ompi_asm_arch_config}" asm_format="${asm_format}-${ompi_cv_asm_text}-${ompi_cv_asm_global}" asm_format="${asm_format}-${ompi_cv_asm_label_suffix}-${ompi_cv_asm_gsym}" @@ -873,7 +905,8 @@ AC_MSG_WARN([significant performance increase.]) else asm_format="${asm_format}-1" fi - ompi_cv_asm_format="${asm_format}-${OMPI_ASM_SUPPORT_64BIT}" + asm_format="${asm_format}-${OMPI_ASM_SUPPORT_64BIT}" + ompi_cv_asm_format="${asm_format}-${ompi_cv_asm_gnu_stack}" OMPI_ASSEMBLY_FORMAT="$ompi_cv_asm_format" AC_MSG_CHECKING([for assembly format]) diff --git a/opal/asm/asm-data.txt b/opal/asm/asm-data.txt index 28bf20d2b0..db5368e72e 100644 --- a/opal/asm/asm-data.txt +++ b/opal/asm/asm-data.txt @@ -25,7 +25,7 @@ # ARCHITECTURE ASSEMBLY FORMAT BASE FILENAME # # Assembly Format field: -# config_file-text-global-label_suffix-gsym-lsym-type-size-align_log-ppc_r_reg-64_bit +# config_file-text-global-label_suffix-gsym-lsym-type-size-align_log-ppc_r_reg-64_bit-gnu_stack ###################################################################### @@ -34,7 +34,8 @@ # ###################################################################### -AMD64 default-.text-.globl-:--.L-@-1-0-1-1 amd64-linux +AMD64 default-.text-.globl-:--.L-@-1-0-1-1-1 amd64-linux +AMD64 default-.text-.globl-:--.L-@-1-0-1-1-0 amd64-linux-nongas ###################################################################### @@ -43,9 +44,11 @@ AMD64 default-.text-.globl-:--.L-@-1-0-1-1 amd64-linux # ###################################################################### -IA32 default-.text-.globl-:--.L-@-1-0-1-1 ia32-linux -IA32 default-.text-.globl-:-_-L--0-1-1-1 ia32-osx -IA32 default-.text-.globl-:-_-L--0-0-1-1 ia32-cygwin +IA32 default-.text-.globl-:--.L-@-1-0-1-1-1 ia32-linux +IA32 default-.text-.globl-:--.L-@-1-0-1-1-0 ia32-linux-nongas +IA32 default-.text-.globl-:-_-L--0-1-1-1-0 ia32-osx +IA32 default-.text-.globl-:-_-L--0-0-1-1-1 ia32-cygwin +IA32 default-.text-.globl-:-_-L--0-0-1-1-0 ia32-cygwin-nongas ###################################################################### @@ -54,7 +57,8 @@ IA32 default-.text-.globl-:-_-L--0-0-1-1 ia32-cygwin # ###################################################################### -IA64 default-.text-.globl-:--.L-@-1-0-1-1 ia64-linux +IA64 default-.text-.globl-:--.L-@-1-0-1-1-1 ia64-linux +IA64 default-.text-.globl-:--.L-@-1-0-1-1-0 ia64-linux-nongas ###################################################################### @@ -66,19 +70,21 @@ IA64 default-.text-.globl-:--.L-@-1-0-1-1 ia64-linux # standard ppc instruction set (AIX calls it ppc). This is not the # true intersection of all the POWER / PowerPC machines, but works # on PowerPCs since the 601 and on at least POWER 3 and above. -POWERPC32 default-.text-.globl-:-_-L--0-1-1-0 powerpc32-osx -POWERPC32 default-.text-.globl-:--.L-@-1-1-0-0 powerpc32-linux -POWERPC32 aix-.csect .text[PR]-.globl-:-.-L--0-1-0-0 powerpc32-aix +POWERPC32 default-.text-.globl-:-_-L--0-1-1-0-0 powerpc32-osx +POWERPC32 default-.text-.globl-:--.L-@-1-1-0-0-1 powerpc32-linux +POWERPC32 default-.text-.globl-:--.L-@-1-1-0-0-0 powerpc32-linux-nongas +POWERPC32 aix-.csect .text[PR]-.globl-:-.-L--0-1-0-0-0 powerpc32-aix # The ppc code above, plus support for the 64 bit operations. This # mode is really only available on OS X when using the OS X 10.3 # compiler chain with the -mcpu=970 option. -POWERPC32 default-.text-.globl-:-_-L--0-1-1-1 powerpc32-64-osx +POWERPC32 default-.text-.globl-:-_-L--0-1-1-1-0 powerpc32-64-osx # PowerPC / POWER 64bit machines. sizeof(void*) == 8. -POWERPC64 default-.text-.globl-:-_-L--0-1-1-1 powerpc64-osx -POWERPC64 default-.text-.globl-:-.-.L-@-1-1-0-1 powerpc64-linux -POWERPC64 aix-.csect .text[PR]-.globl-:-.-L--0-1-0-1 powerpc64-aix +POWERPC64 default-.text-.globl-:-_-L--0-1-1-1-0 powerpc64-osx +POWERPC64 default-.text-.globl-:-.-.L-@-1-1-0-1-1 powerpc64-linux +POWERPC64 default-.text-.globl-:-.-.L-@-1-1-0-1-0 powerpc64-linux-nongas +POWERPC64 aix-.csect .text[PR]-.globl-:-.-L--0-1-0-1-0 powerpc64-aix ###################################################################### @@ -88,15 +94,15 @@ POWERPC64 aix-.csect .text[PR]-.globl-:-.-L--0-1-0-1 powerpc64-aix ###################################################################### # default compile mode on Solaris. Evil. equiv to about Sparc v8 -SPARC default-.text-.globl-:--.L-#-1-0-1-0 sparc-solaris +SPARC default-.text-.globl-:--.L-#-1-0-1-0-0 sparc-solaris # Usually compiled with -xarch=v8plus. Basically Sparc V9, but with # sizeof(void*) == 4 instead of 8. Different from V9_64 because still # uses 2 registers to pass in a 64bit integer -SPARCV9_32 default-.text-.globl-:--.L-#-1-0-1-1 sparcv9-32-solaris +SPARCV9_32 default-.text-.globl-:--.L-#-1-0-1-1-0 sparcv9-32-solaris # The Sparc v9 (aka Ultra Sparc). Sizeof(void*) == 8. -SPARCV9_64 default-.text-.globl-:--.L-#-1-0-1-1 sparcv9-64-solaris +SPARCV9_64 default-.text-.globl-:--.L-#-1-0-1-1-0 sparcv9-64-solaris ###################################################################### @@ -111,4 +117,4 @@ SPARCV9_64 default-.text-.globl-:--.L-#-1-0-1-1 sparcv9-64-solaris # in one register (instead of SPARC and POWER, who use two). Which # means that we can use the same code either way. Woo hoo! -MIPS default-.text-.globl-:--L--1-1-1-1 mips-irix +MIPS default-.text-.globl-:--L--1-1-1-1-0 mips-irix diff --git a/opal/asm/generate-asm.pl b/opal/asm/generate-asm.pl index eb48fe64bd..3cf8940492 100644 --- a/opal/asm/generate-asm.pl +++ b/opal/asm/generate-asm.pl @@ -27,8 +27,8 @@ $ALIGN_LOG = 0; $DEL_R_REG = 0; $IS64BIT = 0; -($CONFIG, $TEXT, $GLOBAL, $SUFFIX, $GSYM, $LSYM, $TYPE, $SIZE, $ALIGN_LOG, $DEL_R_REG, $IS64BIT) = ( - $asmformat =~ /(.*)\-(.*)\-(.*)\-(.*)\-(.*)\-(.*)\-(.*)\-(.*)\-(.*)\-(.*)\-(.*)/); +($CONFIG, $TEXT, $GLOBAL, $SUFFIX, $GSYM, $LSYM, $TYPE, $SIZE, $ALIGN_LOG, $DEL_R_REG, $IS64BIT, $GNU_STACK) = ( + $asmformat =~ /(.*)\-(.*)\-(.*)\-(.*)\-(.*)\-(.*)\-(.*)\-(.*)\-(.*)\-(.*)\-(.*)\-(.*)/); if (0) { print "CONFIG: $CONFIG\n"; @@ -37,6 +37,7 @@ print "GLOBAL: $GLOBAL\n"; print "SUFFIX: $SUFFIX\n"; print "GSYM: $GSYM\n"; print "LSYM: $LSYM\n"; +print "GNU_STACK: $GNU_STACK\n"; } my $current_func = ""; @@ -98,7 +99,10 @@ while () { if ($delete == 0) { print OUTPUT $_; } +} +if ($GNU_STACK == 1) { + print OUTPUT "\n\t.section\t.note.GNU-stack,\"\",\@progbits\n"; } close(INPUT);