[Bug gold/28098] New: Linking with with libcudart_static.a produces an empty eh_frame_hdr section

2021-07-17 Thread michael.krasnyk at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=28098

Bug ID: 28098
   Summary: Linking with with libcudart_static.a produces an empty
eh_frame_hdr section
   Product: binutils
   Version: 2.38 (HEAD)
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: gold
  Assignee: ccoutant at gmail dot com
  Reporter: michael.krasnyk at gmail dot com
CC: ian at airs dot com
  Target Milestone: ---

Hi, 

linking with with libcudart_static.a produces an empty eh_frame_hdr section.

Steps to reproduce:

curl -s
https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-cudart-dev-11-2_11.2.152-1_amd64.deb
| dpkg --fsys-tarfile - | tar xOf -
./usr/local/cuda-11.2/targets/x86_64-linux/lib/libcudart_static.a >
libcudart_static.a
sha256sum libcudart_static.a
3ca014141258ae33abb175aa88a8282507a04d8a16d8f8dc9340e7831c5831e6 
libcudart_static.a


cat > main.c 

[Bug gold/28098] Linking with with libcudart_static.a produces an empty eh_frame_hdr section

2021-07-17 Thread michael.krasnyk at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=28098

--- Comment #1 from Michael Krasnyk  ---
Created attachment 13559
  --> https://sourceware.org/bugzilla/attachment.cgi?id=13559&action=edit
add filtering of R_X86_64_NONE entries

Relocation section '.rela.eh_frame' has an R_X86_64_NONE entry

00013200  000a0002 R_X86_64_PC32  
.text + 5ae80
00013238   R_X86_64_NONE 0
00013258  001e0002 R_X86_64_PC32  
.text._ZN15CUOSdlsymLoaderIPFimPKcEED2Ev + 0



Please consider the patch that adds filtering R_X86_64_NONE entries in
Track_relocs::advance

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


[Bug gold/28098] Linking with with libcudart_static.a produces an empty eh_frame_hdr section

2021-07-17 Thread amodra at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=28098

Alan Modra  changed:

   What|Removed |Added

 Ever confirmed|0   |1
 Status|UNCONFIRMED |ASSIGNED
   Assignee|ccoutant at gmail dot com  |amodra at gmail dot com
   Last reconfirmed||2021-07-18

--- Comment #2 from Alan Modra  ---
Thanks for the analysis and patch.  I'm going to ask you to do just a little
more work.  First, change the patch to skip r_info==0 relocs, which is R_*_NONE
(usually, there are some targets that stupidly define r_type of 0 to be
something other than a no-operation relocations) *and* r_sym of zero.  That
will match ld.bfd.  Also, put a suitable comment in reloc.h, something like
"..would be skipped, excluding r_info==0 relocs." and perhaps expand on this a
little in the function comment in reloc.cc, mentioning R_*_NONE and r_sym of
zero.  Finally, check over all uses of advance() in gold to see that it isn't
used to count relocs for an output array or something like that, which might be
broken by your change.  If you get to that point, post the patch to
binut...@sourceware.org and I'll commit it.

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


[Bug gold/28098] Linking with with libcudart_static.a produces an empty eh_frame_hdr section

2021-07-17 Thread michael.krasnyk at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=28098

--- Comment #3 from Michael Krasnyk  ---
Thanks for your comments, Alan! I have sent the updated patch to the mailing
list.

To duplicate here from the email:

Result values of Reloc::advance are used at five places
https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=gold/ehframe.cc;h=8a19b21055924ae17c40f9f7c2ac4e421bf58392;hb=HEAD#l665
https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=gold/ehframe.cc;h=8a19b21055924ae17c40f9f7c2ac4e421bf58392;hb=HEAD#l688
https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=gold/ehframe.cc;h=8a19b21055924ae17c40f9f7c2ac4e421bf58392;hb=HEAD#l889
https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=gold/ehframe.cc;h=8a19b21055924ae17c40f9f7c2ac4e421bf58392;hb=HEAD#l922
https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=gold/ehframe.cc;h=8a19b21055924ae17c40f9f7c2ac4e421bf58392;hb=HEAD#l1018

 for early termination of do_add_ehframe_input_section and at one place
https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=gold/ehframe.cc;h=8a19b21055924ae17c40f9f7c2ac4e421bf58392;hb=HEAD#l919
in an assertion, so this change should not change behavior but prevent earlier
termination if the relocation section has an entry with r_info = 0.

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


[Bug gold/28098] Linking with with libcudart_static.a produces an empty eh_frame_hdr section

2021-07-17 Thread michael.krasnyk at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=28098

--- Comment #4 from Michael Krasnyk  ---
Created attachment 13561
  --> https://sourceware.org/bugzilla/attachment.cgi?id=13561&action=edit
updated patch

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