x86: Check static link of dynamic objects
authorH.J. Lu <hjl.tools@gmail.com>
Fri, 13 Mar 2020 14:34:56 +0000 (07:34 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Fri, 13 Mar 2020 14:39:06 +0000 (07:39 -0700)
commit74e10d1742f1b8312359c59a2af06c9e661252b3
tree7627e27f43e85e6906a483b754ff43a93047f5c8
parent2d61316c32a9fa3e14786c3312d9ca87c9298db5
x86: Check static link of dynamic objects

On Linux/x86, when -static is passed to gcc, gcc passes it to linker
before all input files suitable for creating static executable.  X86
linker will report error for dynamic input objects if -static is passed
at command-line before all input files without --dynamic-linker unless
--no-dynamic-linker is used.

bfd/

PR ld/24920
* elf-linker-x86.h (elf_linker_x86_params): Add
static_before_all_inputs and has_dynamic_linker.
* elfxx-x86.c (_bfd_x86_elf_link_setup_gnu_properties): Report
dynamic input objects if -static is passed at command-line
before all input files without --dynamic-linker unless
--no-dynamic-linker is used.

ld/

PR ld/24920
* emulparams/elf32_x86_64.sh: Use static.sh.
* emulparams/elf_i386.sh: Likewise.
* emulparams/elf_x86_64.sh: Likewise.
* emulparams/static.sh: New file.
* emultempl/elf-x86.em: Include "ldlex.h".
* testsuite/ld-elf/pr24920.err: New file.
* testsuite/ld-elf/linux-x86.exp: Run ld/24920 tests.
bfd/ChangeLog
bfd/elf-linker-x86.h
bfd/elfxx-x86.c
ld/ChangeLog
ld/emulparams/elf32_x86_64.sh
ld/emulparams/elf_i386.sh
ld/emulparams/elf_x86_64.sh
ld/emulparams/static.sh [new file with mode: 0644]
ld/emultempl/elf-x86.em
ld/testsuite/ld-elf/linux-x86.exp
ld/testsuite/ld-elf/pr24920.err [new file with mode: 0644]
This page took 0.025587 seconds and 4 git commands to generate.