This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
PowerPC64 binutils IE query
- From: "rohitarulraj at freescale dot com" <rohitarulraj at freescale dot com>
- To: "binutils at sourceware dot org" <binutils at sourceware dot org>
- Cc: "amodra at gmail dot com" <amodra at gmail dot com>, Edmar Wienskoski <edmar at freescale dot com>, "rohitarulraj at freescale dot com" <rohitarulraj at freescale dot com>
- Date: Mon, 5 May 2014 07:13:59 +0000
- Subject: PowerPC64 binutils IE query
- Authentication-results: sourceware.org; auth=none
Hello All,
We got this binutils IE (v2.23.1 and v2.21) while compiling Book 3E kernel code.
Command: (Target: e6500 64-bit)
as -v -a64 -me6500 -many -mbig -o test.o test.s
Test case #1:
.text
_foo:
1:
lis %r5,(_goo - _foo)@highest
blr
/tmp/ccxLScrU.s: Assembler messages:
/tmp/ccxLScrU.s: Internal error, aborting at ../../src_bin/gas/config/tc-ppc.c line 6742 in md_apply_fix
Please report this bug.
Ideally we should get the following error: "invalid operands (*UND* and .text sections)" for trying to subtract a symbol.
If I move the "_foo" symbol to some other section (test case #2) , I get the expected error message.
Test case #2:
.data
_foo:
.text
1:
lis %r5,(_goo - _foo)@highest
blr
../3.S: Assembler messages:
../3.S:7: Error: can't resolve `_goo' {*UND* section} - `_foo' {.data section}
../3.S:7: Error: expression too complex
For test case #1, the assembler code tries to fold that expression and convert that symbol in to an offset and tries to do an PC relative relocation because the "_foo" symbol is present in the same section ".text" where the expression is being resolved. But for 64-bit PowerPC target, for symbolic expressions as in (test case #1), the PC relative relocation is not yet handled (for @highest and @higher) and hence it aborts.
Source:binutils/gas/config/tc-ppc.c: line 6725
...
#ifdef OBJ_ELF
case BFD_RELOC_PPC64_HIGHER:
if (fixP->fx_pcrel)
abort ();
md_number_to_chars (fixP->fx_frag->fr_literal + fixP->fx_where,
PPC_HIGHER (value), 2);
break;
case BFD_RELOC_PPC64_HIGHER_S:
if (fixP->fx_pcrel)
abort ();
md_number_to_chars (fixP->fx_frag->fr_literal + fixP->fx_where,
PPC_HIGHERA (value), 2);
break;
case BFD_RELOC_PPC64_HIGHEST:
if (fixP->fx_pcrel)
abort ();
md_number_to_chars (fixP->fx_frag->fr_literal + fixP->fx_where,
PPC_HIGHEST (value), 2);
break;
case BFD_RELOC_PPC64_HIGHEST_S:
if (fixP->fx_pcrel)
abort ();
md_number_to_chars (fixP->fx_frag->fr_literal + fixP->fx_where,
PPC_HIGHESTA (value), 2);
break;
..
Since the PC relative relocation is not yet handled, isn't it better to prevent the assembler code from trying to fold that expression so that we get the expected error message?
Is there any plan for PC relative relocation to be implemented?
Regards,
Rohit