https://sourceware.org/bugzilla/show_bug.cgi?id=29923
Bug ID: 29923 Summary: Renaming symbols with objcopy does not affect the drectve Section Product: binutils Version: 2.39 Status: UNCONFIRMED Severity: normal Priority: P2 Component: binutils Assignee: unassigned at sourceware dot org Reporter: denys.li...@ipg-automotive.com Target Milestone: --- Hello everyone, the following bug report is related to Windows and can be reproduced with the mingw-w64 toolchain, that is available at: https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/8.1.0/threads-win32/seh/x86_64-8.1.0-release-win32-seh-rt_v6-rev0.7z/download A Microsoft Visual Studio installation would be useful as well. All commands are considered to be done at cmd.exe. The bug can be reproduced with the following source code: > // aligned.c > int aligned_var __attribute__((aligned(32))); Compile aligned.c, but dont run the linker > gcc.exe -c -o aligned.o aligned.c Rename the symbol aligned_var with objcopy > objcopy.exe --redefine-sym aligned_var=renamed_var aligned.o renamed.o Verify, that the renaming was successfull: > nm.exe renamed.o > 0000000000000000 b .bss > 0000000000000000 d .data > 0000000000000000 d .drectve > 0000000000000000 r .rdata$zzz > 0000000000000004 C renamed_var > 0000000000000000 t .text Unfortunately the renaming does not affect the alignment, that is stored within the .drectve section. This can be checked with the tool dumpbin.exe, which is part of MS Visual Studio: > dumpbin.exe /directives renamed.o > Microsoft (R) COFF/PE Dumper Version 14.23.28107.0 > Copyright (C) Microsoft Corporation. All rights reserved. > > Dump of file renamed.o > > File Type: COFF OBJECT > > Linker Directives > ----------------- > -aligncomm:aligned_var,5 > > Summary > 0 .bss > 0 .data > 1C .drectve > 20 .rdata$zzz > 0 .text As a consequence the linker ignores the alignment for renamed_var in the final link step. -- You are receiving this mail because: You are on the CC list for the bug.