Skip to content

Commit

Permalink
messing around in Xcode
Browse files Browse the repository at this point in the history
Change-Id: Iee764d3469c618444ff9ac5569336cad2f26d564
  • Loading branch information
cooljeanius committed Oct 16, 2023
1 parent 6423d1d commit f60b157
Show file tree
Hide file tree
Showing 39 changed files with 554 additions and 426 deletions.
2 changes: 1 addition & 1 deletion darwinbuild-OpenSourceVersions/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ sudo darwinbuild -init darwinbuild/gdb.plist -nodmg
Or do something like these instructions say to do:
http://reverse.put.as/2009/01/14/how-to-compile-gdb-and-other-apple-open-source-packages-in-mac-os-x/

Actually I messed up; the plist here is the one that installs as `/usr/local/OpenSourceVersions/gdb.plist`; it is *not* actually one to use with `darwinbuild`
Actually I messed up; the plist here is the one that installs as `/usr/local/OpenSourceVersions/gdb.plist`; it is ***not*** actually one to use with `darwinbuild`
4 changes: 3 additions & 1 deletion libcheckpoint/cpcg.c
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,9 @@ _gdbcp_cg_rollback(pid_t cpid)
int
_gdbcp_cg_delete(pid_t cpid)
{
#pragma unused (cpid)
#if (defined(__APPLE__) && defined(__APPLE_CC__)) || defined(__MWERKS__)
# pragma unused (cpid)
#endif /* (__APPLE__ && __APPLE_CC__) || __MWERKS__ */
return 0;
}

Expand Down
41 changes: 40 additions & 1 deletion src/bfd/aout-adobe.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ aout_adobe_object_p(bfd *abfd)
return NULL;
}

anexec.a_info = H_GET_32(abfd, exec_bytes.e_info);
anexec.a_info = (long)H_GET_32(abfd, exec_bytes.e_info);

/* Normally we just compare for the magic number.
* However, a bunch of Adobe tools are NOT fixed up yet; they generate
Expand Down Expand Up @@ -497,12 +497,34 @@ const bfd_target a_out_adobe_vec =
{bfd_false, aout_adobe_write_object_contents,/* bfd_write_contents. */
_bfd_write_archive_contents, bfd_false},

/* FIXME: test proper macro here: */
#if defined(__LP64__)
# if defined(BFD_JUMP_TABLE_GENERIC) && 0
BFD_JUMP_TABLE_GENERIC(aout_64),
# else
aout_64_bfd_free_cached_info,
# endif /* BFD_JUMP_TABLE_GENERIC && 0 */
#else
BFD_JUMP_TABLE_GENERIC(aout_32),
#endif /* __LP64__ */
BFD_JUMP_TABLE_COPY(_bfd_generic),
BFD_JUMP_TABLE_CORE(_bfd_nocore),
BFD_JUMP_TABLE_ARCHIVE(_bfd_archive_bsd),
#if defined(__LP64__)
# if defined(BFD_JUMP_TABLE_SYMBOLS) && 0
BFD_JUMP_TABLE_SYMBOLS(aout_64),
# else
aout_64_get_symtab_upper_bound,
# endif /* BFD_JUMP_TABLE_SYMBOLS && 0 */
# if defined(BFD_JUMP_TABLE_RELOCS) && 0
BFD_JUMP_TABLE_RELOCS(aout_64),
# else
aout_64_get_reloc_upper_bound,
# endif /* BFD_JUMP_TABLE_RELOCS && 0 */
#else
BFD_JUMP_TABLE_SYMBOLS(aout_32),
BFD_JUMP_TABLE_RELOCS(aout_32),
#endif /* __LP64__ */
BFD_JUMP_TABLE_WRITE(aout_32),
BFD_JUMP_TABLE_LINK(aout_32),
BFD_JUMP_TABLE_DYNAMIC(_bfd_nodynamic),
Expand All @@ -512,4 +534,21 @@ const bfd_target a_out_adobe_vec =
NULL
};

/* silence -Wunused-macros: */
#ifdef aout_32_bfd_make_debug_symbol
# undef aout_32_bfd_make_debug_symbol
#endif /* aout_32_bfd_make_debug_symbol */
#ifdef aout_32_bfd_reloc_type_lookup
# undef aout_32_bfd_reloc_type_lookup
#endif /* aout_32_bfd_reloc_type_lookup */
#ifdef aout_32_close_and_cleanup
# undef aout_32_close_and_cleanup
#endif /* aout_32_close_and_cleanup */
#ifdef aout_32_get_section_contents_in_window
# undef aout_32_get_section_contents_in_window
#endif /* aout_32_get_section_contents_in_window */
#ifdef aout_32_get_section_contents_in_window_with_mode
# undef aout_32_get_section_contents_in_window_with_mode
#endif /* aout_32_get_section_contents_in_window_with_mode */

/* EOF */
57 changes: 28 additions & 29 deletions src/bfd/aout-cris.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ MY (swap_ext_reloc_out) (bfd *abfd,
else if ((sym->flags & BSF_SECTION_SYM) == 0)
{
if (bfd_is_und_section (bfd_get_section (sym))
/* Remember to check for weak symbols; they count as global. */
/* Remember to check for weak symbols; they count as global: */
|| (sym->flags & (BSF_GLOBAL | BSF_WEAK)) != 0)
r_extern = 1;
else
Expand All @@ -196,7 +196,7 @@ MY (swap_ext_reloc_out) (bfd *abfd,
}
else
{
/* Just an ordinary section. */
/* Just an ordinary section: */
r_extern = 0;
r_index = output_section->target_index;
}
Expand All @@ -212,66 +212,65 @@ MY (swap_ext_reloc_out) (bfd *abfd,
bfd_set_error (bfd_error_wrong_format);
}

/* Now the fun stuff. */
natptr->r_index[2] = r_index >> 16;
natptr->r_index[1] = r_index >> 8;
/* Now the fun stuff: */
natptr->r_index[2] = (r_index >> 16U);
natptr->r_index[1] = (r_index >> 8U);
natptr->r_index[0] = r_index;
natptr->r_type[0] =
(r_extern ? RELOC_EXT_BITS_EXTERN_LITTLE : 0)
| (r_type << RELOC_EXT_BITS_TYPE_SH_LITTLE);

PUT_WORD (abfd, r_addend, natptr->r_addend);
PUT_WORD(abfd, r_addend, natptr->r_addend);
}

/* We need our own to assert that a normal 8, 16 or 32 reloc is input. */

/* We need our own to assert that a normal 8, 16 or 32 reloc is input: */
static void
MY (swap_ext_reloc_in) (bfd *abfd,
struct reloc_ext_external *bytes,
arelent *cache_ptr,
asymbol **symbols,
bfd_size_type symcount)
MY(swap_ext_reloc_in)(bfd *abfd,
struct reloc_ext_external *bytes,
arelent *cache_ptr,
asymbol **symbols,
bfd_size_type symcount)
{
unsigned int r_index;
int r_extern;
unsigned int r_type;
struct aoutdata *su = &(abfd->tdata.aout_data->a);

cache_ptr->address = (GET_SWORD (abfd, bytes->r_address));
cache_ptr->address = (GET_SWORD(abfd, bytes->r_address));

/* Now the fun stuff. */
r_index = (bytes->r_index[2] << 16)
| (bytes->r_index[1] << 8)
| bytes->r_index[0];
/* Now the fun stuff: */
r_index = ((bytes->r_index[2] << 16U)
| (bytes->r_index[1] << 8U)
| bytes->r_index[0]);
r_extern = (0 != (bytes->r_type[0] & RELOC_EXT_BITS_EXTERN_LITTLE));
r_type = ((bytes->r_type[0]) >> RELOC_EXT_BITS_TYPE_SH_LITTLE)
& RELOC_EXT_BITS_TYPE_LITTLE;
r_type = (((bytes->r_type[0]) >> RELOC_EXT_BITS_TYPE_SH_LITTLE)
& RELOC_EXT_BITS_TYPE_LITTLE);

if (r_type > 2)
{
(*_bfd_error_handler) (_("%B: Invalid relocation type imported: %d"),
abfd, r_type);
(*_bfd_error_handler)(_("%B: Invalid relocation type imported: %d"),
abfd, r_type);

bfd_set_error (bfd_error_wrong_format);
bfd_set_error(bfd_error_wrong_format);
}

cache_ptr->howto = howto_table_ext + r_type;
cache_ptr->howto = (howto_table_ext + r_type);

if (r_extern && r_index > symcount)
if (r_extern && (r_index > symcount))
{
(*_bfd_error_handler)
(_("%B: Bad relocation record imported: %d"), abfd, r_index);

bfd_set_error (bfd_error_wrong_format);
bfd_set_error(bfd_error_wrong_format);

/* We continue, so we can catch further errors. */
/* We continue, so we can catch further errors: */
r_extern = 0;
r_index = N_ABS;
}

/* Magically uses r_extern, symbols etc. Ugly, but it's what's in the
/* Magically uses r_extern, symbols etc. Ugly, but it is what is in the
default. */
MOVE_ADDRESS (GET_SWORD (abfd, bytes->r_addend));
MOVE_ADDRESS(GET_SWORD(abfd, bytes->r_addend));
}

/* We use the same as the default, except that we also set
Expand Down
6 changes: 3 additions & 3 deletions src/bfd/aout-encap.c
Original file line number Diff line number Diff line change
Expand Up @@ -658,15 +658,15 @@ const bfd_target *encap_real_callback(bfd *abfd)
if (N_FLAGS(exec_aouthdr) & N_FLAGS_COFF_ENCAPSULATE)
{
struct coffheader ch;
int val;
off_t val;
int execchan = 0;
char *filename = NULL;
val = lseek(execchan, -(sizeof(AOUTHDR) + sizeof(ch)), 1);
if (val == -1) {
if (val == -1L) {
perror_with_name(filename);
}
val = myread(execchan, (char *)&ch, sizeof(ch));
if (val < 0) {
if (val < 0L) {
perror_with_name(filename);
}
text_start = ch.text_start;
Expand Down
8 changes: 4 additions & 4 deletions src/bfd/aout-ns32k.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,12 @@ MY(put_reloc)(bfd *abfd, int r_extern, int r_index, bfd_vma value,
int r_ns32k_type;

PUT_WORD(abfd, value, reloc->r_address);
r_length = howto->size; /* Size as a power of two. */
r_length = (unsigned int)howto->size; /* Size as a power of two. */
r_pcrel = (int)howto->pc_relative; /* Relative to PC? */
r_ns32k_type = ((howto - MY(howto_table)) / 6);
r_ns32k_type = ((howto - MY(howto_table)) / 6U);

reloc->r_index[2] = (r_index >> 16);
reloc->r_index[1] = (r_index >> 8);
reloc->r_index[2] = (r_index >> 16U);
reloc->r_index[1] = (r_index >> 8U);
reloc->r_index[0] = r_index;
reloc->r_type[0] =
((r_extern ? RELOC_STD_BITS_EXTERN_LITTLE : 0)
Expand Down
17 changes: 17 additions & 0 deletions src/bfd/aout-tic30.c
Original file line number Diff line number Diff line change
Expand Up @@ -1069,4 +1069,21 @@ const bfd_target tic30_aout_vec =
# include "aout-target.h"
#endif /* !__BFD_AOUT_TARGET_H__ && !tic30_aout_callback && !MY_final_link_callback && !MY_bfd_final_link and so on */

/* for -Wunused-macros: */
#ifdef MY_bfd_debug_info_start
# undef MY_bfd_debug_info_start
#endif /* MY_bfd_debug_info_start */
#ifdef MY_bfd_debug_info_end
# undef MY_bfd_debug_info_end
#endif /* MY_bfd_debug_info_end */
#ifdef MY_bfd_debug_info_accumulate
# undef MY_bfd_debug_info_accumulate
#endif /* MY_bfd_debug_info_accumulate */
#ifdef TARGET_IS_BIG_ENDIAN_P
# undef TARGET_IS_BIG_ENDIAN_P
#endif /* TARGET_IS_BIG_ENDIAN_P */
#ifdef MY
# undef MY
#endif /* MY */

/* EOF */
57 changes: 29 additions & 28 deletions src/bfd/bout.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ bout_swap_exec_header_in (bfd *abfd,
execp->a_talign = bytes->e_talign[0];
execp->a_dalign = bytes->e_dalign[0];
execp->a_balign = bytes->e_balign[0];
execp->a_relaxable = bytes->e_relaxable[0];
execp->a_relaxable = (char)bytes->e_relaxable[0];
}

/* Swaps the information in an internal exec header structure into the
Expand All @@ -123,7 +123,7 @@ bout_swap_exec_header_out (bfd *abfd,
bytes->e_talign[0] = execp->a_talign;
bytes->e_dalign[0] = execp->a_dalign;
bytes->e_balign[0] = execp->a_balign;
bytes->e_relaxable[0] = execp->a_relaxable;
bytes->e_relaxable[0] = (unsigned char)execp->a_relaxable;
}

/* Finish up the opening of a b.out file for reading. Fill in all the
Expand All @@ -141,50 +141,51 @@ b_out_callback (bfd *abfd)
bfd_mach_i960_core /* Default. */
);

/* The positions of the string table and symbol table. */
obj_str_filepos (abfd) = N_STROFF (*execp);
obj_sym_filepos (abfd) = N_SYMOFF (*execp);
/* The positions of the string table and symbol table: */
obj_str_filepos(abfd) = (file_ptr)N_STROFF(*execp);
obj_sym_filepos(abfd) = (file_ptr)N_SYMOFF(*execp);

/* The alignments of the sections. */
obj_textsec (abfd)->alignment_power = execp->a_talign;
obj_datasec (abfd)->alignment_power = execp->a_dalign;
obj_bsssec (abfd)->alignment_power = execp->a_balign;
/* The alignments of the sections: */
obj_textsec(abfd)->alignment_power = execp->a_talign;
obj_datasec(abfd)->alignment_power = execp->a_dalign;
obj_bsssec(abfd)->alignment_power = execp->a_balign;

/* The starting addresses of the sections. */
obj_textsec (abfd)->vma = execp->a_tload;
obj_datasec (abfd)->vma = execp->a_dload;
/* The starting addresses of the sections: */
obj_textsec(abfd)->vma = execp->a_tload;
obj_datasec(abfd)->vma = execp->a_dload;

obj_textsec (abfd)->lma = obj_textsec (abfd)->vma;
obj_datasec (abfd)->lma = obj_datasec (abfd)->vma;
obj_textsec(abfd)->lma = obj_textsec(abfd)->vma;
obj_datasec(abfd)->lma = obj_datasec(abfd)->vma;

/* And reload the sizes, since the aout module zaps them. */
obj_textsec (abfd)->size = execp->a_text;
/* And reload the sizes, since the aout module zaps them: */
obj_textsec(abfd)->size = execp->a_text;

/* BSS = end of data section: */
bss_start = (unsigned long)(execp->a_dload + execp->a_data);
obj_bsssec (abfd)->vma = align_power (bss_start, execp->a_balign);
obj_bsssec(abfd)->vma = align_power(bss_start, execp->a_balign);

obj_bsssec (abfd)->lma = obj_bsssec (abfd)->vma;
obj_bsssec(abfd)->lma = obj_bsssec(abfd)->vma;

/* The file positions of the sections. */
obj_textsec (abfd)->filepos = N_TXTOFF (*execp);
obj_datasec (abfd)->filepos = N_DATOFF (*execp);
/* The file positions of the sections: */
obj_textsec(abfd)->filepos = N_TXTOFF(*execp);
obj_datasec(abfd)->filepos = (file_ptr)N_DATOFF(*execp);

/* The file positions of the relocation info. */
obj_textsec (abfd)->rel_filepos = N_TROFF (*execp);
obj_datasec (abfd)->rel_filepos = N_DROFF (*execp);
/* The file positions of the relocation info: */
obj_textsec(abfd)->rel_filepos = (file_ptr)N_TROFF(*execp);
obj_datasec(abfd)->rel_filepos = (file_ptr)N_DROFF(*execp);

adata (abfd).page_size = 1; /* Not applicable. */
adata (abfd).segment_size = 1; /* Not applicable. */
adata (abfd).exec_bytes_size = EXEC_BYTES_SIZE;
adata(abfd).page_size = 1; /* Not applicable. */
adata(abfd).segment_size = 1; /* Not applicable. */
adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE;

if (execp->a_relaxable)
abfd->flags |= BFD_IS_RELAXABLE;
return abfd->xvec;
}

/* */
static const bfd_target *
b_out_object_p (bfd *abfd)
b_out_object_p(bfd *abfd)
{
struct internal_exec anexec;
struct external_exec exec_bytes;
Expand Down
2 changes: 1 addition & 1 deletion src/bfd/coff-ppc.c
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,7 @@ record_toc(asection *toc_section, bfd_signed_vma our_toc_offset,
abort();
}
t->next = 0;
t->offset = our_toc_offset;
t->offset = (int)our_toc_offset;
t->name = name;
t->cat = cat;
t->addr = (toc_section->output_offset + our_toc_offset);
Expand Down
Loading

0 comments on commit f60b157

Please sign in to comment.