Skip to contentSkip to conversation

2.02-beta3: build fails - getroot.c:(.text+0x2b): undefined reference to `getrawpartition'

openbsd Andrei Borzenkov 3 participants 17 messages Mar 12, 2016 – Mar 24, 2016 1 message not in the archive Kbuild

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

12.03.2016 19:57, Jiri B пишет:

Quoted 6 lines

Hi,

I'm trying to build grub-2.02-beta3 on OpenBSD 5.9 amd64 and build fails:

cc -Wall -W -Wshadow -Wpointer-arith -Wundef -Wchar-subscripts -Wcomment -Wdeprecated-declarations -Wdisabled-optimization -Wdiv-by-zero -Wfloat-equal -Wformat-extra-args -Wformat-security -Wformat-y2k -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Wmain -Wmissing-braces -Wmissing-format-attribute -Wmultichar -Wparentheses -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -Wswitch -Wtrigraphs -Wunknown-pragmas -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable -Wwrite-strings -Wnested-externs -Wstrict-prototypes -Wcast-align -Wextra -Wattributes -Wendif-labels -Winit-self -Wint-to-pointer-cast -Winvalid-pch -Wmissing-field-initializers -Wnonnull -Woverflow -Wvla -Wpointer-to-int-cast -Wstrict-aliasing -Wvariadic-macros -Wvolatile-register-var -Wpointer-sign -Wmissing-include-dirs -Wmissing-prototypes -Wmissing-declarations -Wformat=2 -Wno-undef -Wno-sign-compare -Wno-unused -Wno-unused-parameter -Wno-redundant-decls -Wno-

unreachable-code -Wno-conversion -O2 -pipe -o grub-macbless util/grub_macbless-grub-macbless.o grub-core/osdep/grub_macbless-init.o grub-core/kern/emu/grub_macbless-argp_common.o libgrubmods.a libgrubgcry.a libgrubkern.a grub-core/gnulib/libgnu.a /usr/local/lib/libintl.so.6.0 -L/usr/local/lib /usr/local/lib/libiconv.so.6.0 -lc -Wl,-rpath,/usr/local/lib

Quoted 7 lines

libgrubkern.a(libgrubkern_a-hostdisk.o): In function `read_device_map':
hostdisk.c:(.text+0x7ab): warning: warning: strcpy() is almost always misused, please use strlcpy() libgrubkern.a(libgrubkern_a-misc.o): In function `grub_util_get_path':
misc.c:(.text+0x12a): warning: warning: sprintf() is often misused, please use snprintf() libgrubkern.a(libgrubkern_a-getroot.o): In function `grub_util_part_to_disk':
getroot.c:(.text+0x2b): undefined reference to `getrawpartition'

Does attached patch help?

autogen.sh Sat Mar 12 17:03:05 2016

Quoted 13 lines

Plus, autogen.sh uses GNU options of find command, till now I solved that this way:

autogen.sh Sat Mar 12 17:03:05 2016 renamed from autogen.sh.orig Sat Mar 12 17:02:35 2016 +0 -0

@ -8,7 +8,7 @@ set -e
export LC_COLLATE=C
unset LC_ALL

autogen.sh Sat Mar 12 17:03:05 2016 renamed from autogen.sh.orig Sat Mar 12 17:02:35 2016 +1 -1
-find . -iname '*.[ch]' ! -ipath './grub-core/lib/libgcrypt-grub/*' ! -ipath './build-aux/*' ! -ipath './grub-core/lib/libgcrypt/src/misc.c' ! -ipath './grub-core/lib/libgcrypt/src/global.c' ! -ipath './grub-core/lib/libgcrypt/src/secmem.c'  ! -ipath './util/grub-gen-widthspec.c' ! -ipath './util/grub-gen-asciih.c' |sort > po/POTFILES.in
+find . -iname '*.[ch]' ! -path './grub-core/lib/libgcrypt-grub/*' ! -path './build-aux/*' ! -path './grub-core/lib/libgcrypt/src/misc.c' ! -path './grub-core/lib/libgcrypt/src/global.c' ! -path './grub-core/lib/libgcrypt/src/secmem.c'  ! -path './util/grub-gen-widthspec.c' ! -path './util/grub-gen-asciih.c' |sort > po/POTFILES.in
 find util -iname '*.in' ! -name Makefile.in  |sort > po/POTFILES-shell.in

Hmm ... we support building on Windows which is case insensitive. What are other options to compare full path name case insenstive?

Quoted 7 lines

echo "Importing unicode..."

Another thing - 'INSTALL' file says >= autoconf 2.60 is needed but it is >= 2.62 otherwise there is:

"error: possibly undefined macro: AS_ECHO"

Indeed. According to git log, AS_ECHO appeared first in 2.61a. What version you have?

Quoted 5 lines

IIRC there's also a difference between NetBSD and OpenBSD regarding to disks. NetBSD uses eg. /dev/rwd0c for NetBSD part, /dev/rwd0d for whole disk, OpenBSD uses 'c' for whole disk and 'd' has no special reason.

If I understand it correctly, getrawpartition() is supposed to handle it (i.e. return entire disk partition number). What exactly does not work?

Quoted 8 lines

Howto reproduce:
1. OpenBSD 5.9 amd64 (snapshot; I have one cca month old)
2. get grub-2.02-beta3
3. autoconf-2.62, automake-1.10, python-2.7, gcc-4.9
4. (replace 'ipath' with 'path' in autogen.sh, see above)
5. put PYTHON in env pointing to python2.7
6. build

Quoted 9 lines

Thanks for help.

j.

_______________________________________________
Bug-grub mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-grub

From: Andrei Borzenkov <[email protected]>
Subject: [PATCH] Makefile.util.def: add $LIBINTL to grub-macbless flags

Fixes compilation on Open BSD.

Reported by Jiri B <[email protected]>

---
 Makefile.util.def | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile.util.def +1 -1
index ed9b4c6..f9caccb 100644
@@ -416,7 +416,7 @@ program = {
   ldadd = libgrubgcry.a;
   ldadd = libgrubkern.a;
   ldadd = grub-core/gnulib/libgnu.a;
-  ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
+  ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
 };
 
 data = {
Signature · 1 line
tg: (3c3e96d..) u/bsd-libutil (depends on: master)
#2 lore raw
Quoted 18 lines · Andrei Borzenkov
Quoted 1 line

cc -Wall -W -Wshadow -Wpointer-arith -Wundef -Wchar-subscripts -Wcomment -Wdeprecated-declarations -Wdisabled-optimization -Wdiv-by-zero -Wfloat-equal -Wformat-extra-args -Wformat-security -Wformat-y2k -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Wmain -Wmissing-braces -Wmissing-format-attribute -Wmultichar -Wparentheses -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -Wswitch -Wtrigraphs -Wunknown-pragmas -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable -Wwrite-strings -Wnested-externs -Wstrict-prototypes -Wcast-align -Wextra -Wattributes -Wendif-labels -Winit-self -Wint-to-pointer-cast -Winvalid-pch -Wmissing-field-initializers -Wnonnull -Woverflow -Wvla -Wpointer-to-int-cast -Wstrict-aliasing -Wvariadic-macros -Wvolatile-register-var -Wpointer-sign -Wmissing-include-dirs -Wmissing-prototypes -Wmissing-declarations -Wformat=2 -Wno-undef -Wno-sign-compare -Wno-unused -Wno-unused-parameter -Wno-redundant-decls -Wno

-
unreachable-code -Wno-conversion -O2 -pipe -o grub-macbless util/grub_macbless-grub-macbless.o grub-core/osdep/grub_macbless-init.o grub-core/kern/emu/grub_macbless-argp_common.o libgrubmods.a libgrubgcry.a libgrubkern.a grub-core/gnulib/libgnu.a /usr/local/lib/libintl.so.6.0 -L/usr/local/lib /usr/local/lib/libiconv.so.6.0 -lc -Wl,-rpath,/usr/local/lib

Quoted 7 lines

libgrubkern.a(libgrubkern_a-hostdisk.o): In function `read_device_map':
hostdisk.c:(.text+0x7ab): warning: warning: strcpy() is almost always misused, please use strlcpy() libgrubkern.a(libgrubkern_a-misc.o): In function `grub_util_get_path':
misc.c:(.text+0x12a): warning: warning: sprintf() is often misused, please use snprintf() libgrubkern.a(libgrubkern_a-getroot.o): In function `grub_util_part_to_disk':
getroot.c:(.text+0x2b): undefined reference to `getrawpartition'

Does attached patch help?

Makefile.util.def +0 -0
index ed9b4c6..f9caccb 100644

Makefile.util.def program = { · line 422

Quoted 8 lines
Makefile.util.def +1 -1
@@ -416,7 +416,7 @@ program = {
   ldadd = libgrubgcry.a;
   ldadd = libgrubkern.a;
   ldadd = grub-core/gnulib/libgnu.a;
-  ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
+  ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
 };
 
 data = {

Thank you, your diff makes compilation pass.

Well, I see something went wrong now with compressing a file:

$ tar tzvf /home/jirib/openbsd/packages/amd64/all/grub-2.02-beta3.tgz | grep lzma_decompress
-r-xr-xr-x  1 root     bin           3904 Jan  1  1970 lib/grub/i386-pc/lzma_decompress.image
-r--r--r--  1 root     bin      134480024 Jan  1  1970 lib/grub/i386-pc/lzma_decompress.img

It should not be 128MB, right? :)

I uploaded whole build log here: http://devio.us/~jirib/grub.txt (2.3MB)

Quoted 7 lines

Review

Quoted 4 lines
(quoted diff) +1 -1
-find . -iname '*.[ch]' ! -ipath './grub-core/lib/libgcrypt-grub/*' ! -ipath './build-aux/*' ! -ipath './grub-core/lib/libgcrypt/src/misc.c' ! -ipath './grub-core/lib/libgcrypt/src/global.c' ! -ipath './grub-core/lib/libgcrypt/src/secmem.c'  ! -ipath './util/grub-gen-widthspec.c' ! -ipath './util/grub-gen-asciih.c' |sort > po/POTFILES.in
+find . -iname '*.[ch]' ! -path './grub-core/lib/libgcrypt-grub/*' ! -path './build-aux/*' ! -path './grub-core/lib/libgcrypt/src/misc.c' ! -path './grub-core/lib/libgcrypt/src/global.c' ! -path './grub-core/lib/libgcrypt/src/secmem.c'  ! -path './util/grub-gen-widthspec.c' ! -path './util/grub-gen-asciih.c' |sort > po/POTFILES.in
 find util -iname '*.in' ! -name Makefile.in  |sort > po/POTFILES-shell.in

Hmm ... we support building on Windows which is case insensitive. What are other options to compare full path name case insenstive?

I can live with patching it. OpenBSD find doesn't have 'ipath' and IIUC it's not POSIX requiremement, so I doubt it will be implemented.

Quoted 8 lines
Quoted 5 lines

Another thing - 'INSTALL' file says >= autoconf 2.60 is needed but it is >= 2.62 otherwise there is:

"error: possibly undefined macro: AS_ECHO"

Indeed. According to git log, AS_ECHO appeared first in 2.61a. What version you have?

IIUC it was firstly available in "normal" autoconf release in 2.62.

Quoted 8 lines
Quoted 5 lines

IIRC there's also a difference between NetBSD and OpenBSD regarding to disks. NetBSD uses eg. /dev/rwd0c for NetBSD part, /dev/rwd0d for whole disk, OpenBSD uses 'c' for whole disk and 'd' has no special reason.

If I understand it correctly, getrawpartition() is supposed to handle it (i.e. return entire disk partition number). What exactly does not work?

The above comment was just comment. Not sure if there's real issue in grub code based on those NetBSD/OpenBSD differences.

j.

#3 lore raw

12.03.2016 22:54, Jiri B пишет:

Quoted 2 lines · Andrei Borzenkov
Quoted 1 line
Quoted 1 line

cc -Wall -W -Wshadow -Wpointer-arith -Wundef -Wchar-subscripts -Wcomment -Wdeprecated-declarations -Wdisabled-optimization -Wdiv-by-zero -Wfloat-equal -Wformat-extra-args -Wformat-security -Wformat-y2k -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Wmain -Wmissing-braces -Wmissing-format-attribute -Wmultichar -Wparentheses -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -Wswitch -Wtrigraphs -Wunknown-pragmas -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable -Wwrite-strings -Wnested-externs -Wstrict-prototypes -Wcast-align -Wextra -Wattributes -Wendif-labels -Winit-self -Wint-to-pointer-cast -Winvalid-pch -Wmissing-field-initializers -Wnonnull -Woverflow -Wvla -Wpointer-to-int-cast -Wstrict-aliasing -Wvariadic-macros -Wvolatile-register-var -Wpointer-sign -Wmissing-include-dirs -Wmissing-prototypes -Wmissing-declarations -Wformat=2 -Wno-undef -Wno-sign-compare -Wno-unused -Wno-unused-parameter -Wno-redundant-decls -Wn

o

Quoted 24 lines
Quoted 24 lines

-
unreachable-code -Wno-conversion -O2 -pipe -o grub-macbless util/grub_macbless-grub-macbless.o grub-core/osdep/grub_macbless-init.o grub-core/kern/emu/grub_macbless-argp_common.o libgrubmods.a libgrubgcry.a libgrubkern.a grub-core/gnulib/libgnu.a /usr/local/lib/libintl.so.6.0 -L/usr/local/lib /usr/local/lib/libiconv.so.6.0 -lc -Wl,-rpath,/usr/local/lib

Quoted 7 lines

libgrubkern.a(libgrubkern_a-hostdisk.o): In function `read_device_map':
hostdisk.c:(.text+0x7ab): warning: warning: strcpy() is almost always misused, please use strlcpy() libgrubkern.a(libgrubkern_a-misc.o): In function `grub_util_get_path':
misc.c:(.text+0x12a): warning: warning: sprintf() is often misused, please use snprintf() libgrubkern.a(libgrubkern_a-getroot.o): In function `grub_util_part_to_disk':
getroot.c:(.text+0x2b): undefined reference to `getrawpartition'

Does attached patch help?

Makefile.util.def +1 -1
index ed9b4c6..f9caccb 100644
@@ -416,7 +416,7 @@ program = {
   ldadd = libgrubgcry.a;
   ldadd = libgrubkern.a;
   ldadd = grub-core/gnulib/libgnu.a;
-  ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
+  ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
 };
 
Quoted 4 lines

Makefile.util.def program = { · line 422

Quoted 1 line
Makefile.util.def +0 -0
 data = {

Thank you, your diff makes compilation pass.

Good, pushed. Thanks for testing.

Quoted 8 lines

Well, I see something went wrong now with compressing a file:

$ tar tzvf /home/jirib/openbsd/packages/amd64/all/grub-2.02-beta3.tgz | grep lzma_decompress
(quoted diff) +0 -2
-r-xr-xr-x  1 root     bin           3904 Jan  1  1970 lib/grub/i386-pc/lzma_decompress.image
-r--r--r--  1 root     bin      134480024 Jan  1  1970 lib/grub/i386-pc/lzma_decompress.img

It should not be 128MB, right? :)

No. Something went wrong with section addresses/offsets. Please test 2.02~beta2 - do you observe the same problem? Please upload lzma_decompress.image. Where obcopy comes from (obcopy --version)? What assembler is used?

Quoted 10 lines

I uploaded whole build log here: http://devio.us/~jirib/grub.txt (2.3MB)

Quoted 7 lines

Review

Quoted 4 lines
(quoted diff) +1 -1
-find . -iname '*.[ch]' ! -ipath './grub-core/lib/libgcrypt-grub/*' ! -ipath './build-aux/*' ! -ipath './grub-core/lib/libgcrypt/src/misc.c' ! -ipath './grub-core/lib/libgcrypt/src/global.c' ! -ipath './grub-core/lib/libgcrypt/src/secmem.c'  ! -ipath './util/grub-gen-widthspec.c' ! -ipath './util/grub-gen-asciih.c' |sort > po/POTFILES.in
+find . -iname '*.[ch]' ! -path './grub-core/lib/libgcrypt-grub/*' ! -path './build-aux/*' ! -path './grub-core/lib/libgcrypt/src/misc.c' ! -path './grub-core/lib/libgcrypt/src/global.c' ! -path './grub-core/lib/libgcrypt/src/secmem.c'  ! -path './util/grub-gen-widthspec.c' ! -path './util/grub-gen-asciih.c' |sort > po/POTFILES.in
 find util -iname '*.in' ! -name Makefile.in  |sort > po/POTFILES-shell.in

Hmm ... we support building on Windows which is case insensitive. What are other options to compare full path name case insenstive?

Quoted 3 lines

I can live with patching it. OpenBSD find doesn't have 'ipath' and IIUC it's not POSIX requiremement, so I doubt it will be implemented.

Why did you need it initially? Normally it is needed only when building from GIT; tarball comes with generated files.

Quoted 11 lines
Quoted 8 lines
Quoted 5 lines

Another thing - 'INSTALL' file says >= autoconf 2.60 is needed but it is >= 2.62 otherwise there is:

"error: possibly undefined macro: AS_ECHO"

Indeed. According to git log, AS_ECHO appeared first in 2.61a. What version you have?

IIUC it was firstly available in "normal" autoconf release in 2.62.

This does not answer my question - what autoconf version your system ships with (i.e. - do we need to change configure.ac or simply update INSTALL)?

Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

IIRC there's also a difference between NetBSD and OpenBSD regarding to disks. NetBSD uses eg. /dev/rwd0c for NetBSD part, /dev/rwd0d for whole disk, OpenBSD uses 'c' for whole disk and 'd' has no special reason.

Quoted 6 lines
Quoted 2 lines

If I understand it correctly, getrawpartition() is supposed to handle it (i.e. return entire disk partition number). What exactly does not work?

The above comment was just comment. Not sure if there's real issue in grub code based on those NetBSD/OpenBSD differences.

OK, please test after lzma_decompress issue is solved and report problems.

#4 lore raw
Quoted 6 lines · Andrei Borzenkov
Quoted 6 lines

Well, I see something went wrong now with compressing a file:

$ tar tzvf /home/jirib/openbsd/packages/amd64/all/grub-2.02-beta3.tgz | grep lzma_decompress
(quoted diff) +0 -2
-r-xr-xr-x  1 root     bin           3904 Jan  1  1970 lib/grub/i386-pc/lzma_decompress.image
-r--r--r--  1 root     bin      134480024 Jan  1  1970 lib/grub/i386-pc/lzma_decompress.img
Quoted 7 lines
Quoted 2 lines

It should not be 128MB, right? :)

No. Something went wrong with section addresses/offsets. Please test 2.02~beta2 - do you observe the same problem? Please upload lzma_decompress.image. Where obcopy comes from (obcopy --version)? What assembler is used?

$ objcopy -V
GNU objcopy 2.17
Copyright 2005 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License.  This program has absolutely no warranty.

OpenBSD uses binutils-2.17 and it's not possible to update it just like that, it's part of OS.

The file is available here: http://afterboot.cz/pub/lzma_decompress.img

Quoted 10 lines
Quoted 10 lines

I uploaded whole build log here: http://devio.us/~jirib/grub.txt (2.3MB)

Quoted 7 lines

Review

Quoted 4 lines
(quoted diff) +1 -1
-find . -iname '*.[ch]' ! -ipath './grub-core/lib/libgcrypt-grub/*' ! -ipath './build-aux/*' ! -ipath './grub-core/lib/libgcrypt/src/misc.c' ! -ipath './grub-core/lib/libgcrypt/src/global.c' ! -ipath './grub-core/lib/libgcrypt/src/secmem.c'  ! -ipath './util/grub-gen-widthspec.c' ! -ipath './util/grub-gen-asciih.c' |sort > po/POTFILES.in
+find . -iname '*.[ch]' ! -path './grub-core/lib/libgcrypt-grub/*' ! -path './build-aux/*' ! -path './grub-core/lib/libgcrypt/src/misc.c' ! -path './grub-core/lib/libgcrypt/src/global.c' ! -path './grub-core/lib/libgcrypt/src/secmem.c'  ! -path './util/grub-gen-widthspec.c' ! -path './util/grub-gen-asciih.c' |sort > po/POTFILES.in
 find util -iname '*.in' ! -name Makefile.in  |sort > po/POTFILES-shell.in

Hmm ... we support building on Windows which is case insensitive. What are other options to compare full path name case insenstive?

Quoted 6 lines
Quoted 3 lines

I can live with patching it. OpenBSD find doesn't have 'ipath' and IIUC it's not POSIX requiremement, so I doubt it will be implemented.

Why did you need it initially? Normally it is needed only when building from GIT; tarball comes with generated files.

I built from git snapshot, I haven't seen any tarball for beta3.

Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Quoted 5 lines

Another thing - 'INSTALL' file says >= autoconf 2.60 is needed but it is >= 2.62 otherwise there is:

"error: possibly undefined macro: AS_ECHO"

Indeed. According to git log, AS_ECHO appeared first in 2.61a. What version you have?

Quoted 6 lines
Quoted 2 lines

IIUC it was firstly available in "normal" autoconf release in 2.62.

This does not answer my question - what autoconf version your system ships with (i.e. - do we need to change configure.ac or simply update INSTALL)?

IMO it would be ok to update INSTALL file. I had following autoconf versions:

autoconf-2.13p3
autoconf-2.52p5
autoconf-2.59p4
autoconf-2.60p4
autoconf-2.61p4
autoconf-2.62p1
autoconf-2.63p0
autoconf-2.65p0
autoconf-2.67p0
autoconf-2.68p0
autoconf-2.69p1

Thanks for help.

j.

#5 lore raw

14.03.2016 21:19, Jiri B пишет:

Quoted 7 lines · Andrei Borzenkov
Quoted 6 lines
Quoted 6 lines

Well, I see something went wrong now with compressing a file:

$ tar tzvf /home/jirib/openbsd/packages/amd64/all/grub-2.02-beta3.tgz | grep lzma_decompress
(quoted diff) +0 -2
-r-xr-xr-x  1 root     bin           3904 Jan  1  1970 lib/grub/i386-pc/lzma_decompress.image
-r--r--r--  1 root     bin      134480024 Jan  1  1970 lib/grub/i386-pc/lzma_decompress.img
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines

It should not be 128MB, right? :)

No. Something went wrong with section addresses/offsets. Please test 2.02~beta2 - do you observe the same problem? Please upload

Did you test beta2?

Quoted 9 lines
Quoted 2 lines

lzma_decompress.image. Where obcopy comes from (obcopy --version)? What assembler is used?

$ objcopy -V
GNU objcopy 2.17
Copyright 2005 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License.  This program has absolutely no warranty.
Quoted 5 lines

OpenBSD uses binutils-2.17 and it's not possible to update it just like that, it's part of OS.

The file is available here: http://afterboot.cz/pub/lzma_decompress.img

I asked lzma_decompress.image, not img. img is too late.

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

I uploaded whole build log here: http://devio.us/~jirib/grub.txt (2.3MB)

Quoted 7 lines

Review

Quoted 4 lines
(quoted diff) +1 -1
-find . -iname '*.[ch]' ! -ipath './grub-core/lib/libgcrypt-grub/*' ! -ipath './build-aux/*' ! -ipath './grub-core/lib/libgcrypt/src/misc.c' ! -ipath './grub-core/lib/libgcrypt/src/global.c' ! -ipath './grub-core/lib/libgcrypt/src/secmem.c'  ! -ipath './util/grub-gen-widthspec.c' ! -ipath './util/grub-gen-asciih.c' |sort > po/POTFILES.in
+find . -iname '*.[ch]' ! -path './grub-core/lib/libgcrypt-grub/*' ! -path './build-aux/*' ! -path './grub-core/lib/libgcrypt/src/misc.c' ! -path './grub-core/lib/libgcrypt/src/global.c' ! -path './grub-core/lib/libgcrypt/src/secmem.c'  ! -path './util/grub-gen-widthspec.c' ! -path './util/grub-gen-asciih.c' |sort > po/POTFILES.in
 find util -iname '*.in' ! -name Makefile.in  |sort > po/POTFILES-shell.in

Hmm ... we support building on Windows which is case insensitive. What are other options to compare full path name case insenstive?

Quoted 9 lines
Quoted 6 lines
Quoted 3 lines

I can live with patching it. OpenBSD find doesn't have 'ipath' and IIUC it's not POSIX requiremement, so I doubt it will be implemented.

Why did you need it initially? Normally it is needed only when building from GIT; tarball comes with generated files.

I built from git snapshot, I haven't seen any tarball for beta3.

They are available on http://alpha.gnu.org/gnu/grub/.

#6 lore raw
Quoted 8 lines · Andrei Borzenkov
Quoted 6 lines
Quoted 6 lines

Review

Quoted 3 lines
$ tar tzvf /home/jirib/openbsd/packages/amd64/all/grub-2.02-beta3.tgz | grep lzma_decompress
(quoted diff) +0 -2
-r-xr-xr-x  1 root     bin           3904 Jan  1  1970 lib/grub/i386-pc/lzma_decompress.image
-r--r--r--  1 root     bin      134480024 Jan  1  1970 lib/grub/i386-pc/lzma_decompress.img

[...]
No. Something went wrong with section addresses/offsets. Please test 2.02~beta2 - do you observe the same problem? Please upload

Did you test beta2?

Hi, sorry for delay. Yes I tried beta2, same result.

Quoted 11 lines
Quoted 9 lines
Quoted 2 lines

lzma_decompress.image. Where obcopy comes from (obcopy --version)? What assembler is used?

$ objcopy -V
GNU objcopy 2.17
Copyright 2005 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License.  This program has absolutely no warranty.
[...]

I asked lzma_decompress.image, not img. img is too late.

I apologize, I missed valid filename. So here as lzma_decompress.image from beta3 (as beta2 got same huge img file).

http://afterboot.cz/pub/lzma_decompress.image
SHA256 (lzma_decompress.image) = 3968a35c3fc2570cf1a888179433f23a7319d104c8622c71e501f4ba6ca38308

Thank you for help.

j.

#7 lore raw

17.03.2016 13:12, Jiri B пишет:

Quoted 22 lines · Andrei Borzenkov
Quoted 8 lines
Quoted 6 lines
Quoted 6 lines

Review

Quoted 3 lines
$ tar tzvf /home/jirib/openbsd/packages/amd64/all/grub-2.02-beta3.tgz | grep lzma_decompress
(quoted diff) +0 -2
-r-xr-xr-x  1 root     bin           3904 Jan  1  1970 lib/grub/i386-pc/lzma_decompress.image
-r--r--r--  1 root     bin      134480024 Jan  1  1970 lib/grub/i386-pc/lzma_decompress.img

[...]
No. Something went wrong with section addresses/offsets. Please test 2.02~beta2 - do you observe the same problem? Please upload

Did you test beta2?

Hi, sorry for delay. Yes I tried beta2, same result.

Quoted 10 lines
Quoted 9 lines
Quoted 2 lines

lzma_decompress.image. Where obcopy comes from (obcopy --version)? What assembler is used?

$ objcopy -V
GNU objcopy 2.17
Copyright 2005 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License.  This program has absolutely no warranty.
[...]
Quoted 8 lines
Quoted 1 line

I asked lzma_decompress.image, not img. img is too late.

I apologize, I missed valid filename. So here as lzma_decompress.image from beta3 (as beta2 got same huge img file).

http://afterboot.cz/pub/lzma_decompress.image
SHA256 (lzma_decompress.image) = 3968a35c3fc2570cf1a888179433f23a7319d104c8622c71e501f4ba6ca38308

Well, your compiler managed to create shared library instead of executable file:

bor@bor-Latitude-E5450:~$ LANG=C objdump -f Загрузки/lzma_decompress.image

Загрузки/lzma_decompress.image: file format elf32-i386
architecture: i386, flags 0x00000050:
HAS_SYMS, DYNAMIC
start address 0x00008200

I get the same if I explicitly add -shared to linker flags.

Could you test with

./configure TARGET_LDFLAGS=-static

#8 lore raw

The real problem is .hash section. We need to strip it

Quoted 62 lines · Andrei Borzenkov

17.03.2016 13:12, Jiri B пишет:

Quoted 2 lines · Andrei Borzenkov
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
$ tar tzvf

/home/jirib/openbsd/packages/amd64/all/grub-2.02-beta3.tgz | grep lzma_decompress

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

-r-xr-xr-x 1 root bin 3904 Jan 1 1970

lib/grub/i386-pc/lzma_decompress.image

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

-r--r--r-- 1 root bin 134480024 Jan 1 1970

lib/grub/i386-pc/lzma_decompress.img

Quoted 9 lines
Quoted 5 lines
Quoted 3 lines
Quoted 3 lines

[...]
No. Something went wrong with section addresses/offsets. Please test 2.02~beta2 - do you observe the same problem? Please upload

Did you test beta2?

Hi, sorry for delay. Yes I tried beta2, same result.

Quoted 1 line
Quoted 1 line
Quoted 1 line

lzma_decompress.image. Where obcopy comes from (obcopy --version)?

What

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 1 line

assembler is used?

$ objcopy -V
GNU objcopy 2.17
Copyright 2005 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms

of

Quoted 1 line
Quoted 1 line
Quoted 1 line

the GNU General Public License. This program has absolutely no

warranty.

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

[...]

I asked lzma_decompress.image, not img. img is too late.

I apologize, I missed valid filename. So here as lzma_decompress.image

from beta3

Quoted 4 lines

(as beta2 got same huge img file).

http://afterboot.cz/pub/lzma_decompress.image
SHA256 (lzma_decompress.image) =

3968a35c3fc2570cf1a888179433f23a7319d104c8622c71e501f4ba6ca38308

Quoted 1 line

Well, your compiler managed to create shared library instead of executable file:

bor@bor-Latitude-E5450:~$ LANG=C objdump -f Загрузки/lzma_decompress.image

Загрузки/lzma_decompress.image: file format elf32-i386
architecture: i386, flags 0x00000050:
HAS_SYMS, DYNAMIC
start address 0x00008200

I get the same if I explicitly add -shared to linker flags.

Could you test with

./configure TARGET_LDFLAGS=-static

_______________________________________________
Bug-grub mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-grub

#9 lore raw

17.03.2016 19:04, Vladimir 'phcoder' Serbinenko пишет:

Quoted 2 lines

The real problem is .hash section. We need to strip it

I tried it, it does not change anything.

bor@bor-Latitude-E5450:~/build/grub$ objcopy  -O binary
--strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R
.MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R
.ARM.exidx -R .hash ~/Загрузки/lzma_decompress.image /tmp/x.img
bor@bor-Latitude-E5450:~/build/grub$ LC_ALL=C ll /tmp/x.img
-rw-rw-r-- 1 bor bor 134480024 Mar 17 19:06 /tmp/x.img
Quoted 65 lines · Andrei Borzenkov
Quoted 63 lines

17.03.2016 13:12, Jiri B пишет:

Quoted 2 lines · Andrei Borzenkov
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
$ tar tzvf

/home/jirib/openbsd/packages/amd64/all/grub-2.02-beta3.tgz | grep lzma_decompress

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

-r-xr-xr-x 1 root bin 3904 Jan 1 1970

lib/grub/i386-pc/lzma_decompress.image

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

-r--r--r-- 1 root bin 134480024 Jan 1 1970

lib/grub/i386-pc/lzma_decompress.img

Quoted 9 lines
Quoted 5 lines
Quoted 3 lines
Quoted 3 lines

[...]
No. Something went wrong with section addresses/offsets. Please test 2.02~beta2 - do you observe the same problem? Please upload

Did you test beta2?

Hi, sorry for delay. Yes I tried beta2, same result.

Quoted 1 line
Quoted 1 line
Quoted 1 line

lzma_decompress.image. Where obcopy comes from (obcopy --version)?

What

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 1 line

assembler is used?

$ objcopy -V
GNU objcopy 2.17
Copyright 2005 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms

of

Quoted 1 line
Quoted 1 line
Quoted 1 line

the GNU General Public License. This program has absolutely no

warranty.

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

[...]

I asked lzma_decompress.image, not img. img is too late.

I apologize, I missed valid filename. So here as lzma_decompress.image

from beta3

Quoted 4 lines

(as beta2 got same huge img file).

http://afterboot.cz/pub/lzma_decompress.image
SHA256 (lzma_decompress.image) =

3968a35c3fc2570cf1a888179433f23a7319d104c8622c71e501f4ba6ca38308

Quoted 1 line

Well, your compiler managed to create shared library instead of executable file:

bor@bor-Latitude-E5450:~$ LANG=C objdump -f Загрузки/lzma_decompress.image

Загрузки/lzma_decompress.image: file format elf32-i386
architecture: i386, flags 0x00000050:
HAS_SYMS, DYNAMIC
start address 0x00008200

I get the same if I explicitly add -shared to linker flags.

Could you test with

./configure TARGET_LDFLAGS=-static

_______________________________________________
Bug-grub mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-grub

#10 lore raw
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

[...]
Well, your compiler managed to create shared library instead of executable file:

bor@bor-Latitude-E5450:~$ LANG=C objdump -f Загрузки/lzma_decompress.image

Загрузки/lzma_decompress.image: file format elf32-i386
architecture: i386, flags 0x00000050:
HAS_SYMS, DYNAMIC
start address 0x00008200

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

I get the same if I explicitly add -shared to linker flags.

Could you test with

./configure TARGET_LDFLAGS=-static

TARGET_LDFLAGS=-static caused no difference. But... While being a little bit desperate I had a look at grub 0.9.x in OpenBSD ports and there was

CFLAGS=-ftrampolines -fno-stack-protector -fno-pie -nopie

So I gave it a try and it seems better (?)

$ ls -l /home/jirib/openbsd/pobj/grub-2.02-beta3/fake-amd64/usr/local/lib/grub/i386-pc/lzma_decompress.im*
-rwxr-xr-x  1 jirib  wheel  3068 Mar 17 21:45 /home/jirib/openbsd/pobj/grub-2.02-beta3/fake-amd64/usr/local/lib/grub/i386-pc/lzma_decompress.image*
-rw-r--r--  1 jirib  wheel  2832 Mar 17 21:45 /home/jirib/openbsd/pobj/grub-2.02-beta3/fake-amd64/usr/local/lib/grub/i386-pc/lzma_decompress.img
$ objdump -f /home/jirib/openbsd/pobj/grub-2.02-beta3/fake-amd64/usr/local/lib/grub/i386-pc/lzma_decompress.image

/home/jirib/openbsd/pobj/grub-2.02-beta3/fake-amd64/usr/local/lib/grub/i386-pc/lzma_decompress.image: file format elf32-i386
architecture: i386, flags 0x00000002:
EXEC_P
start address 0x00008200

It is OK?

grub 0.9.x in OpenBSD ports is for i386 arch only (not for 64bit one). I have no idea why, I'll ask on ports@ list some OpenBSD porters.

j.

#11 lore raw

17.03.2016 23:56, Jiri B пишет:

Quoted 29 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

[...]
Well, your compiler managed to create shared library instead of executable file:

bor@bor-Latitude-E5450:~$ LANG=C objdump -f Загрузки/lzma_decompress.image

Загрузки/lzma_decompress.image: file format elf32-i386
architecture: i386, flags 0x00000050:
HAS_SYMS, DYNAMIC
start address 0x00008200

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

I get the same if I explicitly add -shared to linker flags.

Could you test with

./configure TARGET_LDFLAGS=-static

TARGET_LDFLAGS=-static caused no difference. But... While being a little bit desperate I had a look at grub 0.9.x in OpenBSD ports and there was

CFLAGS=-ftrampolines -fno-stack-protector -fno-pie -nopie

So I gave it a try and it seems better (?)

$ ls -l /home/jirib/openbsd/pobj/grub-2.02-beta3/fake-amd64/usr/local/lib/grub/i386-pc/lzma_decompress.im*
(quoted diff) +0 -2
-rwxr-xr-x  1 jirib  wheel  3068 Mar 17 21:45 /home/jirib/openbsd/pobj/grub-2.02-beta3/fake-amd64/usr/local/lib/grub/i386-pc/lzma_decompress.image*
-rw-r--r--  1 jirib  wheel  2832 Mar 17 21:45 /home/jirib/openbsd/pobj/grub-2.02-beta3/fake-amd64/usr/local/lib/grub/i386-pc/lzma_decompress.img
Quoted 9 lines
$ objdump -f /home/jirib/openbsd/pobj/grub-2.02-beta3/fake-amd64/usr/local/lib/grub/i386-pc/lzma_decompress.image

/home/jirib/openbsd/pobj/grub-2.02-beta3/fake-amd64/usr/local/lib/grub/i386-pc/lzma_decompress.image: file format elf32-i386
architecture: i386, flags 0x00000002:
EXEC_P
start address 0x00008200

It is OK?

It certainly looks better than before. Does it actually work?

We aready use -fno-PIE, looks like we need to explicitly check for -fno-pie as well.

Quoted 5 lines

grub 0.9.x in OpenBSD ports is for i386 arch only (not for 64bit one). I have no idea why, I'll ask on ports@ list some OpenBSD porters.

j.

#12 lore raw
Quoted 16 lines · Andrei Borzenkov
Quoted 16 lines

[...]
CFLAGS=-ftrampolines -fno-stack-protector -fno-pie -nopie

So I gave it a try and it seems better (?)

$ ls -l /home/jirib/openbsd/pobj/grub-2.02-beta3/fake-amd64/usr/local/lib/grub/i386-pc/lzma_decompress.im*
(quoted diff) +0 -2
-rwxr-xr-x  1 jirib  wheel  3068 Mar 17 21:45 /home/jirib/openbsd/pobj/grub-2.02-beta3/fake-amd64/usr/local/lib/grub/i386-pc/lzma_decompress.image*
-rw-r--r--  1 jirib  wheel  2832 Mar 17 21:45 /home/jirib/openbsd/pobj/grub-2.02-beta3/fake-amd64/usr/local/lib/grub/i386-pc/lzma_decompress.img
$ objdump -f /home/jirib/openbsd/pobj/grub-2.02-beta3/fake-amd64/usr/local/lib/grub/i386-pc/lzma_decompress.image

/home/jirib/openbsd/pobj/grub-2.02-beta3/fake-amd64/usr/local/lib/grub/i386-pc/lzma_decompress.image: file format elf32-i386
architecture: i386, flags 0x00000002:
EXEC_P
start address 0x00008200

Quoted 7 lines
Quoted 2 lines

It is OK?

It certainly looks better than before. Does it actually work?

We aready use -fno-PIE, looks like we need to explicitly check for -fno-pie as well.

I just booted OpenBSD from "native OpenBSD" grub2:

grub-install /dev/rwd0c # used qemu for testing
XX_xxxx files put into /etc/grub.d
cat >> /etc/grub.d/40_custom << EOF

menuentry "OpenBSD" {
    set root=(hd0,4)
    chainloader +1
}

EOF
grub-mkconfig -o /grub/grub.cfg

Thank you, I'm going to proceed with pxechainloader.

j.

#13 lore raw

18.03.2016 16:01, Jiri B пишет:

Quoted 22 lines · Andrei Borzenkov
Quoted 21 lines
Quoted 9 lines

[...]
CFLAGS=-ftrampolines -fno-stack-protector -fno-pie -nopie

So I gave it a try and it seems better (?)

$ ls -l /home/jirib/openbsd/pobj/grub-2.02-beta3/fake-amd64/usr/local/lib/grub/i386-pc/lzma_decompress.im*
(quoted diff) +0 -2
-rwxr-xr-x  1 jirib  wheel  3068 Mar 17 21:45 /home/jirib/openbsd/pobj/grub-2.02-beta3/fake-amd64/usr/local/lib/grub/i386-pc/lzma_decompress.image*
-rw-r--r--  1 jirib  wheel  2832 Mar 17 21:45 /home/jirib/openbsd/pobj/grub-2.02-beta3/fake-amd64/usr/local/lib/grub/i386-pc/lzma_decompress.img
Quoted 9 lines
$ objdump -f /home/jirib/openbsd/pobj/grub-2.02-beta3/fake-amd64/usr/local/lib/grub/i386-pc/lzma_decompress.image

/home/jirib/openbsd/pobj/grub-2.02-beta3/fake-amd64/usr/local/lib/grub/i386-pc/lzma_decompress.image: file format elf32-i386
architecture: i386, flags 0x00000002:
EXEC_P
start address 0x00008200

It is OK?

It certainly looks better than before. Does it actually work?

Quoted 5 lines
Quoted 2 lines

We aready use -fno-PIE, looks like we need to explicitly check for -fno-pie as well.

I just booted OpenBSD from "native OpenBSD" grub2:

Good. Please test attached patch.

@Vladimir: I was unsure whether to add explicit -fpie test, but at the end I do not see what it buys us. Both options have been introduced at the same time and we want neither enabled. Current test covers both.

Is it OK to commit?

From: Andrei Borzenkov <[email protected]>
Subject: [PATCH] configure: set -fno-pie together with -fno-PIE

OpenBSD 5.9 apparently defaults to -fpie. We use -fno-PIE when appropriate already, but that is not enough - it does not turn off -fpie.

Actually check for -fPIE is not precise enough. __PIE__ is set for both -fpie and -fPIE but with different values. As far as I can tell, both options were introduced at the same time, so both should always be supported.

This fixes compilation on OpenBSD 5.9 which otherwise created insanely big lzma_decompress.img.

Reported, suggested and tested by: Jiri B <[email protected]>

---
 configure.ac | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
configure.ac +2 -2
index a85b134..57e1713 100644
@@ -1185,9 +1185,9 @@ CFLAGS="$TARGET_CFLAGS"
 # Position independent executable.
 grub_CHECK_PIE
 [# Need that, because some distributions ship compilers that include
-# `-fPIE' in the default specs.
+# `-fPIE' or '-fpie' in the default specs.
 if [ x"$pie_possible" = xyes ]; then
-  TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIE"
+  TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIE -fno-pie"
 fi]
 
 CFLAGS="$TARGET_CFLAGS"
Signature · 1 line
tg: (76eac44..) u/fno-pie (depends on: master)
#14 lore raw

If it solves the problem, go ahead

Quoted 44 lines · Andrei Borzenkov

18.03.2016 16:01, Jiri B пишет:

Quoted 7 lines · Andrei Borzenkov
Quoted 6 lines
Quoted 6 lines

[...]
CFLAGS=-ftrampolines -fno-stack-protector -fno-pie -nopie

So I gave it a try and it seems better (?)

$ ls -l

/home/jirib/openbsd/pobj/grub-2.02-beta3/fake-amd64/usr/local/lib/grub/i386-pc/ lzma_decompress.im*

Quoted 1 line
Quoted 1 line
Quoted 1 line

-rwxr-xr-x 1 jirib wheel 3068 Mar 17 21:45

/home/jirib/openbsd/pobj/grub-2.02-beta3/fake-amd64/usr/local/lib/grub/i386-pc/lzma_decompress.image*

Quoted 1 line
Quoted 1 line
Quoted 1 line

-rw-r--r-- 1 jirib wheel 2832 Mar 17 21:45

/home/jirib/openbsd/pobj/grub-2.02-beta3/fake-amd64/usr/local/lib/grub/i386-pc/lzma_decompress.img

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
$ objdump -f

/home/jirib/openbsd/pobj/grub-2.02-beta3/fake-amd64/usr/local/lib/grub/i386-pc/lzma_decompress.image

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

/home/jirib/openbsd/pobj/grub-2.02-beta3/fake-amd64/usr/local/lib/grub/i386-pc/lzma_decompress.image:

   file format elf32-i386
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines

architecture: i386, flags 0x00000002:
EXEC_P
start address 0x00008200

It is OK?

Quoted 7 lines
Quoted 4 lines

It certainly looks better than before. Does it actually work?

We aready use -fno-PIE, looks like we need to explicitly check for -fno-pie as well.

I just booted OpenBSD from "native OpenBSD" grub2:

Good. Please test attached patch.

@Vladimir: I was unsure whether to add explicit -fpie test, but at the end I do not see what it buys us. Both options have been introduced at the same time and we want neither enabled. Current test covers both.

Is it OK to commit?

#15 lore raw
In reply to Andrei Borzenkov
Quoted 20 lines
Quoted 9 lines
Quoted 9 lines

Review

Quoted 9 lines

[...]
CFLAGS=-ftrampolines -fno-stack-protector -fno-pie -nopie

$ ls -l /home/jirib/openbsd/pobj/grub-2.02-beta3/fake-amd64/usr/local/lib/grub/i386-pc/lzma_decompress.im*
(quoted diff) +0 -2
-rwxr-xr-x  1 jirib  wheel  3068 Mar 17 21:45 /home/jirib/openbsd/pobj/grub-2.02-beta3/fake-amd64/usr/local/lib/grub/i386-pc/lzma_decompress.image*
-rw-r--r--  1 jirib  wheel  2832 Mar 17 21:45 /home/jirib/openbsd/pobj/grub-2.02-beta3/fake-amd64/usr/local/lib/grub/i386-pc/lzma_decompress.img
 
[...]

Good. Please test attached patch.

[...]

configure.ac +0 -0
index a85b134..57e1713 100644
@@ -1185,9 +1185,9 @@ CFLAGS="$TARGET_CFLAGS"
 # Position independent executable.

configure.ac CFLAGS="$TARGET_CFLAGS" · line 1193

Quoted 10 lines
configure.ac +2 -2
 grub_CHECK_PIE
 [# Need that, because some distributions ship compilers that include
-# `-fPIE' in the default specs.
+# `-fPIE' or '-fpie' in the default specs.
 if [ x"$pie_possible" = xyes ]; then
-  TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIE"
+  TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIE -fno-pie"
 fi]
 
 CFLAGS="$TARGET_CFLAGS"

Thx, builds find on OpenBSD.

j.

#16 lore raw

22.03.2016 13:31, Jiri B пишет:

Quoted 29 lines
Quoted 29 lines
Quoted 9 lines
Quoted 9 lines

Review

Quoted 9 lines

[...]
CFLAGS=-ftrampolines -fno-stack-protector -fno-pie -nopie

$ ls -l /home/jirib/openbsd/pobj/grub-2.02-beta3/fake-amd64/usr/local/lib/grub/i386-pc/lzma_decompress.im*
(quoted diff) +0 -2
-rwxr-xr-x  1 jirib  wheel  3068 Mar 17 21:45 /home/jirib/openbsd/pobj/grub-2.02-beta3/fake-amd64/usr/local/lib/grub/i386-pc/lzma_decompress.image*
-rw-r--r--  1 jirib  wheel  2832 Mar 17 21:45 /home/jirib/openbsd/pobj/grub-2.02-beta3/fake-amd64/usr/local/lib/grub/i386-pc/lzma_decompress.img
 
[...]

Good. Please test attached patch.

[...]

configure.ac +2 -2
index a85b134..57e1713 100644
@@ -1185,9 +1185,9 @@ CFLAGS="$TARGET_CFLAGS"
 # Position independent executable.
 grub_CHECK_PIE
 [# Need that, because some distributions ship compilers that include
-# `-fPIE' in the default specs.
+# `-fPIE' or '-fpie' in the default specs.
 if [ x"$pie_possible" = xyes ]; then
-  TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIE"
+  TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIE -fno-pie"
 fi]
 
Quoted 4 lines

configure.ac CFLAGS="$TARGET_CFLAGS" · line 1193

Quoted 1 line
configure.ac +0 -0
 CFLAGS="$TARGET_CFLAGS"

Thx, builds find on OpenBSD.

OK, so we are left with -ipath. One possibility is something like attached patch; another - to replace ipath with -path | grep -v. Latter is probably more readable.

From: Andrei Borzenkov <[email protected]>
Subject: [PATCH] autogen.sh: avoid non-portable -ipath and -iname

OpenBSD 5.9 find does not have ipath, although it supports iname. For consistency, also replace iname with suitable pattern.

Reported By: Jiri B <[email protected]>

---
 autogen.sh | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
autogen.sh +3 -2
index 7537561..cd254d8 100755
@@ -8,8 +8,9 @@ set -e
 export LC_COLLATE=C
 unset LC_ALL
 
-find . -iname '*.[ch]' ! -ipath './grub-core/lib/libgcrypt-grub/*' ! -ipath './build-aux/*' ! -ipath './grub-core/lib/libgcrypt/src/misc.c' ! -ipath './grub-core/lib/libgcrypt/src/global.c' ! -ipath './grub-core/lib/libgcrypt/src/secmem.c'  ! -ipath './util/grub-gen-widthspec.c' ! -ipath './util/grub-gen-asciih.c' |sort > po/POTFILES.in
-find util -iname '*.in' ! -name Makefile.in  |sort > po/POTFILES-shell.in
+# This avoids non-portable -iname and -ipath
+find . -name '*.[cC][hH]' ! -path './[gG][rR][uU][bB]-[cC][oO][rR][eE]/[lL][iI][bB]/[lL][iI][bB][gG][cC][rR][yY][pP][tT]-[gG][rR][uU][bB]/*' ! -path './[bB][uU][iI][lL][dD]-[aA][uU][xX]/*' ! -path './[gG][rR][uU][bB]-[cC][oO][rR][eE]/[lL][iI][bB]/[lL][iI][bB][gG][cC][rR][yY][pP][tT]/[sS][rR][cC]/[mM][iI][sS][cC].[cC]' ! -path './[gG][rR][uU][bB]-[cC][oO][rR][eE]/[lL][iI][bB]/[lL][iI][bB][gG][cC][rR][yY][pP][tT]/[sS][rR][cC]/[gG][lL][oO][bB][aA][lL].[cC]' ! -path './[gG][rR][uU][bB]-[cC][oO][rR][eE]/[lL][iI][bB]/[lL][iI][bB][gG][cC][rR][yY][pP][tT]/[sS][rR][cC]/[sS][eE][cC][mM][eE][mM].[cC]'  ! -path './[uU][tT][iI][lL]/[gG][rR][uU][bB]-[gG][eE][nN]-[wW][iI][dD][tT][hH][sS][pP][eE][cC].[cC]' ! -path './[uU][tT][iI][lL]/[gG][rR][uU][bB]-[gG][eE][nN]-[aA][sS][cC][iI][iI][hH].[cC]' |sort > po/POTFILES.in
+find util -name '*.[iI][nN]' ! -name Makefile.in  |sort > po/POTFILES-shell.in
 
 echo "Importing unicode..."
 ${PYTHON} util/import_unicode.py unicode/UnicodeData.txt unicode/BidiMirroring.txt unicode/ArabicShaping.txt grub-core/unidata.c
Signature · 1 line
tg: (f4d35d4..) u/autogen-find-ipath (depends on: master)
#17 lore raw
In reply to Jiri B

14.03.2016 21:19, Jiri B пишет:

Quoted 20 lines
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
Quoted 6 lines

Another thing - 'INSTALL' file says >= autoconf 2.60 is needed but it is >= 2.62 otherwise there is:

"error: possibly undefined macro: AS_ECHO"

Indeed. According to git log, AS_ECHO appeared first in 2.61a. What version you have?

Quoted 6 lines
Quoted 2 lines

IIUC it was firstly available in "normal" autoconf release in 2.62.

This does not answer my question - what autoconf version your system ships with (i.e. - do we need to change configure.ac or simply update INSTALL)?

IMO it would be ok to update INSTALL file. I had following autoconf versions:

Quoted 12 lines

autoconf-2.13p3
autoconf-2.52p5
autoconf-2.59p4
autoconf-2.60p4
autoconf-2.61p4
autoconf-2.62p1
autoconf-2.63p0
autoconf-2.65p0
autoconf-2.67p0
autoconf-2.68p0
autoconf-2.69p1

It is silly to bump version requirement in this case where AS_ECHO is not really needed. Could you retest attached patch with 2.60?

From: Andrei Borzenkov <[email protected]>
Subject: [PATCH] configure: replace AS_ECHO with echo in program transform

INSTALL requires autoconf 2.60, but AS_ECHO appeared first in 2.61a. It is used just once to transform program names; in this case arguments are known plain string so simple `echo' is safe to use. This avoids bumping required autoconf version without real reason.

Reported by: Jiri B <[email protected]>

---
 acinclude.m4 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
acinclude.m4 +1 -1
index 526f97a..e659b1e 100644
@@ -421,5 +421,5 @@ else
 dnl Create an output variable with the transformed name of a GRUB utility
 dnl program.
 AC_DEFUN([grub_TRANSFORM],[dnl
-AC_SUBST(AS_TR_SH([$1]), [`AS_ECHO([$1]) | sed "$program_transform_name"`])dnl
+AC_SUBST(AS_TR_SH([$1]), [`echo [$1] | sed "$program_transform_name"`])dnl
 ])
Signature · 1 line
tg: (f4d35d4..) u/no_as_echo (depends on: master)