Age | Commit message (Collapse) | Author | Files | Lines |
|
|
|
Signed-off-by: Paper <paper@paper.us.eu.org>
|
|
This adds random_r() and associated functions, mostly adapted from
musl's implementation of random().
Signed-off-by: George Matsumura <gm960420@ohio.edu>
|
|
|
|
|
|
The gcompat loader compiled as a static binary doesn't work on Linux
since commit a4ff8e8620d3f4, failing with the error:
```
Uhuuh, elf segment at 0000000000400000 requested but the memory is mapped already
```
This is because the binary we are the ELF interpreter for is also loaded
at 0x400000. While it's actually okay to overlap the binary, since we're
going to call `execve` again, the kernel doesn't allow the overlap
anymore. Fix that by compiling the loader as static PIE, so it can be
loaded at a different address.
Signed-off-by: Samuel Holland <samuel@sholland.org>
|
|
Signed-off-by: Samuel Holland <samuel@sholland.org>
|
|
- Respect user CFLAGS and LDFLAGS consistently.
- Consistent use of curly braces for variables over parentheses.
- Sort flags, putting '-o' at the end for readability of `make` output.
- -fPIE doesn't mean anything to the linker
Signed-off-by: Samuel Holland <samuel@sholland.org>
|
|
Signed-off-by: Samuel Holland <samuel@sholland.org>
|
|
Reuse the machinery from readlink
Signed-off-by: Samuel Holland <samuel@sholland.org>
|
|
Signed-off-by: Samuel Holland <samuel@sholland.org>
|
|
Signed-off-by: Samuel Holland <samuel@sholland.org>
|
|
|
|
|
|
This allows programs run through gcompat to fork and re-exec themselves.
It fixes readlink("/proc/self/exe") to return the executable's absolute
path, instead of musl's path.
Signed-off-by: Samuel Holland <samuel@sholland.org>
|
|
This takes advantage of the (lack of a) musl implementation for
simplicity.
Signed-off-by: Samuel Holland <samuel@sholland.org>
|
|
On musl pread and pread64 are the same thing.
Signed-off-by: Samuel Holland <samuel@sholland.org>
|
|
Signed-off-by: Samuel Holland <samuel@sholland.org>
|
|
Signed-off-by: Samuel Holland <samuel@sholland.org>
|
|
The other unimplemented signal function in LSB is sigreturn, with is not
really implementable.
Signed-off-by: Samuel Holland <samuel@sholland.org>
|
|
These take advantage of the musl implementation for simplicity.
Signed-off-by: Samuel Holland <samuel@sholland.org>
|
|
Signed-off-by: Samuel Holland <samuel@sholland.org>
|
|
This follows the exceptionally-detailed functional description in the
manual page.
Signed-off-by: Samuel Holland <samuel@sholland.org>
|
|
* Add all (non-wchar) stdio functions from LSB, plus those found in use
in other applications. Document those functions from LSB as such.
* Use a consistent structure and paramater names for all functions.
* flag == 0 means FORTIFY_SOURCE=1, so the implemented checks should be
unconditional.
* Add all possible checks without parsing the format string.
* Move functions from wchar.h to their own appropriately-named file.
Signed-off-by: Samuel Holland <samuel@sholland.org>
|
|
Like fgetpwent_r/getpwent_r, these require a deep copy of the structure
into the caller-provided buffer. This is nontrivial for the array of
strings member.
getgrent_r is required by LSB.
[NOTE: I'm not too happy with the macro, but it works. Any suggestions?]
Signed-off-by: Samuel Holland <samuel@sholland.org>
|
|
Changes to existing code:
* Make explicit comparison against NULL.
* Adjust debug message for readability.
Signed-off-by: Samuel Holland <samuel@sholland.org>
|
|
Rename the file to match the header it implements functions from.
Changes to existing code:
* Fix the return value from backtrace (off by one).
* Use __builtin_extract_return_addr as recommended in gcc documentation.
* Document header usage.
* Document where the functions are referenced in the LSB standard.
Signed-off-by: Samuel Holland <samuel@sholland.org>
|
|
* Remove -DPIC as it is unused (and PIC is always enabled).
* Export the loader name as a macro (this will be used in the future).
* Enable compiler warnings, except the expected ones.
Signed-off-by: Samuel Holland <samuel@sholland.org>
|
|
* Prefer providing the underscore-prefixed symbol as the strong
definition.
* Do not use a weak alias if the alias is also underscore-prefixed.
* Make libgcompat objects depend on the new header.
[NOTE: I originally took the weak_alias macro from musl's libc.h, but
it's trivial and the same pattern already in use. If desired, I
can add the musl copyright notice.]
Signed-off-by: Samuel Holland <samuel@sholland.org>
|
|
The settings here are based on the current code style documentation.
Signed-off-by: Samuel Holland <samuel@sholland.org>
|
|
On GCC 4.9.4, at least backtrace.c fails to compile because of variable
declaration in a for statement, which requires -std=c99 or -std=c11.
Since we are using ISO C mode instead of a GNU standard, we additionally
must define _BSD_SOURCE to expose Dl_info for the dl code.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|