ld and strange PE .idata entries in the name table

Joachim Schiele <[email protected]> Sun, 26 May 2024 11:24:07 +0200
Newsgroups gmane.comp.gnu.utils.bugs
Message-ID <[email protected]>
hello compiler & linker crew!

i'm using gnu compiler / linker as a cross compiler for windows and i'm 
currently working on a tool patchPE, which will update the dll name 
inside the PE header of the binary.

this is a subgoal of https://lastlog.de/blog/libnix.html and i'm quite 
happy about the overall progress. however, one thing in the PE header i 
can't wrap my head around is the fact that the .idata header contains 
the dllname which also holds an array of values i don't understand. it 
seems this is only added by ld and not by other linkers.

see the ticket https://github.com/qknight/ImHex-Patterns/issues/1 i've 
created to provide screenshots and a more structured way to create an 
bug report compared to text only.

what is the motivation behind these values and what code segment creates 
these?

# used gnu tools

/run/current-system/sw/bin/ld --version
GNU ld (GNU Binutils) 2.40

/run/current-system/sw/bin/gcc --version
gcc (GCC) 12.3.0

# screenshots from imhex

i've also added two screenshots in this issue report on my project page:

https://github.com/qknight/ImHex-Patterns/issues/1


# summary

i would be very thankful for a helping hand in finding out where in the 
ld code these entries are generated and where the dllname entry is 
generated.

thank you very much!

regards,
joachim

-- 
https://lastlog.de/blog