[all-commits] [llvm/llvm-project] 0248b5: [clang][Driver] Fix safestack -u ordering (#98468)

Rainer Orth via All-commits all-commits at lists.llvm.org
Thu Jul 11 05:05:07 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0248b597b1442ba803b61ba1d099ec8ef3872b2d
      https://github.com/llvm/llvm-project/commit/0248b597b1442ba803b61ba1d099ec8ef3872b2d
  Author: Rainer Orth <ro at gcc.gnu.org>
  Date:   2024-07-11 (Thu, 11 Jul 2024)

  Changed paths:
    M clang/lib/Driver/ToolChains/CommonArgs.cpp
    M clang/test/Driver/ohos.c
    M clang/test/Driver/sanitizer-ld.c

  Log Message:
  -----------
  [clang][Driver] Fix safestack -u ordering (#98468)

When re-enabling safestack testing on Solaris after the unexplained
b0260c5b1052f8e3ff1ec77dc42a11f42da762cc, all tests `FAIL`ed to link:

```
Undefined			first referenced
 symbol  			    in file
__safestack_unsafe_stack_ptr        buffer-copy-vla.o
__safestack_init                    (command line)
ld: fatal: symbol referencing errors
```

The problem is that `-u __safestack_init` was passed to the linker after
the corresponding version of `libclang_rt.safestack-*.a`. Since the
Solaris linker (like Unix linkers for decades) respects the command line
argument order (unlike e.g. GNU ld which uses GNU getopt), this cannot
work. Fixed by moving the `-u` arg further to the front. Two affected
testcases were fixed accordingly.

Tested on `amd64-pc-solaris2.11`, `sparcv9-sun-solaris2.11`,
`x86_64-pc-linux-gnu`, and `sparc64-unknown-linux-gnu`.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list