[FFmpeg-devel] [PATCH] configure: add -fPIE instead of -pie to C flags for ThreadSanitizer
Wan-Teh Chang
wtc at google.com
Mon Dec 12 21:55:05 EET 2016
On Mon, Dec 12, 2016 at 6:42 AM, Carl Eugen Hoyos <ceffmpeg at gmail.com> wrote:
> 2016-12-02 23:04 GMT+01:00 Wan-Teh Chang <wtc-at-google.com at ffmpeg.org>:
>> -pie was added to C flags for ThreadSanitizer in commit
>> 19f251a2882a8d0779b432e63bf282e4d9c443bb. Under clang 3.8.0, the -pie
>> flag causes a compiler warning and a linker error when running configure
>> --toolchain=clang-tsan.
>
> Does the patch have any effect when using gcc?
Hi Carl,
Yes, the patch modifies the code shared by --toolchain=clang-tsan and
--toolchain=gcc-tsan.
I am using Ubuntu 14.04 LTS, which comes with gcc 4.8.4. gcc 4.8.4
does NOT work with and without my patch. I got an error in config.log
like this:
==========
check_cc
BEGIN /tmp/ffconf.jceENASz.c
1 int main(void){ return 0; }
END /tmp/ffconf.jceENASz.c
gcc -fsanitize=thread -fPIE -fPIC -c -o /tmp/ffconf.LuPWPOJB.o
/tmp/ffconf.jceENASz.c
gcc -fsanitize=thread -pie -fPIC -o /tmp/ffconf.03RtebJv /tmp/ffconf.LuPWPOJB.o
/tmp/ffconf.LuPWPOJB.o: In function `_GLOBAL__sub_I_00099_0_ffconf.jceENASz.c':
ffconf.jceENASz.c:(.text+0x10): undefined reference to `__tsan_init'
collect2: error: ld returned 1 exit status
C compiler test failed.
==========
This looks like the gcc 4.9.2 bug described in
https://bugs.launchpad.net/ubuntu/+source/gcc-5/+bug/1413474.
Unfortunately, I can't fix the undefined reference to __tsan_init even
if I add -ltsan to the linker flags.
I then built gcc 6.2.0 from sources and tested it. gcc 6.2.0 works
with and without my patch. So I consider my patch safe for gcc. If
there is any other gcc version I should test my patch with, please let
me know.
Thanks,
Wan-Teh Chang
More information about the ffmpeg-devel
mailing list