Skip to content
Snippets Groups Projects

Use GOT to access data within LEA macro

Closed Pranav Kant requested to merge pranavk/dav1d:mcmodel into master

This is to support building all data under medium code model, eg: using -mcmodel=medium -mlarge-data-threshold=0. Code built with these options is organized in final binary such that all data >= 0 bytes is considered large and any reference to this data from .text section is accessed via GOT. Hardcoded assembly without any wrt (WithReferenceTo) annotation accesses the variable directly assuming small code model. This commit changes LEA macro so that such accesses go via GOT.

Performance-wise, modern linkers are smart enough to remove that additional GOT access, if the final binary size ends up being smaller.

Some general information about code models: https://eli.thegreenplace.net/2012/01/03/understanding-the-x64-code-models

Edited by Pranav Kant

Merge request reports

Pipeline #568836 failed

Pipeline failed for 46b558f5 on pranavk:mcmodel

Test coverage 91.30% (0.10%) from 1 job

Closed by Jean-Baptiste KempfJean-Baptiste Kempf 1 month ago (Feb 21, 2025 1:10am UTC)

Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
Please register or sign in to reply
Loading