Skip to content

Conversation

@haitaka
Copy link
Collaborator

@haitaka haitaka commented Oct 28, 2025

Clang emits source unit path with every annotation in llvm.metadata
section in bitcode.

For example, for every stdlib function annotated with
`__attribute__((annotate("introduced_in=XXX")))` bitcode will
contain a path to the unit the function was declared in.

In order to make bitcode builds reproducible, these paths should be
normalized just like `__FILE__` macro paths are.

This commit reuses `-fmacro-prefix-map` machinery for annotation
paths in bitcode.

    Clang emits source unit path with every annotation in llvm.metadata
    section in bitcode.

    For example, for every stdlib function annotated with
    `__attribute__((annotate("introduced_in=XXX")))` bitcode will
    contain a path to the unit the function was declared in.

    In order to make bitcode builds reproducible, these paths should be
    normalized just like `__FILE__` macro paths are.

    This commit reuses `-fmacro-prefix-map` machinery for annotation
    paths in bitcode.
@haitaka haitaka force-pushed the haitaka/kotlin/remap-annot-unit branch from 6b47f50 to e968a97 Compare October 28, 2025 19:52
@haitaka haitaka merged commit c5e64f7 into kotlin/llvm-19-apple Oct 29, 2025
2 checks passed
@haitaka haitaka deleted the haitaka/kotlin/remap-annot-unit branch October 29, 2025 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants