Skip to content

Do not build dpdk with fPIC options#977

Merged
melvinw merged 1 commit intomasterfrom
no_fPIC_DPDK
Aug 13, 2020
Merged

Do not build dpdk with fPIC options#977
melvinw merged 1 commit intomasterfrom
no_fPIC_DPDK

Conversation

@shinae-woo
Copy link
Copy Markdown
Member

  • This option added before to resolve the issues from older version of
    gcc (gcc-5, gcc-6), which defaultly enable pie mode. This bug had been
    fixed on the newer version of gcc.

  • If stack protector option enabled on kernel (CC_STACKPROTECTOR_STRONG,
    or STACKPROTECTOR_STRONG), pie is not allowed. This is defaultly
    enabled on many of recent Debian-family distros, so The option -fPIC
    triggers an build error for some driver modules (e.g., kmoe, igb_uio)

  • To support default kernel option for stack protector, and as a fact
    that PIE is not default for recent version of gcc anymore, we can
    remove fPIC from the option.

  • Still build with old gcc versions on newer kernel have a chance to
    failure, in that case, multiple options may available
    (though, I didn't test those options by myself)

    1. upgrade gcc to newer version
    2. override DPDK_CFLAGS to set -fPIC
    3. disable STACKPROTECTOR_STRONG from kernel config
    4. disable PIE option on KBUILD_CFLAGS (--no-pie)

@codecov
Copy link
Copy Markdown

codecov Bot commented May 8, 2020

Codecov Report

Merging #977 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #977   +/-   ##
=======================================
  Coverage   55.96%   55.96%           
=======================================
  Files           9        9           
  Lines        1165     1165           
=======================================
  Hits          652      652           
  Misses        513      513           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ea848dd...cd591a4. Read the comment docs.

Comment thread build.py

DPDK_DIR = '%s/%s' % (DEPS_DIR, DPDK_VER)
DPDK_CFLAGS = '"-g -w -fPIC"'
DPDK_CFLAGS = '"-g -w"'
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We might (on some systems that we don't really care about...?) need an explicit no-pic and/or no-pie option (eg -fno-PIE). It looks like there was a big mess of contradictory options introduced in various distributions back in 2016 or so. Should we have a build.py flag for this? That is, rather than hardcoding -fPIC or absence of -fPIC we could have an option to put something in.

We could perhaps even try to figure out the right flags, if any, automatically... If this works for Ubuntu 18 though, that's what we really care about and should be the default.

Copy link
Copy Markdown
Member Author

@shinae-woo shinae-woo May 8, 2020

Choose a reason for hiding this comment

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

-fPIC doesn't work on "Ubuntu18 with gcc+8". And also, "Ubuntu18 with gcc+8" doesn't necessarily need an explicit no-pie option. For the older version of g++, yeap, we explicitly disable the no-pie sounds better option to overwrite the default as you said.

Copy link
Copy Markdown
Contributor

@melvinw melvinw 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!
meowmeow

@melvinw melvinw force-pushed the no_fPIC_DPDK branch 3 times, most recently from 520db2f to 1b1ea7b Compare August 13, 2020 17:42
- This option added before to resolve the issues from older version of
  gcc (gcc-5, gcc-6), which defaultly enable pie mode. This bug had been
  fixed on the newer version of gcc.

- If stack protector option enabled on kernel (CC_STACKPROTECTOR_STRONG,
  or STACKPROTECTOR_STRONG), pie is not allowed. This is defaultly
  enabled on many of recent Debian-family distros, so The option `-fPIC`
  triggers an build error for some driver modules (e.g., kmoe, igb_uio)

- To support default kernel option for stack protector, and as a fact
  that PIE is not default for recent version of gcc anymore, we can
  remove fPIC from the option.

- Still build with old gcc versions on newer kernel have a chance to
  failure, in that case, multiple options may available
  (though, I didn't test those options by myself)

  1) upgrade gcc to newer version
  2) override DPDK_CFLAGS to set -fPIC
  3) disable STACKPROTECTOR_STRONG from kernel config
  4) disable PIE option on KBUILD_CFLAGS (--no-pie)
@melvinw melvinw merged commit ab8773c into master Aug 13, 2020
@melvinw melvinw deleted the no_fPIC_DPDK branch August 13, 2020 18:27
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