mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-18 14:53:32 +08:00
Check ELF section header only for ELF output
When placing an orphan input section, check ELF section header only for ELF output. PR ld/21884 * emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Check ELF section header only for ELF output. * testsuite/ld-elf/pr21884.d: New test. * testsuite/ld-elf/pr21884.t: Likewise. * testsuite/ld-elf/pr21884a.s: Likewise. * testsuite/ld-elf/pr21884b.s: Likewise.
This commit is contained in:
parent
b8f4abd342
commit
db99ecc08f
10
ld/ChangeLog
10
ld/ChangeLog
@ -1,3 +1,13 @@
|
||||
2017-08-02 H.J. Lu <hongjiu.lu@intel.com>
|
||||
|
||||
PR ld/21884
|
||||
* emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Check
|
||||
ELF section header only for ELF output.
|
||||
* testsuite/ld-elf/pr21884.d: New test.
|
||||
* testsuite/ld-elf/pr21884.t: Likewise.
|
||||
* testsuite/ld-elf/pr21884a.s: Likewise.
|
||||
* testsuite/ld-elf/pr21884b.s: Likewise.
|
||||
|
||||
2017-08-02 H.J. Lu <hongjiu.lu@intel.com>
|
||||
|
||||
* emultempl/elf32.em (_place_orphan): Revert the last change.
|
||||
|
@ -2136,7 +2136,8 @@ gld${EMULATION_NAME}_place_orphan (asection *s,
|
||||
}
|
||||
|
||||
/* Look through the script to see where to place this section. */
|
||||
if (constraint == 0)
|
||||
if (constraint == 0
|
||||
&& link_info.output_bfd->xvec->flavour == bfd_target_elf_flavour)
|
||||
for (os = lang_output_section_find (secname);
|
||||
os != NULL;
|
||||
os = next_matching_output_section_statement (os, 0))
|
||||
|
11
ld/testsuite/ld-elf/pr21884.d
Normal file
11
ld/testsuite/ld-elf/pr21884.d
Normal file
@ -0,0 +1,11 @@
|
||||
#source: pr21884a.s
|
||||
#source: pr21884b.s
|
||||
#ld: -T pr21884.t
|
||||
#objdump: -b binary -s
|
||||
#notarget: aarch64*-*-* arm*-*-* nds32*-*-*
|
||||
# Skip targets which can't change output format to binary.
|
||||
|
||||
.*: file format binary
|
||||
|
||||
Contents of section .data:
|
||||
#pass
|
7
ld/testsuite/ld-elf/pr21884.t
Normal file
7
ld/testsuite/ld-elf/pr21884.t
Normal file
@ -0,0 +1,7 @@
|
||||
OUTPUT_FORMAT("binary")
|
||||
|
||||
ENTRY(_main);
|
||||
SECTIONS {
|
||||
. = 0;
|
||||
.setup : { *(.setup) }
|
||||
}
|
5
ld/testsuite/ld-elf/pr21884a.s
Normal file
5
ld/testsuite/ld-elf/pr21884a.s
Normal file
@ -0,0 +1,5 @@
|
||||
.text
|
||||
.globl _main
|
||||
.type _main,%function
|
||||
_main:
|
||||
.dc.a bar
|
5
ld/testsuite/ld-elf/pr21884b.s
Normal file
5
ld/testsuite/ld-elf/pr21884b.s
Normal file
@ -0,0 +1,5 @@
|
||||
.text
|
||||
.globl bar
|
||||
.type bar,%function
|
||||
bar:
|
||||
.byte 0
|
Loading…
Reference in New Issue
Block a user