Skip to content

Commit

Permalink
configure: support x86 assembly on GNU Hurd
Browse files Browse the repository at this point in the history
Hurd too uses ELF and 16-byte stack alignment
just like Linux and many other Unix-likes.

Supposedly its host triplet can include a version number at the end.
Without getting more specific about how a version number is allowed to
look like, checking for *-gnu* overlaps with X32's -gnux32 suffix which
is present on non-Hurd systems.
Linux is the only X32 platform I know about and it uses an identical
configuration to GNU Hurd, so this shouldn't be a problem. Though to be
safe, let's move the case with *-gnu* at the end, to ensure if there's
a "-gnux32"-like suffix on any non-Linux, non-Hurd system it will match
the proper host regex before seeing Hurd's *-gnu* pattern.

Thanks to youpi1 for advice about Hurd and testing.
  • Loading branch information
TheOneric committed Jan 1, 2023
1 parent 062d4ec commit a943ef5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,6 @@ AS_IF([test "x$enable_asm" != xno], [
[*darwin*], [
ASFLAGS="$ASFLAGS -f macho$BITTYPE -DPREFIX -DSTACK_ALIGNMENT=16"
],
[*linux*|*solaris*|*haiku*], [
ASFLAGS="$ASFLAGS -f elf$BITTYPE -DSTACK_ALIGNMENT=16"
],
[*dragonfly*|*bsd*], [
ASFLAGS="$ASFLAGS -f elf$BITTYPE"
],
Expand All @@ -291,6 +288,9 @@ AS_IF([test "x$enable_asm" != xno], [
ASFLAGS="$ASFLAGS -DPREFIX"
])
],
[*linux*|*solaris*|*haiku*|*-gnu*], [
ASFLAGS="$ASFLAGS -f elf$BITTYPE -DSTACK_ALIGNMENT=16"
],
[ # default
AC_MSG_ERROR(m4_text_wrap(m4_normalize([
Please contact libass upstream to figure out if ASM
Expand Down

1 comment on commit a943ef5

@TheOneric
Copy link
Member Author

@TheOneric TheOneric commented on a943ef5 Feb 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I missed a -gnu occurrence right in front of me and such a suffix is actually fairly common on on-Hurd besides X32. Every platform with glibc appears to get such a suffix, e.g. glibc-Linux (*-linux-gnu) or especially notworthy kFreeBSD (-kfreebsd10.3-gnu).
Now, since Linux uses the same config anyway and *bsd* is checked before Hurd’s *-gnu*, these two continue to work as expected. But in theory this might lead to an unsupported glibc platform getting (mis)configured as a Linux/Illumos/Hurd/...-like instead of printing the "contact upstream
" error and potentially lead to runtime degradation or crashes.

If we’re concerend about this, we could tighten the platform check by using $host_os only instead of the full triplet. GNU/Hurd would then start with gnu.
Though I faintly remember some relevant bit being in found in $host_vendor at one occasion; not sure if that was something also relevant for building libass though. Maybe it was cygwin and/or mingw?
But even if, we could still either split the os and vendor check or match on ${host_os}_${host_vendor} instead of $host still clearly distinguishing GNU/Hurd from glibc systems.

(This also casts doubt on -gnux32 being the universally correct check for X32, as the -gnu part is probably from glibc. For X32 musl (experimental port) it might be -muslx32. Since I don't see any option to test X32 on non-glibc with reasonable effort and no-one with such a system showed up and complained yet, it might be fine to leave this check for now)


EDIT: Addressed by #687

Please sign in to comment.