[Bug ld/13616] linker should pad executable sections with nops, not zeros

2020-08-08 Thread i at maskray dot me
https://sourceware.org/bugzilla/show_bug.cgi?id=13616

Fangrui Song  changed:

   What|Removed |Added

 CC||i at maskray dot me

--- Comment #10 from Fangrui Song  ---
I know that some x86-32 systems appear to underalign .init and expect ld to pad
with NOPs: https://bugs.llvm.org/show_bug.cgi?id=46364

If we show less mercy to such broken settings, traps are probably better than
nops.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug ld/13616] linker should pad executable sections with nops, not zeros

2019-10-30 Thread amodra at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=13616

Alan Modra  changed:

   What|Removed |Added

 CC||amodra at gmail dot com

--- Comment #9 from Alan Modra  ---
Not so, this really is a ld problem.  Some object files use a technique called
code pasting, where pieces of a function are pasted together from multiple
object files.  If those pieces are in sections that are aligned greater than
the smallest instruction size, then padding may be inserted between the pieces.
 ld must only insert nops for this scheme to work.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug ld/13616] linker should pad executable sections with nops, not zeros

2019-10-30 Thread akobets at mail dot ru
https://sourceware.org/bugzilla/show_bug.cgi?id=13616

Alexander Kobets  changed:

   What|Removed |Added

 CC||akobets at mail dot ru

--- Comment #8 from Alexander Kobets  ---
By my opinion, this problem is not ld, this problem is objdump, that not
correctly dump of text section, by capture bytes outside of code, incorrectly
count size of text section. This code size = 1 byte (ret), other bytes must be
printed as .byte 0,0,0

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug ld/13616] linker should pad executable sections with nops, not zeros

2019-10-16 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=13616

--- Comment #7 from cvs-commit at gcc dot gnu.org  ---
The master branch has been updated by Alan Modra :

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=22216541c1796e9e1331d6f4e16b03a6f02e7381

commit 22216541c1796e9e1331d6f4e16b03a6f02e7381
Author: Alan Modra 
Date:   Wed Oct 16 21:23:29 2019 +1030

PR13616, linker should pad executable sections with nops, not zeros

This implements padding of orphan executable sections for PowerPC.
Of course, the simple implementation of bfd_arch_ppc_nop_fill and
removing the NOP definition didn't work, with powerpc64 hitting a
testsuite failure linking to S-records.  That's because the srec
target is BFD_ENDIAN_UNKNOWN so the test of bfd_big_endian (abfd) in
default_data_link_order therefore returned false, resulting in a
little-endian nop pattern.  The rest of the patch fixes that problem
by adding a new field to bfd_link_info that can be used to determine
actual endianness on targets like srec.

PR 13616
include/
* bfdlink.h (struct bfd_link_info ): New field.
bfd/
* cpu-powerpc.c (bfd_arch_ppc_nop_fill): New function, use it
for all ppc arch info.
* linker.c (default_data_link_order): Pass info->big_endian to
arch_info->fill function.
ld/
* emulparams/elf64lppc.sh (NOP): Don't define.
* emulparams/elf64ppc.sh (NOP): Don't define.
* ldwrite.c (build_link_order): Use link_info.big_endian.  Move
code determining endian to use for data_statement to..
* ldemul.c (after_open_default): ..here.  Set link_info.big_endian.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/13616] linker should pad executable sections with nops, not zeros

2012-02-09 Thread jajcus at jajcus dot net
http://sourceware.org/bugzilla/show_bug.cgi?id=13616

Jacek Konieczny jajcus at jajcus dot net changed:

   What|Removed |Added

 CC||jajcus at jajcus dot net

--- Comment #6 from Jacek Konieczny jajcus at jajcus dot net 2012-02-09 
10:23:19 UTC ---
The i386 fix seems to break compatibility with older x86 CPUs, which cannot
handle those multi byte NOPs. See bug 13675.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/13616] linker should pad executable sections with nops, not zeros

2012-02-02 Thread roland at gnu dot org
http://sourceware.org/bugzilla/show_bug.cgi?id=13616

--- Comment #5 from Roland McGrath roland at gnu dot org 2012-02-02 22:17:05 
UTC ---
It's been pointed out that zeros are close enough to nops for ARM and Thumb.
I'm not immediately concerned with other targets, so it might be OK to close
this now unless the maintainers for other CPUs really intend to do something
about it soon.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/13616] linker should pad executable sections with nops, not zeros

2012-01-31 Thread cvs-commit at gcc dot gnu.org
http://sourceware.org/bugzilla/show_bug.cgi?id=13616

--- Comment #3 from cvs-commit at gcc dot gnu.org cvs-commit at gcc dot 
gnu.org 2012-01-31 17:54:47 UTC ---
CVSROOT:/cvs/src
Module name:src
Changes by:h...@sourceware.org2012-01-31 17:54:39

Modified files:
bfd: ChangeLog archures.c bfd-in2.h configure 
 configure.in cpu-alpha.c cpu-arc.c cpu-arm.c 
 cpu-avr.c cpu-bfin.c cpu-cr16.c cpu-cr16c.c 
 cpu-cris.c cpu-crx.c cpu-d10v.c cpu-d30v.c 
 cpu-dlx.c cpu-epiphany.c cpu-fr30.c cpu-frv.c 
 cpu-h8300.c cpu-h8500.c cpu-hppa.c cpu-i370.c 
 cpu-i386.c cpu-i860.c cpu-i960.c cpu-ia64.c 
 cpu-ip2k.c cpu-iq2000.c cpu-k1om.c cpu-l1om.c 
 cpu-lm32.c cpu-m10200.c cpu-m10300.c cpu-m32c.c 
 cpu-m32r.c cpu-m68hc11.c cpu-m68hc12.c 
 cpu-m68k.c cpu-m88k.c cpu-mcore.c cpu-mep.c 
 cpu-microblaze.c cpu-mips.c cpu-mmix.c 
 cpu-moxie.c cpu-msp430.c cpu-mt.c cpu-ns32k.c 
 cpu-openrisc.c cpu-or32.c cpu-pdp11.c cpu-pj.c 
 cpu-plugin.c cpu-powerpc.c cpu-rl78.c 
 cpu-rs6000.c cpu-rx.c cpu-s390.c cpu-score.c 
 cpu-sh.c cpu-sparc.c cpu-spu.c cpu-tic30.c 
 cpu-tic4x.c cpu-tic54x.c cpu-tic6x.c 
 cpu-tic80.c cpu-tilegx.c cpu-tilepro.c 
 cpu-v850.c cpu-vax.c cpu-w65.c cpu-we32k.c 
 cpu-xc16x.c cpu-xstormy16.c cpu-xtensa.c 
 cpu-z80.c cpu-z8k.c libbfd.h linker.c 
ld : ChangeLog ldlang.c ldwrite.c 
ld/emulparams  : elf32_x86_64.sh elf_i386.sh elf_i386_be.sh 
 elf_i386_ldso.sh elf_i386_vxworks.sh 
 elf_k1om.sh elf_l1om.sh elf_x86_64.sh 
ld/scripttempl : elf.sc 
ld/testsuite   : ChangeLog 
ld/testsuite/ld-i386: tlsbindesc.dd tlsnopic.dd tlspic.dd 
ld/testsuite/ld-x86-64: tlsbin.dd tlsbindesc.dd tlspic.dd 
include: ChangeLog bfdlink.h 

Log message:
Support arch-dependent fill

bfd/

2012-01-31  H.J. Lu  hongjiu...@intel.com

PR ld/13616
* archures.c (bfd_arch_info): Add fill.
(bfd_default_arch_struct): Add bfd_arch_default_fill.
(bfd_arch_default_fill): New.

* configure.in: Set bfd version to 2.22.52.
* configure: Regenerated.

* cpu-alpha.c: Add bfd_arch_default_fill to bfd_arch_info
initializer.
* cpu-arc.c: Likewise.
* cpu-arm.c: Likewise.
* cpu-avr.c: Likewise.
* cpu-bfin.c: Likewise.
* cpu-cr16.c: Likewise.
* cpu-cr16c.c: Likewise.
* cpu-cris.c: Likewise.
* cpu-crx.c: Likewise.
* cpu-d10v.c: Likewise.
* cpu-d30v.c: Likewise.
* cpu-dlx.c: Likewise.
* cpu-epiphany.c: Likewise.
* cpu-fr30.c: Likewise.
* cpu-frv.c: Likewise.
* cpu-h8300.c: Likewise.
* cpu-h8500.c: Likewise.
* cpu-hppa.c: Likewise.
* cpu-i370.c: Likewise.
* cpu-i860.c: Likewise.
* cpu-i960.c: Likewise.
* cpu-ia64.c: Likewise.
* cpu-ip2k.c: Likewise.
* cpu-iq2000.c: Likewise.
* cpu-lm32.c: Likewise.
* cpu-m10200.c: Likewise.
* cpu-m10300.c: Likewise.
* cpu-m32c.c: Likewise.
* cpu-m32r.c: Likewise.
* cpu-m68hc11.c: Likewise.
* cpu-m68hc12.c: Likewise.
* cpu-m68k.c: Likewise.
* cpu-m88k.c: Likewise.
* cpu-mcore.c: Likewise.
* cpu-mep.c: Likewise.
* cpu-microblaze.c: Likewise.
* cpu-mips.c: Likewise.
* cpu-mmix.c: Likewise.
* cpu-moxie.c: Likewise.
* cpu-msp430.c: Likewise.
* cpu-mt.c: Likewise.
* cpu-ns32k.c: Likewise.
* cpu-openrisc.c: Likewise.
* cpu-or32.c: Likewise.
* cpu-pdp11.c: Likewise.
* cpu-pj.c: Likewise.
* cpu-plugin.c: Likewise.
* cpu-powerpc.c: Likewise.
* cpu-rl78.c: Likewise.
* cpu-rs6000.c: Likewise.
* cpu-rx.c: Likewise.
* cpu-s390.c: Likewise.
* cpu-score.c: Likewise.
* cpu-sh.c: Likewise.
* cpu-sparc.c: Likewise.
* cpu-spu.c: Likewise.
* cpu-tic30.c: Likewise.
* cpu-tic4x.c: Likewise.
* cpu-tic54x.c: Likewise.
* cpu-tic6x.c: Likewise.
* cpu-tic80.c: Likewise.
* cpu-tilegx.c: Likewise.
* cpu-tilepro.c: Likewise.
* cpu-v850.c: Likewise.
* cpu-vax.c: Likewise.
* cpu-w65.c: Likewise.
* cpu-we32k.c: Likewise.
* cpu-xc16x.c: Likewise.
* cpu-xstormy16.c: Likewise.
* cpu-xtensa.c: Likewise.
* cpu-z80.c: Likewise.
* cpu-z8k.c: Likewise.

* cpu-i386.c: Include libiberty.h.
(bfd_arch_i386_fill): New.
Add bfd_arch_i386_fill to  bfd_arch_info initializer.

* cpu-k1om.c: Add bfd_arch_i386_fill to  bfd_arch_info initializer.
* cpu-l1om.c: Likewise.

* linker.c (default_data_link_order): Call abfd-arch_info-fill
if fill size is 0.

* bfd-in2.h: Regenerated.

include/

2012-01-31  

[Bug ld/13616] linker should pad executable sections with nops, not zeros

2012-01-31 Thread hjl.tools at gmail dot com
http://sourceware.org/bugzilla/show_bug.cgi?id=13616

--- Comment #4 from H.J. Lu hjl.tools at gmail dot com 2012-01-31 18:58:16 
UTC ---
It is fixed for i386 and x86-64.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/13616] linker should pad executable sections with nops, not zeros

2012-01-25 Thread hjl.tools at gmail dot com
http://sourceware.org/bugzilla/show_bug.cgi?id=13616

H.J. Lu hjl.tools at gmail dot com changed:

   What|Removed |Added

   Attachment #6173|0   |1
is obsolete||

--- Comment #2 from H.J. Lu hjl.tools at gmail dot com 2012-01-26 01:48:53 
UTC ---
Created attachment 6175
  -- http://sourceware.org/bugzilla/attachment.cgi?id=6175
An improved patch

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/13616] linker should pad executable sections with nops, not zeros

2012-01-24 Thread hjl.tools at gmail dot com
http://sourceware.org/bugzilla/show_bug.cgi?id=13616

H.J. Lu hjl.tools at gmail dot com changed:

   What|Removed |Added

 CC||hjl.tools at gmail dot com

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/13616] linker should pad executable sections with nops, not zeros

2012-01-24 Thread hjl.tools at gmail dot com
http://sourceware.org/bugzilla/show_bug.cgi?id=13616

--- Comment #1 from H.J. Lu hjl.tools at gmail dot com 2012-01-24 19:49:29 
UTC ---
Created attachment 6173
  -- http://sourceware.org/bugzilla/attachment.cgi?id=6173
A patch

Here is a proposed patch.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/13616] linker should pad executable sections with nops, not zeros

2012-01-23 Thread roland at gnu dot org
http://sourceware.org/bugzilla/show_bug.cgi?id=13616

Roland McGrath roland at gnu dot org changed:

   What|Removed |Added

  Component|binutils|ld

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils