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-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to