From 12b2843a6bb12292d8e36d8df22c788a3c91cb2f Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Tue, 23 Dec 2014 19:07:23 +1030 Subject: Use a symbol flag bit to mark linker defined symbols Trying to use the SEC_LINKER_CREATED section flag to determine whether a symbol is linker defined fails to work on targets like alpha that define special SEC_COMMON sections. These might contain symbols that originated in an object file. include/ * bfdlink.h (struct bfd_link_hash_entry): Comment non_ir_ref. Add linker_def. bfd/ * elflink.c (_bfd_elf_define_linkage_sym): Set linker_def. * linker.c (_bfd_generic_link_add_one_symbol): Clear linker_def for CDEF, DEF, DEFW, COM. ld/ * ldexp.c (exp_fold_tree_1 ): Test linker_def. ld/testsuite/ * ld-powerpc/sdabase.s, * ld-powerpc/sdabase.t, * ld-powerpc/sdabase.d: New test. * ld-powerpc/sdabase2.t, * ld-powerpc/sdabase2.d: New test. * ld-powerpc/powerpc.exp: Run them. --- include/bfdlink.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include/bfdlink.h') diff --git a/include/bfdlink.h b/include/bfdlink.h index f3181ba..48c91da 100644 --- a/include/bfdlink.h +++ b/include/bfdlink.h @@ -91,8 +91,14 @@ struct bfd_link_hash_entry /* Type of this entry. */ ENUM_BITFIELD (bfd_link_hash_type) type : 8; + /* Symbol is referenced in a normal object file, as distict from a LTO + IR object file. */ unsigned int non_ir_ref : 1; + /* Symbol is a built-in define. These will be overridden by PROVIDE + in a linker script. */ + unsigned int linker_def : 1; + /* A union of information depending upon the type. */ union { -- cgit v1.1