[llvm-bugs] [Bug 46364] .init section incorrectly filled (padded) with int3 instructions

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jun 26 22:55:25 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=46364

Fangrui Song <i at maskray.me> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|---                         |WONTFIX

--- Comment #4 from Fangrui Song <i at maskray.me> ---
% cat a.sh
echo '.section .init,"ax"; .balign 4; ret' > a.s
cc -c a.s
ld.bfd a.o a.o

GNU ld pads the gap with a NOP which may take several forms (90, 66 90, 0f 1f
00, etc):

  401000:       c3                      ret    
  401001:       0f 1f 00                nop    DWORD PTR [rax]
  401004:       c3                      ret

while LLD pads the gap with a sequence of 0xcc.

.init/.fini/.ctors/.dtors/DT_INIT/DT_FINI have been obsoleted for many years.
The replacement .init_array/.fini_array/DT_INIT_ARRAY/DT_FINI_ARRAY have great
support (https://github.com/dlang/dmd/pull/10562 ). libc implementations of
some newer ABIs (aarch64,riscv) don't even support .init/.fini at all. Many
modern glibc configurations don't even run DT_INIT. Working around the
incorrect sh_addralign has very little value and is in contrary with the spirit
of the trap gap patch.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200627/778e8fd6/attachment-0001.html>


More information about the llvm-bugs mailing list