This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
[arm] EABI annotation of thumb symbols.
- From: Paul Brook <paul at codesourcery dot com>
- To: binutils at sources dot redhat dot com
- Cc: Richard Earnshaw <rearnsha at arm dot com>
- Date: Tue, 2 Nov 2004 14:22:03 +0000
- Subject: [arm] EABI annotation of thumb symbols.
- Organization: CodeSourcery
The current Arm abi identifies thumb function symbols by giving them type
STT_ARM_TFUNC.
The Arm EABI specifies that thumb function symbols should be identified by
setting the least significant bit of the address, and type STT_FUNC.
The patch below implements this. The main complication is that objdump -d
breaks. I added a new bfd function to get the real address of a symbol. This
seemed preferable to trying to mangle symbols while reading them in.
I'm open to alternative suggestions if people think this is the wrong way to
implement this.
Paul
2004-10-29 Paul Brook <paul@codesourcery.com>
gas/
* config/tc-arm.c (arm_adjust_symtab): Set low bit on thumb function
symbols for EABIv4 objects.
opcodes/
* arm-dis.c (print_insn): Recognise thumb symbols by address.
binutils/
* objdump.c: Use bfd_real_symbol_address instead of bfd_asymbol_value.
bfd/
* elf32-arm.h (elf32_arm_relocate_section): Mask low bit on thumb
function addresses.
(elf32_arm_output_symbol_hook): Don't use STT_ARM_TFUMC in EABIv3
objects.
(elf32_arm_add_symbol_hook): New function.
(elf_backend_add_symbol_hook): Define.
(elf32_arm_real_symbol_address): New function.
(bfd_elf32_real_symbol_address): Define.
* syms.c (bfd_real_symbol_address): Add and document.
(bfd_generic_real_symbol_address): New function.
* targets.c (BFD_JUMP_TABLE_SYMBOLS): Add _real_symbol_address.
(_real_symbol_address): New bfd target field.
* libbfd-in.h (_bfd_nosymbols_real_symbol_address): Define.
(bfd_generic_real_symbol_address): Add prototype.
* coff-rs6000.c (rs6000coff_vec, pmac_xcoff_vec): Add
bfd_generic_real_symbol_address.
* coff64-rs6000.c (rs6000coff64_vec, aix5coff64_vec): Add
bfd_generic_real_symbol_address.
* aout-target.h (MY_real_symbol_address): Define.
* aout-tic30.c (MY_real_symbol_address): Define.
* binary.c (binary_real_symbol_address): Define.
* coffcode.h (coff_real_symbol_address): Define.
* elfxx-target.h (bfd_elfNN_real_symbol_address): Define.
* i386msdos.c (msdos_real_symbol_address): Define.
* ieee.c (ieee_real_symbol_address): Define.
* ihex.c (ihex_real_symbol_address): Define.
* libaout.h (aout_32_real_symbol_address): Define.
* libbfd-in.h (_bfd_nosymbols_real_symbol_address): Define.
* libecoff.h (_bfd_ecoff_real_symbol_address): Define.
* mach-o.c (bfd_mach_o_real_symbol_address): Define.
* mmo.c (mmo_real_symbol_address): Define.
* nlm-target.h (nlm_real_symbol_address): Define.
* oasys.c (oasys_real_symbol_address): Define.
* pef.c (bfd_pef_real_symbol_address): Define.
* ppcboot.c (ppcboot_real_symbol_address): Define.
* som.c (som_real_symbol_address): Define.
* srec.c (srec_real_symbol_address): Define.
* tekhex.c (tekhex_real_symbol_address): Define.
* versados.c (versados_real_symbol_address): Define.
* vms.c (vms_real_symbol_address): Define.
* xcoff-target.h (coff_real_symbol_address): Define.
* xsym.c (bfd_sym_real_symbol_address): Define.
* bfd-in2.h: Regenerate.
* libbfd.h: Regenerate.
? bfd/doc/bfd.info
? bfd/doc/bfdint.html
? gas/doc/as.info
? ld/ld.html
? ld/ldint.html
Index: bfd/aout-target.h
===================================================================
RCS file: /cvs/src/src/bfd/aout-target.h,v
retrieving revision 1.27
diff -u -p -r1.27 aout-target.h
--- bfd/aout-target.h 8 Oct 2004 14:53:54 -0000 1.27
+++ bfd/aout-target.h 29 Oct 2004 20:22:13 -0000
@@ -583,6 +583,10 @@ MY_bfd_final_link (abfd, info)
#define MY_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
#endif
+#ifndef MY_real_symbol_address
+#define MY_real_symbol_address bfd_generic_real_symbol_address
+#endif
+
#ifndef MY_bfd_free_cached_info
#define MY_bfd_free_cached_info NAME(aout,bfd_free_cached_info)
#endif
Index: bfd/aout-tic30.c
===================================================================
RCS file: /cvs/src/src/bfd/aout-tic30.c,v
retrieving revision 1.27
diff -u -p -r1.27 aout-tic30.c
--- bfd/aout-tic30.c 8 Oct 2004 14:53:55 -0000 1.27
+++ bfd/aout-tic30.c 29 Oct 2004 20:22:13 -0000
@@ -1041,6 +1041,10 @@ tic30_aout_set_arch_mach (abfd, arch, ma
((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
#endif
+#ifndef MY_real_symbol_address
+#define MY_real_symbol_address bfd_generic_real_symbol_address
+#endif
+
#ifndef MY_bfd_free_cached_info
#define MY_bfd_free_cached_info NAME(aout,bfd_free_cached_info)
#endif
Index: bfd/bfd-in2.h
===================================================================
RCS file: /cvs/src/src/bfd/bfd-in2.h,v
retrieving revision 1.305
diff -u -p -r1.305 bfd-in2.h
--- bfd/bfd-in2.h 16 Oct 2004 18:13:52 -0000 1.305
+++ bfd/bfd-in2.h 29 Oct 2004 20:22:15 -0000
@@ -3833,6 +3833,11 @@ bfd_boolean bfd_is_target_special_symbol
#define bfd_is_target_special_symbol(abfd, sym) \
BFD_SEND (abfd, _bfd_is_target_special_symbol, (abfd, sym))
+bfd_vma bfd_real_symbol_address (bfd *abfd, asymbol *sym);
+
+#define bfd_real_symbol_address(sym) \
+ BFD_SEND (sym->the_bfd, _real_symbol_address, (sym))
+
#define bfd_canonicalize_symtab(abfd, location) \
BFD_SEND (abfd, _bfd_canonicalize_symtab, (abfd, location))
@@ -4452,6 +4457,7 @@ typedef struct bfd_target
NAME##_get_symbol_info, \
NAME##_bfd_is_local_label_name, \
NAME##_bfd_is_target_special_symbol, \
+ NAME##_real_symbol_address, \
NAME##_get_lineno, \
NAME##_find_nearest_line, \
NAME##_bfd_make_debug_symbol, \
@@ -4471,6 +4477,7 @@ typedef struct bfd_target
#define bfd_get_symbol_info(b,p,e) BFD_SEND (b, _bfd_get_symbol_info, (b,p,e))
bfd_boolean (*_bfd_is_local_label_name) (bfd *, const char *);
bfd_boolean (*_bfd_is_target_special_symbol) (bfd *, asymbol *);
+ bfd_vma (*_real_symbol_address) (asymbol *);
alent * (*_get_lineno) (bfd *, struct bfd_symbol *);
bfd_boolean (*_bfd_find_nearest_line)
(bfd *, struct bfd_section *, struct bfd_symbol **, bfd_vma,
Index: bfd/binary.c
===================================================================
RCS file: /cvs/src/src/bfd/binary.c,v
retrieving revision 1.24
diff -u -p -r1.24 binary.c
--- bfd/binary.c 8 Oct 2004 14:53:56 -0000 1.24
+++ bfd/binary.c 29 Oct 2004 20:22:15 -0000
@@ -235,6 +235,7 @@ binary_get_symbol_info (ignore_abfd, sym
}
#define binary_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
+#define binary_real_symbol_address bfd_generic_real_symbol_address
#define binary_bfd_is_local_label_name bfd_generic_is_local_label_name
#define binary_get_lineno _bfd_nosymbols_get_lineno
#define binary_find_nearest_line _bfd_nosymbols_find_nearest_line
Index: bfd/coff-rs6000.c
===================================================================
RCS file: /cvs/src/src/bfd/coff-rs6000.c,v
retrieving revision 1.66
diff -u -p -r1.66 coff-rs6000.c
--- bfd/coff-rs6000.c 21 Oct 2004 15:28:16 -0000 1.66
+++ bfd/coff-rs6000.c 29 Oct 2004 20:22:16 -0000
@@ -4171,6 +4171,7 @@ const bfd_target rs6000coff_vec =
coff_get_symbol_info,
_bfd_xcoff_is_local_label_name,
coff_bfd_is_target_special_symbol,
+ bfd_generic_real_symbol_address,
coff_get_lineno,
coff_find_nearest_line,
coff_bfd_make_debug_symbol,
@@ -4418,6 +4419,7 @@ const bfd_target pmac_xcoff_vec =
coff_get_symbol_info,
_bfd_xcoff_is_local_label_name,
coff_bfd_is_target_special_symbol,
+ bfd_generic_real_symbol_address,
coff_get_lineno,
coff_find_nearest_line,
coff_bfd_make_debug_symbol,
Index: bfd/coff64-rs6000.c
===================================================================
RCS file: /cvs/src/src/bfd/coff64-rs6000.c,v
retrieving revision 1.57
diff -u -p -r1.57 coff64-rs6000.c
--- bfd/coff64-rs6000.c 21 Oct 2004 15:28:19 -0000 1.57
+++ bfd/coff64-rs6000.c 29 Oct 2004 20:22:16 -0000
@@ -2712,6 +2712,7 @@ const bfd_target rs6000coff64_vec =
coff_get_symbol_info,
_bfd_xcoff_is_local_label_name,
coff_bfd_is_target_special_symbol,
+ bfd_generic_real_symbol_address,
coff_get_lineno,
coff_find_nearest_line,
coff_bfd_make_debug_symbol,
@@ -2960,6 +2961,7 @@ const bfd_target aix5coff64_vec =
coff_get_symbol_info,
_bfd_xcoff_is_local_label_name,
coff_bfd_is_target_special_symbol,
+ bfd_generic_real_symbol_address,
coff_get_lineno,
coff_find_nearest_line,
coff_bfd_make_debug_symbol,
Index: bfd/coffcode.h
===================================================================
RCS file: /cvs/src/src/bfd/coffcode.h,v
retrieving revision 1.113
diff -u -p -r1.113 coffcode.h
--- bfd/coffcode.h 13 Oct 2004 18:14:40 -0000 1.113
+++ bfd/coffcode.h 29 Oct 2004 20:22:17 -0000
@@ -5551,6 +5551,10 @@ static const bfd_coff_backend_data ticof
#define coff_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
#endif
+#ifndef coff_real_symbol_address
+#define coff_real_symbol_address bfd_generic_real_symbol_address
+#endif
+
#ifndef coff_read_minisymbols
#define coff_read_minisymbols _bfd_generic_read_minisymbols
#endif
Index: bfd/elf32-arm.h
===================================================================
RCS file: /cvs/src/src/bfd/elf32-arm.h,v
retrieving revision 1.155
diff -u -p -r1.155 elf32-arm.h
--- bfd/elf32-arm.h 27 Oct 2004 20:48:21 -0000 1.155
+++ bfd/elf32-arm.h 29 Oct 2004 20:22:19 -0000
@@ -2103,6 +2103,7 @@ elf32_arm_relocate_section (bfd *
bfd_vma relocation;
bfd_reloc_status_type r;
arelent bfd_reloc;
+ int s_type;
r_symndx = ELF32_R_SYM (rel->r_info);
r_type = ELF32_R_TYPE (rel->r_info);
@@ -2270,11 +2271,19 @@ elf32_arm_relocate_section (bfd *
name = bfd_section_name (input_bfd, sec);
}
+ s_type = h ? ELF_ST_TYPE (h->type) : ELF_ST_TYPE (sym->st_info);
+ /* The low bit of function addresses is used to indicate a thumb
+ function, and is not part of the relocated address. */
+ if (sym && s_type == STT_FUNC && (relocation & 1))
+ {
+ s_type = STT_ARM_TFUNC;
+ relocation = relocation &~ (bfd_vma) 1;
+ }
+
r = elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
input_section, contents, rel,
relocation, info, sec, name,
- (h ? ELF_ST_TYPE (h->type) :
- ELF_ST_TYPE (sym->st_info)), h);
+ s_type, h);
if (r != bfd_reloc_ok)
{
@@ -3211,6 +3220,14 @@ elf32_arm_is_target_special_symbol (bfd
return is_arm_mapping_symbol_name (sym->name);
}
+/* Make sure the low bit is cleared for thumb symbols. */
+
+static bfd_vma
+elf32_arm_real_symbol_address (asymbol * sym)
+{
+ return bfd_generic_real_symbol_address (sym) &~ (bfd_vma) 1;
+}
+
/* This is a copy of elf_find_function() from elf.c except that
ARM mapping symbols are ignored when looking for function names
and STT_ARM_TFUNC is considered to a function type. */
@@ -4381,6 +4398,15 @@ elf32_arm_output_symbol_hook (struct bfd
elf32_arm_section_map *map;
struct elf32_arm_link_hash_table *globals;
+ if (ELF_ST_TYPE (elfsym->st_info) == STT_ARM_TFUNC
+ && EF_ARM_EABI_VERSION (elf_elfheader (input_sec->owner)->e_flags)
+ == EF_ARM_EABI_VER3)
+ {
+ /* STT_ARM_TFUNC is only for internal use. */
+ elfsym->st_info = ELF_ST_INFO (ELF_ST_BIND (elfsym->st_info),
+ STT_FUNC);
+ }
+
/* Only do this on final link. */
if (info->relocatable)
return TRUE;
@@ -4504,6 +4530,33 @@ elf32_arm_write_section (bfd *output_bfd
return FALSE;
}
+
+/* A thumb function can be annotated by either type STT_ARM_TFUNC, or
+ by setting the low bit of the value. This function sets type to
+ STT_ARM_TFUNC in the latter case, so they can be identified by
+ bfd_elf32_arm_process_before_allocation. This will be undone in
+ elf32_arm_output_symbol_hook if neccessary. */
+
+static bfd_boolean
+elf32_arm_add_symbol_hook (bfd *abfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED,
+ Elf_Internal_Sym *sym,
+ const char **name ATTRIBUTE_UNUSED,
+ flagword *flags ATTRIBUTE_UNUSED,
+ asection **sec ATTRIBUTE_UNUSED,
+ bfd_vma *value ATTRIBUTE_UNUSED)
+{
+ switch (ELF_ST_TYPE (sym->st_info))
+ {
+ case STT_FUNC:
+ if (sym->st_value & 1)
+ sym->st_info = ELF_ST_INFO (ELF_ST_BIND (sym->st_info),
+ STT_ARM_TFUNC);
+ break;
+ }
+ return TRUE;
+}
+
#define ELF_ARCH bfd_arch_arm
#define ELF_MACHINE_CODE EM_ARM
#ifdef __QNXTARGET__
@@ -4521,6 +4574,7 @@ elf32_arm_write_section (bfd *output_bfd
#define bfd_elf32_find_nearest_line elf32_arm_find_nearest_line
#define bfd_elf32_new_section_hook elf32_arm_new_section_hook
#define bfd_elf32_bfd_is_target_special_symbol elf32_arm_is_target_special_symbol
+#define bfd_elf32_real_symbol_address elf32_arm_real_symbol_address
#define elf_backend_get_symbol_type elf32_arm_get_symbol_type
#define elf_backend_gc_mark_hook elf32_arm_gc_mark_hook
@@ -4542,6 +4596,7 @@ elf32_arm_write_section (bfd *output_bfd
#define elf_backend_section_from_shdr elf32_arm_section_from_shdr
#define elf_backend_final_write_processing elf32_arm_final_write_processing
#define elf_backend_copy_indirect_symbol elf32_arm_copy_indirect_symbol
+#define elf_backend_add_symbol_hook elf32_arm_add_symbol_hook
#define elf_backend_can_refcount 1
#define elf_backend_can_gc_sections 1
Index: bfd/elfxx-target.h
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-target.h,v
retrieving revision 1.73
diff -u -p -r1.73 elfxx-target.h
--- bfd/elfxx-target.h 8 Oct 2004 14:53:59 -0000 1.73
+++ bfd/elfxx-target.h 29 Oct 2004 20:22:19 -0000
@@ -192,6 +192,9 @@
#define bfd_elfNN_bfd_is_target_special_symbol \
((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
#endif
+#ifndef bfd_elfNN_real_symbol_address
+#define bfd_elfNN_real_symbol_address bfd_generic_real_symbol_address
+#endif
#ifndef bfd_elfNN_get_dynamic_reloc_upper_bound
#define bfd_elfNN_get_dynamic_reloc_upper_bound \
Index: bfd/i386msdos.c
===================================================================
RCS file: /cvs/src/src/bfd/i386msdos.c,v
retrieving revision 1.18
diff -u -p -r1.18 i386msdos.c
--- bfd/i386msdos.c 8 Oct 2004 14:54:00 -0000 1.18
+++ bfd/i386msdos.c 29 Oct 2004 20:22:19 -0000
@@ -194,6 +194,7 @@ msdos_set_section_contents (abfd, sectio
#define msdos_find_nearest_line _bfd_nosymbols_find_nearest_line
#define msdos_get_lineno _bfd_nosymbols_get_lineno
#define msdos_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
+#define msdos_real_symbol_address bfd_generic_real_symbol_address
#define msdos_bfd_is_local_label_name _bfd_nosymbols_bfd_is_local_label_name
#define msdos_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
#define msdos_read_minisymbols _bfd_nosymbols_read_minisymbols
Index: bfd/ieee.c
===================================================================
RCS file: /cvs/src/src/bfd/ieee.c,v
retrieving revision 1.41
diff -u -p -r1.41 ieee.c
--- bfd/ieee.c 8 Oct 2004 14:54:00 -0000 1.41
+++ bfd/ieee.c 29 Oct 2004 20:22:20 -0000
@@ -4020,6 +4020,7 @@ ieee_bfd_debug_info_accumulate (abfd, se
#define ieee_bfd_is_target_special_symbol \
((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
+#define ieee_real_symbol_address bfd_generic_real_symbol_address
#define ieee_bfd_is_local_label_name bfd_generic_is_local_label_name
#define ieee_get_lineno _bfd_nosymbols_get_lineno
#define ieee_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
Index: bfd/ihex.c
===================================================================
RCS file: /cvs/src/src/bfd/ihex.c,v
retrieving revision 1.26
diff -u -p -r1.26 ihex.c
--- bfd/ihex.c 8 Oct 2004 14:54:00 -0000 1.26
+++ bfd/ihex.c 29 Oct 2004 20:22:20 -0000
@@ -969,6 +969,7 @@ ihex_sizeof_headers (abfd, exec)
#define ihex_print_symbol _bfd_nosymbols_print_symbol
#define ihex_get_symbol_info _bfd_nosymbols_get_symbol_info
#define ihex_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
+#define ihex_real_symbol_address bfd_generic_real_symbol_address
#define ihex_bfd_is_local_label_name _bfd_nosymbols_bfd_is_local_label_name
#define ihex_get_lineno _bfd_nosymbols_get_lineno
#define ihex_find_nearest_line _bfd_nosymbols_find_nearest_line
Index: bfd/libaout.h
===================================================================
RCS file: /cvs/src/src/bfd/libaout.h,v
retrieving revision 1.18
diff -u -p -r1.18 libaout.h
--- bfd/libaout.h 8 Oct 2004 14:54:00 -0000 1.18
+++ bfd/libaout.h 29 Oct 2004 20:22:20 -0000
@@ -611,6 +611,10 @@ extern bfd_boolean NAME(aout,bfd_free_ca
((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
#endif
+#ifndef aout_32_real_symbol_address
+#define aout_32_real_symbol_address bfd_generic_real_symbol_address
+#endif
+
#ifndef WRITE_HEADERS
#define WRITE_HEADERS(abfd, execp) \
{ \
Index: bfd/libbfd-in.h
===================================================================
RCS file: /cvs/src/src/bfd/libbfd-in.h,v
retrieving revision 1.44
diff -u -p -r1.44 libbfd-in.h
--- bfd/libbfd-in.h 10 Oct 2004 13:58:04 -0000 1.44
+++ bfd/libbfd-in.h 29 Oct 2004 20:22:20 -0000
@@ -301,6 +301,7 @@ extern bfd_boolean _bfd_archive_coff_con
((bfd_boolean (*) (bfd *, const char *)) bfd_false)
#define _bfd_nosymbols_bfd_is_target_special_symbol \
((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
+#define _bfd_nosymbols_real_symbol_address bfd_generic_real_symbol_address
#define _bfd_nosymbols_get_lineno \
((alent *(*) (bfd *, asymbol *)) bfd_nullvoidptr)
#define _bfd_nosymbols_find_nearest_line \
@@ -394,6 +395,10 @@ extern bfd_boolean _bfd_generic_set_sect
#define _bfd_nodynamic_canonicalize_dynamic_reloc \
((long (*) (bfd *, arelent **, asymbol **)) _bfd_n1)
+/* Generic routine to get the address of a sybol. */
+extern bfd_vma bfd_generic_real_symbol_address
+ (asymbol *);
+
/* Generic routine to determine of the given symbol is a local
label. */
extern bfd_boolean bfd_generic_is_local_label_name
Index: bfd/libbfd.h
===================================================================
RCS file: /cvs/src/src/bfd/libbfd.h,v
retrieving revision 1.129
diff -u -p -r1.129 libbfd.h
--- bfd/libbfd.h 10 Oct 2004 13:58:04 -0000 1.129
+++ bfd/libbfd.h 29 Oct 2004 20:22:20 -0000
@@ -306,6 +306,7 @@ extern bfd_boolean _bfd_archive_coff_con
((bfd_boolean (*) (bfd *, const char *)) bfd_false)
#define _bfd_nosymbols_bfd_is_target_special_symbol \
((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
+#define _bfd_nosymbols_real_symbol_address bfd_generic_real_symbol_address
#define _bfd_nosymbols_get_lineno \
((alent *(*) (bfd *, asymbol *)) bfd_nullvoidptr)
#define _bfd_nosymbols_find_nearest_line \
@@ -399,6 +400,10 @@ extern bfd_boolean _bfd_generic_set_sect
#define _bfd_nodynamic_canonicalize_dynamic_reloc \
((long (*) (bfd *, arelent **, asymbol **)) _bfd_n1)
+/* Generic routine to get the address of a sybol. */
+extern bfd_vma bfd_generic_real_symbol_address
+ (asymbol *);
+
/* Generic routine to determine of the given symbol is a local
label. */
extern bfd_boolean bfd_generic_is_local_label_name
Index: bfd/libecoff.h
===================================================================
RCS file: /cvs/src/src/bfd/libecoff.h,v
retrieving revision 1.17
diff -u -p -r1.17 libecoff.h
--- bfd/libecoff.h 8 Oct 2004 14:54:01 -0000 1.17
+++ bfd/libecoff.h 29 Oct 2004 20:22:20 -0000
@@ -274,6 +274,7 @@ extern bfd_boolean _bfd_ecoff_write_arma
#define _bfd_ecoff_update_armap_timestamp bfd_true
#define _bfd_ecoff_bfd_is_target_special_symbol \
((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
+#define _bfd_ecoff_real_symbol_address bfd_generic_real_symbol_address
extern long _bfd_ecoff_get_symtab_upper_bound PARAMS ((bfd *abfd));
extern long _bfd_ecoff_canonicalize_symtab PARAMS ((bfd *abfd, asymbol **alocation));
Index: bfd/mach-o.c
===================================================================
RCS file: /cvs/src/src/bfd/mach-o.c,v
retrieving revision 1.12
diff -u -p -r1.12 mach-o.c
--- bfd/mach-o.c 8 Oct 2004 14:54:01 -0000 1.12
+++ bfd/mach-o.c 29 Oct 2004 20:22:21 -0000
@@ -45,6 +45,7 @@
#define bfd_mach_o_get_section_contents_in_window _bfd_generic_get_section_contents_in_window
#define bfd_mach_o_bfd_is_local_label_name _bfd_nosymbols_bfd_is_local_label_name
#define bfd_mach_o_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
+#define bfd_mach_o_real_symbol_address bfd_generic_real_symbol_address
#define bfd_mach_o_bfd_is_local_label_name _bfd_nosymbols_bfd_is_local_label_name
#define bfd_mach_o_get_lineno _bfd_nosymbols_get_lineno
#define bfd_mach_o_find_nearest_line _bfd_nosymbols_find_nearest_line
Index: bfd/mmo.c
===================================================================
RCS file: /cvs/src/src/bfd/mmo.c,v
retrieving revision 1.24
diff -u -p -r1.24 mmo.c
--- bfd/mmo.c 24 Oct 2004 22:50:43 -0000 1.24
+++ bfd/mmo.c 29 Oct 2004 20:22:22 -0000
@@ -3195,6 +3195,7 @@ mmo_canonicalize_reloc (bfd *abfd ATTRIB
#define mmo_bfd_is_local_label_name bfd_generic_is_local_label_name
#define mmo_bfd_is_target_special_symbol \
((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
+#define mmo_real_symbol_address bfd_generic_real_symbol_address
/* Is this one really used or defined by anyone? */
#define mmo_get_lineno _bfd_nosymbols_get_lineno
Index: bfd/nlm-target.h
===================================================================
RCS file: /cvs/src/src/bfd/nlm-target.h,v
retrieving revision 1.13
diff -u -p -r1.13 nlm-target.h
--- bfd/nlm-target.h 8 Oct 2004 14:54:01 -0000 1.13
+++ bfd/nlm-target.h 29 Oct 2004 20:22:22 -0000
@@ -28,6 +28,7 @@ Foundation, Inc., 59 Temple Place - Suit
#define nlm_bfd_is_local_label_name bfd_generic_is_local_label_name
#define nlm_bfd_is_target_special_symbol \
((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
+#define nlm_real_symbol_address bfd_generic_real_symbol_address
#define nlm_get_lineno _bfd_nosymbols_get_lineno
#define nlm_find_nearest_line _bfd_nosymbols_find_nearest_line
#define nlm_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
Index: bfd/oasys.c
===================================================================
RCS file: /cvs/src/src/bfd/oasys.c,v
retrieving revision 1.26
diff -u -p -r1.26 oasys.c
--- bfd/oasys.c 8 Oct 2004 14:54:01 -0000 1.26
+++ bfd/oasys.c 29 Oct 2004 20:22:22 -0000
@@ -1490,6 +1490,7 @@ oasys_sizeof_headers (abfd, exec)
#define oasys_bfd_is_local_label_name bfd_generic_is_local_label_name
#define oasys_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
+#define oasys_real_symbol_address bfd_generic_real_symbol_address
#define oasys_get_lineno _bfd_nosymbols_get_lineno
#define oasys_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
#define oasys_read_minisymbols _bfd_generic_read_minisymbols
Index: bfd/pef.c
===================================================================
RCS file: /cvs/src/src/bfd/pef.c,v
retrieving revision 1.10
diff -u -p -r1.10 pef.c
--- bfd/pef.c 8 Oct 2004 14:54:01 -0000 1.10
+++ bfd/pef.c 29 Oct 2004 20:22:22 -0000
@@ -38,6 +38,7 @@
#define bfd_pef_new_section_hook _bfd_generic_new_section_hook
#define bfd_pef_bfd_is_local_label_name bfd_generic_is_local_label_name
#define bfd_pef_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
+#define bfd_pef_real_symbol_address bfd_generic_real_symbol_address
#define bfd_pef_get_lineno _bfd_nosymbols_get_lineno
#define bfd_pef_find_nearest_line _bfd_nosymbols_find_nearest_line
#define bfd_pef_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
Index: bfd/ppcboot.c
===================================================================
RCS file: /cvs/src/src/bfd/ppcboot.c,v
retrieving revision 1.21
diff -u -p -r1.21 ppcboot.c
--- bfd/ppcboot.c 8 Oct 2004 14:54:01 -0000 1.21
+++ bfd/ppcboot.c 29 Oct 2004 20:22:22 -0000
@@ -347,6 +347,7 @@ ppcboot_get_symbol_info (ignore_abfd, sy
#define ppcboot_bfd_is_target_special_symbol \
((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
+#define ppcboot_real_symbol_address bfd_generic_real_symbol_address
#define ppcboot_bfd_is_local_label_name bfd_generic_is_local_label_name
#define ppcboot_get_lineno _bfd_nosymbols_get_lineno
#define ppcboot_find_nearest_line _bfd_nosymbols_find_nearest_line
Index: bfd/som.c
===================================================================
RCS file: /cvs/src/src/bfd/som.c,v
retrieving revision 1.48
diff -u -p -r1.48 som.c
--- bfd/som.c 9 Oct 2004 02:51:31 -0000 1.48
+++ bfd/som.c 29 Oct 2004 20:22:24 -0000
@@ -6404,6 +6404,7 @@ som_bfd_link_split_section (abfd, sec)
#define som_bfd_is_target_special_symbol \
((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
+#define som_real_symbol_address bgf_generic_real_symbol_address
#define som_get_lineno _bfd_nosymbols_get_lineno
#define som_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
#define som_read_minisymbols _bfd_generic_read_minisymbols
Index: bfd/srec.c
===================================================================
RCS file: /cvs/src/src/bfd/srec.c,v
retrieving revision 1.32
diff -u -p -r1.32 srec.c
--- bfd/srec.c 8 Oct 2004 14:54:01 -0000 1.32
+++ bfd/srec.c 29 Oct 2004 20:22:24 -0000
@@ -1263,6 +1263,7 @@ srec_print_symbol (abfd, afile, symbol,
#define srec_new_section_hook _bfd_generic_new_section_hook
#define srec_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
+#define srec_real_symbol_address bfd_generic_real_symbol_address
#define srec_bfd_is_local_label_name bfd_generic_is_local_label_name
#define srec_get_lineno _bfd_nosymbols_get_lineno
#define srec_find_nearest_line _bfd_nosymbols_find_nearest_line
Index: bfd/syms.c
===================================================================
RCS file: /cvs/src/src/bfd/syms.c,v
retrieving revision 1.39
diff -u -p -r1.39 syms.c
--- bfd/syms.c 8 Oct 2004 14:54:01 -0000 1.39
+++ bfd/syms.c 29 Oct 2004 20:22:24 -0000
@@ -399,6 +399,29 @@ DESCRIPTION
/*
FUNCTION
+ bfd_real_symbol_address
+
+SYNOPSIS
+ bfd_vma bfd_real_symbol_address (bfd *abfd, asymbol *sym);
+
+DESCRIPTION
+ Some targets use spare address bits encode auxiliary information
+ about the symbol (eg. arm/thumb). This returns the actual
+ VM address refered to be the symbol.
+
+.#define bfd_real_symbol_address(sym) \
+. BFD_SEND (sym->the_bfd, _real_symbol_address, (sym))
+.
+*/
+
+bfd_vma
+bfd_generic_real_symbol_address (asymbol * sym)
+{
+ return bfd_asymbol_value (sym);
+}
+
+/*
+FUNCTION
bfd_canonicalize_symtab
DESCRIPTION
Index: bfd/targets.c
===================================================================
RCS file: /cvs/src/src/bfd/targets.c,v
retrieving revision 1.118
diff -u -p -r1.118 targets.c
--- bfd/targets.c 8 Oct 2004 14:54:01 -0000 1.118
+++ bfd/targets.c 29 Oct 2004 20:22:25 -0000
@@ -339,6 +339,7 @@ BFD_JUMP_TABLE macros.
. NAME##_get_symbol_info, \
. NAME##_bfd_is_local_label_name, \
. NAME##_bfd_is_target_special_symbol, \
+. NAME##_real_symbol_address, \
. NAME##_get_lineno, \
. NAME##_find_nearest_line, \
. NAME##_bfd_make_debug_symbol, \
@@ -358,6 +359,7 @@ BFD_JUMP_TABLE macros.
.#define bfd_get_symbol_info(b,p,e) BFD_SEND (b, _bfd_get_symbol_info, (b,p,e))
. bfd_boolean (*_bfd_is_local_label_name) (bfd *, const char *);
. bfd_boolean (*_bfd_is_target_special_symbol) (bfd *, asymbol *);
+. bfd_vma (*_real_symbol_address) (asymbol *);
. alent * (*_get_lineno) (bfd *, struct bfd_symbol *);
. bfd_boolean (*_bfd_find_nearest_line)
. (bfd *, struct bfd_section *, struct bfd_symbol **, bfd_vma,
Index: bfd/tekhex.c
===================================================================
RCS file: /cvs/src/src/bfd/tekhex.c,v
retrieving revision 1.22
diff -u -p -r1.22 tekhex.c
--- bfd/tekhex.c 8 Oct 2004 14:54:02 -0000 1.22
+++ bfd/tekhex.c 29 Oct 2004 20:22:25 -0000
@@ -990,6 +990,7 @@ tekhex_print_symbol (abfd, filep, symbol
#define tekhex_new_section_hook _bfd_generic_new_section_hook
#define tekhex_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
+#define tekhex_real_symbol_address bfd_generic_real_symbol_address
#define tekhex_bfd_is_local_label_name bfd_generic_is_local_label_name
#define tekhex_get_lineno _bfd_nosymbols_get_lineno
#define tekhex_find_nearest_line _bfd_nosymbols_find_nearest_line
Index: bfd/versados.c
===================================================================
RCS file: /cvs/src/src/bfd/versados.c,v
retrieving revision 1.24
diff -u -p -r1.24 versados.c
--- bfd/versados.c 8 Oct 2004 14:54:02 -0000 1.24
+++ bfd/versados.c 29 Oct 2004 20:22:25 -0000
@@ -857,6 +857,7 @@ versados_canonicalize_reloc (abfd, secti
#define versados_bfd_is_target_special_symbol \
((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
+#define versados_real_symbol_address bfd_generic_real_symbol_address
#define versados_bfd_is_local_label_name bfd_generic_is_local_label_name
#define versados_get_lineno _bfd_nosymbols_get_lineno
#define versados_find_nearest_line _bfd_nosymbols_find_nearest_line
Index: bfd/vms.c
===================================================================
RCS file: /cvs/src/src/bfd/vms.c,v
retrieving revision 1.32
diff -u -p -r1.32 vms.c
--- bfd/vms.c 8 Oct 2004 14:54:02 -0000 1.32
+++ bfd/vms.c 29 Oct 2004 20:22:25 -0000
@@ -165,6 +165,7 @@ static bfd_boolean vms_bfd_set_private_f
PARAMS ((bfd *abfd, flagword flags));
#define vms_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
+#define vms_real_symbol_address bfd_generic_real_symbol_address
#define vms_make_empty_symbol _bfd_generic_make_empty_symbol
#define vms_bfd_link_just_syms _bfd_generic_link_just_syms
#define vms_bfd_is_group_section bfd_generic_is_group_section
Index: bfd/xcoff-target.h
===================================================================
RCS file: /cvs/src/src/bfd/xcoff-target.h,v
retrieving revision 1.11
diff -u -p -r1.11 xcoff-target.h
--- bfd/xcoff-target.h 8 Oct 2004 14:54:02 -0000 1.11
+++ bfd/xcoff-target.h 29 Oct 2004 20:22:26 -0000
@@ -44,6 +44,7 @@ Foundation, Inc., 59 Temple Place - Suit
#define coff_bfd_copy_private_bfd_data _bfd_xcoff_copy_private_bfd_data
#define coff_bfd_is_local_label_name _bfd_xcoff_is_local_label_name
#define coff_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
+#define coff_real_symbol_address bfd_generic_real_symbol_address
#define coff_bfd_reloc_type_lookup _bfd_xcoff_reloc_type_lookup
#define coff_relocate_section _bfd_ppc_xcoff_relocate_section
Index: bfd/xsym.c
===================================================================
RCS file: /cvs/src/src/bfd/xsym.c,v
retrieving revision 1.9
diff -u -p -r1.9 xsym.c
--- bfd/xsym.c 8 Oct 2004 14:54:02 -0000 1.9
+++ bfd/xsym.c 29 Oct 2004 20:22:26 -0000
@@ -28,6 +28,7 @@
#define bfd_sym_new_section_hook _bfd_generic_new_section_hook
#define bfd_sym_bfd_is_local_label_name bfd_generic_is_local_label_name
#define bfd_sym_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
+#define bfd_sym_real_symbol_address bfd_generic_real_symbol_address
#define bfd_sym_get_lineno _bfd_nosymbols_get_lineno
#define bfd_sym_find_nearest_line _bfd_nosymbols_find_nearest_line
#define bfd_sym_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
Index: binutils/objdump.c
===================================================================
RCS file: /cvs/src/src/binutils/objdump.c,v
retrieving revision 1.96
diff -u -p -r1.96 objdump.c
--- binutils/objdump.c 11 Oct 2004 08:18:43 -0000 1.96
+++ binutils/objdump.c 29 Oct 2004 20:22:27 -0000
@@ -695,9 +695,9 @@ find_symbol_for_address (bfd_vma vma,
thisplace = (max + min) / 2;
sym = sorted_syms[thisplace];
- if (bfd_asymbol_value (sym) > vma)
+ if (bfd_real_symbol_address (sym) > vma)
max = thisplace;
- else if (bfd_asymbol_value (sym) < vma)
+ else if (bfd_real_symbol_address (sym) < vma)
min = thisplace;
else
{
@@ -711,8 +711,8 @@ find_symbol_for_address (bfd_vma vma,
value, we want the first one. */
thisplace = min;
while (thisplace > 0
- && (bfd_asymbol_value (sorted_syms[thisplace])
- == bfd_asymbol_value (sorted_syms[thisplace - 1])))
+ && (bfd_real_symbol_address (sorted_syms[thisplace])
+ == bfd_real_symbol_address (sorted_syms[thisplace - 1])))
--thisplace;
/* If the file is relocatable, and the symbol could be from this
@@ -734,8 +734,8 @@ find_symbol_for_address (bfd_vma vma,
for (i = thisplace + 1; i < sorted_symcount; i++)
{
- if (bfd_asymbol_value (sorted_syms[i])
- != bfd_asymbol_value (sorted_syms[thisplace]))
+ if (bfd_real_symbol_address (sorted_syms[i])
+ != bfd_real_symbol_address (sorted_syms[thisplace]))
break;
}
@@ -746,8 +746,8 @@ find_symbol_for_address (bfd_vma vma,
if (sorted_syms[i]->section == sec
&& (i == 0
|| sorted_syms[i - 1]->section != sec
- || (bfd_asymbol_value (sorted_syms[i])
- != bfd_asymbol_value (sorted_syms[i - 1]))))
+ || (bfd_real_symbol_address (sorted_syms[i])
+ != bfd_real_symbol_address (sorted_syms[i - 1]))))
{
thisplace = i;
break;
@@ -783,7 +783,7 @@ find_symbol_for_address (bfd_vma vma,
{
++ thisplace;
if (thisplace >= sorted_symcount
- || bfd_asymbol_value (sorted_syms [thisplace]) > vma)
+ || bfd_real_symbol_address (sorted_syms [thisplace]) > vma)
return NULL;
}
@@ -825,15 +825,17 @@ objdump_print_addr_with_sym (bfd *abfd,
{
(*info->fprintf_func) (info->stream, " <");
objdump_print_symname (abfd, info, sym);
- if (bfd_asymbol_value (sym) > vma)
+ if (bfd_real_symbol_address (sym) > vma)
{
(*info->fprintf_func) (info->stream, "-0x");
- objdump_print_value (bfd_asymbol_value (sym) - vma, info, TRUE);
+ objdump_print_value (bfd_real_symbol_address (sym) - vma, info,
+ TRUE);
}
- else if (vma > bfd_asymbol_value (sym))
+ else if (vma > bfd_real_symbol_address (sym))
{
(*info->fprintf_func) (info->stream, "+0x");
- objdump_print_value (vma - bfd_asymbol_value (sym), info, TRUE);
+ objdump_print_value (vma - bfd_real_symbol_address (sym), info,
+ TRUE);
}
(*info->fprintf_func) (info->stream, ">");
}
@@ -881,7 +883,7 @@ objdump_symbol_at_address (bfd_vma vma,
sym = find_symbol_for_address (vma, info, NULL);
- return (sym != NULL && (bfd_asymbol_value (sym) == vma));
+ return (sym != NULL && (bfd_real_symbol_address (sym) == vma));
}
/* Hold the last function name and the last line number we displayed
@@ -1686,13 +1688,13 @@ disassemble_section (bfd *abfd, asection
addr = section->vma + addr_offset;
- if (sym != NULL && bfd_asymbol_value (sym) <= addr)
+ if (sym != NULL && bfd_real_symbol_address (sym) <= addr)
{
int x;
for (x = place;
(x < sorted_symcount
- && (bfd_asymbol_value (sorted_syms[x]) <= addr));
+ && (bfd_real_symbol_address (sorted_syms[x]) <= addr));
++x)
continue;
@@ -1713,7 +1715,7 @@ disassemble_section (bfd *abfd, asection
pinfo->fprintf_func (pinfo->stream, ":\n");
}
- if (sym != NULL && bfd_asymbol_value (sym) > addr)
+ if (sym != NULL && bfd_real_symbol_address (sym) > addr)
nextsym = sym;
else if (sym == NULL)
nextsym = NULL;
@@ -1721,7 +1723,7 @@ disassemble_section (bfd *abfd, asection
{
#define is_valid_next_sym(SYM) \
((SYM)->section == section \
- && (bfd_asymbol_value (SYM) > bfd_asymbol_value (sym)) \
+ && (bfd_real_symbol_address (SYM) > bfd_real_symbol_address (sym)) \
&& pinfo->symbol_is_valid (SYM, pinfo))
/* Search forward for the next appropriate symbol in
@@ -1738,12 +1740,12 @@ disassemble_section (bfd *abfd, asection
nextsym = sorted_syms[place];
}
- if (sym != NULL && bfd_asymbol_value (sym) > addr)
- nextstop_offset = bfd_asymbol_value (sym) - section->vma;
+ if (sym != NULL && bfd_real_symbol_address (sym) > addr)
+ nextstop_offset = bfd_real_symbol_address (sym) - section->vma;
else if (nextsym == NULL)
nextstop_offset = stop_offset;
else
- nextstop_offset = bfd_asymbol_value (nextsym) - section->vma;
+ nextstop_offset = bfd_real_symbol_address (nextsym) - section->vma;
if (nextstop_offset > stop_offset)
nextstop_offset = stop_offset;
@@ -1753,7 +1755,7 @@ disassemble_section (bfd *abfd, asection
disassembling them. */
if (disassemble_all
|| sym == NULL
- || bfd_asymbol_value (sym) > addr
+ || bfd_real_symbol_address (sym) > addr
|| ((sym->flags & BSF_OBJECT) == 0
&& (strstr (bfd_asymbol_name (sym), "gnu_compiled")
== NULL)
Index: gas/config/tc-arm.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-arm.c,v
retrieving revision 1.184
diff -u -p -r1.184 tc-arm.c
--- gas/config/tc-arm.c 25 Oct 2004 12:26:01 -0000 1.184
+++ gas/config/tc-arm.c 29 Oct 2004 20:22:29 -0000
@@ -13370,19 +13370,29 @@ arm_adjust_symtab (void)
{
if (ARM_IS_THUMB (sym))
{
- elf_symbol_type * elf_sym;
- elf_sym = elf_symbol (symbol_get_bfdsym (sym));
- bind = ELF_ST_BIND (elf_sym);
-
- /* If it's a .thumb_func, declare it as so,
- otherwise tag label as .code 16. */
- if (THUMB_IS_FUNC (sym))
- elf_sym->internal_elf_sym.st_info =
- ELF_ST_INFO (bind, STT_ARM_TFUNC);
+ if (meabi_flags == EF_ARM_EABI_VER4)
+ {
+ /* Set the low bit on thumb symbols. */
+ if (THUMB_IS_FUNC (sym))
+ symbol_get_bfdsym (sym)->value |= 1;
+ }
else
- elf_sym->internal_elf_sym.st_info =
- ELF_ST_INFO (bind, STT_ARM_16BIT);
+ {
+ elf_symbol_type * elf_sym;
+
+ elf_sym = elf_symbol (symbol_get_bfdsym (sym));
+ bind = ELF_ST_BIND (elf_sym);
+
+ /* If it's a .thumb_func, declare it as so,
+ otherwise tag label as .code 16. */
+ if (THUMB_IS_FUNC (sym))
+ elf_sym->internal_elf_sym.st_info =
+ ELF_ST_INFO (bind, STT_ARM_TFUNC);
+ else
+ elf_sym->internal_elf_sym.st_info =
+ ELF_ST_INFO (bind, STT_ARM_16BIT);
+ }
}
}
#endif
Index: opcodes/arm-dis.c
===================================================================
RCS file: /cvs/src/src/opcodes/arm-dis.c,v
retrieving revision 1.38
diff -u -p -r1.38 arm-dis.c
--- opcodes/arm-dis.c 30 Sep 2004 16:21:43 -0000 1.38
+++ opcodes/arm-dis.c 29 Oct 2004 20:22:31 -0000
@@ -1286,7 +1286,8 @@ print_insn (pc, info, little)
es = *(elf_symbol_type **)(info->symbols);
type = ELF_ST_TYPE (es->internal_elf_sym.st_info);
- is_thumb = (type == STT_ARM_TFUNC) || (type == STT_ARM_16BIT);
+ is_thumb = (type == STT_ARM_TFUNC) || (type == STT_ARM_16BIT)
+ || (type == STT_FUNC && (es->internal_elf_sym.st_value & 1));
}
}