| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
binutils 2.40 introduces DW_TAG_unspecified_type for assembly
functions with an unknown return type. This breaks the
run-funcretval.sh testcase because dwfl_module_return_value_location
returns an error for such functions because it cannot determine the
return value location. Fix that by treating DW_TAG_unspecified_type
as if the DIE doesn't have a DW_AT_type.
Also update the testcase to explicitly checking for
DW_TAG_unspecified_type and printing "returns unspecified type".
https://sourceware.org/bugzilla/show_bug.cgi?id=30047
Signed-off-by: Mark Wielaard <mark@klomp.org>
|
|
|
|
|
|
|
|
|
| |
On the low level, they are the same as pointers. The change needs to be
done for all backends, so define a function and a macro to avoid
repetition. Also add a native test, which has to be implemented in C++.
Add the configure check for it.
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
MSan complains:
Uninitialized value was created by an allocation of 'reglocs' in the stack frame
#0 0x562d35c686f0 in handle_core_note elfutils/src/readelf.c:12674:3
#const Ebl_Register_Location *reglocs;
==1006199==WARNING: MemorySanitizer: use-of-uninitialized-value
#0 0x562d35c68a2a in handle_core_note elfutils/src/readelf.c:12692:11
#colno = handle_core_registers (ebl, ebl->elf, desc + regs_offset,
# reglocs, nregloc);
Strictly speaking, this is not a problem, because nregloc == 0, but for
other note types we initialize it anyway, so do it here as well.
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
|
|
|
|
|
|
|
|
|
| |
Using the NONE relocation doesn't do anything, but is harmless.
This fixes several (self) tests on sparc that use elflint to
check files are valid ELF.
Signed-off-by: Mark Wielaard <mark@klomp.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There is no regression in tests for an x86_64 build, while the new
hello_arc_hs4.ko is added as well. This is the only meaningful
test that I could add at the moment, given the features supported
by this port.
$ cat tests/test-suite.log
==========================================
elfutils 0.188: tests/test-suite.log
==========================================
# TOTAL: 236
# PASS: 235
# SKIP: 1
# XFAIL: 0
# FAIL: 0
# XPASS: 0
# ERROR: 0
.. contents:: :depth: 2
SKIP: run-lfs-symbols.sh
========================
LFS testing is irrelevant on this system
SKIP run-lfs-symbols.sh (exit status: 77)
$ cat tests/run-strip-reloc.sh.log
runtest hello_i386.ko
runtest hello_x86_64.ko
runtest hello_ppc64.ko
runtest hello_s390.ko
runtest hello_aarch64.ko
runtest hello_m68k.ko
runtest hello_riscv64.ko
runtest hello_csky.ko
runtest hello_arc_hs4.ko <-- [ new ARC HS4 test ]
runtest /home/shahab/pahole_pkg/elfutils-git/bld_arc/src/strip
runtest /home/shahab/pahole_pkg/elfutils-git/bld_arc/src/strip.o
runtest strip-uncompressed.o
runtest strip-compressed.o
runtest testfile-debug-rel-ppc64.o
runtest testfile-debug-rel-ppc64-z.o
runtest testfile-debug-rel-ppc64-g.o
PASS run-strip-reloc.sh (exit status: 0)
Signed-off-by: Shahab Vahedi <shahab@synopsys.email>
|
|
|
|
|
|
| |
This implements initial support for the LoongArch architecture.
Signed-off-by: Hengqi Chen <hengqi.chen@gmail.com>
|
|
|
|
|
|
| |
Handle PT_RISCV_ATTRIBUTES, SHT_RISCV_ATTRIBUTES, DT_RISCV_VARIANT_CC.
Signed-off-by: Andreas Schwab <schwab@suse.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Arm needs to decode flags and I modeled it after the binutils code.
The same messages are printed. Given the requirement of the interface
and the ABIs the current version of the callback function isn't
sufficient unless one wants to create a stateful interface. The
problem is that most flags need to be interpreted in the context of
the ABI version. So I changed the API to also pass the original flag
value. This shouldn't be a problem because there are no users yet.
There is also a bug in ebl_machine_flag_name. When copying the string
provided by the callback cp is moved past the NUL byte. It should
move to the NUL byte. Otherwise one cannot anything but the first
added flag description. Finally some cosmetic changes (space after
each comma in the output).
Signed-off-by: Mark Wielaard <mark@klomp.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The code in ppc_initreg.c used PTRACE_PEEKUSER to fetch all registers
one by one. Which is slightly inefficient. It did this because it wanted
things to work on linux 2.6.18 which didn't support PTRACE_GETREGSET.
PTRACE_GETREGSET was only officially since 2.6.34 (but backported
to some earlier versions). It seems ok to require a linux kernel that
supports PTRACE_GETREGSET now. This is much more efficient since it
takes just one ptrace call instead of 44 calls to fetch each register
individually.
For some really old versions we need to include <linux/ptrace.h> to
get PTRACE_GETREGSET defined. And on ppc64 there is no 32bit version
of struct pt_regs available, so we define that ourselves and check
how much data is returned to know whether this is a full pt_regs or
one for a 32bit process. An alternative would be to use the raw
iov_base bytes with 64bit or 32bit offset constants to get at the
registers instead of using a struct with names.
The code works for inspecting a 32bit process from a 64bit build,
but not the other way around (the previous code also didn't). This
could work if we also defined and used a 64bit pt_regs struct on
ppc32. But it seems a use case that is not really used (it was hard
enough finding ppc32 setups to test this on).
Tested against ppc and ppc64 on linux 2.6.32 and glibc 2.12 and
ppc and ppc64 on linux 3.10.0 with glibc 2.17.
Signed-off-by: Mark Wielaard <mark@klomp.org>
|
|
|
|
|
|
|
|
|
|
|
|
| |
The RISC-V Linux kernel is compiled without floating point (the LP64
ABI) and elfutils could not obtain return value locations for
functions in the kernel. This issue was noticed when Systemtap
generated RISC-V kernel modules for scripts that used $return target
variables in function return probes. This patch adds the needed
support to provide return value information for the LP64 and LP64F
ABIs.
Signed-off-by: William Cohen <wcohen@redhat.com>
|
|
|
|
|
|
|
| |
New function in system.h that returns true if a string has a given
prefix, false otherwise. Use it in place of strncmp.
Signed-off-by: Martin Liška <mliska@suse.cz>
|
|
|
|
|
|
|
| |
Necessary on musl for struct pt_regs definition, doesn't affect the
build on glibc, since <sys/user.h> includes the same header.
Signed-off-by: Érico Rolim <erico.erc@gmail.com>
|
|
|
|
|
|
|
| |
adress -> address
sigle -> single
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
|
|
|
|
|
|
|
|
|
| |
The x86_64 abi defines a special section type for .eh_frame[_hdr],
SHT_X86_64_UNWIND, which is a valid relocation target type.
https://sourceware.org/bugzilla/show_bug.cgi?id=26878
Signed-off-by: Mark Wielaard <mark@klomp.org>
|
|
|
|
|
|
|
|
| |
Support for the Tilera TILE-Gx processor has been removed or deprecated
in gcc and binutils already. There are no users and there is no way to
test it.
Signed-off-by: Mark Wielaard <mark@klomp.org>
|
|
|
|
|
|
|
|
|
| |
GCC11 -Warray-parameter warned about ebl_syscall_abi being inconsistently
declared (once with a pointer to int, once with an array of 6 int elements).
Since ebl_syscall_abi isn't actually used and was only implemented for
3 backends without any tests just remove it.
Signed-off-by: Mark Wielaard <mark@klomp.org>
|
|
|
|
| |
Signed-off-by: Mark Wielaard <mark@klomp.org>
|
|
|
|
|
|
|
|
| |
We are using the reloc_nametable zero element as an char array.
So make that element an actual array (we are actually after one
of the next string arrays in the table).
Signed-off-by: Mark Wielaard <mark@klomp.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We used to do several sanity checks when the ebl backend libraries
were loaded to make sure there was no version mismatch. When initializing
the backend we passed the current Ebl struct size so the library could
check it supported the given Ebl struct and we checked that the init
method returned the correct build time module version string. Neither
are necessary now that the backends are builtin.
Remove both the struct size check and the MODVERSION string (which
wasn't actually checked anymore). Make the init function return the
given Ebl handle or NULL on error (no init function currently indicates
any error).
Signed-off-by: Mark Wielaard <mark@klomp.org>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently, architecture-specific code for libebl exists in separate
libebl_$ARCH.so libraries which libebl loads with dlopen() at runtime.
This makes it impossible to have standalone, statically-linked binaries
which use libdwfl if they depend on any architecture-specific
functionality. Additionally, when these libraries cannot be found, the
failure modes are non-obvious. So, let's get rid of libebl_$arch.so and
move it all into libdw.so/libdw.a, which simplifies things considerably.
Signed-off-by: Omar Sandoval <osandov@fb.com>
|
|
|
|
|
|
|
|
|
| |
Currently, libcpu and libebl are always compiled as PIC. An upcoming
change will add the objects from libcpu.a and libebl.a to libdw.a, which
should not be PIC unless configured that way. So, make libcpu.a and
libebl.a non-PIC and add libcpu_pic.a and libebl_pic.a.
Signed-off-by: Omar Sandoval <osandov@fb.com>
|
|
|
|
|
|
|
| |
In preparation for combining the libebl backend modules, combine all of
the libcpu backends into libcpu.a.
Signed-off-by: Omar Sandoval <osandov@fb.com>
|
|
|
|
|
|
|
|
|
| |
C-SKY V2 ABI manual:
https://github.com/c-sky/csky-doc/blob/master/C-SKY_V2_CPU_Applications_Binary_Interface_Standards_Manual.pdf
C-SKY architecture user guide:
https://github.com/c-sky/csky-doc/blob/master/CSKY%20Architecture%20user_guide.pdf
Signed-off-by: Mao Han <han_mao@c-sky.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
To print eh human readable description of the ELF e_machine header field
we used the ebl name. But this is not set for most EM constants. Introduce
a new function dwelf_elf_e_machine_string that does work for all known
EM values. Use that in eu-readelf to print a string representation of the
e_machine value.
Since this was the only usage of ebl->name, remove that from struct ebl.
Also add a testcase that makes sure dwelf_elf_e_machine_string works for
all EM values in the libelf/elf.h header so we will immediately notice
when a new value appears.
Signed-off-by: Mark Wielaard <mark@klomp.org>
|
|
|
|
|
|
|
| |
BACKEND should have been defined as riscv_ (not aarch64_).
Reported-by: Mao Han <han_mao@c-sky.com>
Signed-off-by: Mark Wielaard <mark@klomp.org>
|
|
|
|
|
|
|
|
|
|
| |
The _GLOBAL_OFFSET_TABLE_ symbol might point to the DT_PLTGOT,
which is in the .got section, even if the symbol itself is
associated with the .got.plt section.
See https://sourceware.org/ml/binutils/2018-07/msg00200.html
Signed-off-by: Mark Wielaard <mark@klomp.org>
|
|
|
|
|
|
|
|
| |
Adds 32-bit support exactly the same way that the sparc backend handles
32- and 64-bit core file support. The 64-bit core file support was tested
and still works same as before.
Signed-off-by: Jim Wilson <jimw@sifive.com>
|
|
|
|
|
|
|
|
|
|
| |
Started with the aarch64 support and modified it for RISC-V. The
flattened structure support hasn't been written yet, but the rest of
it should be correct for the LP64D ABI. We have potentially 6 different
ABIs to support, so this requires checking elf header flags in riscv_init
when setting the hook.
Signed-off-by: Jim Wilson <jimw@sifive.com>
|
|
|
|
|
|
|
|
|
| |
This fixes two problems. The offset for x1 is changed from 1 to 8 because
this is a byte offset not a register skip count. Support for reading the
PC value is added. This requires changing the testsuite to match the new
readelf output for coredumps.
Signed-off-by: Jim Wilson <jimw@sifive.com>
|
|
|
|
|
|
|
|
| |
Makes sure that eu-readelf and eu-elflint recognize and show the
x86_64 specific section type correctly.
Signed-off-by: Mark Wielaard <mark@klomp.org>
Tested-by: Milian Wolff <milian.wolff@kdab.com>
|
|
|
|
|
|
|
|
|
| |
The size of the dwarf_regs is a constant, but when building without
optimizations the compiler doesn't see that and will warn that it
cannot proof the stack size is bounded. Use a define instead of a
const, so the compiler will use a constant expression everywhere.
Signed-off-by: Mark Wielaard <mark@klomp.org>
|
|
|
|
|
|
| |
This adds support for ADD and SUB relocations as seen on RISC-V.
Signed-off-by: Andreas Schwab <schwab@suse.de>
|
|
|
|
|
|
|
|
|
| |
The .odp section is found by name. But ppc64_init used the e_shstrndx
Ehdr field for that. This is wrong if the file contains more than
SHN_LORESERVE sections. Use elf_getshdrstrndx instead to find the
shstrtab section.
Signed-off-by: Mark Wielaard <mark@klomp.org>
|
|
|
|
|
|
|
|
|
|
| |
The check_special_symbol backend functions used the Ehdr e_shstrndx
field to get at the name of sections. This is not correct if there
are more than SHN_LORESERVE sections. Always use elf_getshdrstrndx
to get the shstrtab section. And drop the Ehdr argument that isn't
necessary anymore.
Signed-off-by: Mark Wielaard <mark@klomp.org>
|
|
|
|
|
|
| |
This fixes all testsuite failures.
Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
|
|
|
|
| |
Signed-off-by: Andreas Schwab <schwab@suse.de>
|
|
|
|
| |
Signed-off-by: Andreas Schwab <schwab@suse.de>
|
|
|
|
|
|
|
| |
This fixes the backtrace-dwarf and deleted tests, and lets
backtrace-native run a bit further.
Signed-off-by: Andreas Schwab <schwab@suse.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Due to libdw does not have proper BPF relocation support,
the pahole cannot display filenames correctly for objects
with default llvm options. So we have to invent
a special option "llc -march=bpf -mattr=dwarfris" to
prevent llvm from generating cross-section dwarf relocation
records (https://reviews.llvm.org/rL326505).
The pahole related discussion is in linux netdev
mailing list (http://lists.openwall.net/netdev/2018/06/15/38, etc.)
We would like to add proper BPF relocation support
to libdw so eventually we could retire the special llc bpf
flag "-mattr=dwarfris".
The bpf relocations are defined in
llvm_repo:include/llvm/BinaryFormat/ELFRelocs/BPF.def:
ELF_RELOC(R_BPF_NONE, 0)
ELF_RELOC(R_BPF_64_64, 1)
ELF_RELOC(R_BPF_64_32, 10)
Removed the relocation type R_BPF_MAP_FD whoes name does not
confirm to llvm definition and replaced it with R_BPF_64_64.
The BPF object is just a relocatible object, not an executable or
a shared library, so assign ELF type to REL only in bpf_reloc.def.
Signed-off-by: Yonghong Song <yhs@fb.com>
|
|
|
|
|
|
| |
Add NT_PPC_PKEY, R_BPF_64_64 and R_BPF_64_32. Remove R_BPF_MAP_FD.
Signed-off-by: Mark Wielaard <mark@klomp.org>
|
|
|
|
|
|
|
|
| |
From
https://github.com/riscv/riscv-isa-manual/raw/master/release/riscv-spec-v2.2.pdf
and GCC source.
Signed-off-by: Andreas Schwab <schwab@suse.de>
|
|
|
|
| |
Signed-off-by: Andreas Schwab <schwab@suse.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This implements initial support for the RISC-V architecture. It has
been tested with qemu linux-user emulation
<https://build.opensuse.org/package/live_build_log/openSUSE:Factory:RISCV/elfutils/standard/riscv64>,
with the following unresolved issues
FAIL: run-strip-strmerge.sh
===========================
elflint /home/abuild/rpmbuild/BUILD/elfutils-0.170/tests/elfstrmerge
section [32] '.symtab': _GLOBAL_OFFSET_TABLE_ symbol value 0x51c0 does not match .got section address 0x5010
section [32] '.symtab': symbol 119: st_value out of bounds
FAIL run-strip-strmerge.sh (exit status: 1)
FAIL: run-elflint-self.sh
=========================
section [33] '.symtab': _GLOBAL_OFFSET_TABLE_ symbol value 0x6220 does not match .got section address 0x6008
section [33] '.symtab': symbol 135: st_value out of bounds
*** failure in /home/abuild/rpmbuild/BUILD/elfutils-0.170/src/elflint --quiet --gnu-ld /home/abuild/rpmbuild/BUILD/elfutils-0.170/src/addr2line
section [33] '.symtab': _GLOBAL_OFFSET_TABLE_ symbol value 0x91d8 does not match .got section address 0x9040
section [33] '.symtab': symbol 163: st_value out of bounds
*** failure in /home/abuild/rpmbuild/BUILD/elfutils-0.170/src/elflint --quiet --gnu-ld /home/abuild/rpmbuild/BUILD/elfutils-0.170/src/elfcmp
section [33] '.symtab': _GLOBAL_OFFSET_TABLE_ symbol value 0x1a2a0 does not match .got section address 0x1a040
section [33] '.symtab': symbol 267: st_value out of bounds
*** failure in /home/abuild/rpmbuild/BUILD/elfutils-0.170/src/elflint --quiet --gnu-ld /home/abuild/rpmbuild/BUILD/elfutils-0.170/src/elflint
section [33] '.symtab': _GLOBAL_OFFSET_TABLE_ symbol value 0xd418 does not match .got section address 0xd0f0
section [33] '.symtab': symbol 238: st_value out of bounds
*** failure in /home/abuild/rpmbuild/BUILD/elfutils-0.170/src/elflint --quiet --gnu-ld /home/abuild/rpmbuild/BUILD/elfutils-0.170/src/nm
section [33] '.symtab': _GLOBAL_OFFSET_TABLE_ symbol value 0xa2d0 does not match .got section address 0xa0b0
section [33] '.symtab': symbol 193: st_value out of bounds
*** failure in /home/abuild/rpmbuild/BUILD/elfutils-0.170/src/elflint --quiet --gnu-ld /home/abuild/rpmbuild/BUILD/elfutils-0.170/src/objdump
section [33] '.symtab': _GLOBAL_OFFSET_TABLE_ symbol value 0x2e5b8 does not match .got section address 0x2e058
section [33] '.symtab': symbol 410: st_value out of bounds
*** failure in /home/abuild/rpmbuild/BUILD/elfutils-0.170/src/elflint --quiet --gnu-ld /home/abuild/rpmbuild/BUILD/elfutils-0.170/src/readelf
section [32] '.symtab': _GLOBAL_OFFSET_TABLE_ symbol value 0x171b8 does not match .got section address 0x17010
*** failure in /home/abuild/rpmbuild/BUILD/elfutils-0.170/src/elflint --quiet --gnu-ld /home/abuild/rpmbuild/BUILD/elfutils-0.170/libelf/libelf.so
section [32] '.symtab': _GLOBAL_OFFSET_TABLE_ symbol value 0x3a5b0 does not match .got section address 0x3a0d8
*** failure in /home/abuild/rpmbuild/BUILD/elfutils-0.170/src/elflint --quiet --gnu-ld /home/abuild/rpmbuild/BUILD/elfutils-0.170/libdw/libdw.so
section [31] '.symtab': _GLOBAL_OFFSET_TABLE_ symbol value 0xd0c8 does not match .got section address 0xd008
*** failure in /home/abuild/rpmbuild/BUILD/elfutils-0.170/src/elflint --quiet --gnu-ld /home/abuild/rpmbuild/BUILD/elfutils-0.170/backends/libebl_i386.so
section [31] '.symtab': _GLOBAL_OFFSET_TABLE_ symbol value 0xf0c8 does not match .got section address 0xf008
*** failure in /home/abuild/rpmbuild/BUILD/elfutils-0.170/src/elflint --quiet --gnu-ld /home/abuild/rpmbuild/BUILD/elfutils-0.170/backends/libebl_x86_64.so
FAIL run-elflint-self.sh (exit status: 1)
FAIL: run-native-test.sh
========================
/home/abuild/rpmbuild/BUILD/elfutils-0.170/tests/allregs: dwfl_module_register_names: no backend registers known
FAIL run-native-test.sh (exit status: 1)
FAIL: run-backtrace-native-core.sh
==================================
backtrace: backtrace.c:111: callback_verify: Assertion `symname && strcmp (symname, "raise") == 0' failed.
./test-subr.sh: line 84: 26040 Aborted (core dumped) LD_LIBRARY_PATH="${built_library_path}${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH" $VALGRIND_CMD "$@"
backtrace-child-core.26027: no main
rmdir: failed to remove 'test-26016': Directory not empty
FAIL run-backtrace-native-core.sh (exit status: 1)
In addition, all tests that use ptrace are failing as linux-user
emulation does not implement it.
There are no regressions for a x86_64 build.
Signed-off-by: Andreas Schwab <schwab@suse.de>
|
|
|
|
|
|
|
|
|
| |
The CFA is set by default to the stack pointer of the previous frame.
So that is also how we can always restore the SP. This default aarch64
CFI rule is necessary on Fedora 28 with GCC8 to make the run-deleted.sh
and run-backtrace-dwarf.sh testcases work.
Signed-off-by: Mark Wielaard <mark@klomp.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
On some systems, at least on Fedora 27 ppc64le with glibc 2.26-24 and
kernel 4.14.18-300, including sys/ptrace.h late (after signal.h or
sys/wait.h for example) will cause issues and produce errors like:
In file included from /usr/include/asm/sigcontext.h:12:0,
from /usr/include/bits/sigcontext.h:30,
from /usr/include/signal.h:287,
from /usr/include/sys/wait.h:36,
from linux-pid-attach.c:38:
/usr/include/sys/ptrace.h:73:3: error: expected identifier before numeric constant
PTRACE_GETREGS = 12,
^
Swapping the include order fixes these issues.
Signed-off-by: Mark Wielaard <mark@klomp.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Use __attribute__ ((fallthrough)) to indicate switch case fall through
instead of a comment. This ensures that the fallthrough warning is not
triggered even if the file is pre-processed (hence stripping the
comments) before it is compiled.
The actual fallback implementation is hidden behind a FALLBACK macro in
case the compiler doesn't support it.
Finally, the -Wimplict-fallthrough warning was upgraded to only allow
the attribute to satisfy it; a comment alone is no longer sufficient.
Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
|
|
|
|
|
|
|
|
|
| |
The GCC8 -Wpacked-not-aligned warns if a structure field with explicit
padding in a packed structure will be misaligned. m68k prstatus core
notes are described by a packed structure which has such aligned structure
fields.
Signed-off-by: Mark Wielaard <mark@klomp.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
gcc defaults to using struct layouts that follow the native conventions,
even if __attribute__((packed)) is given. In order to get the layout we
expect, we need to tell gcc to always use the gcc struct layout, at
least for packed structs. To do this, we can use the gcc_struct
attribute.
This is important, not only for porting to windows, but also potentially
for other platforms, as the bugs resulting from struct layout
differences are rather subtle and hard to find.
Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Those flags are not available on all platforms, and omitting them when
not available will not cause any harm. In particular:
-z,defs disallows undefined symbols in object files. This option is
unsupported if the target binary format enforces the same condition
already. Furthermore it is only a compile time sanity check. When it is
omitted, the same binary is produced.
-z,relro instructs the loader to mark sections read-only after loading
the library, where possible. This is a hardening mechanism. If it is
unavailable, the functionality of the code is not affected in any way.
-fPIC instructs the compiler to produce position independent code. While
this is preferable to relocatable code, relocatable code also works and
may even be faster. Relocatable code might just be loaded into memory
multiple times for different processes.
-fPIE is the same thing as -fPIC for executables rather than shared
libraries.
Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
|