[PATCH] fix underfined Thumb symbols

Vladimir Prus vladimir@codesourcery.com
Sat Jun 17 12:43:00 GMT 2006
Hello!

For ARM EABI, the low bit of st_value field of function symbols is used to 
indicate the thumbness of the symbol. However, this low bit is set not only
for symbols defined in an object, but also for underfined symbols.

Suppose libfoo.so defines thumb symbol foo, and libbar.so uses foo and links 
to libfoo.so. The static linker, when creating 'libbar.so', will carry over
thumbness of 'foo' into libbar.so's symbol table, like this:

   6   2: 00000001     2    FUNC GLOBAL DEFAULT UND foo

This is not quite right:

1. At runtime, the symbol 'foo' in libfoo.so might no longer be Thumb symbol.
And ifs it's Thumb symbol, dynamic linker will handle this just fine anyway, 
without that low bit hint.
2. The '1' address can be confusing for user and for dynamic linker, as
usually non-null values of underfined symbols are used in main executable to
refer to PLT entries.

The attached patch fixes this by not setting the low bit when writing 
underfined Thumb symbols.

Tested with cross to arm-none-linux-gnueabi.

bfd/
2006-06-17  Vladimir Prus  <vladimir@codesourcery.com>

	* elf32-arm.c (elf32_arm_swap_symbol_out): Don't set low
    bit for underfined symbols.

ld/testsuite
2006-06-17  Vladimir Prus  <vladimir@codesourcery.com>

    * ld-arm/arm-elf.exp: New test.
    * ld-arm/use-thumb-lib.s: New file.
    * ld-arm/usr-thumb-lib.sym: New file.



- Volodya


-------------- next part --------------
A non-text attachment was scrubbed...
Name: undefined_thumb.diff
Type: text/x-diff
Size: 3562 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20060617/8ad74ce6/attachment.bin>


More information about the Binutils mailing list