Skip to content
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

Autodesk: Bugfix: Enable customizing the suffix of constructor and destructor section name #2908

Conversation

erikaharrison-adsk
Copy link
Contributor

Description of Change(s)

Background:

USD put some functions in a section 'pxrctor', which perform initialization work after loading the module. Also, they are expected to be called only once.

Now say we have library A linked to USD build A; and executable B has its own USD build B with modified dylib name. USD build A and B are different. USD build A would be loaded first, then get a function lists via iterating all sections named 'pxrctor' from all loaded modules, and then call each of them. ie. intialize them. After that, while loading USD build B, the initialization process would also get a function lists in the same way, and it would also contain functions lists collected from USD build A. Again, all functions would be called, including those from USD build A. That means those functions from USD build A would be called twice. This leads to a crash in our use case.

Solution:

Enable the ability to customize and append a suffix to the section name. The corresponding build argument is
--build-args=USD,"-DPXR_INIT_SECTION_NAME_SUFFIX=_v2"

Fixes Issue(s)

  • N/A
  • I have verified that all unit tests pass with the proposed changes
  • I have submitted a signed Contributor License Agreement

…section name

Background:

USD put some functions in section named 'pxrctor', and those functions
intend to be called to perform initialization work after loading the
module.  Also, they are expected to be called only once.

Now we have library A was linked to USD build A, and executable B has
its own USD build B with modified dylib name. USD build A and B are
different.  USD build A would be loaded first, then get a function lists
via iterating all sections named 'pxrctor' from all loaded modules, and
then call each of them. In one word, intialized. After that, while
loading USD build B, the initialization process would also get a
function lists in the same way, and it would also contains the functions
lists collected from USD build A. Again, all functions would be called,
including those from USD build A. That means those functions from USD
build A would be called twice. And it leads to crash in our case.

Solution:

Enable to customize and append a suffix to the section name.  the
corresponding build argument is
`--build-args=USD,"-DPXR_INIT_SECTION_NAME_SUFFIX=_v2"`
@jesschimein
Copy link
Contributor

Filed as internal issue #USD-9189

@FlorianZ
Copy link
Contributor

@erikaharrison-adsk, thanks for your PR! We are actually looking at this internally, and received another PR #2861 which appears to tackle this same issue. Thanks again!

@spiffmon
Copy link
Member

Closing, as we addressed this with commit 319d589 - thank you!

@spiffmon spiffmon closed this Apr 29, 2024
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.

5 participants