[Bug ld/29900] Partial Linking removes alignment from linker directives
https://sourceware.org/bugzilla/show_bug.cgi?id=29900 Nick Clifton changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution|--- |FIXED --- Comment #9 from Nick Clifton --- Ok, I am going to close this PR, since the specific problem has been solved. At least probably. It may still turn out that concatenating together .drectve sections is the wrong thing to do. -- You are receiving this mail because: You are on the CC list for the bug.
[Bug ld/29900] Partial Linking removes alignment from linker directives
https://sourceware.org/bugzilla/show_bug.cgi?id=29900 --- Comment #8 from cvs-commit at gcc dot gnu.org --- The master branch has been updated by Nick Clifton : https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=a7a32d588f29466221f5b4d421d0fc0a652dae48 commit a7a32d588f29466221f5b4d421d0fc0a652dae48 Author: Nick Clifton Date: Wed Dec 21 10:23:08 2022 + Keep the .drectve section when performing a relocateable link. PR 29900 * scripttempl/pe.sc: Keep the .drectve section when performing a relocateable link. * scripttempl/pep.sc: Likewise. -- You are receiving this mail because: You are on the CC list for the bug.
[Bug ld/29900] Partial Linking removes alignment from linker directives
https://sourceware.org/bugzilla/show_bug.cgi?id=29900 --- Comment #7 from Denys Linke --- Created attachment 14532 --> https://sourceware.org/bugzilla/attachment.cgi?id=14532=edit linked.o created with patched ld -- You are receiving this mail because: You are on the CC list for the bug.
[Bug ld/29900] Partial Linking removes alignment from linker directives
https://sourceware.org/bugzilla/show_bug.cgi?id=29900 --- Comment #6 from Denys Linke --- Hi Nick, thanks for the patch. I can confirm, that it now preserves the .drectve section when doing partial linking. The output of dumpbin.exe now shows this: >> dumpbin /directives linked.o > Microsoft (R) COFF/PE Dumper Version 14.23.28107.0 > Copyright (C) Microsoft Corporation. All rights reserved. > > Dump of file linked.o > > File Type: COFF OBJECT > >Linker Directives >- >-aligncomm:var,2 >-aligncomm:aligned_var,5 > > Summary >0 .bss >0 .data > 30 .drectve >0 .rdata > 20 .rdata$zzz >0 .text Notice the new line "0 .rdata" that didn't exist before too. > Not being a PE expert I am not sure what should happen when you partially > link two or more files containing .drectve sections. Should the contents > just be concatenated together, or is there more to it than that ? I am not a PE expert either but for me your patch fixes this issue. However, this leads me to the next problem which is related to objcopy: https://sourceware.org/bugzilla/show_bug.cgi?id=29923 Just in case someone is interested, I will attach the new version of linked.o that has been created by the patched ld. Cheers Denys -- You are receiving this mail because: You are on the CC list for the bug.
[Bug ld/29900] Partial Linking removes alignment from linker directives
https://sourceware.org/bugzilla/show_bug.cgi?id=29900 --- Comment #5 from Nick Clifton --- Created attachment 14527 --> https://sourceware.org/bugzilla/attachment.cgi?id=14527=edit Proposed patch Preserve .drectve sections when performing a relocateable link -- You are receiving this mail because: You are on the CC list for the bug.
[Bug ld/29900] Partial Linking removes alignment from linker directives
https://sourceware.org/bugzilla/show_bug.cgi?id=29900 Nick Clifton changed: What|Removed |Added Ever confirmed|0 |1 Status|UNCONFIRMED |ASSIGNED Assignee|unassigned at sourceware dot org |nickc at redhat dot com Last reconfirmed||2022-12-19 --- Comment #4 from Nick Clifton --- (In reply to Denys Linke from comment #0) Hi Denys, Thanks for the object files. > As far as I can tell it is not possible to check the symbol alignment with > one of the binutils tools. I think that this might actually be the key to this mystery. As far as I can tell the PE file format does not allow for symbols to have alignments. This is why none of the binutils tools display this information. > Therefore I use dumpbin.exe, which is part of MS > Visual Studio. I suspect that what is happening here is that dumpbin is decoding the contents of the .drectve section and using that to recreate the alignment needs of the symbols. >> dumpbin.exe /directives linked.o > Microsoft (R) COFF/PE Dumper Version 14.23.28107.0 > Copyright (C) Microsoft Corporation. All rights reserved. > > Dump of file linked.o > > File Type: COFF OBJECT > > Summary >0 .bss >0 .data > 20 .rdata$zzz >0 .text And here is the problem. The partially linked file does not have its .drectve section. Not being a PE expert I am not sure what should happen when you partially link two or more files containing .drectve sections. Should the contents just be concatenated together, or is there more to it than that ? On the assumption that concatenation is OK, would you be able to try out the patch that I am about to upload. This should preserve the .drectve sections when performing a partial link. Cheers Nick -- You are receiving this mail because: You are on the CC list for the bug.
[Bug ld/29900] Partial Linking removes alignment from linker directives
https://sourceware.org/bugzilla/show_bug.cgi?id=29900 --- Comment #2 from Denys Linke --- Created attachment 14525 --> https://sourceware.org/bugzilla/attachment.cgi?id=14525=edit object file created by compiling aligned.c -- You are receiving this mail because: You are on the CC list for the bug.
[Bug ld/29900] Partial Linking removes alignment from linker directives
https://sourceware.org/bugzilla/show_bug.cgi?id=29900 Denys Linke changed: What|Removed |Added Attachment #14526|object file after partial |linked.o description|linking | -- You are receiving this mail because: You are on the CC list for the bug.
[Bug ld/29900] Partial Linking removes alignment from linker directives
https://sourceware.org/bugzilla/show_bug.cgi?id=29900 Denys Linke changed: What|Removed |Added Attachment #14525|object file created by |aligned.o description|compiling aligned.c | -- You are receiving this mail because: You are on the CC list for the bug.
[Bug ld/29900] Partial Linking removes alignment from linker directives
https://sourceware.org/bugzilla/show_bug.cgi?id=29900 --- Comment #3 from Denys Linke --- Created attachment 14526 --> https://sourceware.org/bugzilla/attachment.cgi?id=14526=edit object file after partial linking -- You are receiving this mail because: You are on the CC list for the bug.
[Bug ld/29900] Partial Linking removes alignment from linker directives
https://sourceware.org/bugzilla/show_bug.cgi?id=29900 Nick Clifton changed: What|Removed |Added CC||nickc at redhat dot com --- Comment #1 from Nick Clifton --- Hi Denys, Please could you upload copies of the aligned.o and linked.o binaries so that I can take a look for myself ? Cheers Nick -- You are receiving this mail because: You are on the CC list for the bug.