This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Problems with branch-to-arm-from-thumb for typeless symbol


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?

code_in_thumb_mode:
	bl	lib_func2

(where lib_func2 is in arm mode but with no type decoration)

 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.

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]