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

pie: Mark __export_*() functions as externally_visible #2279

Merged
merged 1 commit into from
Oct 7, 2023

Conversation

avagin
Copy link
Member

@avagin avagin commented Oct 5, 2023

GCC's lto source:

> To avoid this problem the compiler must assume that it sees the
> whole program when doing link-time optimization.  Strictly
> speaking, the whole program is rarely visible even at link-time.
> Standard system libraries are usually linked dynamically or not
> provided with the link-time information.  In GCC, the whole
> program option (@option{-fwhole-program}) asserts that every
> function and variable defined in the current compilation
> unit is static, except for function @code{main} (note: at
> link time, the current unit is the union of all objects compiled
> with LTO).  Since some functions and variables need to
> be referenced externally, for example by another DSO or from an
> assembler file, GCC also provides the function and variable
> attribute @code{externally_visible} which can be used to disable
> the effect of @option{-fwhole-program} on a specific symbol.

As far as I read gcc's source, ipa_comdats() will avoid placing symbols that are either already in a user-defined section or have externally_visible attribute into new optimized gcc sections.

@avagin avagin requested a review from 0x7f454c46 October 5, 2023 23:53
@avagin avagin force-pushed the externally_visible branch from db2a3a3 to d8b02a1 Compare October 6, 2023 00:10
@codecov-commenter
Copy link

codecov-commenter commented Oct 6, 2023

Codecov Report

Attention: 136 lines in your changes are missing coverage. Please review.

Comparison is base (4c1a2ac) 70.63% compared to head (62ca092) 70.54%.
Report is 162 commits behind head on criu-dev.

❗ Current head 62ca092 differs from pull request most recent head 70b5f43. Consider uploading reports for the commit 70b5f43 to get more accurate results

Additional details and impacted files
@@             Coverage Diff              @@
##           criu-dev    #2279      +/-   ##
============================================
- Coverage     70.63%   70.54%   -0.09%     
============================================
  Files           132      132              
  Lines         33434    33509      +75     
============================================
+ Hits          23615    23640      +25     
- Misses         9819     9869      +50     
Files Coverage Δ
criu/apparmor.c 54.01% <100.00%> (ø)
criu/include/image.h 100.00% <ø> (ø)
criu/include/parasite.h 100.00% <ø> (ø)
criu/include/restorer.h 100.00% <ø> (ø)
criu/include/rst_info.h 100.00% <ø> (ø)
criu/include/util.h 70.37% <ø> (-29.63%) ⬇️
criu/include/vma.h 100.00% <100.00%> (ø)
criu/libnetlink.c 75.26% <ø> (-0.27%) ⬇️
criu/mem.c 86.30% <ø> (+0.95%) ⬆️
criu/namespaces.c 69.48% <ø> (ø)
... and 30 more

... and 9 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

GCC's lto source:
> To avoid this problem the compiler must assume that it sees the
> whole program when doing link-time optimization.  Strictly
> speaking, the whole program is rarely visible even at link-time.
> Standard system libraries are usually linked dynamically or not
> provided with the link-time information.  In GCC, the whole
> program option (@option{-fwhole-program}) asserts that every
> function and variable defined in the current compilation
> unit is static, except for function @code{main} (note: at
> link time, the current unit is the union of all objects compiled
> with LTO).  Since some functions and variables need to
> be referenced externally, for example by another DSO or from an
> assembler file, GCC also provides the function and variable
> attribute @code{externally_visible} which can be used to disable
> the effect of @option{-fwhole-program} on a specific symbol.

As far as I read gcc's source, ipa_comdats() will avoid placing symbols
that are either already in a user-defined section or have
externally_visible attribute into new optimized gcc sections.

Signed-off-by: Dmitry Safonov <dima@arista.com>
Signed-off-by: Andrei Vagin <avagin@gmail.com>
@avagin avagin force-pushed the externally_visible branch from d8b02a1 to 70b5f43 Compare October 6, 2023 05:10
Copy link
Member

@0x7f454c46 0x7f454c46 left a comment

Choose a reason for hiding this comment

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

LGTM!
Thanks for getting it over the line!

@avagin avagin merged commit e3391ed into checkpoint-restore:criu-dev Oct 7, 2023
36 of 38 checks passed
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.

3 participants