[PATCH] bfd/{pe, pei}-x86_64: Decrease preferred section alignment from 16 to 4

Martin Storsjö martin@martin.st
Fri Mar 28 10:32:16 GMT 2025


On Fri, 28 Mar 2025, Jan Beulich wrote:

> On 28.03.2025 10:48, LIU Hao wrote:
>> 在 2025-3-28 15:36, Jan Beulich 写道:
>>> On 28.03.2025 07:34, LIU Hao wrote:
>>>
>>
>> Yes MASM sets `.text` to 16-byte alignment. I don't know how to change 
>> that. Sorry.
>>
>> However I would like to remind you that MSVC and Clang have integrated 
>> assemblers, therefore a) to compile C code to assembly, then assemble 
>> it to object code, and b) to compile C code directly to object code, 
>> might not have the same effect.
>
> IOW you're (implicitly) suggesting we add a way for compilers to indicate to
> the assembler that this is compiler-generated code, and that behavior should
> be different than for hand-written assembly.

I don't think we should draw that much conclusions from it yet.

Yes, Clang does have a built-in assembler, and compiling directly to an 
object file takes a shorter/different codepath internally than compiling 
to assembly and assembling that with the same Clang. But going through 
assembly _is_ supposed to produce the exact same object file in the end - 
if not, I would consider that a bug.

This is notably different from MSVC, where MASM (for x86) and 
armasm/armasm64 (for arm/aarch64) aren't even remotely related to what the 
compiler itself does.

// Martin


More information about the Binutils mailing list