This is an archive of the discontinued LLVM Phabricator instance.

[X32][CET] Fix size and alignment of .note.gnu.property section
ClosedPublic

Authored by hvdijk on May 1 2021, 5:33 AM.

Details

Summary

X32 uses 32-bit ELF object files with 32-bit alignment, so the .note.gnu.property section needs to be emitted as it is for X86.

Diff Detail

Event Timeline

hvdijk created this revision.May 1 2021, 5:33 AM
hvdijk requested review of this revision.May 1 2021, 5:33 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 1 2021, 5:33 AM
MaskRay accepted this revision.May 1 2021, 1:55 PM
MaskRay retitled this revision from [X32][CET] Fix .note.gnu.property section to [X32][CET] Fix alignment of .note.gnu.property section.

LGTM.

llvm/lib/Target/X86/X86AsmPrinter.cpp
646–647

While here, const int

llvm/test/CodeGen/X86/note-cet-property.ll
3

you can omit <

This revision is now accepted and ready to land.May 1 2021, 1:55 PM
hvdijk updated this revision to Diff 342177.May 1 2021, 2:10 PM
hvdijk retitled this revision from [X32][CET] Fix alignment of .note.gnu.property section to [X32][CET] Fix size and alignment of .note.gnu.property section.

It wasn't just the alignment that was wrong, the section contains its own size as a field, which had an incorrect value as a result of the alignment.

hvdijk marked an inline comment as done.May 1 2021, 2:11 PM
hvdijk added inline comments.
llvm/test/CodeGen/X86/note-cet-property.ll
3

llc writes to stdout by default when reading from stdin, and writes to <file>.s otherwise, so just dropping < doesn't work. It's possible to use -o - instead to explicitly specify writing to stdout but the other lines in this file and the other three CET test files all use llc < %s rather than llc %s -o -, so for consistency I'd rather leave it if that's okay too?

MaskRay added inline comments.May 1 2021, 2:15 PM
llvm/test/CodeGen/X86/note-cet-property.ll
3

I forgot it:)

This revision was landed with ongoing or failed builds.May 1 2021, 2:17 PM
This revision was automatically updated to reflect the committed changes.