Question about llvm/llvm-gcc visibility

Gurus-

Do llvm/llvm-gcc support pragma definitions for visibility like:

#pragma GCC visibility push(hidden)

If so, what are the options I need to set when configuring llvm and llvm-gcc?

I’m able to compile the module with llvm-gcc (with the above pragma included), but the kernel still rejects the module at load time saying the module is compiled with PLT/GOT.

Any Inputs, Insights?

Thanks in advance,
-KC

Hi, Mark

#pragma GCC visibility push(hidden)

In theory - yes.

If so, what are the options I need to set when configuring llvm and
llvm-gcc?

Well... No extra options are needed.

I'm able to compile the module with llvm-gcc (with the above pragma
included), but the kernel still rejects the module at load time saying the
module is compiled with PLT/GOT.

Visibility != w/o PLT/GOT, it only reduces calls / accesses via PLT/GOT.

Any Inputs, Insights?

Please consider filling a PR in llvm bugzilla with sources in question
and/or generated LLVM IR (you can grab it supplying -emit-llvm option
to llvm-gcc)

Hi, Mark

#pragma GCC visibility push(hidden)

In theory - yes.

If so, what are the options I need to set when configuring llvm and
llvm-gcc?

Well… No extra options are needed.

I’m able to compile the module with llvm-gcc (with the above pragma
included), but the kernel still rejects the module at load time saying the
module is compiled with PLT/GOT.

Visibility != w/o PLT/GOT, it only reduces calls / accesses via PLT/GOT.

I agree, though initially I thought otherwise.

The symbol in question here is a memcpy (introduced by the compiler probably at codegen) for a “big” copy. The memcpy thus introduced is somehow of type R_X86_64_PLT32 instead of it being a R_X86_64_PC32. Without the “bad” memcpy, things seem to work, the module loads and works.

I’ll investigate some more and then file a PR. Thanks for your help!

-KC