htab->plt_type = plt_type;
}
}
- if (htab->plt_type == PLT_OLD && htab->params->plt_style == PLT_NEW)
+ if (htab->plt_type == PLT_OLD)
{
- if (htab->old_bfd != NULL)
- _bfd_error_handler (_("bss-plt forced due to %pB"), htab->old_bfd);
- else
- _bfd_error_handler (_("bss-plt forced by profiling"));
+ if (!info->user_warn_rwx_segments)
+ info->no_warn_rwx_segments = 1;
+ if (htab->params->plt_style == PLT_NEW
+ || (htab->params->plt_style != PLT_OLD
+ && !info->no_warn_rwx_segments))
+ {
+ if (htab->old_bfd != NULL)
+ _bfd_error_handler (_("bss-plt forced due to %pB"), htab->old_bfd);
+ else
+ _bfd_error_handler (_("bss-plt forced by profiling"));
+ }
}
BFD_ASSERT (htab->plt_type != PLT_VXWORKS);
/* TRUE if warnings should not be generated for TLS segments with eXecute
permission or LOAD segments with RWX permissions. */
unsigned int no_warn_rwx_segments: 1;
+ /* TRUE if the user gave either --warn-rwx-segments or
+ --no-warn-rwx-segments. */
+ unsigned int user_warn_rwx_segments: 1;
/* TRUE if the stack can be made executable because of the absence of a
.note.GNU-stack section in an input file. Note - even if this field
break;
case OPTION_WARN_RWX_SEGMENTS:
link_info.no_warn_rwx_segments = 0;
+ link_info.user_warn_rwx_segments = 1;
break;
case OPTION_NO_WARN_RWX_SEGMENTS:
link_info.no_warn_rwx_segments = 1;
+ link_info.user_warn_rwx_segments = 1;
break;
case 'e':
lang_add_entry (optarg, true);
return $text
}
+ set curr_ldflags $LDFLAGS
+ if { [istarget powerpc*-*-*] && ![istarget powerpc64*-*-*] } {
+ # Don't generate an executable .plt section
+ set LDFLAGS "$LDFLAGS --secure-plt"
+ }
+
# Since the warnings can be disabled by configure, ensure consistency
# of the first test by forcing the flags.
run_ld_link_tests [list \
"rwx-segments-3.exe"] \
]
+ set LDFLAGS $curr_ldflags
+
if { [target_defaults_to_execstack] } {
run_ld_link_tests [list \
[list "PR ld/29072 (warn about absent .note.GNU-stack)" \