9912
10014
case Tag_VFP_arch:
9913
/* Use the "greatest" from the sequence 0, 1, 2, 4, 3, or the
9914
largest value if greater than 4 (for future-proofing). */
9915
if ((in_attr[i].i > 4 && in_attr[i].i > out_attr[i].i)
9916
|| (in_attr[i].i <= 4 && out_attr[i].i <= 4
9917
&& order_01243[in_attr[i].i] > order_01243[out_attr[i].i]))
9918
out_attr[i].i = in_attr[i].i;
10016
static const struct
10020
} vfp_versions[7] =
10034
/* Values greater than 6 aren't defined, so just pick the
10036
if (in_attr[i].i > 6 && in_attr[i].i > out_attr[i].i)
10038
out_attr[i] = in_attr[i];
10041
/* The output uses the superset of input features
10042
(ISA version) and registers. */
10043
ver = vfp_versions[in_attr[i].i].ver;
10044
if (ver < vfp_versions[out_attr[i].i].ver)
10045
ver = vfp_versions[out_attr[i].i].ver;
10046
regs = vfp_versions[in_attr[i].i].regs;
10047
if (regs < vfp_versions[out_attr[i].i].regs)
10048
regs = vfp_versions[out_attr[i].i].regs;
10049
/* This assumes all possible supersets are also a valid
10051
for (newval = 6; newval > 0; newval--)
10053
if (regs == vfp_versions[newval].regs
10054
&& ver == vfp_versions[newval].ver)
10057
out_attr[i].i = newval;
9920
10060
case Tag_PCS_config:
9921
10061
if (out_attr[i].i == 0)
10033
10173
out_attr[i].i = in_attr[i].i;
10177
/* This tag is set to zero if we can use UDIV and SDIV in Thumb
10178
mode on a v7-M or v7-R CPU; to one if we can not use UDIV or
10179
SDIV at all; and to two if we can use UDIV or SDIV on a v7-A
10180
CPU. We will merge as follows: If the input attribute's value
10181
is one then the output attribute's value remains unchanged. If
10182
the input attribute's value is zero or two then if the output
10183
attribute's value is one the output value is set to the input
10184
value, otherwise the output value must be the same as the
10186
if (in_attr[i].i != 1 && out_attr[i].i != 1)
10188
if (in_attr[i].i != out_attr[i].i)
10191
(_("DIV usage mismatch between %B and %B"),
10197
if (in_attr[i].i != 1)
10198
out_attr[i].i = in_attr[i].i;
10202
case Tag_MPextension_use_legacy:
10203
/* We don't output objects with Tag_MPextension_use_legacy - we
10204
move the value to Tag_MPextension_use. */
10205
if (in_attr[i].i != 0 && in_attr[Tag_MPextension_use].i != 0)
10207
if (in_attr[Tag_MPextension_use].i != in_attr[i].i)
10210
(_("%B has has both the current and legacy "
10211
"Tag_MPextension_use attributes"),
10217
if (in_attr[i].i > out_attr[Tag_MPextension_use].i)
10218
out_attr[Tag_MPextension_use] = in_attr[i];
10036
10222
case Tag_nodefaults:
10037
10223
/* This tag is set if it exists, but the value is unused (and is
10038
10224
typically zero). We don't actually need to do anything here -
10195
10381
object file when linking. */
10197
10383
static bfd_boolean
10198
elf32_arm_merge_private_bfd_data (bfd * ibfd, bfd * obfd)
10200
flagword out_flags;
10202
bfd_boolean flags_compatible = TRUE;
10205
/* Check if we have the same endianess. */
10206
if (! _bfd_generic_verify_endian_match (ibfd, obfd))
10209
if (! is_arm_elf (ibfd) || ! is_arm_elf (obfd))
10212
if (!elf32_arm_merge_eabi_attributes (ibfd, obfd))
10215
/* The input BFD must have had its flags initialised. */
10216
/* The following seems bogus to me -- The flags are initialized in
10217
the assembler but I don't think an elf_flags_init field is
10218
written into the object. */
10219
/* BFD_ASSERT (elf_flags_init (ibfd)); */
10221
in_flags = elf_elfheader (ibfd)->e_flags;
10222
out_flags = elf_elfheader (obfd)->e_flags;
10224
/* In theory there is no reason why we couldn't handle this. However
10225
in practice it isn't even close to working and there is no real
10226
reason to want it. */
10227
if (EF_ARM_EABI_VERSION (in_flags) >= EF_ARM_EABI_VER4
10228
&& !(ibfd->flags & DYNAMIC)
10229
&& (in_flags & EF_ARM_BE8))
10231
_bfd_error_handler (_("error: %B is already in final BE8 format"),
10236
if (!elf_flags_init (obfd))
10238
/* If the input is the default architecture and had the default
10239
flags then do not bother setting the flags for the output
10240
architecture, instead allow future merges to do this. If no
10241
future merges ever set these flags then they will retain their
10242
uninitialised values, which surprise surprise, correspond
10243
to the default values. */
10244
if (bfd_get_arch_info (ibfd)->the_default
10245
&& elf_elfheader (ibfd)->e_flags == 0)
10248
elf_flags_init (obfd) = TRUE;
10249
elf_elfheader (obfd)->e_flags = in_flags;
10251
if (bfd_get_arch (obfd) == bfd_get_arch (ibfd)
10252
&& bfd_get_arch_info (obfd)->the_default)
10253
return bfd_set_arch_mach (obfd, bfd_get_arch (ibfd), bfd_get_mach (ibfd));
10258
/* Determine what should happen if the input ARM architecture
10259
does not match the output ARM architecture. */
10260
if (! bfd_arm_merge_machines (ibfd, obfd))
10263
/* Identical flags must be compatible. */
10264
if (in_flags == out_flags)
10267
/* Check to see if the input BFD actually contains any sections. If
10268
not, its flags may not have been initialised either, but it
10269
cannot actually cause any incompatiblity. Do not short-circuit
10270
dynamic objects; their section list may be emptied by
10271
elf_link_add_object_symbols.
10273
Also check to see if there are no code sections in the input.
10274
In this case there is no need to check for code specific flags.
10275
XXX - do we need to worry about floating-point format compatability
10276
in data sections ? */
10277
if (!(ibfd->flags & DYNAMIC))
10279
bfd_boolean null_input_bfd = TRUE;
10280
bfd_boolean only_data_sections = TRUE;
10282
for (sec = ibfd->sections; sec != NULL; sec = sec->next)
10284
/* Ignore synthetic glue sections. */
10285
if (strcmp (sec->name, ".glue_7")
10286
&& strcmp (sec->name, ".glue_7t"))
10288
if ((bfd_get_section_flags (ibfd, sec)
10289
& (SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS))
10290
== (SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS))
10291
only_data_sections = FALSE;
10293
null_input_bfd = FALSE;
10298
if (null_input_bfd || only_data_sections)
10302
/* Complain about various flag mismatches. */
10303
if (!elf32_arm_versions_compatible (EF_ARM_EABI_VERSION (in_flags),
10304
EF_ARM_EABI_VERSION (out_flags)))
10307
(_("error: Source object %B has EABI version %d, but target %B has EABI version %d"),
10309
(in_flags & EF_ARM_EABIMASK) >> 24,
10310
(out_flags & EF_ARM_EABIMASK) >> 24);
10314
/* Not sure what needs to be checked for EABI versions >= 1. */
10315
/* VxWorks libraries do not use these flags. */
10316
if (get_elf_backend_data (obfd) != &elf32_arm_vxworks_bed
10317
&& get_elf_backend_data (ibfd) != &elf32_arm_vxworks_bed
10318
&& EF_ARM_EABI_VERSION (in_flags) == EF_ARM_EABI_UNKNOWN)
10320
if ((in_flags & EF_ARM_APCS_26) != (out_flags & EF_ARM_APCS_26))
10323
(_("error: %B is compiled for APCS-%d, whereas target %B uses APCS-%d"),
10325
in_flags & EF_ARM_APCS_26 ? 26 : 32,
10326
out_flags & EF_ARM_APCS_26 ? 26 : 32);
10327
flags_compatible = FALSE;
10330
if ((in_flags & EF_ARM_APCS_FLOAT) != (out_flags & EF_ARM_APCS_FLOAT))
10332
if (in_flags & EF_ARM_APCS_FLOAT)
10334
(_("error: %B passes floats in float registers, whereas %B passes them in integer registers"),
10338
(_("error: %B passes floats in integer registers, whereas %B passes them in float registers"),
10341
flags_compatible = FALSE;
10344
if ((in_flags & EF_ARM_VFP_FLOAT) != (out_flags & EF_ARM_VFP_FLOAT))
10346
if (in_flags & EF_ARM_VFP_FLOAT)
10348
(_("error: %B uses VFP instructions, whereas %B does not"),
10352
(_("error: %B uses FPA instructions, whereas %B does not"),
10355
flags_compatible = FALSE;
10358
if ((in_flags & EF_ARM_MAVERICK_FLOAT) != (out_flags & EF_ARM_MAVERICK_FLOAT))
10360
if (in_flags & EF_ARM_MAVERICK_FLOAT)
10362
(_("error: %B uses Maverick instructions, whereas %B does not"),
10366
(_("error: %B does not use Maverick instructions, whereas %B does"),
10369
flags_compatible = FALSE;
10372
#ifdef EF_ARM_SOFT_FLOAT
10373
if ((in_flags & EF_ARM_SOFT_FLOAT) != (out_flags & EF_ARM_SOFT_FLOAT))
10375
/* We can allow interworking between code that is VFP format
10376
layout, and uses either soft float or integer regs for
10377
passing floating point arguments and results. We already
10378
know that the APCS_FLOAT flags match; similarly for VFP
10380
if ((in_flags & EF_ARM_APCS_FLOAT) != 0
10381
|| (in_flags & EF_ARM_VFP_FLOAT) == 0)
10383
if (in_flags & EF_ARM_SOFT_FLOAT)
10385
(_("error: %B uses software FP, whereas %B uses hardware FP"),
10389
(_("error: %B uses hardware FP, whereas %B uses software FP"),
10392
flags_compatible = FALSE;
10397
/* Interworking mismatch is only a warning. */
10398
if ((in_flags & EF_ARM_INTERWORK) != (out_flags & EF_ARM_INTERWORK))
10400
if (in_flags & EF_ARM_INTERWORK)
10403
(_("Warning: %B supports interworking, whereas %B does not"),
10409
(_("Warning: %B does not support interworking, whereas %B does"),
10415
return flags_compatible;
10384
elf32_arm_merge_private_bfd_data (bfd * ibfd, bfd * obfd);
10418
10386
/* Display the flags field. */
14001
14026
#include "elf32-target.h"
14029
/* Merge backend specific data from an object file to the output
14030
object file when linking. */
14033
elf32_arm_merge_private_bfd_data (bfd * ibfd, bfd * obfd)
14035
flagword out_flags;
14037
bfd_boolean flags_compatible = TRUE;
14040
/* Check if we have the same endianess. */
14041
if (! _bfd_generic_verify_endian_match (ibfd, obfd))
14044
if (! is_arm_elf (ibfd) || ! is_arm_elf (obfd))
14047
if (!elf32_arm_merge_eabi_attributes (ibfd, obfd))
14050
/* The input BFD must have had its flags initialised. */
14051
/* The following seems bogus to me -- The flags are initialized in
14052
the assembler but I don't think an elf_flags_init field is
14053
written into the object. */
14054
/* BFD_ASSERT (elf_flags_init (ibfd)); */
14056
in_flags = elf_elfheader (ibfd)->e_flags;
14057
out_flags = elf_elfheader (obfd)->e_flags;
14059
/* In theory there is no reason why we couldn't handle this. However
14060
in practice it isn't even close to working and there is no real
14061
reason to want it. */
14062
if (EF_ARM_EABI_VERSION (in_flags) >= EF_ARM_EABI_VER4
14063
&& !(ibfd->flags & DYNAMIC)
14064
&& (in_flags & EF_ARM_BE8))
14066
_bfd_error_handler (_("error: %B is already in final BE8 format"),
14071
if (!elf_flags_init (obfd))
14073
/* If the input is the default architecture and had the default
14074
flags then do not bother setting the flags for the output
14075
architecture, instead allow future merges to do this. If no
14076
future merges ever set these flags then they will retain their
14077
uninitialised values, which surprise surprise, correspond
14078
to the default values. */
14079
if (bfd_get_arch_info (ibfd)->the_default
14080
&& elf_elfheader (ibfd)->e_flags == 0)
14083
elf_flags_init (obfd) = TRUE;
14084
elf_elfheader (obfd)->e_flags = in_flags;
14086
if (bfd_get_arch (obfd) == bfd_get_arch (ibfd)
14087
&& bfd_get_arch_info (obfd)->the_default)
14088
return bfd_set_arch_mach (obfd, bfd_get_arch (ibfd), bfd_get_mach (ibfd));
14093
/* Determine what should happen if the input ARM architecture
14094
does not match the output ARM architecture. */
14095
if (! bfd_arm_merge_machines (ibfd, obfd))
14098
/* Identical flags must be compatible. */
14099
if (in_flags == out_flags)
14102
/* Check to see if the input BFD actually contains any sections. If
14103
not, its flags may not have been initialised either, but it
14104
cannot actually cause any incompatiblity. Do not short-circuit
14105
dynamic objects; their section list may be emptied by
14106
elf_link_add_object_symbols.
14108
Also check to see if there are no code sections in the input.
14109
In this case there is no need to check for code specific flags.
14110
XXX - do we need to worry about floating-point format compatability
14111
in data sections ? */
14112
if (!(ibfd->flags & DYNAMIC))
14114
bfd_boolean null_input_bfd = TRUE;
14115
bfd_boolean only_data_sections = TRUE;
14117
for (sec = ibfd->sections; sec != NULL; sec = sec->next)
14119
/* Ignore synthetic glue sections. */
14120
if (strcmp (sec->name, ".glue_7")
14121
&& strcmp (sec->name, ".glue_7t"))
14123
if ((bfd_get_section_flags (ibfd, sec)
14124
& (SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS))
14125
== (SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS))
14126
only_data_sections = FALSE;
14128
null_input_bfd = FALSE;
14133
if (null_input_bfd || only_data_sections)
14137
/* Complain about various flag mismatches. */
14138
if (!elf32_arm_versions_compatible (EF_ARM_EABI_VERSION (in_flags),
14139
EF_ARM_EABI_VERSION (out_flags)))
14142
(_("error: Source object %B has EABI version %d, but target %B has EABI version %d"),
14144
(in_flags & EF_ARM_EABIMASK) >> 24,
14145
(out_flags & EF_ARM_EABIMASK) >> 24);
14149
/* Not sure what needs to be checked for EABI versions >= 1. */
14150
/* VxWorks libraries do not use these flags. */
14151
if (get_elf_backend_data (obfd) != &elf32_arm_vxworks_bed
14152
&& get_elf_backend_data (ibfd) != &elf32_arm_vxworks_bed
14153
&& EF_ARM_EABI_VERSION (in_flags) == EF_ARM_EABI_UNKNOWN)
14155
if ((in_flags & EF_ARM_APCS_26) != (out_flags & EF_ARM_APCS_26))
14158
(_("error: %B is compiled for APCS-%d, whereas target %B uses APCS-%d"),
14160
in_flags & EF_ARM_APCS_26 ? 26 : 32,
14161
out_flags & EF_ARM_APCS_26 ? 26 : 32);
14162
flags_compatible = FALSE;
14165
if ((in_flags & EF_ARM_APCS_FLOAT) != (out_flags & EF_ARM_APCS_FLOAT))
14167
if (in_flags & EF_ARM_APCS_FLOAT)
14169
(_("error: %B passes floats in float registers, whereas %B passes them in integer registers"),
14173
(_("error: %B passes floats in integer registers, whereas %B passes them in float registers"),
14176
flags_compatible = FALSE;
14179
if ((in_flags & EF_ARM_VFP_FLOAT) != (out_flags & EF_ARM_VFP_FLOAT))
14181
if (in_flags & EF_ARM_VFP_FLOAT)
14183
(_("error: %B uses VFP instructions, whereas %B does not"),
14187
(_("error: %B uses FPA instructions, whereas %B does not"),
14190
flags_compatible = FALSE;
14193
if ((in_flags & EF_ARM_MAVERICK_FLOAT) != (out_flags & EF_ARM_MAVERICK_FLOAT))
14195
if (in_flags & EF_ARM_MAVERICK_FLOAT)
14197
(_("error: %B uses Maverick instructions, whereas %B does not"),
14201
(_("error: %B does not use Maverick instructions, whereas %B does"),
14204
flags_compatible = FALSE;
14207
#ifdef EF_ARM_SOFT_FLOAT
14208
if ((in_flags & EF_ARM_SOFT_FLOAT) != (out_flags & EF_ARM_SOFT_FLOAT))
14210
/* We can allow interworking between code that is VFP format
14211
layout, and uses either soft float or integer regs for
14212
passing floating point arguments and results. We already
14213
know that the APCS_FLOAT flags match; similarly for VFP
14215
if ((in_flags & EF_ARM_APCS_FLOAT) != 0
14216
|| (in_flags & EF_ARM_VFP_FLOAT) == 0)
14218
if (in_flags & EF_ARM_SOFT_FLOAT)
14220
(_("error: %B uses software FP, whereas %B uses hardware FP"),
14224
(_("error: %B uses hardware FP, whereas %B uses software FP"),
14227
flags_compatible = FALSE;
14232
/* Interworking mismatch is only a warning. */
14233
if ((in_flags & EF_ARM_INTERWORK) != (out_flags & EF_ARM_INTERWORK))
14235
if (in_flags & EF_ARM_INTERWORK)
14238
(_("Warning: %B supports interworking, whereas %B does not"),
14244
(_("Warning: %B does not support interworking, whereas %B does"),
14250
return flags_compatible;
14004
14254
/* Symbian OS Targets. */
14006
14256
#undef TARGET_LITTLE_SYM