Skip to content

[LLD][COFF] Implement ECExportThunkChunk::classof #130106

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions lld/COFF/Chunks.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ class Chunk {
SectionKind,
SectionECKind,
OtherKind,
ImportThunkKind
ImportThunkKind,
ECExportThunkKind
};
Kind kind() const { return chunkKind; }

Expand Down Expand Up @@ -827,7 +828,10 @@ static const uint8_t ECExportThunkCode[] = {

class ECExportThunkChunk : public NonSectionCodeChunk {
public:
explicit ECExportThunkChunk(Defined *targetSym) : target(targetSym) {}
explicit ECExportThunkChunk(Defined *targetSym)
: NonSectionCodeChunk(ECExportThunkKind), target(targetSym) {}
static bool classof(const Chunk *c) { return c->kind() == ECExportThunkKind; }

size_t getSize() const override { return sizeof(ECExportThunkCode); };
void writeTo(uint8_t *buf) const override;
MachineTypes getMachine() const override { return AMD64; }
Expand Down
5 changes: 4 additions & 1 deletion lld/test/COFF/build-id-sym.s
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# REQUIRES: x86
# RUN: llvm-mc -triple=x86_64-windows-msvc -filetype=obj -o %t.obj %s
# RUN: lld-link -debug:symtab -entry:main %t.obj -build-id -Brepro -out:%t.exe
# RUN: lld-link -debug:symtab -entry:main %t.obj -build-id -Brepro -out:%t.exe -guard:cf
# RUN: llvm-objdump -s -t %t.exe | FileCheck %s

# Check __buildid points to 0x14000203c which is after the signature RSDS.
Expand All @@ -21,3 +21,6 @@ main:
.section .bss,"bw",discard,__buildid
.global __buildid
__buildid:

.data
.quad __buildid