Problems with branch-to-arm-from-thumb for typeless symbol
Fri Mar 1 14:16:00 GMT 2013
On 01/03/13 05:23, Hans-Peter Nilsson wrote:
> See <http://sourceware.org/bugzilla/show_bug.cgi?id=15217>. Are
> target symbols required to have a type specified in order for
> arm/thumb stubs to work?
> bl lib_func2
> (where lib_func2 is in arm mode but with no type decoration)
The assumption is that if you call an untyped symbol the code knows what
it is doing and that special processing for interworking is not
required. Furthermore, the guarantee that IP (r12) is free as an
interworking register is not available for untyped symbol interfaces.
> If so, would it be an improvement to emit errors when finding
> calls to symbols that have no type specified? That'd at least
> warn people inheriting sloppily hand-written assembly code as to
> what goes wrong.
That would break existing use cases where the code is correct.
There may be a small number of cases where you could safely say that the
user is being silly, but it would need careful thought to ensure that it
doesn't break valid cases.
> FWIW, I tried the following patch (to set the default stub for
> defined untyped symbols), which seems to work for the specific
> test-case, but causes some stub names to change from
> "__func_to_branch_to_veneer" to
> "__func_to_branch_to_from_thumb", causing these tests to fail:
> Running /expvol/pp_slask/hp/ticket44165/trunkbinu/src/ld/testsuite/ld-arm/arm-elf.exp ...
> FAIL: erratum 760522 fix (default for v6z)
> FAIL: erratum 760522 fix (explicitly on at v6z)
> FAIL: erratum 760522 fix (explicitly off at v6z)
> FAIL: erratum 760522 fix (default for v5)
> FAIL: erratum 760522 fix (default for v7-a)
> FAIL: erratum 760522 fix (default for ARM1156)
> and also munges the "C" symbol in the
> ld-elf/extract-symbol-1sym.d test-case to:
> 00020122 T C
> causing this:
> Running /expvol/pp_slask/hp/ticket44165/trunkbinu/src/ld/testsuite/ld-elf/elf.exp ...
> FAIL: --extract-symbol test 1 (symbols)
> so the patch is at least incomplete. Thoughts?
> diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
> index aba1814..a53c64f 100644
> --- a/bfd/elf32-arm.c
> +++ b/bfd/elf32-arm.c
> @@ -15457,9 +15457,12 @@ elf32_arm_swap_symbol_in (bfd * abfd,
> return FALSE;
> /* New EABI objects mark thumb function symbols by setting the low bit of
> - the address. */
> + the address. Hand-written assembly-code may lack specification of
> + the symbol type. */
> if (ELF_ST_TYPE (dst->st_info) == STT_FUNC
> - || ELF_ST_TYPE (dst->st_info) == STT_GNU_IFUNC)
> + || ELF_ST_TYPE (dst->st_info) == STT_GNU_IFUNC
> + || (ELF_ST_TYPE (dst->st_info) == STT_NOTYPE
> + && dst->st_info != STN_UNDEF))
> if (dst->st_value & 1)
> brgds, H-P
More information about the Binutils