Skip to content

x265: shared lib should be linked with -Bsymbolic and one other issue #209

Description

@bergerspencer

See pull request #208. Recently, when I was building an x265 that supported multiple bit depths, I discovered a couple of issues with the patch that was introduced in TritonDataCenter/pkgsrc-legacy#455.

The first issue with the patch is that it went further than it needed to, and completely removed -Bsymbolic on SunOS when it was only necessary to remove it from the executable target. This breaks bit-depth introspection. Even if you don't care about bit-depth introspection, it's best to stay as close to upstream as possible; it's possible other programs that link x265 also rely on it being compiled with -Bsymbolic

The second issue is that the patch adds "-Wa,--noexecstack" to the linker flags, which does nothing.

There are 3 reasons it does nothing:

  1. cmake only sends the flag to gcc at the linking stage, it is never sent during the compilation stage
  2. x265 doesn't use gcc to assemble its handwritten assembly, it uses nasm (formerly yasm), so passing -Wa,--noexecstack in the correct place wouldn't help; gcc of course already marks its generated assembly without needing this flag
  3. As the patch comment questions, solaris ld ignores this anyway; if you compile a one-file c-program with gcc7 from pkgsrc it's not marked as noexecstack

This isn't a big deal because the default for 64 bit executables is a nonexecutable stack, even if they don't have the appropriate ELF header. But I figured I may as well pass a flag that generates a PT_SUNWSTACK header since it's necessary to pass -mimpure-text anyway.

Activity

  1. despair86 commented on Jun 30, 2019

    @despair86

    nice. I knew I was missing something in my own patch, but I hardly use symbolic linkage in my own projects 🤷🏻

  2. added a commit that references this issue on Jul 11, 2019
  3. added a commit that references this issue on Aug 26, 2019
  4. added a commit that references this issue on Oct 10, 2019
  5. added a commit that references this issue on Oct 20, 2019
  6. added a commit that references this issue on Nov 6, 2019
  7. added a commit that references this issue on Dec 15, 2019
    8e0de63
  8. added a commit that references this issue on Jan 3, 2020
  9. added a commit that references this issue on Mar 7, 2020
  10. added a commit that references this issue on May 3, 2020
  11. added a commit that references this issue on Jun 22, 2020
  12. added a commit that references this issue on Sep 16, 2020
  13. added a commit that references this issue on Oct 19, 2020
  14. added a commit that references this issue on Mar 30, 2021
  15. 82 remaining items

  16. added a commit that references this issue on Jul 26, 2026
  17. added a commit that references this issue on Aug 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions