Plugin target handling
This patch fixes failures with LTO on mingw32 targets. Since git
commit 7cf7fcc83c
all possible targets (minus binary) are matched in
bfd_check_format_matches rather than lower priority targets being
excluded once a higher priority target matches. During linking that
results in the ld/plugin.c plugin_object_p function being called with
the input file xvec set to plugin_vec, which means
plugin_get_ir_dummy_bfd doesn't see the real format of the file
(pe-i386). It defaults to the output format instead, which happens to
be pei-i386, and this wrong choice persists for the dummy bfd.
pei-i386 isn't recognised as a valid linker input file.
So, omit recognizing a plugin object in bfd_check_format_matches when
some other object format matches, and make sure those other object
formats are checked first.
* format.c (bfd_check_format_matches): Don't match plugin target
if another target matches. Expand comment.
* targets.c (_bfd_target_vector): Move plugin_vec after all other
non-corefile targets, outside !SELECT_VECS.
* config.bfd: Don't handle targ=plugin here.
* configure.ac: Don't add plugin to enable_targets or handle in
target loop setting selvecs and other target vars.
* configure: Regenerate.
This commit is contained in:
parent
f60c61e60e
commit
999d6dff80
@ -1,3 +1,14 @@
|
|||||||
|
2019-06-28 Alan Modra <amodra@gmail.com>
|
||||||
|
|
||||||
|
* format.c (bfd_check_format_matches): Don't match plugin target
|
||||||
|
if another target matches. Expand comment.
|
||||||
|
* targets.c (_bfd_target_vector): Move plugin_vec after all other
|
||||||
|
non-corefile targets, outside !SELECT_VECS.
|
||||||
|
* config.bfd: Don't handle targ=plugin here.
|
||||||
|
* configure.ac: Don't add plugin to enable_targets or handle in
|
||||||
|
target loop setting selvecs and other target vars.
|
||||||
|
* configure: Regenerate.
|
||||||
|
|
||||||
2019-06-26 Nick Clifton <nickc@redhat.com>
|
2019-06-26 Nick Clifton <nickc@redhat.com>
|
||||||
|
|
||||||
PR 24703
|
PR 24703
|
||||||
|
@ -218,11 +218,6 @@ esac
|
|||||||
# convention, else the table becomes a real mess to understand and maintain.
|
# convention, else the table becomes a real mess to understand and maintain.
|
||||||
|
|
||||||
case "${targ}" in
|
case "${targ}" in
|
||||||
plugin)
|
|
||||||
targ_defvec=plugin_vec
|
|
||||||
targ_selvecs="plugin_vec"
|
|
||||||
;;
|
|
||||||
|
|
||||||
# START OF targmatch.h
|
# START OF targmatch.h
|
||||||
#ifdef BFD64
|
#ifdef BFD64
|
||||||
aarch64-*-darwin*)
|
aarch64-*-darwin*)
|
||||||
|
15
bfd/configure
vendored
15
bfd/configure
vendored
@ -12409,10 +12409,6 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if test "$plugins" = "yes"; then
|
|
||||||
enable_targets="$enable_targets plugin"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check whether --enable-64-bit-bfd was given.
|
# Check whether --enable-64-bit-bfd was given.
|
||||||
if test "${enable_64_bit_bfd+set}" = set; then :
|
if test "${enable_64_bit_bfd+set}" = set; then :
|
||||||
enableval=$enable_64_bit_bfd; case "${enableval}" in
|
enableval=$enable_64_bit_bfd; case "${enableval}" in
|
||||||
@ -14613,12 +14609,12 @@ selarchs=
|
|||||||
TDEFINES=
|
TDEFINES=
|
||||||
for targ in $target $canon_targets
|
for targ in $target $canon_targets
|
||||||
do
|
do
|
||||||
if test "x$targ" = "xall"; then
|
if test $targ = all; then
|
||||||
all_targets=true
|
all_targets=true
|
||||||
assocvecs="$assocvecs $targ_defvec $targ_selvecs"
|
assocvecs="$assocvecs $targ_defvec $targ_selvecs"
|
||||||
else
|
elif test $targ != plugin; then
|
||||||
. $srcdir/config.bfd
|
. $srcdir/config.bfd
|
||||||
if test "x$targ" = "x$target"; then
|
if test $targ = $target; then
|
||||||
defvec=$targ_defvec
|
defvec=$targ_defvec
|
||||||
fi
|
fi
|
||||||
selvecs="$selvecs $targ_defvec $targ_selvecs"
|
selvecs="$selvecs $targ_defvec $targ_selvecs"
|
||||||
@ -14856,7 +14852,6 @@ do
|
|||||||
pef_xlib_vec) tb="$tb pef.lo" ;;
|
pef_xlib_vec) tb="$tb pef.lo" ;;
|
||||||
pj_elf32_vec) tb="$tb elf32-pj.lo elf32.lo $elf" ;;
|
pj_elf32_vec) tb="$tb elf32-pj.lo elf32.lo $elf" ;;
|
||||||
pj_elf32_le_vec) tb="$tb elf32-pj.lo elf32.lo $elf" ;;
|
pj_elf32_le_vec) tb="$tb elf32-pj.lo elf32.lo $elf" ;;
|
||||||
plugin_vec) tb="$tb plugin.lo" ;;
|
|
||||||
powerpc_boot_vec) tb="$tb ppcboot.lo" ;;
|
powerpc_boot_vec) tb="$tb ppcboot.lo" ;;
|
||||||
powerpc_elf32_vec) tb="$tb elf32-ppc.lo elf-vxworks.lo elf32.lo $elf" ;;
|
powerpc_elf32_vec) tb="$tb elf32-ppc.lo elf-vxworks.lo elf32.lo $elf" ;;
|
||||||
powerpc_elf32_le_vec) tb="$tb elf32-ppc.lo elf-vxworks.lo elf32.lo $elf" ;;
|
powerpc_elf32_le_vec) tb="$tb elf32-ppc.lo elf-vxworks.lo elf32.lo $elf" ;;
|
||||||
@ -14983,6 +14978,10 @@ do
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if test "$plugins" = "yes"; then
|
||||||
|
tb="$tb plugin.lo"
|
||||||
|
fi
|
||||||
|
|
||||||
# Target architecture .o files.
|
# Target architecture .o files.
|
||||||
# A couple of CPUs use shorter file names to avoid problems on DOS
|
# A couple of CPUs use shorter file names to avoid problems on DOS
|
||||||
# filesystems.
|
# filesystems.
|
||||||
|
@ -46,10 +46,6 @@ ACX_LARGEFILE
|
|||||||
|
|
||||||
AM_CONDITIONAL(PLUGINS, test "$plugins" = "yes")
|
AM_CONDITIONAL(PLUGINS, test "$plugins" = "yes")
|
||||||
|
|
||||||
if test "$plugins" = "yes"; then
|
|
||||||
enable_targets="$enable_targets plugin"
|
|
||||||
fi
|
|
||||||
|
|
||||||
AC_ARG_ENABLE(64-bit-bfd,
|
AC_ARG_ENABLE(64-bit-bfd,
|
||||||
[ --enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes)],
|
[ --enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes)],
|
||||||
[case "${enableval}" in
|
[case "${enableval}" in
|
||||||
@ -349,12 +345,12 @@ selarchs=
|
|||||||
TDEFINES=
|
TDEFINES=
|
||||||
for targ in $target $canon_targets
|
for targ in $target $canon_targets
|
||||||
do
|
do
|
||||||
if test "x$targ" = "xall"; then
|
if test $targ = all; then
|
||||||
all_targets=true
|
all_targets=true
|
||||||
assocvecs="$assocvecs $targ_defvec $targ_selvecs"
|
assocvecs="$assocvecs $targ_defvec $targ_selvecs"
|
||||||
else
|
elif test $targ != plugin; then
|
||||||
. $srcdir/config.bfd
|
. $srcdir/config.bfd
|
||||||
if test "x$targ" = "x$target"; then
|
if test $targ = $target; then
|
||||||
defvec=$targ_defvec
|
defvec=$targ_defvec
|
||||||
fi
|
fi
|
||||||
selvecs="$selvecs $targ_defvec $targ_selvecs"
|
selvecs="$selvecs $targ_defvec $targ_selvecs"
|
||||||
@ -592,7 +588,6 @@ do
|
|||||||
pef_xlib_vec) tb="$tb pef.lo" ;;
|
pef_xlib_vec) tb="$tb pef.lo" ;;
|
||||||
pj_elf32_vec) tb="$tb elf32-pj.lo elf32.lo $elf" ;;
|
pj_elf32_vec) tb="$tb elf32-pj.lo elf32.lo $elf" ;;
|
||||||
pj_elf32_le_vec) tb="$tb elf32-pj.lo elf32.lo $elf" ;;
|
pj_elf32_le_vec) tb="$tb elf32-pj.lo elf32.lo $elf" ;;
|
||||||
plugin_vec) tb="$tb plugin.lo" ;;
|
|
||||||
powerpc_boot_vec) tb="$tb ppcboot.lo" ;;
|
powerpc_boot_vec) tb="$tb ppcboot.lo" ;;
|
||||||
powerpc_elf32_vec) tb="$tb elf32-ppc.lo elf-vxworks.lo elf32.lo $elf" ;;
|
powerpc_elf32_vec) tb="$tb elf32-ppc.lo elf-vxworks.lo elf32.lo $elf" ;;
|
||||||
powerpc_elf32_le_vec) tb="$tb elf32-ppc.lo elf-vxworks.lo elf32.lo $elf" ;;
|
powerpc_elf32_le_vec) tb="$tb elf32-ppc.lo elf-vxworks.lo elf32.lo $elf" ;;
|
||||||
@ -719,6 +714,10 @@ do
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if test "$plugins" = "yes"; then
|
||||||
|
tb="$tb plugin.lo"
|
||||||
|
fi
|
||||||
|
|
||||||
# Target architecture .o files.
|
# Target architecture .o files.
|
||||||
# A couple of CPUs use shorter file names to avoid problems on DOS
|
# A couple of CPUs use shorter file names to avoid problems on DOS
|
||||||
# filesystems.
|
# filesystems.
|
||||||
|
@ -290,8 +290,15 @@ bfd_check_format_matches (bfd *abfd, bfd_format format, char ***matching)
|
|||||||
{
|
{
|
||||||
const bfd_target *temp;
|
const bfd_target *temp;
|
||||||
|
|
||||||
/* Don't check the default target twice. */
|
/* The binary target matches anything, so don't return it when
|
||||||
|
searching. Don't match the plugin target if we have another
|
||||||
|
alternative since we want to properly set the input format
|
||||||
|
before allowing a plugin to claim the file. Also, don't
|
||||||
|
check the default target twice. */
|
||||||
if (*target == &binary_vec
|
if (*target == &binary_vec
|
||||||
|
#if BFD_SUPPORTS_PLUGINS
|
||||||
|
|| (match_count != 0 && *target == &plugin_vec)
|
||||||
|
#endif
|
||||||
|| (!abfd->target_defaulted && *target == save_targ))
|
|| (!abfd->target_defaulted && *target == save_targ))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -1149,10 +1149,6 @@ static const bfd_target * const _bfd_target_vector[] =
|
|||||||
&pj_elf32_vec,
|
&pj_elf32_vec,
|
||||||
&pj_elf32_le_vec,
|
&pj_elf32_le_vec,
|
||||||
|
|
||||||
#if BFD_SUPPORTS_PLUGINS
|
|
||||||
&plugin_vec,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
&powerpc_boot_vec,
|
&powerpc_boot_vec,
|
||||||
&powerpc_elf32_vec,
|
&powerpc_elf32_vec,
|
||||||
&powerpc_elf32_le_vec,
|
&powerpc_elf32_le_vec,
|
||||||
@ -1305,6 +1301,10 @@ static const bfd_target * const _bfd_target_vector[] =
|
|||||||
/* Likewise for ihex. */
|
/* Likewise for ihex. */
|
||||||
&ihex_vec,
|
&ihex_vec,
|
||||||
|
|
||||||
|
#if BFD_SUPPORTS_PLUGINS
|
||||||
|
&plugin_vec,
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Add any required traditional-core-file-handler. */
|
/* Add any required traditional-core-file-handler. */
|
||||||
|
|
||||||
#ifdef AIX386_CORE
|
#ifdef AIX386_CORE
|
||||||
|
Loading…
Reference in New Issue
Block a user