In the TLS GD/LD to LE optimization, ld replaces a sequence like
addi 3,2,x@got@tlsgd R_PPC64_GOT_TLSGD16 x
bl __tls_get_addr(x@tlsgd) R_PPC64_TLSGD x
R_PPC64_REL24 __tls_get_addr
nop
with
addis 3,13,x@tprel@ha R_PPC64_TPREL16_HA x
addi 3,3,x@tprel@l R_PPC64_TPREL16_LO x
nop
When the tprel offset is small, this can be further optimized to
nop
addi 3,13,x@tprel
nop
bfd/
* elf64-ppc.c (struct ppc_link_hash_table): Add do_tls_opt.
(ppc64_elf_tls_optimize): Set it.
(ppc64_elf_relocate_section): Nop addis on TPREL16_HA, and convert
insn on TPREL16_LO and TPREL16_LO_DS relocs to use r13 when
addis would add zero.
* elf32-ppc.c (struct ppc_elf_link_hash_table): Add do_tls_opt.
(ppc_elf_tls_optimize): Set it.
(ppc_elf_relocate_section): Nop addis on TPREL16_HA, and convert
insn on TPREL16_LO relocs to use r2 when addis would add zero.
gold/
* powerpc.cc (Target_powerpc::Relocate::relocate): Nop addis on
TPREL16_HA, and convert insn on TPREL16_LO and TPREL16_LO_DS
relocs to use r2/r13 when addis would add zero.
ld/
* testsuite/ld-powerpc/tls.s: Add calls with tls markers.
* testsuite/ld-powerpc/tls32.s: Likewise.
* testsuite/ld-powerpc/powerpc.exp: Run tls marker tests.
* testsuite/ld-powerpc/tls.d: Adjust for TPREL16_HA/LO optimization.
* testsuite/ld-powerpc/tlsexe.d: Likewise.
* testsuite/ld-powerpc/tlsexetoc.d: Likewise.
* testsuite/ld-powerpc/tlsld.d: Likewise.
* testsuite/ld-powerpc/tlsmark.d: Likewise.
* testsuite/ld-powerpc/tlsopt4.d: Likewise.
* testsuite/ld-powerpc/tlstoc.d: Likewise.
There isn't a good reason for ld.bfd to behave differently from gold
in the code generated by TLS GD/LD to LE optimization.
bfd/
* elf64-ppc.c (ppc64_elf_relocate_section): When optimizing
__tls_get_addr call sequences to LE, don't move the addi down
to the nop. Replace the bl with addi and leave the nop alone.
ld/
* testsuite/ld-powerpc/tls.d: Update.
* testsuite/ld-powerpc/tlsexe.d: Update.
* testsuite/ld-powerpc/tlsexetoc.d: Update.
* testsuite/ld-powerpc/tlsld.d: Update.
* testsuite/ld-powerpc/tlsmark.d: Update.
* testsuite/ld-powerpc/tlsopt4.d: Update.
* testsuite/ld-powerpc/tlstoc.d: Update.
FreeBSD/mips kernels were recently changed to include the floating
point implementation revision register in the floating point register
set exported in process cores and via ptrace() (r318067). This change
will first ship in FreeBSD 12.0 when it is eventually released. The
space used to hold FIR was previously reserved in 'struct fpreg' as a
zero-filled dummy for padding, so 'struct fpreg' has not changed in
size. Since FIR should be non-zero on all MIPS processors supported
by FreeBSD, ignore a value of 0 from 'struct fpreg' and only report
non-zero values as a valid FIR register.
gdb/ChangeLog:
* mips-fbsd-nat.c (getfpregs_supplies): Return true for FIR.
* mips-fbsd-tdep.c (mips_fbsd_supply_fpregs): Split supply of FSR
out of loop and add supply of FIR.
(mips_fbsd_collect_fpregs): Split collect of FSR out of loop and
add collect of FIR.
This implements the special __tls_get_addr_opt call stub for powerpc
gold that returns __thread variable addresses without actually making
a call to __tls_get_addr in most cases. Shared libraries that are
loaded at program load time (ie. dlopen is not used) have a known
layout for their __thread variables, and thus DTPMOD64/DPTREL64 pairs
describing those variables can be set up by ld.so for the
__tls_get_addr_opt call stub fast exit.
Ref https://sourceware.org/ml/libc-alpha/2015-03/msg00626.html
I really, really wish I'd used a differently versioned __tls_get_addr
symbol than the base symbol to indicate glibc support for the
optimized call, rather than having glibc export __tls_get_addr_opt. A
lot of the messing around here, flipping symbols from __tls_get_addr
to __tls_get_addr_opt, is caused by that decision. About the only
benefit is that a user can see at a glance that their disassembled
code is calling __tls_get_addr via the fancy call stub.. Anyway, we
need references to __tls_get_addr to seem like they were to
__tls_get_addr_opt, and in cases like the tsan interceptor, a
definition of __tls_get_addr to seem like one of __tls_get_addr_opt
as well. That's the reason for Symbol::clear_in_reg and
Symbol_table::clone, and why symbols are substituted in Scan::global
and other places dealing with dynamic linking.
elfcpp/
* elfcpp.h (DT_PPC_OPT): Define.
* powerpc.h (PPC_OPT_TLS): Define.
gold/
* options.h (tls_get_addr_optimize): New option.
* symtab.h (Symbol::clear_in_reg, clone): New functions.
(Sized_symbol::clone): New function.
(Symbol_table::clone): New function.
* resolve.cc (Symbol::clone, Sized_symbol::clone): New functions.
* powerpc.cc (Target_powerpc::has_tls_get_addr_opt_,
tls_get_addr_, tls_get_addr_opt_): New vars.
(Target_powerpc::tls_get_addr_opt, tls_get_addr,
is_tls_get_addr_opt, replace_tls_get_addr,
set_has_tls_get_addr_opt, stk_linker): New functions.
(Target_powerpc::Track_tls::maybe_skip_tls_get_addr_call): Add
target param. Update callers. Compare symbols rather than names.
(Target_powerpc::do_define_standard_symbols): Init tls_get_addr_
and tls_get_addr_opt_.
(Target_powerpc::Branch_info::mark_pltcall): Translate tls_get_addr
sym to tls_get_addr_opt.
(Target_powerpc::Branch_info::make_stub): Likewise.
(Stub_table::define_stub_syms): Likewise.
(Target_powerpc::Scan::global): Likewise.
(Target_powerpc::Relocate::relocate): Likewise.
(add_3_12_2, add_3_12_13, bctrl, beqlr, cmpdi_11_0, cmpwi_11_0,
ld_11_1, ld_11_3, ld_12_3, lwz_11_3, lwz_12_3, mr_0_3, mr_3_0,
mtlr_11, std_11_1): New constants.
(Stub_table::eh_frame_added_): Delete.
(Stub_table::tls_get_addr_opt_bctrl_, plt_fde_len_, plt_fde_): New vars.
(Stub_table::init_plt_fde): New functions.
(Stub_table::add_eh_frame, replace_eh_frame): Move definition out
of line. Init and use plt_fde_.
(Stub_table::plt_call_size): Return size for tls_get_addr stub.
Extract alignment code to..
(Stub_table::plt_call_align): ..this new function. Adjust all callers.
(Stub_table::add_plt_call_entry): Set has_tls_get_addr_opt and
tls_get_addr_opt_bctrl, and align after that.
(Stub_table::do_write): Write out tls_get_addr stub.
(Target_powerpc::do_finalize_sections): Emit DT_PPC_OPT
PPC_OPT_TLS/PPC64_OPT_TLS bit.
(Target_powerpc::Relocate::relocate): Don't check for or modify
nop following bl for tls_get_addr stub.
On 64-bit targets there is a 32-bit hole in symbol->u_, and another
due to symbol flags exceeding 32 bits. By splitting the union,
the total size of the class reduces by one 64-bit word.
* symtab.h (Symbol): Split u_ into u1_ and u2_. Adjust accessors
to suit. Move plt_offset_ before got_offsets_.
* symtab.cc (Symbol::init_fields): Adjust for union change.
(Symbol::init_base_output_data): Likewise.
(Symbol::init_base_output_segment): Likewise.
(Symbol::allocate_base_common): Likewise.
(Symbol::output_section): Likewise.
(Symbol::set_output_section): Likewise.
(Symbol::set_output_segment): Likewise.
* resolve.cc (Symbol::override_base): Likewise.
(Symbol::override_base_with_special): Likewise.
gold/ChangeLog:
PR gold/21868
* aarch64.cc (AArch64_relobj::try_fix_erratum_843419_optimized):
Add extra view offset argument to function.
(AArch64_relobj::fix_errata_and_relocate_erratum_stubs): Add
extra view offset set to the output offset when the view has
is_input_output_view set, since it has not already been
included. Pass this to try_fix_erratum_843419_optimized.
Since _bfd_elf_ifunc_get_synthetic_symtab is no longer called by x86
get_synthetic_symtab, it is now unused. This patch removes it.
* elf-bfd.h (_bfd_elf_ifunc_get_synthetic_symtab): Removed.
* elf-ifunc.c (_bfd_elf_ifunc_get_synthetic_symtab): Likewise.
Commit
Command names: make them case sensitive
3d7b173c29
made command name lookup case sensitive. However, define_command, used
when creating a user-defined command, converts the command name to
lowercase, assuming that the command name lookup works in a case
insensitive way. This causes user-defined commands with capital letters
in their name to only be callable with a lowercase version:
(gdb) define Foo
Type commands for definition of "Foo".
End with a line saying just "end".
>print 1
>end
(gdb) Foo
Undefined command: "Foo". Try "help".
(gdb) foo
$1 = 1
This patch removes that conversion to lowercase, so that the user can
call the command with the same name they provided.
gdb/ChangeLog:
* cli/cli-script.c (define_command): Don't convert command name
to lower case.
gdb/testsuite/ChangeLog:
* gdb.base/commands.exp (user_defined_command_case_sensitivity):
New proc, call it from toplevel.
If a custom linker script with an unexpected relative layout of .got
and .got.plt sections was used, gold might produce a wrong offset
when applying R_AARCH64_TLSDESC_* relocations.
This patch fixes the issue by calculating "got_tlsdesc_offset"
in a more direct way.
gold/
* aarch64.cc (Target_aarch64::Relocate::relocate_tls):
Make got_tlsdesc_offset signed and fix its calculation.
* testsuite/Makefile.am (aarch64_tlsdesc): New test.
* testsuite/Makefile.in: Regenerate.
* testsuite/aarch64_tlsdesc.s: New test source file.
* testsuite/aarch64_tlsdesc.sh: New test script.
* testsuite/aarch64_tlsdesc.t: New test linker script.
This patch provides a flag for PowerPC64 ELFv2 use in class Symbol,
and modifies Sized_target::resolve to return whether the symbol has
been resolved. If not, normal processing continues. I use this for
PowerPC64 ELFv2 to keep track of whether a symbol has any definition
with non-zero localentry, in order to disable --plt-localentry for
that symbol.
PR 21847
* powerpc.cc (Target_powerpc::is_elfv2_localentry0): Test
non_zero_localentry.
(Target_powerpc::resolve): New function.
(powerpc_info): Set has_resolve for 64-bit.
* target.h (Sized_target::resolve): Return bool.
* resolve.cc (Symbol_table::resolve): Continue with normal
processing when target resolve returns false.
* symtab.h (Symbol::non_zero_localentry, set_non_zero_localentry):
New accessors.
(Symbol::non_zero_localentry_): New flag bit.
* symtab.cc (Symbol::init_fields): Init non_zero_localentry_.
We shpouldn't generate copy relocation to resolve reference to protected
data symbol defined in shared object with the NO_COPY_ON_PROTECTED
property. This patch adds a bit to elf_obj_tdata as well as
elf_i386_link_hash_entry and elf_x86_64_link_hash_entry to track the bfd
with the NO_COPY_ON_PROTECTED property as well as protected symbol
defined in shared object. extern_protected_data is set to FALSE if any
input relocatable file contains the NO_COPY_ON_PROTECTED property.
bfd/
PR ld/21997
* elf-bfd.h (elf_obj_tdata): Use ENUM_BITFIELD on object_id,
dyn_lib_class and has_gnu_symbols. Change bad_symtab to bitfield.
Add a has_no_copy_on_protected bitfield.
(elf_has_no_copy_on_protected): New.
* elf-properties.c (_bfd_elf_parse_gnu_properties): Set
elf_has_no_copy_on_protected for GNU_PROPERTY_NO_COPY_ON_PROTECTED.
(elf_merge_gnu_property_list): Likewise.
(_bfd_elf_link_setup_gnu_properties): Set extern_protected_data
to FALSE for elf_has_no_copy_on_protected.
* elf32-i386.c (SYMBOL_NO_COPYRELOC): New.
(elf_i386_link_hash_entry): Add def_protected.
(elf_i386_adjust_dynamic_symbol): Also check SYMBOL_NO_COPYRELOC
when checking info->nocopyreloc.
(elf_i386_link_setup_gnu_properties): Don't set
extern_protected_data here.
(elf_i386_merge_symbol_attribute): New function.
(elf_backend_merge_symbol_attribute): New.
* elf64-x86-64.c (SYMBOL_NO_COPYRELOC): New.
(elf_x86_64_link_hash_entry): Add def_protected.
(elf_x86_64_need_pic): Report protected symbol for def_protected.
(elf_x86_64_adjust_dynamic_symbol): Also check SYMBOL_NO_COPYRELOC
when checking info->nocopyreloc.
(elf_x86_64_relocate_section): Also check for R_X86_64_PC32
relocation run-time overflow and unresolvable R_X86_64_32S
relocation against protected data symbol defined in shared object
with GNU_PROPERTY_NO_COPY_ON_PROTECTED.
(elf_x86_64_link_setup_gnu_properties): Don't set
extern_protected_data here.
(elf_x86_64_merge_symbol_attribute): New function.
(elf_backend_merge_symbol_attribute): New.
ld/
PR ld/21997
* testsuite/ld-i386/i386.exp: Run PR ld/21997 tests.
* testsuite/ld-x86-64/x86-64.exp: Likewise.
* testsuite/ld-i386/pr21997-1a.S: New file.
* testsuite/ld-i386/pr21997-1b.c: Likewise.
* testsuite/ld-i386/pr21997-1c.S: Likewise.
* testsuite/ld-x86-64/pr21997-1a.S: Likewise.
* testsuite/ld-x86-64/pr21997-1a.err: Likewise.
* testsuite/ld-x86-64/pr21997-1b.c: Likewise.
* testsuite/ld-x86-64/pr21997-1b.err: Likewise.
* testsuite/ld-x86-64/pr21997-1c.c: Likewise.
Tidy how these are handled in PIEs.
* elf32-ppc.c (must_be_dyn_reloc): Use bfd_link_dll. Comment.
(ppc_elf_check_relocs): Only set DF_STATIC_TLS in shared libs.
(ppc_elf_relocate_section): Comment fix.
* elf64-ppc.c (must_be_dyn_reloc): Use bfd_link_dll. Comment.
(ppc64_elf_check_relocs): Only set DF_STATIC_TLS in shared libs.
Support dynamic relocs for TPREL16 when non-pic too.
(dec_dynrel_count): Adjust TPREL16 handling as per check_relocs.
(ppc64_elf_relocate_section): Support dynamic relocs for TPREL16
when non-pic too.
The function is always called with DISPP set to NULL, so there is
no need for this parameter anymore. This patch removes it, and
eliminates some dead code associated to that.
gdb/ChangeLog:
* ada-lang.c (ada_lookup_struct_elt_type): Remove parameter "dispp".
Update all callers accordingly. Remove all code blocks handling
the case where DISPP is not NULL.
Tested on x86_64-linux, no regression.
These functions apply to thread, and not inferiors (in the gdbserver
sense, the abstraction for threads and processes, as in
inferior_list). Therefore, it would make more sense if these functions
were named with "thread" rather than "inferior".
gdb/gdbserver/ChangeLog:
* inferiors.h (inferior_target_data): Rename to ...
(thread_target_data): ... this.
(inferior_regcache_data): Rename to ...
(thread_regcache_data): ... this.
(set_inferior_regcache_data): Rename to ...
(set_thread_regcache_data): ... this.
* inferiors.c (inferior_target_data): Rename to ...
(thread_target_data): ... this.
(inferior_regcache_data): Rename to ...
(thread_regcache_data): ... this.
(set_inferior_regcache_data): Rename to ...
(set_thread_regcache_data): ... this.
(free_one_thread): Update.
* linux-low.h (get_thread_lwp): Update.
* regcache.c (get_thread_regcache): Update.
(regcache_invalidate_thread): Update.
(free_register_cache_thread): Update.
* win32-i386-low.c (update_debug_registers_callback): Update.
(win32_get_current_dr): Update.
* win32-low.c (thread_rec): Update.
(delete_thread_info): Update.
(continue_one_thread): Update.
(suspend_one_thread): Update.
PR 21994
* readelf.c (process_version_sections <SHT_GNU_verdef>): Check
vd_aux and vda_next for sanity. Delete "end". Correct overflow
checks.
(process_version_sections <SHT_GNU_verneed>): Correct overflow
check. Don't report invalid vna_next on overflow. Do report
invalid vna_next on size less than aux info.
The inferior (thread) target data is always set through add_thread.
gdb/gdbserver/ChangeLog:
* inferiors.c (set_inferior_target_data): Remove.
* inferiors.h (set_inferior_target_data): Remove.
Replace regexp with string match to workaround dejagnu 1.4.4 which
complains:
ERROR: bad switch "-fPIE": must be -all, -about, -indices, -inline, -expanded, -line, -linestop, -lineanchor, -nocase, -start, or --
* testsuite/ld-i386/i386.exp (undefined_weak): Replace regexp
with string match.
* testsuite/ld-x86-64/x86-64.exp (undefined_weak): Likewise.
Run pr22001-1b on x32 since R_X86_64_32S relocation can be turned into
dynamic R_X86_64_32 relocation which won't overflow on x32.
* testsuite/ld-x86-64/x86-64.exp: Run pr22001-1b on x32.
On x86-64, when -z nocopyreloc is used to build executable, relocations
may overflow at run-time or may not be resolved without PIC. This patch
checks these conditions and issues an error with suggestion for -fPIC.
bfd/
PR ld/22001
* elf64-x86-64.c (elf_x86_64_relocate_section): Check for
R_X86_64_PC32 relocation run-time overflow and unresolvable
R_X86_64_32S relocation with -z nocopyreloc.
ld/
PR ld/22001
* testsuite/ld-i386/i386.exp: Run -z nocopyreloc tests.
* testsuite/ld-x86-64/x86-64.exp: Likewise.
* ld/testsuite/ld-i386/pr22001-1a.c: New file.
* ld/testsuite/ld-i386/pr22001-1b.c: Likewise.
* ld/testsuite/ld-i386/pr22001-1c.S: Likewise.
* ld/testsuite/ld-x86-64/pr22001-1a.c: Likewise.
* ld/testsuite/ld-x86-64/pr22001-1a.err: Likewise.
* ld/testsuite/ld-x86-64/pr22001-1b.c: Likewise.
* ld/testsuite/ld-x86-64/pr22001-1b.err: Likewise.
* ld/testsuite/ld-x86-64/pr22001-1c.c: Likewise.
When processing an orphan section we first call lang_place_orphans, this
function handles a few sections for which the behaviour is known COMMON
sections, or sections marked as SEC_EXCLUDE.
Any orphans that are not handled in lang_place_orphans are passed on to
ldlang_place_orphan, this is where we decide where to put the orphan,
and then call lang_add_section to perform the actual orphan placement.
We previously had a larger set of checks at the start of the function
lang_add_section to discard some sections that we _knew_ should not be
added into the output file, this was where .group sections (in a final
link) and .debug* sections (with --strip-debug) were dropped.
The problem with dropping these sections at the lang_add_section stage
is that a user might also be using --orphan-handling=error to prevent
orphans. If they are then they should not be get errors about sections
that we know will be discarded, and which are not mentioned in the
linker script.
The solution proposed in this patch is to move the "will this section be
discarded" check into a separate function, and use this in
lang_place_orphans to have the early discard phase discard sections that
we know should not be included in the output file.
ld/ChangeLog:
PR 21961
* ldlang.c (lang_discard_section_p): New function.
(lang_add_section): Checks moved out into new function, which is
now called.
(lang_place_orphans): Call lang_discard_section_p instead of
duplicating some of the checks from lang_add_section.
* testsuite/ld-elf/orphan-11.d: New file.
* testsuite/ld-elf/orphan-11.ld: New file.
* testsuite/ld-elf/orphan-11.s: New file.
* testsuite/ld-elf/orphan-12.d: New file.
* testsuite/ld-elf/orphan-12.s: New file.
* elf32-i386.c (elf_i386_check_relocs): Revert the last change.
Undefined symbols may not have a type.
* elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
GDB was now accessing as signatured_type memory allocated only by size of
dwarf2_per_cu_data.
gdb/ChangeLog
2017-08-24 Jan Kratochvil <jan.kratochvil@redhat.com>
* dwarf2read.c (build_type_psymtabs_reader): New prototype.
(process_psymtab_comp_unit): Accept IS_DEBUG_TYPES.
(read_comp_units_from_section): New parameter abbrev_section, use
read_and_check_comp_unit_head, allocate signatured_type if needed.
(create_all_comp_units): Update read_comp_units_from_section caller.
git commit 46434633f9 said
Make undefined symbols in allocate_dynrelocs dynamic
..if they have dynamic relocs. An undefined symbol in a PIC object
that finds no definition ought to become dynamic in order to support
--allow-shlib-undefined, but there is nothing in the generic ELF
linker code to do this if the reference isn't via the GOT or PLT. (An
initialized function pointer is an example.) So it falls to backend
code to ensure the symbol is made dynamic.
The above isn't true. Undefined symbols are indeed made dynamic for
shared libraries. Undefined symbols are not automatically made
dynamic in executables, and it was the PIE case that triggered an
internal consistency assertion on powerpc64. I guess I could have
jumped the other way when fixing PR21988, and not created a dynamic
reloc. Either way, it doesn't matter a great deal. We're going to
get an error on strong undefined symbols in an executable anyway, and
broken binaries if you try to use --unresolved-symbols=ignore-all to
disable the error.
* testsuite/ld-undefined/fundef.s: New test.
* testsuite/ld-undefined/undefined.exp: Test that undefined
symbols in shared libraries are made dynamic.
Add '\' before -- to workaround dejagnu 1.4.4 which complains:
ERROR: bad switch "--no-define-common may not be used without -shared":...
* testsuite/ld-elf/pr21903c.d: Add '\' before --.
* testsuite/ld-elf/pr21903d.d: Likewise.
* testsuite/ld-elf/pr21903e.d: Likewise.
There is an assertion that is triggering when we start GDB and
instruct it to debug a remote inferior, but don't provide a local
binary, like:
./gdb -nx -q --data-directory=data-directory -ex "tar ext :1234" \
-ex "set remote exec-file /bin/ls" -ex r
In this case, when calling exec_file_locate_attach to locate the
inferior, GDB is incorrectly resetting the breakpoints without a
thread/inferior even running, which causes an assertion to be
triggered:
binutils-gdb/gdb/thread.c:1609: internal-error: scoped_restore_current_thread::scoped_restore_current_thread(): Assertion `tp != NULL' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n)
This happens because add_current_inferior_and_thread (on remote.c) is
breaking an invariant: making inferior_ptid point to a non-existing
thread and then calling common code, which in this case is
breakpoint_re_set. The fix is to make sure that inferior_ptid points
to null_ptid if there is no thread present.
A testcase is provided. Regtested on buildbot.
gdb/ChangeLog:
2017-08-23 Pedro Alves <palves@redhat.com>
PR remote/21852
* remote.c (add_current_inferior_and_thread): Set inferior_ptid
to null_ptid and switch to thread without reading the registers
after adding the inferior.
gdb/testsuite/ChangeLog:
2017-08-23 Sergio Durigan Junior <sergiodj@redhat.com>
PR remote/21852
* gdb.server/normal.c: New file, copied from gdb.base.
* gdb.server/run-without-local-binary.exp: New file.
-fPIC may be needed to compile PIE or PDE objects, not just shared
object.
bfd/
* elf64-x86-64.c (elf_x86_64_need_pic): Add an argument for
bfd_link_info. Report shared, PIE or PDE object based on
bfd_link_info.
(elf_x86_64_check_relocs): Update elf_x86_64_need_pic call.
(elf_x86_64_relocate_section): Likewise.
ld/
* testsuite/ld-x86-64/pie2.d: Updated.
* testsuite/ld-x86-64/pr19719.d: Likewise.
* testsuite/ld-x86-64/pr19807-2a.d: Likewise.
* testsuite/ld-x86-64/pr19969.d: Likewise.
Since PLT entry is needed only for function symbols, increment PLT count
only for function symbols.
* elf32-i386.c (elf_i386_check_relocs): Increment PLT count only
for function symbols.
* elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
When GNU_PROPERTY_NO_COPY_ON_PROTECTED is set, it indicates that there
are no copy relocations against protected data symbols. When linker
sees GNU_PROPERTY_NO_COPY_ON_PROTECTED on any input relocatable file,
it sets extern_protected_data to FALSE.
bfd/
* elf32-i386.c (elf_i386_link_setup_gnu_properties): Set
extern_protected_data to FALSE if GNU_PROPERTY_NO_COPY_ON_PROTECTED
is set on any input relocatable file.
* elf64-x86-64.c (elf_x86_64_link_setup_gnu_properties): Likewise.
ld/
* testsuite/ld-i386/i386.exp: Run protected7.
* testsuite/ld-i386/protected7.d: New file.
* testsuite/ld-i386/protected7.s: Likewise.
* testsuite/ld-x86-64/protected8.d: Likewise.
* testsuite/ld-x86-64/protected8.s: Likewise.
* testsuite/ld-x86-64/x86-64.exp: Run protected8.