nanos
nanos copied to clipboard
investigate(build): warnings - gcc-12.2, ld-2.40
Starting with release 2.39 of the GNU Binutils several new warnings have been added to the linker. Also gcc-12 may have new rules/checks.
In order to continue building nanos successfully -Wno-error=stringop-overflow -Wno-error=maybe-uninitialized
may need to be added to build flags.
Posting all warnings, after adding those build flags, just to check if there is anything that's relevant and needs to be handled on code.
- tools
$ ld --version
GNU ld (GNU Binutils for Debian) 2.40
...
$ gcc --version
gcc (Debian 12.2.0-14) 12.2.0
- build logs
$ make
...
ld: warning: /ops/nanos/output/klib/bin/firewall.dbg has a LOAD segment with RWX permissions
...
ld: warning: /ops/nanos/output/klib/bin/gcp.dbg has a LOAD segment with RWX permissions
...
ld: warning: /ops/nanos/output/klib/bin/ntp.dbg has a LOAD segment with RWX permissions
...
ld: warning: /ops/nanos/output/klib/bin/radar.dbg has a LOAD segment with RWX permissions
...
ld: warning: /ops/nanos/output/klib/bin/test/page_table.dbg has a LOAD segment with RWX permissions
...
ld: warning: /ops/nanos/output/platform/pc/boot/platform/pc/boot/service32.o: missing .note.GNU-stack section implies executable stack
ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
ld: warning: /ops/nanos/output/platform/pc/boot/bin/stage2.elf has a LOAD segment with RWX permissions
...
ld: warning: /ops/nanos/output/platform/pc/boot/uefi/x86_64/uefi-crt0.o: missing .note.GNU-stack section implies executable stack
ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
...
CC /ops/nanos/output/platform/pc/src/unix/aio.o
In file included from /ops/nanos/src/runtime/runtime.h:3,
from /ops/nanos/src/kernel/kernel.h:2,
from /ops/nanos/src/unix/unix_internal.h:3,
from /ops/nanos/src/unix/aio.c:1:
In function ‘fetch_and_add’,
inlined from ‘refcount_reserve’ at /ops/nanos/src/runtime/refcount.h:15:5,
inlined from ‘aio_from_ring_id’ at /ops/nanos/src/unix/aio.c:68:5,
inlined from ‘io_submit’ at /ops/nanos/src/unix/aio.c:303:11:
/ops/nanos/src/x86_64/machine.h:72:12: warning: ‘__sync_fetch_and_add_8’ writing 8 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
72 | return __sync_fetch_and_add(variable, value);
| ^~~~~~~~~~~~~~~~~~~~
/ops/nanos/src/x86_64/machine.h:72:12: warning: ‘__sync_fetch_and_add_8’ writing 8 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
At top level:
cc1: note: unrecognized command-line option ‘-Wno-unknown-warning-option’ may have been intended to silence earlier diagnostics
...
CC /ops/nanos/output/platform/pc/src/unix/syscall.o
In file included from /ops/nanos/src/runtime/runtime.h:3,
from /ops/nanos/src/kernel/kernel.h:2,
from /ops/nanos/src/unix/unix_internal.h:3,
from /ops/nanos/src/unix/syscall.c:1:
In function ‘fetch_and_add’,
inlined from ‘refcount_reserve’ at /ops/nanos/src/runtime/refcount.h:15:5,
inlined from ‘thread_reserve’ at /ops/nanos/src/unix/unix_internal.h:617:5,
inlined from ‘lookup_thread’ at /ops/nanos/src/unix/syscall.c:2268:9,
inlined from ‘sched_setaffinity’ at /ops/nanos/src/unix/syscall.c:2281:15:
/ops/nanos/src/x86_64/machine.h:72:12: warning: ‘__sync_fetch_and_add_8’ writing 8 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
72 | return __sync_fetch_and_add(variable, value);
| ^~~~~~~~~~~~~~~~~~~~
In function ‘fetch_and_add’,
inlined from ‘refcount_reserve’ at /ops/nanos/src/runtime/refcount.h:15:5,
inlined from ‘thread_reserve’ at /ops/nanos/src/unix/unix_internal.h:617:5,
inlined from ‘lookup_thread’ at /ops/nanos/src/unix/syscall.c:2268:9,
inlined from ‘sched_getaffinity’ at /ops/nanos/src/unix/syscall.c:2300:15:
/ops/nanos/src/x86_64/machine.h:72:12: warning: ‘__sync_fetch_and_add_8’ writing 8 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
72 | return __sync_fetch_and_add(variable, value);
| ^~~~~~~~~~~~~~~~~~~~
At top level:
cc1: note: unrecognized command-line option ‘-Wno-unknown-warning-option’ may have been intended to silence earlier diagnostics
...
CC /ops/nanos/output/platform/pc/src/hyperv/utilities/vmbus_ic.o
/ops/nanos/src/hyperv/utilities/vmbus_ic.c: In function ‘vmbus_ic_negomsg’:
/ops/nanos/src/hyperv/utilities/vmbus_ic.c:159:25: warning: ‘sel_fw_ver’ may be used uninitialized [-Wmaybe-uninitialized]
159 | nego->ic_ver[0] = sel_fw_ver;
| ~~~~~~~~~~~~~~~~^~~~~~~~~~~~
/ops/nanos/src/hyperv/utilities/vmbus_ic.c:46:18: note: ‘sel_fw_ver’ was declared here
46 | uint32_t sel_fw_ver, sel_msg_ver;
| ^~~~~~~~~~
At top level:
cc1: note: unrecognized command-line option ‘-Wno-unknown-warning-option’ may have been intended to silence earlier diagnostics
...
ld: warning: /ops/nanos/output/platform/pc/src/x86_64/crt0.o: missing .note.GNU-stack section implies executable stack
ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
...
as of master branch at https://github.com/nanovms/nanos/commit/888809a7a8f0003b66a8ec2af2f5e8dd749866d0 the remaining warning(s):
$ make
...
ld: warning: /usr/local/src/nanos/output/klib/bin/cloud_init.dbg has a LOAD segment with RWX permissions
...
ld: warning: /usr/local/src/nanos/output/klib/bin/firewall.dbg has a LOAD segment with RWX permissions
...
ld: warning: /usr/local/src/nanos/output/klib/bin/ntp.dbg has a LOAD segment with RWX permissions
...
ld: warning: /usr/local/src/nanos/output/klib/bin/radar.dbg has a LOAD segment with RWX permissions
...
ld: warning: /usr/local/src/nanos/output/klib/bin/syslog.dbg has a LOAD segment with RWX permissions
...
ld: warning: /usr/local/src/nanos/output/klib/bin/tun.dbg has a LOAD segment with RWX permissions
...
ld: warning: /usr/local/src/nanos/output/klib/bin/test/page_table.dbg has a LOAD segment with RWX permissions
...
ld: warning: /usr/local/src/nanos/output/platform/pc/boot/platform/pc/boot/service32.o: missing .note.GNU-stack section implies executable stack
ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
ld: warning: /usr/local/src/nanos/output/platform/pc/boot/bin/stage2.elf has a LOAD segment with RWX permissions
...
ld: warning: /usr/local/src/nanos/output/platform/pc/boot/uefi/x86_64/uefi-crt0.o: missing .note.GNU-stack section implies executable stack
ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
...
ld: warning: /usr/local/src/nanos/output/platform/pc/src/x86_64/crt0.o: missing .note.GNU-stack section implies executable stack
ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
...
@francescolavra jic, there is a new one after merging in the https://github.com/nanovms/nanos/pull/2004 (iirc)
ld: warning: /usr/local/src/nanovms/nanos/output/platform/pc/src/x86_64/init.o: missing .note.GNU-stack section implies executable stack
ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
ld: /usr/local/src/nanovms/nanos/output/platform/pc/src/x86_64/init.o: warning: relocation in read-only section `.start'
ld: warning: creating DT_TEXTREL in a PIE
as of master branch at https://github.com/nanovms/nanos/commit/8a66481fd4f1d657122fc37998e13ee452b1768b the remaining warning(s):
$ make
...
ld: warning: /usr/local/src/nanovms/nanos/output/klib/bin/cloud_init.dbg has a LOAD segment with RWX permissions
...
ld: warning: /usr/local/src/nanovms/nanos/output/klib/bin/cloudwatch.dbg has a LOAD segment with RWX permissions
...
ld: warning: /usr/local/src/nanovms/nanos/output/klib/bin/firewall.dbg has a LOAD segment with RWX permissions
...
ld: warning: /usr/local/src/nanovms/nanos/output/klib/bin/gcp.dbg has a LOAD segment with RWX permissions
...
ld: warning: /usr/local/src/nanovms/nanos/output/klib/bin/ntp.dbg has a LOAD segment with RWX permissions
...
ld: warning: /usr/local/src/nanovms/nanos/output/klib/bin/radar.dbg has a LOAD segment with RWX permissions
...
ld: warning: /usr/local/src/nanovms/nanos/output/klib/bin/shmem.dbg has a LOAD segment with RWX permissions
...
ld: warning: /usr/local/src/nanovms/nanos/output/klib/bin/special_files.dbg has a LOAD segment with RWX permissions
...
ld: warning: /usr/local/src/nanovms/nanos/output/klib/bin/syslog.dbg has a LOAD segment with RWX permissions
...
ld: warning: /usr/local/src/nanovms/nanos/output/klib/bin/tmpfs.dbg has a LOAD segment with RWX permissions
...
ld: warning: /usr/local/src/nanovms/nanos/output/klib/bin/tun.dbg has a LOAD segment with RWX permissions
...
ld: warning: /usr/local/src/nanovms/nanos/output/klib/bin/umcg.dbg has a LOAD segment with RWX permissions
,,,
ld: warning: /usr/local/src/nanovms/nanos/output/klib/bin/test/lock.dbg has a LOAD segment with RWX permissions
...
ld: warning: /usr/local/src/nanovms/nanos/output/klib/bin/test/page_table.dbg has a LOAD segment with RWX permissions
...
ld: warning: /usr/local/src/nanovms/nanos/output/platform/pc/boot/platform/pc/boot/service32.o: missing .note.GNU-stack section implies executable stack
ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
ld: warning: /usr/local/src/nanovms/nanos/output/platform/pc/boot/bin/stage2.elf has a LOAD segment with RWX permissions
...
ld: warning: /usr/local/src/nanovms/nanos/output/platform/pc/boot/uefi/x86_64/uefi-crt0.o: missing .note.GNU-stack section implies executable stack
ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
...
ld: warning: /usr/local/src/nanovms/nanos/output/platform/pc/src/x86_64/init.o: missing .note.GNU-stack section implies executable stack
ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
ld: /usr/local/src/nanovms/nanos/output/platform/pc/src/x86_64/init.o: warning: relocation in read-only section `.start'
ld: warning: creating DT_TEXTREL in a PIE
...