Age | Commit message (Collapse) | Author |
|
When running `xeyes` via `SSH -X` on CHERI-RISC-V FreeBSD, I was getting
a Bus Error (unaligned store) in the `cl->callback = callback;` line of
_XtAddCallback. The `cl` variable (created using `ToList(icl)`) was only
aligned to 8 bytes, but for CHERI-RISC-V pointer-type loads and stores
require 16-byte alignment.
In order to fix this, I added a C99 flexible array member to
internalCallbackRec when compiling for C99 or newer. This ensures
that sizeof(InternalCallbackRec) is 16 (since it now includes the
required 12 byte padding up to the first XtCallbackRec). This also
ensures that alignof(InternalCallbackRec) is 16, but that doesn't
matter in this case since malloc() will always return a
sufficiently-aligned pointer.
I also changed ToList(p) to use the flexible array member directly
when compiling for C99. This is not a functional change since it
will evaluate to the same pointer, but it does add additional type
checking and ensures that only a `InternalCallbackRec *` can be
passed to the macro.
Signed-off-by: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
|
|
On CHERI-enabled architectures (e.g. Arm's Morello), pointers are twice
the size of addresses (i.e. 128 bits for Morello, 64 bits for 32-bit
RISC-V). However, XtArgVal is currently defined as long, so it cannot
be used to store pointers on these architectures.
Also add a _Static_assert() when compiling with C11 support to check
that the offset of the last member matches that of XtResource.
Signed-off-by: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
|
|
Various Xt*Id types are integer types that are used to hold pointers.
Use uintptr_t for standards-compliant conversion and to support
architectures where long cannot hold pointers (e.g. CHERI).
I found these by compiling libXt with the CHERI Clang compiler, as it
warns about conversions from integer to pointer that do not use intptr_t.
Signed-off-by: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
|
|
On CHERI-enabled architectures (e.g. Arm's Morello), pointers are twice
the size of addresses (i.e. 128 bits for Morello, 64 bits for 32-bit
RISC-V). However, XtArgVal is currently defined as long, so it cannot
be used to store pointers on these architectures.
This commit changes XtArgVal to use intptr_t instead, which should be
long on most architectures but is larger for CHERI.
It also introduces XtIntPtr/XtUIntPtr which will be used in follow-up
changes. This commit should also help on LLP64 ABIs where long is 32
bits but pointers are 64 bits.
I am not sure what the compiler and C standard requirements are, so I've
guarded the use of stdint.h with `#if __STDC_VERSION__ >= 199901L`.
I've also added a _Static_assert() when compiling in C11 mode to
statically verify that the XtArgVal type requirements are met.
Signed-off-by: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
|
|
All modern compilers (GCC>=4.6, Clang>=3.0) define this macro, so we can
use it to detect 64-bit longs without adding to the architecture list.
This change is needed to successfully run xeyes on a FreeBSD CHERI-RISC-V
QEMU VM via SSH forwarding.
See also https://gitlab.freedesktop.org/xorg/proto/xorgproto/-/merge_requests/41
Signed-off-by: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
|
|
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
|
|
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
|
|
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
|
|
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
|
|
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
|
|
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
|
|
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
|
|
time interval, etc., in turn requires an update to the specification version.
Update that now.
|
|
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
|
|
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
|
|
be updated during initialization.
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
|
|
by changing some function parameters and struct-members to _XtString
(always "char*") from String (which may be "const char *"). There are
still many compiler warnings; subsequent commits will reduce those.
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
|
|
https://invisible-island.net/xterm/xterm.faq.html#building_it
I would like to add an optional feature which makes the String typedef
"const" if _CONST_X_STRING is defined. Modifying the Intrinsic.h header
is only a partial solution because the library has not been modified to
take advantage of this (if it had, most of the const-warnings from gcc
would go away).
This change modifies the header file as well as the makestrs.c program
which generates Shell.h and StringDefs.h so that they use String-casts
rather than char*-casts (reducing the warnings seen when compiling with
Xt's header files).
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
|
|
Regress script, comparing object-files before/after the edits:
https://invisible-island.net/ansification/index.html
https://invisible-island.net/scripts/readme.html
The changes are casts, which quiet the gcc warnings about implicit
conversion that my "gcc-normal" script would show. I avoided
reformatting the code.
The change reduces the number of gcc warnings from 769 to 163.
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
|
|
Use memset, which is standard (and supported for some 30 years).
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
|
|
and bzero. When the library was written (1989), none of those had been
standardized, and the source-code used "(int)" casts to help with K&R
compilers. The cleanup done in the previous update used binary-compare
to validate, which does not work for these because the compiler is recording
the cast's effect.
This change reduces the number of gcc warnings from 163 to 128.
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
|
|
That turns on a debugging feature (activated by a resource setting).
Its use of <stdarg.h> was incorrect. Also fix compiler warnings in
the related file.
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
|
|
As noted in Initialize.c, _XtInherit needs special treatment as it's both called
as a function, and used as a value to compare with.
We need to change this trickery for x86_64, as the symbols are no longer
underscore prefixed, and the address is 64 bits.
We also cannot place the trampoline in the .data section, as it may be marked
no-execute, so we use a special section for it instead.
v2: Uses of XtInherit must also be marked dllimport, so that they do not use a
thunk, but instead indirect via the __imp_XtInherit auto-import. This avoids
problems with an incorrect relocation being calculated in the case where libXt
and a library using it (e.g. libXaw/libXaw3d/libXm/etc.) are loaded more than
2GiB apart from each other.
This is enough to build a working libXt for Cygwin x86_64, because it uses the
LP64 data model. I believe that more patches are needed for libXt to work
correctly when built for the Windows LLP64 data model.
Signed-off-by: Yaakov Selkowitz <yselkowitz@cygwin.com>
Reviewed-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
|
|
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|
Performed with: find * -type f | xargs perl -i -p -e 's{[ \t]+$}{}'
git diff -w & git diff -b show no diffs from this change
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|
Trying to outsmart the compiler and libc is a losing battle, but
since UNALIGNED was never defined, we weren't even trying.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|
Like asprintf() but using XtMalloc() to tie into the Xt memory allocation
and error handling subsystems.
Bumps libXt version to 1.0.99.1 so that modules can set their pkg-config
dependency to libXt >= 1.0.99.1 to require XtAsprintf().
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|
Signed-off-by: Jesse Adkins <jesserayadkins@gmail.com>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|
Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
|
|
Using common defaults will reduce errors and maintenance.
Only the very small or inexistent custom section need periodic maintenance
when the structure of the component changes. Do not edit defaults.
|
|
Most "compiler" warnings were actually sparse warnings, due to
assigning a integer to a pointer, or an external symbol without
a previous declaration.
|
|
|
|
|
|
builds.
|
|
|
|
|
|
modular and the monolithic tree.
- Update XTrap to use #include <X11/internal-xt-headerI.h>
- Add XvMC to symlink.sh
|
|
- add build system for lib/Xt
|
|
terminating element in a varargs list). A sentinel needs to be NULL,
not 0 - which doesn't make a difference on 32bit but matters on 64bit.
Furthermore it can be told that functions have a printf-like format
string and argument list so that they can verify that both match. To
use these features certain attributes need to be set - which are
compiler specific. To do this we define macros which are expanded
depending on the compiler version. For now we put those in
include/Xfuncproto.h (the XFree86 DDX layer contains a file compiler.h
which however is not visible outside the DDX) (Bugzilla #3268).
|
|
(Thomas Dickey).
|
|
|
|
COMPOSITE extension's new macro. These appear to only be used
internally.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|