After a quick reference through documentation, it appears that LLVM strip uses the exact same flags that gcc's strip uses, at least for the only 2 strip modes we use (--strip-debug, or shortened to just -g, and --strip-unneeded), meaning we can fortunately fold both into the same branch (The current -S option passed to LLVM is an alias for -g). Looks like the comment is also somewhat out of date too. Interestingly clang's --strip-unneeded could also be used in the Minimal configuration too, since right now the build system only supports it for Linux (Presumably since it assumes only gcc has a working strip that supports this option - On an unrelated note, I wonder if adding a configure option to run --strip-unneeded on all gcc and clang compiled JDKs outside of a Minimal build would be of any use?)
best regards, Julian On Tue, Aug 2, 2022 at 1:02 AM <erik.joels...@oracle.com> wrote: > On 7/27/22 7:46 PM, Julian Waters wrote: > > What would be a good way to test for the strip executable? The easiest > solution off the top of my head is to assume a particular compiler uses a > particular strip, but that sounds a little too inflexible. > > Maybe assuming based on toolchain is good enough, it depends on how big > the differences are between different tool variants. Maybe strip from llvm > and gnu are similar enough that it doesn't matter? I haven't investigated > so I don't know. > > To really probe, see examples of how we probe for compiler flags in > flags.m4 FLAGS_C_COMPILER_CHECK_ARGUMENTS. We would need something similar > for strip in that case. But as said, it might be overkill. > > In the case of strip, some toolchains (microsoft) doesn't even use it at > all. > > /Erik > > best regards, > Julian > > On Wed, Jul 27, 2022 at 1:04 AM <erik.joels...@oracle.com> wrote: > >> I'm not very familiar with this, but it looks like clang/llvm does come >> with its own strip utility, which would make this comment wrong. >> >> On Linux, it's likely common to find the gnu binutils strip on the path >> even when trying to use clang to compile OpenJDK. Ideally we should >> setup STRIPFLAGS based on probing the strip executable that was found. >> >> /Erik >> >> On 7/24/22 1:07 AM, Julian Waters wrote: >> > Found something interesting in FLAGS_SETUP_STRIPFLAGS recently: >> > ## Setup strip. >> > # FIXME: should this really be per platform, or should it be per >> > toolchain type? >> > # strip is not provided by clang; so guessing platform makes most sense. >> > >> > STRIPFLAGS is set to -S after this for clang (or more accurately, when >> > the OS being compiled for is MacOS), but STRIP for clang (Likely using >> > the clang driver itself) doesn't seem to be set anywhere within make. >> > The only place I can find it being set is in >> > toolchain.m4, UTIL_LOOKUP_TOOLCHAIN_PROGS(STRIP, strip), when the OS >> > that's being compiled for != windows. But if the comment that strip >> > isn't available for clang is still correct and up to date, this >> > doesn't seem right, considering Linux allows for compiling the JDK >> > with clang as well, while -S is only set with MacOS, and the != >> > windows check would also not work properly since it would still check >> > for the regular strip utility even if the compiler was clang. >> > >> > best regards, >> > Julian >> >