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

Release numactl 2.0.14 #93

Merged
merged 3 commits into from
Sep 18, 2020
Merged

Release numactl 2.0.14 #93

merged 3 commits into from
Sep 18, 2020

Conversation

filbranden
Copy link
Member

Pushing two more small commits related to LTO, follow ups for #92, then bumping the version on the configure.ac file.

Otherwise, building with hardened settings fails with:

  /usr/bin/ld: numademo-numademo.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
  /usr/bin/ld: numademo-stream_lib.o: relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a PIE object; recompile with -fPIE
  /usr/bin/ld: numademo-mt.o: relocation R_X86_64_32 against symbol `mt_buffer' can not be used when making a PIE object; recompile with -fPIE
  /usr/bin/ld: numademo-clearcache.o: relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a PIE object; recompile with -fPIE
  collect2: error: ld returned 1 exit status
  make[1]: *** [Makefile:906: numademo] Error 1

The linker still gets LDFLAGS with -specs=/usr/lib/rpm/redhat/redhat-hardened-ld
but the CFLAGS with -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 get clobbered
by this custom setting.

Let's append `$(AM_CFLAGS)` to the beginning of the list, so these are always
preserved when passed.

Tested with:

  $ ./configure \
        CFLAGS='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection' \
        LDFLAGS='-Wl,-z,relro -Wl,--as-needed  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld'
Since the LTO build has been fixed with the SYMVER commit (92d4e7d),
we can now drop the custom CFLAGS for building libnuma sources.

Tested that enabling LTO results in a working build. Tested with:

  $ ./configure \
        CFLAGS='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -flto' \
        LDFLAGS='-Wl,-z,relro -Wl,--as-needed  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -flto'

(Note the extra `-flto` at the end of both CFLAGS and LDFLAGS.)

Also compared the symbols in `objdump -T .libs/libnuma.so.1.0.0` of an LTO
build versus a non-LTO build, to confirm that all the expected symbols are
still exported under the expected names.
Signed-off-by: Filipe Brandenburger <filbranden@gmail.com>
@filbranden
Copy link
Member Author

Will merge and tag it, together with a tarball.

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.

1 participant