Commit Graph

28974 Commits

Author SHA1 Message Date
Idan Horowitz
20d990563c LibJS: Convert to_number() to ThrowCompletionOr 2021-10-18 08:01:38 +03:00
Jelle Raaijmakers
a36ee213b9 LibGL: Implement glIsEnabled() 2021-10-17 21:01:52 -07:00
Jelle Raaijmakers
b2627c8b74 LibGL: Implement disabling GL_FOG 2021-10-17 21:01:52 -07:00
Jelle Raaijmakers
abaac02c88 LibGL: Correct GL_MODELVIEW and GL_PROJECTION values
According to the Khronos group, GL enum values are in the spec:

https://www.khronos.org/registry/OpenGL/docs/enums.html

Not adhering to their values will cause issues with projects that ship
their own copy of `gl.h`, such as ScummVM.
2021-10-17 21:01:52 -07:00
Andreas Kling
ca4276db77 LibWeb: Fill page background with the "base" palette color
This fixes an issue where you'd see black (or ghost) pixels when
painting web pages with content smaller than the viewport.
2021-10-18 03:04:01 +02:00
Andreas Kling
b78a69f7dd LoginServer: Use the verb "log in" for window title & submit button 2021-10-18 03:04:01 +02:00
L Pereira
f4ea3b0168 LibC: Define ULLONG_MAX
Some ports require this constant to be defined as it is specified in
the standard[1].

[1] https://www.cplusplus.com/reference/climits/
2021-10-17 23:43:43 +01:00
Andreas Kling
879ba5bd17 Base: Add a basic SystemServer.ini for the anon user :^) 2021-10-17 22:24:56 +02:00
Andreas Kling
dabbade05c LibWeb: Factor out creation of independent formatting contexts
This patch breaks FormattingContext::layout_inside() into two functions,
one that creates an independent formatting context (if needed), and
another that calls the former and then performs the inside layout within
the appropriate context.

The main goal here was to make layout_inside() return the independent
formatting context if one was created. This will allow us to defer
certain operations in child contexts until the parent context has
finished formatting the child root box.
2021-10-17 22:18:59 +02:00
Andreas Kling
f2d0e8d0ee LibWeb: Expose FormattingContext type
Instead of having a virtual is_block_formatting_context(), let's have a
type() that can tell you exactly which type of formatting context it is.
2021-10-17 22:18:59 +02:00
Peter Elliott
b77dad5ba3 LoginServer: Add --auto-login switch
Auto login will automatically log in a user without prompting for a
password, but will still allow logouts and subsequent password logins.
2021-10-17 22:18:48 +02:00
Peter Elliott
c19d868a3e LibGUI: Don't render placeholders as secret
before my placeholder 'password' showed up as '********'.
2021-10-17 22:18:48 +02:00
Peter Elliott
92b6e4fd76 TaskBar+Utilities: Add logout(1) command, and call it in ShutdownDialog
logout kills the session that SystemServer --user was started with.
2021-10-17 22:18:48 +02:00
Peter Elliott
7283b0b214 Utilities: Show PGID and SID in ps -f 2021-10-17 22:18:48 +02:00
Peter Elliott
e3ed7f76c5 LoginServer: Process logins and start SystemServer in user mode 2021-10-17 22:18:48 +02:00
Peter Elliott
9e3d6d161b LoginServer: Layout a basic login window 2021-10-17 22:18:48 +02:00
Peter Elliott
f8fb0359ae SystemServer: Add per user mode (--user)
System server running in user mode will form the basis of a "session"
for login purposes in serenity.
2021-10-17 22:18:48 +02:00
Hediadyoin1
3ad6d87a45 LibX86: Add SSE support
This only adds the decodeing support for SSE, not SSE2, etc.
may contain traces of SSE2.
2021-10-17 13:06:23 -07:00
Karol Kosek
d91f194ddd LibGUI: Remember the maximized value if a window hasn't been created yet
d0fb511d75 set the maximized window value
in the File Manager before a window was created, which resulted in crash
everytime you tried to open the program that was closed while it was
maximized. ugh

Here we do more-or-less what GUI::Window::set_rect() does, except we
don't add it to the WindowServer::create_window() IPC call.
That's because the Window Server knows nothing about menus at this
point and just assumes they don't need to be visible.
So if we try to maximize the window then, it could be slightly taller
and a titlebar could be hidden.

So even though it looks how it looks like, it does work and it doesn't
show in the startup size, as described in the mentioned commit (the call
is put a few lines before the initial update()). :^)
2021-10-17 21:39:54 +02:00
SeekingBlues
9705580c53 rev: Unbreak reading from standard input
Since Core::File does not handle streaming input properly (see #5093
and #4198), we use the LibC APIs instead.
2021-10-17 12:07:09 -07:00
SeekingBlues
6d4e58efea tac: Unbreak reading from standard input
Since Core::File does not handle streaming input properly (see #5093
and #4198), we use the LibC APIs instead.
2021-10-17 12:07:09 -07:00
SeekingBlues
c63bdba955 shuf: Fix division by zero when no lines are read 2021-10-17 12:07:09 -07:00
Sam Atkins
0588db5c30 LibWeb: Make the CSS serialization functions actually output things :^)
Pro tip: If your function takes a StringBuilder by value, it doesn't
actually append anything to the caller's StringBuilder. On the plus
side, I probably won't make this mistake for a while? I hope?
2021-10-17 19:59:27 +01:00
Daniel Bertalan
48687c3fbb Tests: Remove Clang workaround from TestSourceLocation
Clang 13 now correctly handles `__builtin_FILE()` and
`-ffile-prefix-map` being specified together, so this test should fully
pass.
2021-10-17 17:09:58 +01:00
Daniel Bertalan
dabd8dbedd Ports: Make it possible to build (some) ports with Clang
This commit introduces the changes needed in the port build system that
will allow us to compile ports with Clang. Note that many ports still
don't build, especially due to linker differences. Fixing these is
outside the scope of this PR.

For now, building bash, ncurses and nano is known to work. Bash runs
fine, while nano crashes due to DT_VERSYM not being supported by our
dynamic loader.
2021-10-17 17:09:58 +01:00
Daniel Bertalan
928665d3bc Meta: Support llvm-addr2line in serenity.sh
With this, the subcommands 'addr2line` and `kaddr2line` work as with the
GNU toolchain.
2021-10-17 17:09:58 +01:00
Daniel Bertalan
10c3cf9a47 Kernel: Enable LTO for kernel_heap if ENABLE_KERNEL_LTO is set
By enabling LTO for the kernel_heap object too, we open the door for
optimization opportunities that come from (partially) inlining `::new`
or kmalloc. Every software spends a non-trivial amount of its run time
on allocating memory, so hopefully this change will make LTO builds even
faster.
2021-10-17 17:09:58 +01:00
Daniel Bertalan
06fc64be13 Toolchain+Meta: Update LLVM version to 13.0.0
This commit updates the Clang toolchain's version to 13.0.0, which comes
with better C++20 support and improved handling of new features by
clang-format. Due to the newly enabled `-Bsymbolic-functions` flag, our
Clang binaries will only be 2-4% slower than if we dynamically linked
them, but we save hundreds of megabytes of disk space.

The `BuildClang.sh` script has been reworked to build the entire
toolchain in just three steps: one for the compiler, one for GNU
binutils, and one for the runtime libraries. This reduces the complexity
of the build script, and will allow us to modify the CI configuration to
only rebuild the libraries when our libc headers change.

Most of the compile flags have been moved out to a separate CMake cache
file, similarly to how the Android and Fuchsia toolchains are
implemented within the LLVM repo. This provides a nicer interface than
the heaps of command-line arguments.

We no longer build separate toolchains for each architecture, as the
same Clang binary can compile code for multiple targets.

The horrible mess that `SERENITY_CLANG_ARCH` was, has been removed in
this commit. Clang happily accepts an `i686-pc-serenity` target triple,
which matches what our GCC toolchain accepts.
2021-10-17 17:09:58 +01:00
Daniel Bertalan
28c088cd91 Kernel: Support split data sections
This feature is used by Clang when performing LTO. With this change,
these split sections now go in the right place.
2021-10-17 17:09:58 +01:00
Daniel Bertalan
a8fefd89cd Everywhere: Make some symbols __attribute__((used)) for LTO
With these changes, the userland builds correctly with Clang's ThinLTO
enabled.
2021-10-17 17:09:58 +01:00
Daniel Bertalan
1faffc2192 Kernel: Introduce workaround to make LTO builds work with Clang
LLD fails to define the _GLOBAL_OFFSET_TABLE_ symbol if all inputs to it
are LLVM bitcode files (i.e. those used for LTO). To allow the kernel to
be built with ThinLTO, the workaround suggested in the original LLVM bug
report (<https://bugs.llvm.org/show_bug.cgi?id=39634>) is added in this
commit.
2021-10-17 17:09:58 +01:00
Daniel Bertalan
3c3df95958 LibCoredump: Show frames from Loader.so if the crash occurs in it
Previously we rejected all entries from Loader.so even if the faulting
address was located in it, i.e. the actual issue was with the dynamic
loader. We no longer do that to make debugging Loader crashes easier.
2021-10-17 17:09:58 +01:00
Daniel Bertalan
bb4bb3c2f4 LibDebug: Enable parsing libgcc_s.so
Now that our DWARF 5 support is nearly feature-complete, there is no
reason anymore to special-case this library, as we can process it just
fine.
2021-10-17 17:09:58 +01:00
Daniel Bertalan
a60d960420 LibDebug: Don't create compilation units for embedded resources
Our implementation (naively) assumes that there is a one-to-one
correspondence between compilation units and line programs, and that
their orders are identical. This is not the case for embedded resources,
as Clang only creates line programs for it, but not compilation units.

This mismatch caused an assertion failure, which made generating
backtraces for GUI applications impossible. This commit introduces a
hack that skips creating CompilationUnit objects for LinePrograms that
come from embedded resources.
2021-10-17 17:09:58 +01:00
Daniel Bertalan
622d408d82 LibDebug: Make use of the newly supported data forms
With this change, our DWARF 5 support is nearly feature-complete.
2021-10-17 17:09:58 +01:00
Daniel Bertalan
8278039105 LibDebug: Support DW_FORM_data16
Clang emits this form at all debug levels.
2021-10-17 17:09:58 +01:00
Daniel Bertalan
ac53569bd1 LibDebug: Support addrx*, strx* and rnglistx forms
These forms were introduced in DWARF5, and have a fair deal of
advantages over the more traditional encodings: they reduce the size of
the binary and the number of relocations.

GCC does not emit these with `-g1` by default, but Clang does at all
debug levels.
2021-10-17 17:09:58 +01:00
Daniel Bertalan
8e5b70a0ba LibDebug: Don't expose AttributeValue internals, use getters instead
This will be needed when we add `DW_FORM_strx*` and `DW_FORM_addrx*`
support, which requires us to fetch `DW_AT_str_offsets_base` and
`DW_AT_addr_base` attributes from the parent compilation unit. This
can't be done as we read the values, because it would create infinite
recursion (as we might try to parse the compilation unit's
`DW_FORM_strx*` encoded name before we get to the attribute). Having
getters ensures that we will perform lookups if they are needed.
2021-10-17 17:09:58 +01:00
Daniel Bertalan
1b63c8f3b0 LibCoredump: Accept dynamic libraries with versioned names
Our Clang toolchain uses versioned names for its shared libraries,
meaning that our applications link against `libc++.so.1.0`, not simply
`libc++.so`. Without this change, the LLVM runtime libraries are
excluded from backtraces, which makes debugging toolchain issues harder.
2021-10-17 17:09:58 +01:00
Daniel Bertalan
9869b598d5 AK: Make Span trivially copy-constructible
There is no need to have a user-defined copy constructor that simply
calls the base class's copy constructor. By having the compiler generate
it for us, Span is made trivially copyable, so it can be passed in
registers.
2021-10-17 17:09:58 +01:00
Daniel Bertalan
c524f58290 Toolchain: Introduce stubs for core system libraries
This allows the linker to link against these dynamic libraries when
compiling libc++/libunwind, without having to do a separate
bootstrapping LibC build.

Without this change, libc++ would fail to pick up the need to link to
`LibPthread` if no prior builds of it existed. Because of this, we'd
immediately have an assertion failure in SystemServer, as mutexes are
used for the safe construction of function-local static variables.
2021-10-17 17:09:58 +01:00
Daniel Bertalan
95c32fdf19 LibC: Primitively implement wcsxfrm
The `wcsxfrm` function copies a wide character string into a buffer,
such that comparing the new string against any similarly pre-processed
string with `wcscmp` produces the same result as if the original strings
were compared with `wcscoll`.

Our current `wcscoll` implementation is simply an alias for `wcscmp`, so
`wcsxfrm` needs to perform no actions other than copying the string.
2021-10-17 17:09:58 +01:00
Daniel Bertalan
13e6d9d71a LibC: Implement wcslcpy 2021-10-17 17:09:58 +01:00
Daniel Bertalan
e6164d35fa LibC: Fix wcsrchr declaration to return a non-const wchar*
This is how the standard specifies it; similarly to the already
correctly declared wcschr function.
2021-10-17 17:09:58 +01:00
Daniel Bertalan
763a69d46d LibC: Stub out mbsnrtowcs 2021-10-17 17:09:58 +01:00
Daniel Bertalan
54eee525e6 LibC: Stub out wcsnrtombs 2021-10-17 17:09:58 +01:00
Daniel Bertalan
57f0c12b9a LibC: Implement wmemcmp 2021-10-17 17:09:58 +01:00
Daniel Bertalan
685045176b LibC: Add ELAST errno macro
The ELAST macro is used on many systems to refer to the largest possible
valid errno value. LLVM's libc++ uses errno values of ELAST+1 and
ELAST+2 internally, and defines an arbitrary fallback value for
platforms which don't have the macro. This means that it's possible for
their internal errno numbers could coincide with values we actually use,
which would be a very bad thing.
2021-10-17 17:09:58 +01:00
Daniel Bertalan
b5fcb10493 LibC: Forward-declare struct tm in wchar.h
The C standard specifies that this forward-declaration be present in
wchar.h, and is needed in order to build libstdc++.
2021-10-17 17:09:58 +01:00
Tim Schumacher
20986b7066 Prekernel: Force enable PAE on Intel Pentium M CPUs 2021-10-17 16:15:36 +01:00