In fs/vfs/main.cc we have bootfs_start, which was defined as a single character (extern char bootfs_start) but was really treated as the beginning of a longer memory area. Gcc 11 can recognize that we access beyond this single character, and fail the compilation.
To work around this problem, we declare bootfs_start as extern char bootfs_start[] Little needs to be changed besides this - except changing &bootfs_start + offset - which gcc doesn't like, to &bootfs_start[offset]. Signed-off-by: Nadav Har'El <n...@scylladb.com> --- fs/vfs/main.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/vfs/main.cc b/fs/vfs/main.cc index 71110796..b411da60 100644 --- a/fs/vfs/main.cc +++ b/fs/vfs/main.cc @@ -2197,7 +2197,7 @@ struct bootfs_metadata { char name[BOOTFS_PATH_MAX]; }; -extern char bootfs_start; +extern char bootfs_start[]; int ramfs_set_file_data(struct vnode *vp, const void *data, size_t size); void unpack_bootfs(void) @@ -2223,7 +2223,7 @@ void unpack_bootfs(void) if (md[i].type == bootfs_file_type::symlink) { // This is a symbolic link record. The file's content is the // target path, and we assume ends with a null. - if (symlink(&bootfs_start + md[i].offset, md[i].name) != 0) { + if (symlink(&bootfs_start[md[i].offset], md[i].name) != 0) { kprintf("couldn't symlink %s: %d\n", md[i].name, errno); sys_panic("unpack_bootfs failed"); } @@ -2250,7 +2250,7 @@ void unpack_bootfs(void) } struct vnode *vp = fp->f_dentry->d_vnode; - ret = ramfs_set_file_data(vp, &bootfs_start + md[i].offset, md[i].size); + ret = ramfs_set_file_data(vp, &bootfs_start[md[i].offset], md[i].size); if (ret) { kprintf("ramfs_set_file_data failed, ret = %d\n", ret); sys_panic("unpack_bootfs failed"); -- 2.31.1 -- You received this message because you are subscribed to the Google Groups "OSv Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to osv-dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/osv-dev/20210614062057.1998552-8-nyh%40scylladb.com.