https://sourceware.org/bugzilla/show_bug.cgi?id=33433

            Bug ID: 33433
           Summary: elf32_updatenull.c:57:7: error: potential null pointer
                    dereference [-Werror=null-dereference]
           Product: elfutils
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libelf
          Assignee: unassigned at sourceware dot org
          Reporter: [email protected]
                CC: elfutils-devel at sourceware dot org
  Target Milestone: ---

When building with current gcc trunk libelf.so fails to build with LTO:

gcc -Wall -Wshadow -Wformat=2 -Wold-style-definition -Wstrict-prototypes
-Wtrampolines -Wlogical-op -Wduplicated-cond -Wnull-dereference
-Wimplicit-fallthrough=5 -Wuse-after-free=3 -Werror -Wunused -Wextra
-Wstack-usage=262144    -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3
-fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables
-fstack-clash-protection -Werror=return-type -flto=auto -ffat-lto-objects -g -g
-Werror=date-time  -flto=auto -ffat-lto-objects -o libelf.so -shared
-Wl,-z,defs -Wl,-z,relro -o libelf.so \
        -Wl,--soname,libelf.so.1 \
        -Wl,--version-script,libelf.map \
        -Wl,--no-undefined \
        -Wl,--whole-archive libelf_pic.a -Wl,--no-whole-archive \
        ../lib/libeu.a -lz -lzstd -llzma  -lbz2  
In function ‘default_ehdr64’,
    inlined from ‘__elf64_updatenull_wrlock’ at elf32_updatenull.c:138:7,
    inlined from ‘elf_update’ at elf_update.c:211:6:
elf32_updatenull.c:57:7: error: potential null pointer dereference
[-Werror=null-dereference]
   57 |   if (memcmp (&ehdr->e_ident[EI_MAG0], ELFMAG, SELFMAG) != 0)
      |       ^
lto1: all warnings being treated as errors
make[3]: *** [/tmp/ccENG5L0.mk:2: /tmp/ccMoFZZ9.ltrans0.ltrans.o] Error 1
lto-wrapper: fatal error: make returned 2 exit status
compilation terminated.
/usr/lib64/gcc/x86_64-suse-linux/16/../../../../x86_64-suse-linux/bin/ld:
error: lto-wrapper failed
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:1395: libelf.so] Error 1
make[1]: *** [Makefile:626: all-recursive] Error 1
make: *** [Makefile:541: all] Error 2

Since getehdr_wrlock can return NULL, this seems to be a valid complaint.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Reply via email to