From: Brad Smith <brad-at-comstyle.com@ffmpeg.org>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH] configure: link to libatomic when it's present
Date: Fri, 28 Jan 2022 23:44:52 -0500
Message-ID: <e4998dba-dcc7-6827-d405-9199453da3b1@comstyle.com> (raw)
In-Reply-To: <164319779380.23111.8858951174610122392@lain.red.khirnov.net>
On 1/26/2022 6:49 AM, Anton Khirnov wrote:
> Quoting Brad Smith (2022-01-23 20:40:30)
>> Testing this commit out it does as I had suspected and even with --as-needed
>> causes a false positive on OpenBSD / FreeBSD.
> Why?
Looking at this again and thinking about what it does, the test as is is
flawed.
With the order being used it doesn't check to see if the linked binary even
is linked against libatomic. Using --as-needed it drops the libatomic
dependency
but since the link succeeds then the code as it is and based on the
ordering, as
I commented about, says go ahead and link in libatomic. Changing the order
so it is "" "-latomic" instead of "-latomic" "" does the right thing.
humpty$ cc -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
-DPIC -O2 -pipe -I/usr/local/include -I/usr/X11R6/include -std=c11 -fPIC
-c -o test.o test.c
humpty$ cc -Wl,--as-needed -Wl,-z,noexecstack -o test test.o -latomic
-L/usr/local/lib -L/usr/X11R6/lib
humpty$ objdump -p test
test: file format elf64-x86-64
Program Header:
PHDR off 0x0000000000000040 vaddr 0x0000000000000040 paddr
0x0000000000000040 align 2**3
filesz 0x00000000000002a0 memsz 0x00000000000002a0 flags r--
INTERP off 0x00000000000002e0 vaddr 0x00000000000002e0 paddr
0x00000000000002e0 align 2**0
filesz 0x0000000000000013 memsz 0x0000000000000013 flags r--
LOAD off 0x0000000000000000 vaddr 0x0000000000000000 paddr
0x0000000000000000 align 2**12
filesz 0x00000000000005dc memsz 0x00000000000005dc flags r--
LOAD off 0x00000000000005e0 vaddr 0x00000000000015e0 paddr
0x00000000000015e0 align 2**12
filesz 0x0000000000000450 memsz 0x0000000000000450 flags r-x
LOAD off 0x0000000000000a30 vaddr 0x0000000000002a30 paddr
0x0000000000002a30 align 2**12
filesz 0x00000000000001c0 memsz 0x00000000000001c0 flags rw-
LOAD off 0x0000000000000bf0 vaddr 0x0000000000003bf0 paddr
0x0000000000003bf0 align 2**12
filesz 0x0000000000000000 memsz 0x0000000000000055 flags rw-
DYNAMIC off 0x0000000000000a88 vaddr 0x0000000000002a88 paddr
0x0000000000002a88 align 2**3
filesz 0x0000000000000120 memsz 0x0000000000000120 flags rw-
RELRO off 0x0000000000000a30 vaddr 0x0000000000002a30 paddr
0x0000000000002a30 align 2**0
filesz 0x00000000000001c0 memsz 0x00000000000005d0 flags r--
EH_FRAME off 0x00000000000004c8 vaddr 0x00000000000004c8 paddr
0x00000000000004c8 align 2**2
filesz 0x0000000000000034 memsz 0x0000000000000034 flags r--
OPENBSD_RANDOMIZE off 0x0000000000000a30 vaddr 0x0000000000002a30
paddr 0x0000000000002a30 align 2**3
filesz 0x0000000000000030 memsz 0x0000000000000030 flags rw-
STACK off 0x0000000000000000 vaddr 0x0000000000000000 paddr
0x0000000000000000 align 2**0
filesz 0x0000000000000000 memsz 0x0000000000000000 flags rw-
NOTE off 0x00000000000002f4 vaddr 0x00000000000002f4 paddr
0x00000000000002f4 align 2**2
filesz 0x0000000000000018 memsz 0x0000000000000018 flags r--
Dynamic Section:
NEEDED libc.so.96.1
FLAGS_1 0x8000000
DEBUG 0x0
RELA 0x438
RELASZ 0x30
RELAENT 0x18
RELACOUNT 0x1
JMPREL 0x468
PLTRELSZ 0x60
PLTGOT 0x2bb8
PLTREL 0x7
SYMTAB 0x310
SYMENT 0x18
STRTAB 0x3f8
STRSZ 0x3f
GNU_HASH 0x3a0
HASH 0x3c0
libatomic is dropped by --as-needed since it is not necessary.
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next prev parent reply other threads:[~2022-01-29 4:45 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-19 11:54 Anton Khirnov
2022-01-19 12:34 ` James Almer
2022-01-19 12:37 ` Andreas Rheinhardt
2022-01-19 12:40 ` Anton Khirnov
2022-01-19 13:16 ` James Almer
2022-01-19 13:48 ` Anton Khirnov
2022-01-19 15:23 ` James Almer
2022-01-22 6:42 ` Brad Smith
2022-01-22 9:00 ` Hendrik Leppkes
2022-01-23 19:40 ` Brad Smith
2022-01-26 11:49 ` Anton Khirnov
2022-01-29 4:44 ` Brad Smith [this message]
2022-01-29 9:54 ` Hendrik Leppkes
2022-01-29 18:15 ` Brad Smith
2022-01-29 20:38 ` Anton Khirnov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e4998dba-dcc7-6827-d405-9199453da3b1@comstyle.com \
--to=brad-at-comstyle.com@ffmpeg.org \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git