No subject
Thu Aug 17 01:58:45 UTC 2006
"Function symbols (those with type STT_FUNC) in shared object files have
special significance.
When another object file references a function from a shared object, the
link editor automatically
creates a procedure linkage table entry for the referenced symbol. Shared
object symbols with types
other than STT_FUNC will not be referenced automatically through the
procedure linkage table."
http://publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/aixprggd/genprogc/binary_symtabSymb.htm
So just searching for the function types (STT_FUNC on most architectures,
STT_ARM_TFUNC too on ARM) should be safe and, with the move of the
_dl_strcmp to after the test on type, it should be a speed improvement.
----------------------------------------------------------------------
jocke - 08-15-05 09:48
----------------------------------------------------------------------
Mind trying the this change to dl_find_hash instead?
Index: dl-hash.c
===================================================================
--- dl-hash.c (revision 11157)
+++ dl-hash.c (working copy)
@@ -184,14 +184,15 @@
for (si = tpnt->elf_buckets[hn]; si != STN_UNDEF; si =
tpnt->chains[si]) {
sym = &symtab[si];
- if (type_class & (sym->st_shndx == SHN_UNDEF))
+ if (type_class & (sym->st_shndx == SHN_UNDEF ||
(ELF_ST_TYPE(sym->st_info) < STT_FUNC)))
continue;
if (_dl_strcmp(strtab + sym->st_name, name) != 0)
continue;
if (sym->st_value == 0)
continue;
- if (ELF_ST_TYPE(sym->st_info) > STT_FUNC)
+ if (ELF_ST_BIND(sym->st_info) == STB_LOCAL) /* not sure if this is
needed */
continue;
+ /* what about COMMOM types ? */
switch (ELF_ST_BIND(sym->st_info)) {
case STB_WEAK:
----------------------------------------------------------------------
jbowler - 08-15-05 10:22
----------------------------------------------------------------------
There's also a whole thread about STT_ARM_TFUNC which basically says 'get
rid of it', see, for example
http://sources.redhat.com/ml/binutils/2004-11/msg00290.html and this
comment from the patch:
+ /* We convert STT_ARM_TFUNC symbols into STT_FUNC with the low bit
+ of the address set, as per the new EABI. We do this
unconditionally
+ because objcopy does not set the elf header flags until after
+ it writes out the symbol table. */
+ if (ELF_ST_TYPE (src->st_info) == STT_ARM_TFUNC)
OE is using binutils 2.16 in general, but for uclibc uses a 2.14 variant
because of 'bitrot in the uclibc patches' - i.e. the 2.14 patches for
uclibc don't work with 2.16 - so since this is an EABI change it may be
necessary to upgrade to 2.16
----------------------------------------------------------------------
jbowler - 08-15-05 11:16
----------------------------------------------------------------------
The STT_ARM_TFUNC hackery is in binutils 2.16, but gcc 3.4.4 is still
generating objects using STT_ARM_TFUNC. The are no references to
STT_ARM_TFUNC in unpatched uclibc 0.9.27, therefore there is no thumb func
handling in uclibc (but there is handling for the thumb relocations)
I'll probably come up with a better patch which does the same thing as
binutils 2.16 - i.e. set the low bit in an STT_ARM_TFUNC symbol value and
convert it to STT_FUNC, then check the low bit in elfinterp.c (which is, I
believe, the only place in uclibc which hacks processor specific ELF).
This affects the dll lookup stuff only - all the asm patches (i.e. changes
to the assembler code) are, so far as I can see, good, it's just the stuff
in elfinterp.c which needs more work.
Of course the current binutils being used in OE is probably broken too,
but that's a separate problem.
----------------------------------------------------------------------
jocke - 08-15-05 11:17
----------------------------------------------------------------------
Using buildroot you should be able to use a never(2.16) binutils
----------------------------------------------------------------------
jbowler - 09-08-05 22:25
----------------------------------------------------------------------
I've verified the fixes in 0.9.28, they all look fine. I've rearranged the
other fixes (the ones not in 0.9.28) to isolate the ARM only changes from
the resolver change and to minimise the impact on the shared code
(dl-hash.c). I still find it necessary to change dl-hash.c because the
code to handle STT_ARM_TFUNC needs to know the symbol type (the function
in dl-hash.c just returns the value). I've verified this stuff to the
level of having a full NSLU2 build with only libgcc and uclibc build using
arm as opposed to thumb functions - everything looks fine. (And
libgcc/uclibc may work fine too, I just haven't tested that yet.)
The three additional patch sets will be attached:
# These patches should be applied in this order to the SVN head
# (in fact order is probably unimportant, I believe there are no
# overlaps).
thumb-defined-arm-or-thumb.patch
thumb-mov-pc-bx.patch
thumb-resolve.patch
----------------------------------------------------------------------
jbowler - 09-08-05 22:27
----------------------------------------------------------------------
These patches are to the SVN head (20050908).
thumb-resolve.patch contains the only change to a non-arm-specific file
----------------------------------------------------------------------
jocke - 09-09-05 02:22
----------------------------------------------------------------------
Just looked at the dl-hash.c stuff:
Don't quite understand why you need the STT_ARM_TFUNC here. Didn't
newer binutils already encode the STT_ARM_TFUNC as STT_FUNC
toghter with sym_val | 1?
If this is to support older binutiles, please don't. Make
newer binutils a requirement for Thumb instead.
In case STT_ARM_TFUNC must be there with never binutils:
I think you can remove the
if (ELF_ST_TYPE(sym->st_info) > STT_FUNC)
test, or replace it with
if (ELF_ST_BIND(sym->st_info) == STB_LOCAL)
Not sure moving the _dl_strcmp is a good idea since this test
will mostly be true and the if (sym->st_value == 0) will mostly
be false which will make dl_find_hash execute sym->st_value == 0 test
needlessly.
Please don't use #ifdefs, do a ARCH_<insert a good name here>(tpnt, sym)
macro for all archs instead.
----------------------------------------------------------------------
jbowler - 01-20-06 22:18
----------------------------------------------------------------------
This is an updated patch set against svn 20060120 (i.e. the head on that
date). The tested patches are (in this order):
thumb-defined-arm-or-thumb.patch
thumb-mov-pc-bx.patch
thumb-swi-r7.patch
thumb-sysnum-h.patch
thumb-asm-swi.patch
thumb-call-via-rx.patch
thumb-resolve.patch
thumb-resolve dl-hash.c may be unnecessary except that the weak symbol
handling is required (it is actually used for some DLL stuff - not sure
uClibc works without it). I haven't tested this.
----------------------------------------------------------------------
jbowler - 01-20-06 22:35
----------------------------------------------------------------------
I'm not sure whether the binutils-2.16 (and later) changes are converting
all gcc 3.4.4 generated ARM_STT_TFUNC symbols to ARM_STT_FUNC, still it is
possible to apply these patches *without* the dl-hash.c bit from
thumb-resolve.patch. I.e. everything will still compile fine and work
just as well as it does at present.
----------------------------------------------------------------------
kmk - 10-13-06 19:30
----------------------------------------------------------------------
Hi
few questions.
1. The above patches support both thumb and mixed mode or mixed mode only
2. Will the above patches work if I link uclibc statically? If not, what
additional changes required?
3. Any updates to the above patches?
Any info is appreciated.
Thanks
kmk
----------------------------------------------------------------------
khem - 11-10-06 12:13
----------------------------------------------------------------------
The last two patches uploaded on 11-10-06 are pending to be committed for
thumb support. These are
uclibc-thumb-call-via-rx.patch
uclibc-thumb-resolve.patch
----------------------------------------------------------------------
andersen - 11-10-06 12:46
----------------------------------------------------------------------
all patches now applied. Closing bug.
Issue History
Date Modified Username Field Change
======================================================================
08-13-05 22:51 jbowler New Issue
08-13-05 22:51 jbowler Status new => assigned
08-13-05 22:51 jbowler Assigned To => uClibc
08-13-05 22:51 jbowler File Added: thumb-swi.patch
08-13-05 22:52 jbowler File Added: thumb-swp.patch
08-13-05 22:52 jbowler File Added: arm-thumb-defined.patch
08-13-05 22:53 jbowler File Added: thumb-ldso-dlboot.patch
08-13-05 22:53 jbowler File Added: thumb-interwork-asm.patch
08-13-05 22:54 jbowler File Added: thumb-static-main.patch
08-14-05 06:21 vapier Note Added: 0000409
08-14-05 06:21 vapier Summary ARM thumb (including
interworking) support is non-functional => add support for ARM thumb
08-14-05 08:05 jocke Note Added: 0000410
08-14-05 08:54 jbowler Note Added: 0000411
08-14-05 10:26 jocke Note Added: 0000412
08-14-05 12:48 jbowler Note Added: 0000413
08-14-05 13:32 jocke Note Added: 0000414
08-14-05 16:16 jbowler Note Added: 0000415
08-14-05 20:31 vapier Note Added: 0000417
08-15-05 09:37 jbowler Note Added: 0000419
08-15-05 09:48 jocke Note Added: 0000420
08-15-05 10:22 jbowler Note Added: 0000421
08-15-05 11:16 jbowler Note Added: 0000422
08-15-05 11:17 jocke Note Added: 0000423
09-08-05 22:25 jbowler Note Added: 0000509
09-08-05 22:25 jbowler File Added: thumb-defined-arm-or-thumb.patch
09-08-05 22:26 jbowler File Added: thumb-mov-pc-bx.patch
09-08-05 22:26 jbowler File Added: thumb-resolve.patch
09-08-05 22:27 jbowler Note Added: 0000510
09-09-05 02:22 jocke Note Added: 0000511
01-20-06 22:18 jbowler Note Added: 0000967
01-20-06 22:27 jbowler File Added: 20060120-thumb-asm-swi.patch
01-20-06 22:28 jbowler File Added: 20060120-thumb-call-via-rx.patch
01-20-06 22:28 jbowler File Added:
20060120-thumb-defined-arm-or-thumb.patch
01-20-06 22:28 jbowler File Added: 20060120-thumb-mov-pc-bx.patch
01-20-06 22:28 jbowler File Added: 20060120-thumb-resolve.patch
01-20-06 22:29 jbowler File Added: 20060120-thumb-swi-r7.patch
01-20-06 22:29 jbowler File Added: 20060120-thumb-sysnum-h.patch
01-20-06 22:35 jbowler Note Added: 0000968
01-30-06 17:03 khem File Added:
uclibc-arm-thumb-interworking-returns.patch
10-13-06 19:28 kmk Note Added: 0001701
10-13-06 19:30 kmk Note Edited: 0001701
11-10-06 12:12 khem File Added: uclibc-thumb-call-via-rx.patch
11-10-06 12:12 khem File Added: uclibc-thumb-resolve.patch
11-10-06 12:13 khem Note Added: 0001738
11-10-06 12:46 andersen Note Added: 0001739
11-10-06 12:46 andersen Status assigned => closed
11-10-06 12:46 andersen Resolution open => fixed
======================================================================
More information about the uClibc-cvs
mailing list