strange visibility error when compiling llvm-gcc-4.2

I'm on Debian Etch and re-compile llvm/llvm-gcc-4.2 from
scratch. I'm on svn revision 46813.

I'm using the following commands for the compilation:

Hi,

if /bin/sh ./libtool --mode=compile /s/llvm/obj.gcc42/./gcc/xgcc -B/s/llvm/obj.gcc42/./gcc/ -B/usr/local/i686-pc-linux-gnu/bin/ -B/usr/local/i686-pc-linux-gnu/lib/ -isystem /usr/local/i686-pc-linux-gnu/include -isystem /usr/local/i686-pc-linux-gnu/sys-include -DHAVE_CONFIG_H -I. -I/s/llvm/svn.gcc42/libgomp -I. -I/s/llvm/svn.gcc42/libgomp/config/linux/x86 -I/s/llvm/svn.gcc42/libgomp/config/linux -I/s/llvm/svn.gcc42/libgomp/config/posix -I/s/llvm/svn.gcc42/libgomp -Wall -Werror -ftls-model=initial-exec -march=i486 -mtune=i686 -Wc,-pthread -O2 -g -O2 -MT lock.lo -MD -MP -MF ".deps/lock.Tpo" -c -o lock.lo /s/llvm/svn.gcc42/libgomp/config/linux/lock.c; \
        then mv -f ".deps/lock.Tpo" ".deps/lock.Plo"; else rm -f ".deps/lock.Tpo"; exit 1; fi
yes
cc1: warnings being treated as errors
/s/llvm/svn.gcc42/libgomp/team.c:341: warning: visibility attribute not supported in this configuration; ignored
/s/llvm/svn.gcc42/libgomp/team.c:341: warning: visibility attribute not supported in this configuration; ignored
checking for tanl... make[5]: *** [team.lo] Error 1
----------------------------------

Because of the -Werror, this warning is taken as an error
and compilation aborts. I wonder why it warns in the first
place, is something broken with xgcc?

I suspect this is due to the recent change by Bill (revision 46747).

Best wishes,

Duncan.

Bill's change only affected darwin IIRC. I don't know that anyone has built GOMP on linux yet, and OpenMP hasn't been widely tested at all. I'd suggest using --enable-languages=c,c++

-Chris

I am seeing the same errors with just building c,c++. (linux x86, also debian)

Andrew

I suspect this is due to the recent change by Bill (revision 46747).

Bill's change only affected darwin IIRC. I don't know that anyone has
built GOMP on linux yet, and OpenMP hasn't been widely tested at all.
I'd suggest using --enable-languages=c,c++

This looks like something is broken on the gcc side of things. Does a simple:

void
__attribute__((visibility ("hidden")))
foo()
{ }

compile with your resultant compiler?

-eric

I suspect this is due to the recent change by Bill (revision 46747).

Bill's change only affected darwin IIRC. I don't know that anyone has
built GOMP on linux yet, and OpenMP hasn't been widely tested at all.
I'd suggest using --enable-languages=c,c++

I am seeing the same errors with just building c,c++. (linux x86, also debian)

Ah, I didn't notice that Bill changed varasm.c. Bill?

-Chris

> > I suspect this is due to the recent change by Bill (revision 46747).
>
> Bill's change only affected darwin IIRC. I don't know that anyone has
> built GOMP on linux yet, and OpenMP hasn't been widely tested at all.
> I'd suggest using --enable-languages=c,c++

I am seeing the same errors with just building c,c++. (linux x86, also debian)

There was a change to varasm.c that was not conditioned on being on darwin:

+ /* The "make_assemble_visibility" method may issue a warning if the visibility
+ attribute isn't supported in a configuration. This is all done through a
+ call-back. We want to issue this same warning when needed. */
+ if (TREE_PUBLIC (decl))
+ maybe_assemble_visibility (decl);

It seems suspicious.

Ciao,

Duncan.

; ModuleID = 'foo.c'
target datalayout =
"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
target triple = "i686-pc-linux-gnu"

define hidden void @foo() {
entry:
        br label %return

return: ; preds = %entry
        ret void
}

also works when going to native .o or bytecode.

llvm-gcc -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../source/configure
--prefix=/home/andrewl/Research/cfe-4.2/install
--enable-llvm=/home/andrewl/Research/llvm --enable-languages=c,c++
--disable-bootstrap --disable-shared --disable-werror
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5546) (LLVM build)

It does seem odd, what was the reason for the change?

-eric

This looks like something is broken on the gcc side of things. Does a
simple:

void
__attribute__((visibility ("hidden")))
foo()
{ }

compile with your resultant compiler?

also works when going to native .o or bytecode.

Well, at least it's not completely broken :slight_smile:

-eric

> Bill's change only affected darwin IIRC. I don't know that anyone has
> built GOMP on linux yet, and OpenMP hasn't been widely tested at all.
> I'd suggest using --enable-languages=c,c++

I am seeing the same errors with just building c,c++. (linux x86, also debian)

This bit of Bill's patch did it:

-#ifdef HAVE_GAS_HIDDEN

It's not suspicious. Look down about 3 lines after the ENABLE_LLVM
if-def block. It's being called unconditionally for all platforms. The
problem lies elsewhere. I made a mistake in my if-defs for the
default_assemble_visibility function.

-bw

Aaah yes. That'd do it.

-eric

Yes. :frowning: Sorry about that. I claim that it was late when I made the
patch. :wink: Anyway, I corrected my logic. Try it now.

-bw