1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2024-09-29 18:09:29 +02:00

Make the code compile on FreeBSD.

This commit is contained in:
Konstantin Belousov 2017-01-15 20:39:55 +02:00 committed by Dave Watson
parent 7c079200d0
commit 09a598a3da
2 changed files with 7 additions and 4 deletions

View file

@ -527,7 +527,7 @@ dwarf_find_debug_frame (int found, unw_dyn_info_t *di_debug, unw_word_t ip,
#define EH_FRAME_LEN /* strlen(".eh_frame") + 1 */ 10 #define EH_FRAME_LEN /* strlen(".eh_frame") + 1 */ 10
static ElfW(Addr) static Elf_W (Addr)
dwarf_find_eh_frame_section(struct dl_phdr_info *info) dwarf_find_eh_frame_section(struct dl_phdr_info *info)
{ {
int fd; int fd;
@ -665,7 +665,7 @@ dwarf_callback (struct dl_phdr_info *info, size_t size, void *ptr)
} }
else else
{ {
ElfW(Addr) eh_frame; Elf_W (Addr) eh_frame;
Debug (1, "no .eh_frame_hdr section found\n"); Debug (1, "no .eh_frame_hdr section found\n");
eh_frame = dwarf_find_eh_frame_section (info); eh_frame = dwarf_find_eh_frame_section (info);
if (eh_frame) if (eh_frame)
@ -674,10 +674,10 @@ dwarf_callback (struct dl_phdr_info *info, size_t size, void *ptr)
Debug (1, "using synthetic .eh_frame_hdr section for %s\n", Debug (1, "using synthetic .eh_frame_hdr section for %s\n",
info->dlpi_name); info->dlpi_name);
/* synth_eh_frame_hdr.version */ p[0] = DW_EH_VERSION; /* synth_eh_frame_hdr.version */ p[0] = DW_EH_VERSION;
/* synth_eh_frame_hdr.eh_frame_ptr_enc */ p[1] = DW_EH_PE_absptr | ((sizeof(ElfW(Addr)) == 4) ? DW_EH_PE_udata4 : DW_EH_PE_udata8); /* synth_eh_frame_hdr.eh_frame_ptr_enc */ p[1] = DW_EH_PE_absptr | ((sizeof(Elf_W (Addr)) == 4) ? DW_EH_PE_udata4 : DW_EH_PE_udata8);
/* synth_eh_frame_hdr.fde_count_enc */ p[2] = DW_EH_PE_omit; /* synth_eh_frame_hdr.fde_count_enc */ p[2] = DW_EH_PE_omit;
/* synth_eh_frame_hdr.table_enc */ p[3] = DW_EH_PE_omit; /* synth_eh_frame_hdr.table_enc */ p[3] = DW_EH_PE_omit;
*(ElfW(Addr) *)(&p[4]) = eh_frame; *(Elf_W (Addr) *)(&p[4]) = eh_frame;
hdr = &synth_eh_frame_hdr; hdr = &synth_eh_frame_hdr;
} }
} }

View file

@ -39,6 +39,9 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#if !defined(MAP_ANONYMOUS) && defined(MAP_ANON) #if !defined(MAP_ANONYMOUS) && defined(MAP_ANON)
# define MAP_ANONYMOUS MAP_ANON # define MAP_ANONYMOUS MAP_ANON
#endif #endif
#if !defined(MAP_NORESERVE)
# define MAP_NORESERVE 0
#endif
int int
main (void) main (void)