Skip to content

Questionable MSVC compatibility break after we always defining begin symbol for a section #101346

@KanRobert

Description

@KanRobert
void bar();

#pragma alloc_text("bar", bar)

void bar() {} 

Clang after #96459

clang --target=x86_64-pc-windows-msvc 

error: symbol 'bar' is already defined

(passed in 18.1 release)

MSVC

bar     SEGMENT
bar     PROC
        ret     0
bar     ENDP
bar     ENDS

https://godbolt.org/z/crEzMzzqj

I am not sure whether putting a function is a section with same name is ill-formed or not. GCC also reports an error at assemble stage

__attribute__ ((section ("bar"))) void bar() {} 
Error: symbol `bar' is already defined

https://godbolt.org/z/he51jdbTG

@MaskRay @aengelke

Metadata

Metadata

Assignees

No one assigned

    Labels

    llvm:mcMachine (object) codeplatform:windowswontfixIssue is real, but we can't or won't fix it. Not invalid

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions