• Alex Brainman's avatar
    cmd/link: move .rel symbol from .rdata into .text · 8256bcda
    Alex Brainman authored
    .rel symbol type is sym.SELFROSECT, and that makes .rel written
    into .rdata section. But .rel stores code - jump table used for
    external C functions. So we have to mark whole .rdata section
    as executable (IMAGE_SCN_MEM_EXECUTE), because of .rel presence
    in it.
    
    Move .rel into .text section, and make .rdata section non executable.
    
    I also had to move code that adjusted the size of .rel symbol
    before calling textaddress, otherwise textaddress would not
    calculate size of .text section correctly.
    
    Fixes #25926
    
    Change-Id: I4962f5de7b367410154c8709adfcd8472de9ac1a
    Reviewed-on: https://go-review.googlesource.com/c/125455
    Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
    8256bcda
main.go 9.49 KB