aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2008-12-03 14:51:00 +0000
committerNick Clifton <nickc@redhat.com>2008-12-03 14:51:00 +0000
commite7c3341679431c5ecfc170a984d7196cdc175777 (patch)
tree5be48e5e73b1b747806d4cc47c80ca9893f3aea4 /gas
parent5d73705c26e9cb0108f95c127fc5b87c9a982289 (diff)
downloadgdb-e7c3341679431c5ecfc170a984d7196cdc175777.zip
gdb-e7c3341679431c5ecfc170a984d7196cdc175777.tar.gz
gdb-e7c3341679431c5ecfc170a984d7196cdc175777.tar.bz2
include/elf/
* common.h (STT_IFUNC): Define. elfcpp/ * elfcpp.h (enum STT): Add STT_IFUNC. bfd/ * syms.c (struct bfd_symbol): Add new flag BSF_INDIRECT_FUNCTION. Remove redundant flag BFD_FORT_COMM_DEFAULT_VALUE. Renumber flags to remove gaps. (bfd_print_symbol_vandf): Return 'i' for BSF_INDIRECT_FUNCTION. (bfd_decode_symclass): Likewise. * elf.c (swap_out_syms): Translate BSF_INDIRECT_FUNCTION into STT_IFUNC. (elf_find_function): Treat STT_IFUNC in the same way as STT_FUNC. (_bfd_elf_is_function_type): Likewise. * elf32-arm.c (arm_elf_find_function): Likewise. (elf32_arm_adjust_dynamic_symbol): Likewise. (elf32_arm_swap_symbol_in): Likewise. (elf32_arm_additional_program_headers): Likewise. * elf32-i386.c (is_indirect_symbol): New function. (elf_i386_check_relocs): Also generate dynamic relocs for relocations against STT_IFUNC symbols. (allocate_dynrelocs): Likewise. (elf_i386_relocate_section): Likewise. * elf64-x86-64.c (is_indirect_symbol): New function. (elf64_x86_64_check_relocs): Also generate dynamic relocs for relocations against STT_IFUNC symbols. (allocate_dynrelocs): Likewise. (elf64_x86_64_relocate_section): Likewise. * elfcode.h (elf_slurp_symbol_table): Translate STT_IFUNC into BSF_INDIRECT_FUNCTION. * elflink.c (_bfd_elf_adjust_dynamic_reloc_section): Add support for STT_IFUNC symbols. (get_ifunc_reloc_section_name): New function. (_bfd_elf_make_ifunc_reloc_section): New function. * elf-bfd.h (struct bfd_elf_section_data): Add indirect_relocs field. * bfd-in2.h: Regenerate. gas/ * config/obj-elf.c (obj_elf_type): Add support for STT_IFUNC type. * doc/as.texinfo: Document new feature. * NEWS: Mention new feature. gas/testsuite/ * gas/elf/type.s: Add test of STT_IFUNC symbol type. * gas/elf/type.e: Update expected disassembly. * gas/elf/elf.exp: Update grep of symbol types. ld/ * NEWS: Mention new feature. * pe-dll.c (process_def_file): Replace use of redundant BFD_FORT_COMM_DEFAULT_VALUE with 0. * scripttempl/elf.sc: Add .rel.ifunc.dyn and .rela.ifunc.dyn sections. ld/testsuite/ * ld-mips-elf/reloc-1-n32.d: Updated expected output for reloc descriptions. * ld-mips-elf/reloc-1-n64.d: Likewise. * ld-i386/ifunc.d: New test. * ld-i386/ifunc.s: Source file for the new test. * ld-i386/i386.exp: Run the new test.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog6
-rw-r--r--gas/NEWS5
-rw-r--r--gas/config/obj-elf.c14
-rw-r--r--gas/doc/as.texinfo11
-rw-r--r--gas/testsuite/ChangeLog6
-rw-r--r--gas/testsuite/gas/elf/elf.exp2
-rw-r--r--gas/testsuite/gas/elf/type.e1
-rw-r--r--gas/testsuite/gas/elf/type.s4
8 files changed, 47 insertions, 2 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index d89a87e..c2abca5 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,9 @@
+2008-12-03 Nick Clifton <nickc@redhat.com>
+
+ * config/obj-elf.c (obj_elf_type): Add support for STT_IFUNC type.
+ * doc/as.texinfo: Document new feature.
+ * NEWS: Mention new feature.
+
2008-11-29 Kai Tietz <kai.tietz@onevision.com>
* config/tc-i386.c (i386_target_format): For coff flavour in TE_PEP
diff --git a/gas/NEWS b/gas/NEWS
index 16324d6..327782f 100644
--- a/gas/NEWS
+++ b/gas/NEWS
@@ -1,5 +1,10 @@
-*- text -*-
+* The .type pseudo-op now accepts a type of STT_IFUNC which can be used to
+ indicate that if the symbol is the target of a relocation, its value should
+ not be used. Instead the function should be invoked and its result used as
+ the value.
+
Changes in 2.19:
* New pseudo op .cfi_val_encoded_addr, to record constant addresses in unwind
diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c
index cf31770..0f0c7d3 100644
--- a/gas/config/obj-elf.c
+++ b/gas/config/obj-elf.c
@@ -1663,6 +1663,20 @@ obj_elf_type (int ignore ATTRIBUTE_UNUSED)
}
}
}
+ else if (strcmp (typename, "indirect_function") == 0
+ || strcmp (typename, "10") == 0
+ || strcmp (typename, "STT_IFUNC") == 0)
+ {
+ const struct elf_backend_data *bed;
+
+ bed = get_elf_backend_data (stdoutput);
+ if (!(bed->elf_osabi == ELFOSABI_LINUX
+ /* GNU/Linux is still using the default value 0. */
+ || bed->elf_osabi == ELFOSABI_NONE))
+ as_bad (_("symbol type \"%s\" is supported only by GNU targets"),
+ typename);
+ type = BSF_FUNCTION | BSF_INDIRECT_FUNCTION;
+ }
#ifdef md_elf_symbol_type
else if ((type = md_elf_symbol_type (typename, sym, elfsym)) != -1)
;
diff --git a/gas/doc/as.texinfo b/gas/doc/as.texinfo
index fef736a..5a655a5 100644
--- a/gas/doc/as.texinfo
+++ b/gas/doc/as.texinfo
@@ -6267,7 +6267,7 @@ The syntaxes supported are:
.type <name> STT_<TYPE_IN_UPPER_CASE>
.type <name>,#<type>
.type <name>,@@<type>
- .type <name>,%>type>
+ .type <name>,%<type>
.type <name>,"<type>"
@end smallexample
@@ -6289,6 +6289,15 @@ Mark the symbol as being a thead-local data object.
@item STT_COMMON
@itemx common
Mark the symbol as being a common data object.
+
+@item STT_NOTYPE
+@itemx notype
+Does not mark the symbol in any way. It is supported just for completeness.
+
+@item STT_IFUNC
+@itemx indirect_function
+Mark the symbol as an indirect function when evaluated during reloc
+processing. (This is only supported on Linux targeted assemblers).
@end table
Note: Some targets support extra types in addition to those listed above.
diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog
index 60b8c90..523275a 100644
--- a/gas/testsuite/ChangeLog
+++ b/gas/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2008-12-03 Nick Clifton <nickc@redhat.com>
+
+ * gas/elf/type.s: Add test of STT_IFUNC symbol type.
+ * gas/elf/type.e: Update expected disassembly.
+ * gas/elf/elf.exp: Update grep of symbol types.
+
2008-11-27 M R Swami Reddy <MR.Swami.Reddy@nsc.com>
* gas/cr16/pic-1.s: New.
diff --git a/gas/testsuite/gas/elf/elf.exp b/gas/testsuite/gas/elf/elf.exp
index 5506903..637ce9a 100644
--- a/gas/testsuite/gas/elf/elf.exp
+++ b/gas/testsuite/gas/elf/elf.exp
@@ -114,7 +114,7 @@ if { ([istarget "*-*-*elf*"]
run_elf_list_test "section5" "" "-al" "-SW" "| grep \" \\\\.test\\\[0-9\\\]\""
run_dump_test "struct"
run_dump_test "symver"
- run_elf_list_test "type" "" "" "-s" "| grep \"1 \\\[FONTC\\\]\""
+ run_elf_list_test "type" "" "" "-s" "| grep \"1 \\\[FIONTC\\\]\""
run_dump_test "section6"
run_dump_test "section7"
}
diff --git a/gas/testsuite/gas/elf/type.e b/gas/testsuite/gas/elf/type.e
index 50a49ab..2eb352d 100644
--- a/gas/testsuite/gas/elf/type.e
+++ b/gas/testsuite/gas/elf/type.e
@@ -1,4 +1,5 @@
.: 0+0 1 FUNC LOCAL DEFAULT . function
+ .: 0+1 1 IFUNC LOCAL DEFAULT . indirect_function
.: 0+0 1 OBJECT LOCAL DEFAULT . object
.: 0+1 1 TLS LOCAL DEFAULT . tls_object
.: 0+2 1 NOTYPE LOCAL DEFAULT . notype
diff --git a/gas/testsuite/gas/elf/type.s b/gas/testsuite/gas/elf/type.s
index 11f75bf..5a6476c 100644
--- a/gas/testsuite/gas/elf/type.s
+++ b/gas/testsuite/gas/elf/type.s
@@ -3,6 +3,10 @@
.type function,%function
function:
.byte 0x0
+ .size indirect_function,1
+ .type indirect_function,%indirect_function
+indirect_function:
+ .byte 0x0
.data
.type object,%object
.size object,1