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

Add ability to default enable PIC when compiling ponyc #2113

Merged
merged 1 commit into from
Jul 31, 2017

Conversation

dipinhora
Copy link
Contributor

This commit allows folks compiling from source (for packaging or
for their own use) to easily specify that ponyc should always
compile programs using Position Independent Code (PIC). The main
driving force behind this is a smoother user experience for folks
on distributions where PIC is enabled by default so they don't
have to always remember to pass --pic to ponyc when compiling
programs. Alpine Edge is one such example. With this change,
packaging for Alpine Edge is as simple as make force_pic=true
and then users of ponyc on Alpine Edge don't need to be aware
of PIC being enabled by default at all and don't have to remember
to pass --pic to every invocation of ponyc.

NOTE: This does not change the default behavior of ponyc when
not compiling with force_pic=true and it is mainly a convenience
meant to be used only when the person compiling knows that the
toolset being used (gcc on a distro with PIC enabled by default)
will cause issues otherwise.


@ponylang/core This is related to #1811 and #1484 where alternate solutions have been discussed. Hopefully this is an acceptable compromise until the longer term solutions previously discussed can be implemented.

Copy link
Member

@jemc jemc left a comment

Choose a reason for hiding this comment

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

Seems reasonable to me, though I don't necessarily have as much context on this issue as some others, so I'll let someone else merge.

@SeanTAllen
Copy link
Member

More than 1 person has requested this. This is nice.

Copy link
Member

@Praetonus Praetonus left a comment

Choose a reason for hiding this comment

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

Should we also have a --nopic option for ponyc to disable position-independent code even for force_pic builds? That seems more flexible to me. If we do take that route I think force_pic should be renamed to default_pic as it better conveys the meaning.

@dipinhora
Copy link
Contributor Author

@Praetonus Having --nopic and changing force_pic to default_pic sounds like a good idea but I wonder how often people who have default_pic enabled would use the --nopic option.

If others agree that adding --nopic and changing to default_pic is preferred, I'll update this PR accordingly.

@Praetonus
Copy link
Member

I feel like --nopic could be useful when cross-compiling from a PIC-enabled system to a PIC-disabled system.

This commit allows folks compiling from source (for packaging or
for their own use) to easily specify that `ponyc` should by default
compile programs using Position Independent Code (PIC). The main
driving force behind this is a smoother user experience for folks
on distributions where PIC is enabled by default so they don't
have to always remember to pass `--pic` to `ponyc` when compiling
programs. Alpine Edge is one such example. With this change,
packaging for Alpine Edge is as simple as `make default_pic=true`
and then users of `ponyc` on Alpine Edge don't need to be aware
of PIC being enabled by default at all and don't have to remember
to pass `--pic` to every invocation of `ponyc`.

This commit also adds the ability to specify `--nopic` to disable
PIC if `ponyc` was compiled with `default_pic=true`.

NOTE: This does not change the default behavior of `ponyc` when
not compiling with `default_pic=true` and it is mainly a convenience
meant to be used only when the person compiling knows that the
toolset being used (gcc on a distro with PIC enabled by default)
will cause issues otherwise.
@dipinhora
Copy link
Contributor Author

Makes sense. PR updated to add --nopic and to rename force_pic to default_pic.

@dipinhora dipinhora changed the title Add ability to force PIC when compiling ponyc Add ability to default enable PIC when compiling ponyc Jul 31, 2017
@SeanTAllen
Copy link
Member

@Praetonus does this look good to you?

@SeanTAllen SeanTAllen added the changelog - added Automatically add "Added" CHANGELOG entry on merge label Jul 31, 2017
@Praetonus Praetonus merged commit 166e47f into ponylang:master Jul 31, 2017
ponylang-main added a commit that referenced this pull request Jul 31, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog - added Automatically add "Added" CHANGELOG entry on merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants