Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 May 2011 17:46:00 +0200
From:      Olivier Smedts <olivier@gid0.org>
To:        Roman Divacky <rdivacky@freebsd.org>
Cc:        "O. Hartmann" <ohartman@zedat.fu-berlin.de>, current@freebsd.org
Subject:   Re: Clang error make buildworld
Message-ID:  <BANLkTimkOU9NDUONH1r=qX68iwj4W5LVpg@mail.gmail.com>
In-Reply-To: <20110505135458.GA79622@freebsd.org>
References:  <201105040107.p4417NTR048534@pozo.com> <4DC0F46C.3020806@FreeBSD.org> <201105041344.p44DiOId032272@pozo.com> <4DC160B9.5060004@FreeBSD.org> <4DC2A0E5.5040602@zedat.fu-berlin.de> <BANLkTimiU42U0m5nCo=hSdaUF50rwnOk4w@mail.gmail.com> <20110505135458.GA79622@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
2011/5/5 Roman Divacky <rdivacky@freebsd.org>:
>> Because with clang, -march=3Dnative often breaks buildworld, while
>> -march=3Dcore2 is ok.
>
> Can you be more specific about this claim? On what CPU are seeing
> this breakage?

Ok, with latest HEAD...

%echo | gcc -march=3Dnative -E -v -x c -### -
Using built-in specs.
Target: amd64-undermydesk-freebsd
Configured with: FreeBSD/amd64 system compiler
Thread model: posix
gcc version 4.2.2 20070831 prerelease [FreeBSD]
 "/usr/libexec/cc1" "-E" "-quiet" "-v" "-D_LONGLONG" "-"
"-march=3Dcore2" "-mtune=3Dgeneric"

With "-march=3Dnative", gcc adds "-mtune=3Dgeneric" while the man pages
says "-march=3Dxxx" sets "-mtune=3Dxxx".

%echo | gcc -march=3Dcore2 -E -v -x c -### -
Using built-in specs.
Target: amd64-undermydesk-freebsd
Configured with: FreeBSD/amd64 system compiler
Thread model: posix
gcc version 4.2.2 20070831 prerelease [FreeBSD]
 "/usr/libexec/cc1" "-E" "-quiet" "-v" "-D_LONGLONG" "-" "-march=3Dcore2"

With "-march=3Dcore2", gcc doesn't add "-mtune=3Dgeneric", so it should
use "-mtune=3Dcore2" as suggested by its man page.

That's why I use "-march=3Dcore2" for gcc. Now for clang...

With "-march=3Dcore2", my buildworld compiles just fine on my Core2
Quad, whereas with "-march=3Dnative" (without -jX) if fails on :
=3D=3D=3D> libexec/atrun (all)
clang -O2 -pipe -march=3Dnative -fomit-frame-pointer
-DATJOB_DIR=3D\"/var/at/jobs/\"  -DLFILE=3D\"/var/at/jobs/.lockfile\"
-DLOADAVG_MX=3D1.5 -DATSPOOL_DIR=3D\"/var/at/spool\"  -DVERSION=3D\"2.9\"
-DDAEMON_UID=3D1 -DDAEMON_GID=3D1  -DDEFAULT_BATCH_QUEUE=3D\'E\'
-DDEFAULT_AT_QUEUE=3D\'c\' -DPERM_PATH=3D\"/var/at/\"
-I/usr/src/libexec/atrun/../../usr.bin/at -I/usr/src/libexec/atrun
-DLOGIN_CAP -DPAM -std=3Dgnu99 -fstack-protector -Wsystem-headers -Wall
-Wno-format-y2k -Wno-uninitialized -Wno-pointer-sign -c
/usr/src/libexec/atrun/atrun.c
clang -O2 -pipe -march=3Dnative -fomit-frame-pointer
-DATJOB_DIR=3D\"/var/at/jobs/\"  -DLFILE=3D\"/var/at/jobs/.lockfile\"
-DLOADAVG_MX=3D1.5 -DATSPOOL_DIR=3D\"/var/at/spool\"  -DVERSION=3D\"2.9\"
-DDAEMON_UID=3D1 -DDAEMON_GID=3D1  -DDEFAULT_BATCH_QUEUE=3D\'E\'
-DDEFAULT_AT_QUEUE=3D\'c\' -DPERM_PATH=3D\"/var/at/\"
-I/usr/src/libexec/atrun/../../usr.bin/at -I/usr/src/libexec/atrun
-DLOGIN_CAP -DPAM -std=3Dgnu99 -fstack-protector -Wsystem-headers -Wall
-Wno-format-y2k -Wno-uninitialized -Wno-pointer-sign -c
/usr/src/libexec/atrun/gloadavg.c
clang -O2 -pipe -march=3Dnative -fomit-frame-pointer
-DATJOB_DIR=3D\"/var/at/jobs/\"  -DLFILE=3D\"/var/at/jobs/.lockfile\"
-DLOADAVG_MX=3D1.5 -DATSPOOL_DIR=3D\"/var/at/spool\"  -DVERSION=3D\"2.9\"
-DDAEMON_UID=3D1 -DDAEMON_GID=3D1  -DDEFAULT_BATCH_QUEUE=3D\'E\'
-DDEFAULT_AT_QUEUE=3D\'c\' -DPERM_PATH=3D\"/var/at/\"
-I/usr/src/libexec/atrun/../../usr.bin/at -I/usr/src/libexec/atrun
-DLOGIN_CAP -DPAM -std=3Dgnu99 -fstack-protector -Wsystem-headers -Wall
-Wno-format-y2k -Wno-uninitialized -Wno-pointer-sign  -o atrun atrun.o
gloadavg.o -lpam -lutil
clang: warning: argument unused during compilation: '-std=3Dgnu99'
/usr/obj/usr/src/tmp/usr/lib/crt1.o: In function `_start':
/usr/src/lib/csu/amd64/crt1.c:(.text+0x5d): undefined reference to `atexit'
/usr/src/lib/csu/amd64/crt1.c:(.text+0x64): undefined reference to `_init_t=
ls'
/usr/src/lib/csu/amd64/crt1.c:(.text+0x6e): undefined reference to `atexit'
/usr/src/lib/csu/amd64/crt1.c:(.text+0x88): undefined reference to `exit'
atrun.o: In function `perr':
/usr/src/libexec/atrun/atrun.c:(.text+0x65): undefined reference to `strlen=
'
/usr/src/libexec/atrun/atrun.c:(.text+0xac): undefined reference to `vwarn'
/usr/src/libexec/atrun/atrun.c:(.text+0xb6): undefined reference to `exit'
/usr/src/libexec/atrun/atrun.c:(.text+0xd5): undefined reference to `snprin=
tf'
/usr/src/libexec/atrun/atrun.c:(.text+0xe6): undefined reference to `vsyslo=
g'
/usr/src/libexec/atrun/atrun.c:(.text+0xf0): undefined reference to `exit'
atrun.o: In function `perrx':
/usr/src/libexec/atrun/atrun.c:(.text+0x19f): undefined reference to `vwarn=
x'
/usr/src/libexec/atrun/atrun.c:(.text+0x1a9): undefined reference to `exit'
/usr/src/libexec/atrun/atrun.c:(.text+0x1be): undefined reference to `vsysl=
og'
/usr/src/libexec/atrun/atrun.c:(.text+0x1c8): undefined reference to `exit'
atrun.o: In function `main':
/usr/src/libexec/atrun/atrun.c:(.text+0x224): undefined reference to `geteu=
id'
/usr/src/libexec/atrun/atrun.c:(.text+0x239): undefined reference to `geteg=
id'
/usr/src/libexec/atrun/atrun.c:(.text+0x24a): undefined reference to `seteg=
id'
/usr/src/libexec/atrun/atrun.c:(.text+0x255): undefined reference to `seteu=
id'
/usr/src/libexec/atrun/atrun.c:(.text+0x269): undefined reference to `openl=
og'
/usr/src/libexec/atrun/atrun.c:(.text+0x26f): undefined reference to `opter=
r'
/usr/src/libexec/atrun/atrun.c:(.text+0x292): undefined reference to `getop=
t'
/usr/src/libexec/atrun/atrun.c:(.text+0x2ac): undefined reference to `optar=
g'
/usr/src/libexec/atrun/atrun.c:(.text+0x2bb): undefined reference to `sscan=
f'
/usr/src/libexec/atrun/atrun.c:(.text+0x2e7): undefined reference to `__std=
errp'
/usr/src/libexec/atrun/atrun.c:(.text+0x2fb): undefined reference to `fwrit=
e'
/usr/src/libexec/atrun/atrun.c:(.text+0x305): undefined reference to `exit'
/usr/src/libexec/atrun/atrun.c:(.text+0x316): undefined reference to `syslo=
g'
/usr/src/libexec/atrun/atrun.c:(.text+0x320): undefined reference to `exit'
/usr/src/libexec/atrun/atrun.c:(.text+0x32a): undefined reference to `chdir=
'
/usr/src/libexec/atrun/atrun.c:(.text+0x349): undefined reference to `opend=
ir'
/usr/src/libexec/atrun/atrun.c:(.text+0x361): undefined reference to `time'
/usr/src/libexec/atrun/atrun.c:(.text+0x3cc): undefined reference to `sscan=
f'
/usr/src/libexec/atrun/atrun.c:(.text+0x416): undefined reference to
`__mb_sb_limit'
/usr/src/libexec/atrun/atrun.c:(.text+0x42a): undefined reference to
`_CurrentRuneLocale'
/usr/src/libexec/atrun/atrun.c:(.text+0x43e): undefined reference to `strcm=
p'
/usr/src/libexec/atrun/atrun.c:(.text+0x454): undefined reference to `strlc=
py'
/usr/src/libexec/atrun/atrun.c:(.text+0x463): undefined reference to
`__mb_sb_limit'
/usr/src/libexec/atrun/atrun.c:(.text+0x4a1): undefined reference to
`_CurrentRuneLocale'
/usr/src/libexec/atrun/atrun.c:(.text+0x4ea): undefined reference to `unlin=
k'
/usr/src/libexec/atrun/atrun.c:(.text+0x4f4): undefined reference to `readd=
ir'
/usr/src/libexec/atrun/atrun.c:(.text+0x50b): undefined reference to `stat'
/usr/src/libexec/atrun/atrun.c:(.text+0x54c): undefined reference to `close=
log'
/usr/src/libexec/atrun/atrun.c:(.text+0x553): undefined reference to `exit'
atrun.o: In function `run_file':
[...]
/usr/src/libexec/atrun/atrun.c:(.text+0xba4): undefined reference to
`__stack_chk_fail'
/usr/src/libexec/atrun/atrun.c:(.text+0xc90): undefined reference to `exit'
/usr/src/libexec/atrun/atrun.c:(.text+0xcb2): undefined reference to `exit'
gloadavg.o: In function `gloadavg':
/usr/src/libexec/atrun/gloadavg.c:(.text+0xb): undefined reference to
`getloadavg'
/usr/obj/usr/src/tmp/usr/lib/libutil.so: undefined reference to `stpcpy'
/usr/obj/usr/src/tmp/usr/lib/libutil.so: undefined reference to `putchar'
/usr/obj/usr/src/tmp/usr/lib/libutil.so: undefined reference to `strcpy'
/usr/obj/usr/src/tmp/usr/lib/libutil.so: undefined reference to `warnx'
/usr/obj/usr/src/tmp/usr/lib/libpam.so: undefined reference to `__stdoutp'
/usr/obj/usr/src/tmp/usr/lib/libutil.so: undefined reference to `getrlimit'
/usr/obj/usr/src/tmp/usr/lib/libutil.so: undefined reference to `ioctl'
/usr/obj/usr/src/tmp/usr/lib/libpam.so: undefined reference to `dlerror'
/usr/obj/usr/src/tmp/usr/lib/libutil.so: undefined reference to `getgid'
/usr/obj/usr/src/tmp/usr/lib/libutil.so: undefined reference to `printf'
/usr/obj/usr/src/tmp/usr/lib/libutil.so: undefined reference to `mac_is_pre=
sent'
/usr/obj/usr/src/tmp/usr/lib/libutil.so: undefined reference to `mac_from_t=
ext'
/usr/obj/usr/src/tmp/usr/lib/libpam.so: undefined reference to `sigemptyset=
'
/usr/obj/usr/src/tmp/usr/lib/libutil.so: undefined reference to `strerror'
/usr/obj/usr/src/tmp/usr/lib/libutil.so: undefined reference to `__pw_scan'
/usr/obj/usr/src/tmp/usr/lib/libutil.so: undefined reference to `memmove'
/usr/obj/usr/src/tmp/usr/lib/libpam.so: undefined reference to `__stdinp'
/usr/obj/usr/src/tmp/usr/lib/libutil.so: undefined reference to
`cpuset_setaffinity'
/usr/obj/usr/src/tmp/usr/lib/libutil.so: undefined reference to `getenv'
/usr/obj/usr/src/tmp/usr/lib/libutil.so: undefined reference to `fchmod'
[...]
/usr/obj/usr/src/tmp/usr/lib/libutil.so: undefined reference to `setlogin'
/usr/obj/usr/src/tmp/usr/lib/libutil.so: undefined reference to `raise'
/usr/obj/usr/src/tmp/usr/lib/libpam.so: undefined reference to `free'
/usr/obj/usr/src/tmp/usr/lib/libpam.so: undefined reference to `sigprocmask=
'
clang: error: linker command failed with exit code 1 (use -v to see invocat=
ion)
*** Error code 1

Stop in /usr/src/libexec/atrun.
*** Error code 1

Stop in /usr/src/libexec.
*** Error code 1

Stop in /usr/src.
*** Error code 1


>
> Anyway, can you compile and run on that machine this:
>
> =A0 =A0 =A0 =A0http://lev.vlakno.cz/~rdivacky/Host.cpp
>
> It's the LLVM CPU autodetection code, it will print the name of
> your CPU. I wonder whats the difference to "core2".
>
> Thank you. roman
>


--=20
Olivier Smedts=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=A0 _
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=
 =A0 ASCII ribbon campaign ( )
e-mail: olivier@gid0.org=A0 =A0 =A0 =A0 - against HTML email & vCards=A0 X
www: http://www.gid0.org=A0 =A0 - against proprietary attachments / \

=A0 "Il y a seulement 10 sortes de gens dans le monde :
=A0 ceux qui comprennent le binaire,
=A0 et ceux qui ne le comprennent pas."



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?BANLkTimkOU9NDUONH1r=qX68iwj4W5LVpg>