2011/4/28 Andrew Stubbs andrew.stubbs@linaro.org:
On 28/04/11 02:30, Barry Song wrote:
I am using the newest binary utils(2.21) and encounted the following ASSERT in arm_elf32.c:
- if (out_attr[i].i == 0)
- {
- BFD_ASSERT (out_attr[Tag_ABI_HardFP_use].i == 0);
[...]
But not sure whether it is a bug.
I should say that it is a bug because asserts are there to catch bugs. If it were checking the input were valid then it would give a diagnostic message. That said, it may be that the bug *is* that a diagnostic should be used instead of an assert. :)
In this case 'i' will be 'Tag_FP_arch', so the code is saying that if Tag_FP_arch is not set, then set that and set Tag_ABI_HardFP_use at the same time. Since this is the only place Tag_ABI_HardFP_use is ever set, it should not be possible to have it set without Tag_FP_arch also being set, so if the assert triggers then something is broken.
So, the question is, what is setting the tags this way? Assuming the code is ok, the only other way it could happen is in a malformed input file.
Now, the reason this is an assert, and not a diagnostic, is probably because the tags are not considered "user input". Yes, the user can set them via assembler directives, but the assembler is supposed to make sure they are valid before creating the object file.
Could you please run the broken link again with "-Wl,-t" (trace) and record all the input files the linker uses, and check what attributes (tags) are set on those files using "readelf -A".
my other two mails explain what happened, in fact link input file is simple: readelf -A .../dir_soc.o Attribute Section: aeabi File Attributes Tag_CPU_name: "ARM1136JF-S" Tag_CPU_arch: v6 Tag_ARM_ISA_use: Yes Tag_THUMB_ISA_use: Thumb-1 Tag_FP_arch: VFPv2 Tag_ABI_PCS_wchar_t: 4 Tag_ABI_FP_denormal: Needed Tag_ABI_FP_exceptions: Needed Tag_ABI_FP_number_model: IEEE 754 Tag_ABI_align_needed: 8-byte Tag_ABI_enum_size: int Tag_ABI_HardFP_use: SP and DP Tag_ABI_optimization_goals: Aggressive Speed Tag_DIV_use: Not allowed
ASSERT found just because we are using -nostdlib flag since we don't call any library. This flag changed out_attr[Tag_FP_arch] to 0, which is generically 4 for linaro new toolchain by watching a normal compile/link process.
I suspect that you may have a mal-formed binary on your system (possibly created by an older version of binutils).
Andrew