Skip to content

fix(cmake): drop -pie from global link options#50

Open
hillwoodroc wants to merge 1 commit intolinuxdeepin:masterfrom
hillwoodroc:master
Open

fix(cmake): drop -pie from global link options#50
hillwoodroc wants to merge 1 commit intolinuxdeepin:masterfrom
hillwoodroc:master

Conversation

@hillwoodroc
Copy link

-pie forces building PIE executables and breaks shared library linking on ppc64le, resulting in undefined reference to main.

-pie forces building PIE executables and breaks shared library linking
on ppc64le, resulting in undefined reference to main.
@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: hillwoodroc

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@deepin-ci-robot
Copy link

Hi @hillwoodroc. Thanks for your PR. 😃

@deepin-ci-robot
Copy link

Hi @hillwoodroc. Thanks for your PR.

I'm waiting for a linuxdeepin member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

# 安全编译选项
add_compile_options(-fstack-protector-strong -D_FORTITY_SOURCE=1)
add_link_options(-z noexecstack -pie -fPIC)
add_link_options(-z noexecstack -fPIC)
Copy link

Choose a reason for hiding this comment

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

This compilation parameter is required for security purposes.

Copy link

Choose a reason for hiding this comment

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

If the architecture for this parameter cannot be found, isolation is recommended.

Copy link
Author

Choose a reason for hiding this comment

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

-pie is specifically used for generating executables; since this is merely a shared library, there is no need to use this parameter.

Refer:https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html?hl=zh-CN

--pie

Produce a dynamically linked position independent executable on targets that support it. For predictable results, you must also specify the same set of options used for compilation (-fpie, -fPIE, or model suboptions) when you specify this linker option.

Copy link

Choose a reason for hiding this comment

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

The parameters for fpic do seem incorrect; it's recommended to remove this unnecessary parameter. pie is indeed necessary.

Copy link
Member

Choose a reason for hiding this comment

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

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.

4 participants