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

bpo-37690: Simplify linking of shared libraries on the AIX OS #14965

Closed
wants to merge 2 commits into from

Conversation

ericvw
Copy link
Contributor

@ericvw ericvw commented Jul 26, 2019

Have the approach of building shared libraries on the AIX operating
system be similar to that of a System V system. The primary benefit of
this change is the elimination of custom AIX paths and reducing the
changes at ./configure to affect just the LDSHARED environment
variable.

For background context, AIX sees shared libraries as fully linked and
resolved, where symbol references are resolved at link-time and cannot
be rebound at load-time. System V resolves all global symbols by the
run-time linker. Thus, conventional shared libraries in AIX cannot have
undefined symbols, while System V can.

However, AIX does allow for run-time linking in allowing symbols to be
undefined until load-time.

Therefore, this change affects how linking of shared libraries are
performed on AIX to behave similarly to that of System V.

Given that symbols are now going to be allowed to be undefined for AIX,
all the code paths for generating exported symbols and the related
wrapper scripts go away.

The real magic is in the -G flag for LDSHARED. Effectively, -G
is equivalent to specifying the following:

  • -berok: Suppress errors even if there are unresolved symbols
  • -brtl: Enable run-time linking
  • -bnortllib: Do not include a reference to the run-time linker
  • -bnosymbolic: Assigns 'nosymbolic' attribute to most symbols (i.e.,
    can be rebound)
  • -bnoautoexp: Prevent auto exportation of any symbols
  • -bM:SRE: Set the module type to reusable (i.e., require a private copy
    of the data area for each process).

https://bugs.python.org/issue37690

Have the approach of building shared libraries on the AIX operating
system be similar to that of a System V system.  The primary benefit of
this change is the elimination of custom AIX paths and reducing the
changes at `./configure` to affect just the `LDSHARED` environment
variable.

For background context, AIX sees shared libraries as fully linked and
resolved, where symbol references are resolved at link-time and cannot
be rebound at load-time.  System V resolves all global symbols by the
run-time linker.  Thus, conventional shared libraries in AIX cannot have
undefined symbols, while System V can.

However, AIX does allow for run-time linking in allowing symbols to be
undefined until load-time.

Therefore, this change affects how linking of shared libraries are
performed on AIX to behave similarly to that of System V.

Given that symbols are now going to be allowed to be undefined for AIX,
all the code paths for generating exported symbols and the related
wrapper scripts go away.

The real magic is in the `-G` flag for `LDSHARED`.  Effectively, `-G`
is equivalent to specifying the following:

* -berok: Suppress errors even if there are unresolved symbols
* -brtl: Enable run-time linking
* -bnortllib: Do not include a reference to the run-time linker
* -bnosymbolic: Assigns 'nosymbolic' attribute to most symbols (i.e.,
                can be rebound)
* -bnoautoexp: Prevent auto exportation of any symbols
* -bM:SRE: Set the module type to reusable (i.e., require a private copy
           of the data area for each process).
Ensure that the summary of the change will be rendered in release notes.
Copy link
Contributor Author

@ericvw ericvw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The two lines highlighted are the important ones which allow for the removal of other AIX related code or files entirely.

@@ -9357,8 +9348,7 @@ if test -z "$LDSHARED"
then
case $ac_sys_system/$ac_sys_release in
AIX*)
BLDSHARED="Modules/ld_so_aix \$(CC) -bI:Modules/python.exp"
LDSHARED="\$(LIBPL)/ld_so_aix \$(CC) -bI:\$(LIBPL)/python.exp"
LDSHARED='$(CC) -G'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is one of the important changes.

@@ -2513,8 +2504,7 @@ if test -z "$LDSHARED"
then
case $ac_sys_system/$ac_sys_release in
AIX*)
BLDSHARED="Modules/ld_so_aix \$(CC) -bI:Modules/python.exp"
LDSHARED="\$(LIBPL)/ld_so_aix \$(CC) -bI:\$(LIBPL)/python.exp"
LDSHARED='$(CC) -G'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is the other important changes.

@ericvw
Copy link
Contributor Author

ericvw commented Jul 29, 2019

Abandoning this change due to feedback provided in https://bugs.python.org/issue37690.

@ericvw ericvw closed this Jul 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants