*** empty log message ***
This commit is contained in:
parent
1327fb2956
commit
a37cc0c05c
|
@ -65,13 +65,13 @@ boolean
|
||||||
_bfd_generic_mkarchive (abfd)
|
_bfd_generic_mkarchive (abfd)
|
||||||
bfd *abfd;
|
bfd *abfd;
|
||||||
{
|
{
|
||||||
abfd->tdata =(PTR) zalloc (sizeof (struct artdata));
|
abfd->tdata = bfd_zalloc(abfd, sizeof (struct artdata));
|
||||||
|
|
||||||
if (abfd->tdata == NULL) {
|
if (abfd->tdata == NULL) {
|
||||||
bfd_error = no_memory;
|
bfd_error = no_memory;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bfd_ardata(abfd)->cache = 0;
|
bfd_ardata(abfd)->cache = 0;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,8 +139,7 @@ add_bfd_to_cache (arch_bfd, filepos, new_elt)
|
||||||
bfd *arch_bfd, *new_elt;
|
bfd *arch_bfd, *new_elt;
|
||||||
file_ptr filepos;
|
file_ptr filepos;
|
||||||
{
|
{
|
||||||
struct ar_cache *new_cache = ((struct ar_cache *)
|
struct ar_cache *new_cache = ((struct ar_cache *)bfd_zalloc(arch_bfd,sizeof (struct ar_cache)));
|
||||||
zalloc (sizeof (struct ar_cache)));
|
|
||||||
|
|
||||||
if (new_cache == NULL) {
|
if (new_cache == NULL) {
|
||||||
bfd_error = no_memory;
|
bfd_error = no_memory;
|
||||||
|
@ -252,7 +251,7 @@ snarf_ar_hdr (abfd)
|
||||||
allocsize += namelen + 1;
|
allocsize += namelen + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
allocptr = zalloc (allocsize);
|
allocptr = bfd_zalloc(abfd, allocsize);
|
||||||
if (allocptr == NULL) {
|
if (allocptr == NULL) {
|
||||||
bfd_error = no_memory;
|
bfd_error = no_memory;
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -296,7 +295,6 @@ get_elt_at_filepos (archive, filepos)
|
||||||
|
|
||||||
n_nfd = _bfd_create_empty_archive_element_shell (archive);
|
n_nfd = _bfd_create_empty_archive_element_shell (archive);
|
||||||
if (n_nfd == NULL) {
|
if (n_nfd == NULL) {
|
||||||
free (new_areldata);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
n_nfd->origin = bfd_tell (archive);
|
n_nfd->origin = bfd_tell (archive);
|
||||||
|
@ -307,8 +305,6 @@ get_elt_at_filepos (archive, filepos)
|
||||||
return n_nfd;
|
return n_nfd;
|
||||||
|
|
||||||
/* huh? */
|
/* huh? */
|
||||||
free (new_areldata);
|
|
||||||
free (n_nfd);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -379,7 +375,7 @@ bfd_generic_archive_p (abfd)
|
||||||
if (strncmp (armag, ARMAG, SARMAG)) return 0;
|
if (strncmp (armag, ARMAG, SARMAG)) return 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bfd_set_ardata(abfd, (struct artdata *) zalloc (sizeof (struct artdata)));
|
bfd_set_ardata(abfd, (struct artdata *) bfd_zalloc(abfd,sizeof (struct artdata)));
|
||||||
|
|
||||||
if (bfd_ardata (abfd) == NULL) {
|
if (bfd_ardata (abfd) == NULL) {
|
||||||
bfd_error = no_memory;
|
bfd_error = no_memory;
|
||||||
|
@ -389,14 +385,14 @@ bfd_generic_archive_p (abfd)
|
||||||
bfd_ardata (abfd)->first_file_filepos = SARMAG;
|
bfd_ardata (abfd)->first_file_filepos = SARMAG;
|
||||||
|
|
||||||
if (!BFD_SEND (abfd, _bfd_slurp_armap, (abfd))) {
|
if (!BFD_SEND (abfd, _bfd_slurp_armap, (abfd))) {
|
||||||
free (bfd_ardata (abfd));
|
bfd_release(abfd, bfd_ardata (abfd));
|
||||||
abfd->tdata = NULL;
|
abfd->tdata = NULL;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* armap could be left ungc'd! FIXME -- potential storage leak */
|
/* armap could be left ungc'd! FIXME -- potential storage leak */
|
||||||
if (!BFD_SEND (abfd, _bfd_slurp_extended_name_table, (abfd))) {
|
if (!BFD_SEND (abfd, _bfd_slurp_extended_name_table, (abfd))) {
|
||||||
free (bfd_ardata (abfd));
|
bfd_release(abfd, bfd_ardata (abfd));
|
||||||
abfd->tdata = NULL;
|
abfd->tdata = NULL;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -428,18 +424,16 @@ bfd_slurp_bsd_armap (abfd)
|
||||||
mapdata = snarf_ar_hdr (abfd);
|
mapdata = snarf_ar_hdr (abfd);
|
||||||
if (mapdata == NULL) return false;
|
if (mapdata == NULL) return false;
|
||||||
|
|
||||||
raw_armap = (int *) zalloc (mapdata->parsed_size);
|
raw_armap = (int *) bfd_zalloc(abfd,mapdata->parsed_size);
|
||||||
if (raw_armap == NULL) {
|
if (raw_armap == NULL) {
|
||||||
bfd_error = no_memory;
|
bfd_error = no_memory;
|
||||||
byebye:
|
byebye:
|
||||||
free (mapdata);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bfd_read ((PTR)raw_armap, 1, mapdata->parsed_size, abfd) !=
|
if (bfd_read ((PTR)raw_armap, 1, mapdata->parsed_size, abfd) !=
|
||||||
mapdata->parsed_size) {
|
mapdata->parsed_size) {
|
||||||
bfd_error = malformed_archive;
|
bfd_error = malformed_archive;
|
||||||
free (raw_armap);
|
|
||||||
goto byebye;
|
goto byebye;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -457,7 +451,6 @@ bfd_slurp_bsd_armap (abfd)
|
||||||
ardata->first_file_filepos = bfd_tell (abfd);
|
ardata->first_file_filepos = bfd_tell (abfd);
|
||||||
/* Pad to an even boundary if you have to */
|
/* Pad to an even boundary if you have to */
|
||||||
ardata->first_file_filepos += (ardata-> first_file_filepos) %2;
|
ardata->first_file_filepos += (ardata-> first_file_filepos) %2;
|
||||||
free (mapdata);
|
|
||||||
bfd_has_map (abfd) = true;
|
bfd_has_map (abfd) = true;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -492,11 +485,11 @@ bfd_slurp_coff_armap (abfd)
|
||||||
mapdata = snarf_ar_hdr (abfd);
|
mapdata = snarf_ar_hdr (abfd);
|
||||||
if (mapdata == NULL) return false;
|
if (mapdata == NULL) return false;
|
||||||
|
|
||||||
raw_armap = (int *) zalloc (mapdata->parsed_size);
|
raw_armap = (int *) bfd_alloc(abfd,mapdata->parsed_size);
|
||||||
if (raw_armap == NULL) {
|
if (raw_armap == NULL) {
|
||||||
bfd_error = no_memory;
|
bfd_error = no_memory;
|
||||||
byebye:
|
byebye:
|
||||||
free (mapdata);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -504,7 +497,7 @@ bfd_slurp_coff_armap (abfd)
|
||||||
mapdata->parsed_size) {
|
mapdata->parsed_size) {
|
||||||
bfd_error = malformed_archive;
|
bfd_error = malformed_archive;
|
||||||
oops:
|
oops:
|
||||||
free (raw_armap);
|
|
||||||
goto byebye;
|
goto byebye;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -518,7 +511,7 @@ bfd_slurp_coff_armap (abfd)
|
||||||
unsigned int carsym_size = (nsymz * sizeof (carsym));
|
unsigned int carsym_size = (nsymz * sizeof (carsym));
|
||||||
unsigned int ptrsize = (4 * nsymz);
|
unsigned int ptrsize = (4 * nsymz);
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
ardata->symdefs = (carsym *) zalloc (carsym_size + stringsize + 1);
|
ardata->symdefs = (carsym *) bfd_zalloc(abfd,carsym_size + stringsize + 1);
|
||||||
if (ardata->symdefs == NULL) {
|
if (ardata->symdefs == NULL) {
|
||||||
bfd_error = no_memory;
|
bfd_error = no_memory;
|
||||||
goto oops;
|
goto oops;
|
||||||
|
@ -544,8 +537,7 @@ bfd_slurp_coff_armap (abfd)
|
||||||
ardata->first_file_filepos = bfd_tell (abfd);
|
ardata->first_file_filepos = bfd_tell (abfd);
|
||||||
/* Pad to an even boundary if you have to */
|
/* Pad to an even boundary if you have to */
|
||||||
ardata->first_file_filepos += (ardata->first_file_filepos) %2;
|
ardata->first_file_filepos += (ardata->first_file_filepos) %2;
|
||||||
free (raw_armap);
|
|
||||||
free (mapdata);
|
|
||||||
bfd_has_map (abfd) = true;
|
bfd_has_map (abfd) = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -580,18 +572,18 @@ _bfd_slurp_extended_name_table (abfd)
|
||||||
if (namedata == NULL) return false;
|
if (namedata == NULL) return false;
|
||||||
|
|
||||||
|
|
||||||
bfd_ardata (abfd)->extended_names = zalloc (namedata->parsed_size);
|
bfd_ardata (abfd)->extended_names = bfd_zalloc(abfd,namedata->parsed_size);
|
||||||
if (bfd_ardata (abfd)->extended_names == NULL) {
|
if (bfd_ardata (abfd)->extended_names == NULL) {
|
||||||
bfd_error = no_memory;
|
bfd_error = no_memory;
|
||||||
byebye:
|
byebye:
|
||||||
free (namedata);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bfd_read ((PTR)bfd_ardata (abfd)->extended_names, 1,
|
if (bfd_read ((PTR)bfd_ardata (abfd)->extended_names, 1,
|
||||||
namedata->parsed_size, abfd) != namedata->parsed_size) {
|
namedata->parsed_size, abfd) != namedata->parsed_size) {
|
||||||
bfd_error = malformed_archive;
|
bfd_error = malformed_archive;
|
||||||
free (bfd_ardata (abfd)->extended_names);
|
|
||||||
bfd_ardata (abfd)->extended_names = NULL;
|
bfd_ardata (abfd)->extended_names = NULL;
|
||||||
goto byebye;
|
goto byebye;
|
||||||
}
|
}
|
||||||
|
@ -609,7 +601,7 @@ _bfd_slurp_extended_name_table (abfd)
|
||||||
bfd_ardata (abfd)->first_file_filepos +=
|
bfd_ardata (abfd)->first_file_filepos +=
|
||||||
(bfd_ardata (abfd)->first_file_filepos) %2;
|
(bfd_ardata (abfd)->first_file_filepos) %2;
|
||||||
|
|
||||||
free (namedata);
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -656,7 +648,7 @@ bfd_construct_extended_name_table (abfd, tabloc, tablen)
|
||||||
|
|
||||||
if (total_namelen == 0) return true;
|
if (total_namelen == 0) return true;
|
||||||
|
|
||||||
*tabloc = zalloc (total_namelen);
|
*tabloc = bfd_zalloc (abfd,total_namelen);
|
||||||
if (*tabloc == NULL) {
|
if (*tabloc == NULL) {
|
||||||
bfd_error = no_memory;
|
bfd_error = no_memory;
|
||||||
return false;
|
return false;
|
||||||
|
@ -701,8 +693,9 @@ bfd_construct_extended_name_table (abfd, tabloc, tablen)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct areltdata *
|
struct areltdata *
|
||||||
bfd_ar_hdr_from_filesystem (filename)
|
DEFUN(bfd_ar_hdr_from_filesystem, (abfd,filename),
|
||||||
char *filename;
|
bfd* abfd AND
|
||||||
|
CONST char *filename)
|
||||||
{
|
{
|
||||||
struct stat status;
|
struct stat status;
|
||||||
struct areltdata *ared;
|
struct areltdata *ared;
|
||||||
|
@ -715,7 +708,7 @@ bfd_ar_hdr_from_filesystem (filename)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ared = (struct areltdata *) zalloc (sizeof (struct ar_hdr) +
|
ared = (struct areltdata *) bfd_zalloc(abfd, sizeof (struct ar_hdr) +
|
||||||
sizeof (struct areltdata));
|
sizeof (struct areltdata));
|
||||||
if (ared == NULL) {
|
if (ared == NULL) {
|
||||||
bfd_error = no_memory;
|
bfd_error = no_memory;
|
||||||
|
@ -751,11 +744,12 @@ bfd_ar_hdr_from_filesystem (filename)
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ar_hdr *
|
struct ar_hdr *
|
||||||
bfd_special_undocumented_glue (filename)
|
DEFUN(bfd_special_undocumented_glue, (abfd, filename),
|
||||||
char *filename;
|
bfd *abfd AND
|
||||||
|
char *filename)
|
||||||
{
|
{
|
||||||
|
|
||||||
return (struct ar_hdr *) bfd_ar_hdr_from_filesystem (filename) -> arch_header;
|
return (struct ar_hdr *) bfd_ar_hdr_from_filesystem (abfd, filename) -> arch_header;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -916,7 +910,7 @@ _bfd_write_archive_contents (arch)
|
||||||
}
|
}
|
||||||
if (!current->arelt_data) {
|
if (!current->arelt_data) {
|
||||||
current->arelt_data =
|
current->arelt_data =
|
||||||
(PTR) bfd_ar_hdr_from_filesystem (current->filename);
|
(PTR) bfd_ar_hdr_from_filesystem (arch, current->filename);
|
||||||
if (!current->arelt_data) return false;
|
if (!current->arelt_data) return false;
|
||||||
|
|
||||||
/* Put in the file name */
|
/* Put in the file name */
|
||||||
|
@ -951,7 +945,6 @@ _bfd_write_archive_contents (arch)
|
||||||
if (makemap && hasobjects) {
|
if (makemap && hasobjects) {
|
||||||
|
|
||||||
if (compute_and_write_armap (arch, elength) != true) {
|
if (compute_and_write_armap (arch, elength) != true) {
|
||||||
if (etable) free (etable);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -968,7 +961,7 @@ _bfd_write_archive_contents (arch)
|
||||||
bfd_write (&hdr, 1, sizeof (struct ar_hdr), arch);
|
bfd_write (&hdr, 1, sizeof (struct ar_hdr), arch);
|
||||||
bfd_write (etable, 1, elength, arch);
|
bfd_write (etable, 1, elength, arch);
|
||||||
if ((elength % 2) == 1) bfd_write ("\n", 1, 1, arch);
|
if ((elength % 2) == 1) bfd_write ("\n", 1, 1, arch);
|
||||||
if (etable) free (etable);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (current = arch->archive_head; current; current = current->next) {
|
for (current = arch->archive_head; current; current = current->next) {
|
||||||
|
@ -1018,7 +1011,7 @@ compute_and_write_armap (arch, elength)
|
||||||
if (elength != 0) elength += sizeof (struct ar_hdr);
|
if (elength != 0) elength += sizeof (struct ar_hdr);
|
||||||
elength += elength %2 ;
|
elength += elength %2 ;
|
||||||
|
|
||||||
map = (struct orl *) zalloc (orl_max * sizeof (struct orl));
|
map = (struct orl *) bfd_zalloc (arch,orl_max * sizeof (struct orl));
|
||||||
if (map == NULL) {
|
if (map == NULL) {
|
||||||
bfd_error = no_memory;
|
bfd_error = no_memory;
|
||||||
return false;
|
return false;
|
||||||
|
@ -1039,7 +1032,7 @@ compute_and_write_armap (arch, elength)
|
||||||
storage = get_symtab_upper_bound (current);
|
storage = get_symtab_upper_bound (current);
|
||||||
if (storage != 0) {
|
if (storage != 0) {
|
||||||
|
|
||||||
syms = (asymbol **) zalloc (storage);
|
syms = (asymbol **) bfd_zalloc (arch,storage);
|
||||||
if (syms == NULL) {
|
if (syms == NULL) {
|
||||||
bfd_error = no_memory; /* FIXME -- memory leak */
|
bfd_error = no_memory; /* FIXME -- memory leak */
|
||||||
return false;
|
return false;
|
||||||
|
@ -1057,7 +1050,7 @@ compute_and_write_armap (arch, elength)
|
||||||
if (orl_count == orl_max)
|
if (orl_count == orl_max)
|
||||||
{
|
{
|
||||||
orl_max *= 2;
|
orl_max *= 2;
|
||||||
map = (struct orl *) realloc ((char *) map,
|
map = (struct orl *) bfd_realloc (arch, (char *) map,
|
||||||
orl_max * sizeof (struct orl));
|
orl_max * sizeof (struct orl));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1075,11 +1068,11 @@ compute_and_write_armap (arch, elength)
|
||||||
/* OK, now we have collected all the data, let's write them out */
|
/* OK, now we have collected all the data, let's write them out */
|
||||||
if (!BFD_SEND (arch, write_armap,
|
if (!BFD_SEND (arch, write_armap,
|
||||||
(arch, elength, map, orl_count, stridx))) {
|
(arch, elength, map, orl_count, stridx))) {
|
||||||
free (map);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
free (map);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,15 +25,17 @@ DEBUG = -g
|
||||||
|
|
||||||
SCRIPTS = ld-gld68k.script ld-gld68k-Ur.script ld-gld68k-r.script \
|
SCRIPTS = ld-gld68k.script ld-gld68k-Ur.script ld-gld68k-r.script \
|
||||||
ld-gld.script ld-gld-Ur.script ld-gld-r.script ld-lnk960.script \
|
ld-gld.script ld-gld-Ur.script ld-gld-r.script ld-lnk960.script \
|
||||||
ld-lnk960-r.script ld-gld960.script
|
ld-lnk960-r.script ld-gld960.script \
|
||||||
|
ld-gldm88kbcs.script ld-gldm88kbcs-Ur.script ld-gldm88kbcs-r.script
|
||||||
|
|
||||||
PROCESSED_SCRIPTS = ld-gld68k.x ld-gld68k-Ur.x ld-gld68k-r.x ld-gld.x \
|
PROCESSED_SCRIPTS = ld-gld68k.x ld-gld68k-Ur.x ld-gld68k-r.x ld-gld.x \
|
||||||
ld-gld-Ur.x ld-gld-r.x ld-lnk960.x ld-lnk960-r.x ld-gld960.x
|
ld-gld-Ur.x ld-gld-r.x ld-lnk960.x ld-lnk960-r.x ld-gld960.x \
|
||||||
|
ld-gldm88kbcs.x ld-gldm88kbcs-Ur.x ld-gldm88kbcs-r.x
|
||||||
|
|
||||||
#### target and host dependent Makefile fragments come in here.
|
#### target and host dependent Makefile fragments come in here.
|
||||||
###
|
###
|
||||||
|
|
||||||
CFLAGS = $(INCLUDES) $(DEBUG) $(HDEFINES) $(TDEFINES)
|
CFLAGS = $(INCLUDES) $(DEBUG) $(HDEFINES) $(TDEFINES) $(CDEFINES)
|
||||||
LINTFLAGS = $(INCLUDES) $(EXTRA_DEF)
|
LINTFLAGS = $(INCLUDES) $(EXTRA_DEF)
|
||||||
|
|
||||||
.SUFFIXES: .y .x .script $(SUFFIXES)
|
.SUFFIXES: .y .x .script $(SUFFIXES)
|
||||||
|
@ -58,6 +60,7 @@ LDEMULATION=gld
|
||||||
BFDLIB=$(srcdir)/../bfd$(subdir)/libbfd.a
|
BFDLIB=$(srcdir)/../bfd$(subdir)/libbfd.a
|
||||||
|
|
||||||
OFILES= ldgram.o ldlex.o ldlang.o ldmain.o ldwrite.o ldexp.o ld-lnk960.o ld-gld68k.o \
|
OFILES= ldgram.o ldlex.o ldlang.o ldmain.o ldwrite.o ldexp.o ld-lnk960.o ld-gld68k.o \
|
||||||
|
ld-gldm88kbcs.o \
|
||||||
ld-gld.o ld-gld960.o ld-emul.o ldversion.o ldmisc.o ldsym.o ld-vanilla.o ldfile.o
|
ld-gld.o ld-gld960.o ld-emul.o ldversion.o ldmisc.o ldsym.o ld-vanilla.o ldfile.o
|
||||||
|
|
||||||
HEADERS=config.h ldmain.h ldmain.h ldmisc.h ldsym.h ldlang.h ldexp.h \
|
HEADERS=config.h ldmain.h ldmain.h ldmisc.h ldsym.h ldlang.h ldexp.h \
|
||||||
|
@ -66,6 +69,7 @@ HEADERS=config.h ldmain.h ldmain.h ldmisc.h ldsym.h ldlang.h ldexp.h \
|
||||||
MANSOURCES=ld.tex
|
MANSOURCES=ld.tex
|
||||||
|
|
||||||
LDCSOURCES=ldlang.c ldmain.c ldwrite.c ld-lnk960.c ld-gld.c ld-gld68k.c \
|
LDCSOURCES=ldlang.c ldmain.c ldwrite.c ld-lnk960.c ld-gld.c ld-gld68k.c \
|
||||||
|
ld-gldm88kbcs.c \
|
||||||
ld-gld960.c ld-emul.c ldversion.c ldmisc.c ldexp.c ldsym.c ldfile.c ld-vanilla.c
|
ld-gld960.c ld-emul.c ldversion.c ldmisc.c ldexp.c ldsym.c ldfile.c ld-vanilla.c
|
||||||
|
|
||||||
GENERATED_SOURCES=ldgram.tab.c ldlex.c ldgram.tab.h y.tab.h
|
GENERATED_SOURCES=ldgram.tab.c ldlex.c ldgram.tab.h y.tab.h
|
||||||
|
@ -128,6 +132,7 @@ ldlang.o: ldlang.c ldgram.tab.h
|
||||||
|
|
||||||
ld-gld68k.o: $(PROCESSED_SCRIPTS) ld-gld68k.c
|
ld-gld68k.o: $(PROCESSED_SCRIPTS) ld-gld68k.c
|
||||||
ld-gld960.o: $(PROCESSED_SCRIPTS) ld-gld960.c
|
ld-gld960.o: $(PROCESSED_SCRIPTS) ld-gld960.c
|
||||||
|
ld-gldm88kbcs.o: $(PROCESSED_SCRIPTS) ld-gldm88kbcs.c
|
||||||
ld-emul.o: ld-emul.c
|
ld-emul.o: ld-emul.c
|
||||||
ld-vanilla.o: ld-vanilla.c
|
ld-vanilla.o: ld-vanilla.c
|
||||||
ld-lnk960.o: $(PROCESSED_SCRIPTS) ld-lnk960.c
|
ld-lnk960.o: $(PROCESSED_SCRIPTS) ld-lnk960.c
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
/* If in there look for the strings: */
|
/* If in there look for the strings: */
|
||||||
#define GLD_EMULATION_NAME "gld"
|
#define GLD_EMULATION_NAME "gld"
|
||||||
#define VANILLA_EMULATION_NAME "vanilla"
|
#define VANILLA_EMULATION_NAME "vanilla"
|
||||||
|
#define GLDM88KBCS_EMULATION_NAME "gldm88kbcs"
|
||||||
#define GLD68K_EMULATION_NAME "gld68k"
|
#define GLD68K_EMULATION_NAME "gld68k"
|
||||||
#define GLD960_EMULATION_NAME "gld960"
|
#define GLD960_EMULATION_NAME "gld960"
|
||||||
#define LNK960_EMULATION_NAME "lnk960"
|
#define LNK960_EMULATION_NAME "lnk960"
|
||||||
|
@ -43,7 +44,7 @@
|
||||||
#define LNK960_TARGET "coff-Intel-big"
|
#define LNK960_TARGET "coff-Intel-big"
|
||||||
#define GLD960_TARGET "b.out.big"
|
#define GLD960_TARGET "b.out.big"
|
||||||
#define VANILLA_TARGET "a.out-generic-big"
|
#define VANILLA_TARGET "a.out-generic-big"
|
||||||
|
#define GLDM88KBCS_TARGET "m88kbcs"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
#include "ldmisc.h"
|
#include "ldmisc.h"
|
||||||
|
|
||||||
extern ld_emulation_xfer_type ld_lnk960_emulation;
|
extern ld_emulation_xfer_type ld_lnk960_emulation;
|
||||||
|
extern ld_emulation_xfer_type ld_gldm88kbcs_emulation;
|
||||||
extern ld_emulation_xfer_type ld_gld_emulation;
|
extern ld_emulation_xfer_type ld_gld_emulation;
|
||||||
extern ld_emulation_xfer_type ld_vanilla_emulation;
|
extern ld_emulation_xfer_type ld_vanilla_emulation;
|
||||||
extern ld_emulation_xfer_type ld_gld68k_emulation;
|
extern ld_emulation_xfer_type ld_gld68k_emulation;
|
||||||
|
@ -111,6 +112,9 @@ char *target;
|
||||||
else if (strcmp(target,GLD960_EMULATION_NAME)==0) {
|
else if (strcmp(target,GLD960_EMULATION_NAME)==0) {
|
||||||
ld_emulation = &ld_gld960_emulation;
|
ld_emulation = &ld_gld960_emulation;
|
||||||
}
|
}
|
||||||
|
else if (strcmp(target,GLDM88KBCS_EMULATION_NAME)==0) {
|
||||||
|
ld_emulation = &ld_gldm88kbcs_emulation;
|
||||||
|
}
|
||||||
#ifndef GNU960
|
#ifndef GNU960
|
||||||
else if (strcmp(target,GLD_EMULATION_NAME)==0) {
|
else if (strcmp(target,GLD_EMULATION_NAME)==0) {
|
||||||
ld_emulation = &ld_gld_emulation;
|
ld_emulation = &ld_gld_emulation;
|
||||||
|
|
|
@ -54,7 +54,6 @@ static void gld_before_parse()
|
||||||
ldfile_add_library_path("/lib");
|
ldfile_add_library_path("/lib");
|
||||||
ldfile_add_library_path("/usr/lib");
|
ldfile_add_library_path("/usr/lib");
|
||||||
ldfile_add_library_path("/usr/local/lib/lib");
|
ldfile_add_library_path("/usr/local/lib/lib");
|
||||||
ldfile_output_architecture = bfd_arch_sparc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -81,8 +80,7 @@ static void
|
||||||
gld_set_output_arch()
|
gld_set_output_arch()
|
||||||
{
|
{
|
||||||
/* Set the output architecture and machine if possible */
|
/* Set the output architecture and machine if possible */
|
||||||
unsigned long machine = 0;
|
bfd_set_arch_mach(output_bfd, ldfile_output_architecture, ldfile_output_machine);
|
||||||
bfd_set_arch_mach(output_bfd, ldfile_output_architecture, machine);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
|
OUTPUT_ARCH(sparc)
|
||||||
|
OUTPUT_FORMAT("a.out-generic-big")
|
||||||
SEARCH_DIR(/lib)
|
SEARCH_DIR(/lib)
|
||||||
SEARCH_DIR(/usr/lib)
|
SEARCH_DIR(/usr/lib)
|
||||||
SEARCH_DIR(/usr/local/lib)
|
SEARCH_DIR(/usr/local/lib)
|
||||||
|
|
|
@ -326,7 +326,7 @@ bfd_vma dot;
|
||||||
sdef->section->vma : 0));
|
sdef->section->vma : 0));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
result = new_rel(sdef->value, os);
|
result = new_rel(sdef->value + sdef->section->output_offset, os);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
17
ld/ldfile.c
17
ld/ldfile.c
|
@ -333,3 +333,20 @@ DEFUN(ldfile_add_arch,(in_name),
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Set the output architecture */
|
||||||
|
void
|
||||||
|
DEFUN(ldfile_set_output_arch,(string),
|
||||||
|
CONST char *string)
|
||||||
|
{
|
||||||
|
enum bfd_architecture arch;
|
||||||
|
unsigned long machine;
|
||||||
|
if (bfd_scan_arch_mach(string, &arch, &machine) == true) {
|
||||||
|
ldfile_output_architecture = arch;
|
||||||
|
ldfile_output_machine = machine;
|
||||||
|
ldfile_output_machine_name = string;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
info("%P%F: Can't represent machine `%s'\n", string);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
18
ld/ldgram.y
18
ld/ldgram.y
|
@ -62,7 +62,6 @@ boolean had_script = false;
|
||||||
boolean force_make_executable = false;
|
boolean force_make_executable = false;
|
||||||
|
|
||||||
boolean ldgram_in_script = false;
|
boolean ldgram_in_script = false;
|
||||||
boolean ldgram_in_defsym = false;
|
|
||||||
boolean ldgram_had_equals = false;
|
boolean ldgram_had_equals = false;
|
||||||
/* LOCALS */
|
/* LOCALS */
|
||||||
|
|
||||||
|
@ -113,7 +112,7 @@ boolean ldgram_had_equals = false;
|
||||||
%token <token> ALIGN_K BLOCK LONG SHORT BYTE
|
%token <token> ALIGN_K BLOCK LONG SHORT BYTE
|
||||||
%token SECTIONS
|
%token SECTIONS
|
||||||
%token '{' '}'
|
%token '{' '}'
|
||||||
%token ALIGNMENT SIZEOF_HEADERS OUTPUT_FORMAT FORCE_COMMON_ALLOCATION
|
%token ALIGNMENT SIZEOF_HEADERS OUTPUT_FORMAT FORCE_COMMON_ALLOCATION OUTPUT_ARCH
|
||||||
%token NEXT SIZEOF ADDR SCRIPT ENDSCRIPT
|
%token NEXT SIZEOF ADDR SCRIPT ENDSCRIPT
|
||||||
%token MEMORY
|
%token MEMORY
|
||||||
%token DSECT NOLOAD COPY INFO OVERLAY
|
%token DSECT NOLOAD COPY INFO OVERLAY
|
||||||
|
@ -121,8 +120,8 @@ boolean ldgram_had_equals = false;
|
||||||
%token OPTION_e OPTION_c OPTION_noinhibit_exec OPTION_s OPTION_S
|
%token OPTION_e OPTION_c OPTION_noinhibit_exec OPTION_s OPTION_S
|
||||||
%token OPTION_format OPTION_F OPTION_u
|
%token OPTION_format OPTION_F OPTION_u
|
||||||
|
|
||||||
%token OPTION_d OPTION_dc OPTION_dp OPTION_x OPTION_X
|
%token OPTION_d OPTION_dc OPTION_dp OPTION_x OPTION_X OPTION_defsym
|
||||||
%token OPTION_v OPTION_M OPTION_t STARTUP HLL SYSLIB FLOAT NOFLOAT OPTION_defsym
|
%token OPTION_v OPTION_M OPTION_t STARTUP HLL SYSLIB FLOAT NOFLOAT
|
||||||
%token OPTION_n OPTION_r OPTION_o OPTION_b OPTION_A OPTION_R
|
%token OPTION_n OPTION_r OPTION_o OPTION_b OPTION_A OPTION_R
|
||||||
%token <name> OPTION_l OPTION_L OPTION_T OPTION_Aarch OPTION_Tfile OPTION_Texp
|
%token <name> OPTION_l OPTION_L OPTION_T OPTION_Aarch OPTION_Tfile OPTION_Texp
|
||||||
%token OPTION_Ur
|
%token OPTION_Ur
|
||||||
|
@ -152,11 +151,11 @@ command_line:
|
||||||
;
|
;
|
||||||
|
|
||||||
command_line_option:
|
command_line_option:
|
||||||
SCRIPT
|
'{'
|
||||||
{ ldgram_in_script = true; }
|
{ ldgram_in_script = true; }
|
||||||
ifile_list
|
ifile_list
|
||||||
{ ldgram_in_script = false; }
|
{ ldgram_in_script = false; }
|
||||||
ENDSCRIPT
|
'}'
|
||||||
| OPTION_v
|
| OPTION_v
|
||||||
{
|
{
|
||||||
ldversion();
|
ldversion();
|
||||||
|
@ -280,14 +279,11 @@ command_line_option:
|
||||||
}
|
}
|
||||||
| OPTION_defsym
|
| OPTION_defsym
|
||||||
{
|
{
|
||||||
ldgram_in_defsym = true;
|
|
||||||
ldgram_had_equals = false;
|
|
||||||
}
|
}
|
||||||
NAME '='
|
NAME '='
|
||||||
exp_head
|
exp_head
|
||||||
{
|
{
|
||||||
lang_add_assignment(exp_assop($4,$3,$5));
|
lang_add_assignment(exp_assop($4,$3,$5));
|
||||||
ldgram_in_defsym = false;
|
|
||||||
}
|
}
|
||||||
| '-' NAME
|
| '-' NAME
|
||||||
{ info("%P%F Unrecognised option -%s\n", $2); }
|
{ info("%P%F Unrecognised option -%s\n", $2); }
|
||||||
|
@ -303,7 +299,7 @@ command_line_option:
|
||||||
|
|
||||||
script_file:
|
script_file:
|
||||||
{ ldgram_in_script = true; }
|
{ ldgram_in_script = true; }
|
||||||
ifile_list ENDSCRIPT
|
ifile_list '}'
|
||||||
{ ldgram_in_script = false; }
|
{ ldgram_in_script = false; }
|
||||||
|
|
||||||
;
|
;
|
||||||
|
@ -332,6 +328,8 @@ ifile_p1:
|
||||||
{ lang_add_output($3); }
|
{ lang_add_output($3); }
|
||||||
| OUTPUT_FORMAT '(' NAME ')'
|
| OUTPUT_FORMAT '(' NAME ')'
|
||||||
{ lang_add_output_format($3); }
|
{ lang_add_output_format($3); }
|
||||||
|
| OUTPUT_ARCH '(' NAME ')'
|
||||||
|
{ ldfile_set_output_arch($3); }
|
||||||
| FORCE_COMMON_ALLOCATION
|
| FORCE_COMMON_ALLOCATION
|
||||||
{ command_line.force_common_definition = true ; }
|
{ command_line.force_common_definition = true ; }
|
||||||
| INPUT '(' input_list ')'
|
| INPUT '(' input_list ')'
|
||||||
|
|
|
@ -1015,6 +1015,7 @@ DEFUN(print_input_section,(in),
|
||||||
else {
|
else {
|
||||||
printf("%s", abfd->filename);
|
printf("%s", abfd->filename);
|
||||||
}
|
}
|
||||||
|
printf("(%d bytes)", bfd_alloc_size(abfd));
|
||||||
print_nl();
|
print_nl();
|
||||||
|
|
||||||
/* Find all the symbols in this file defined in this section */
|
/* Find all the symbols in this file defined in this section */
|
||||||
|
@ -2237,3 +2238,4 @@ CONST char *format)
|
||||||
{
|
{
|
||||||
output_target = format;
|
output_target = format;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -341,4 +341,4 @@ PROTO(lang_output_section_statement_type *,
|
||||||
lang_output_section_statement_lookup,(CONST char * CONST name));
|
lang_output_section_statement_lookup,(CONST char * CONST name));
|
||||||
|
|
||||||
PROTO(void, ldlang_add_undef,(CONST char *CONST name));
|
PROTO(void, ldlang_add_undef,(CONST char *CONST name));
|
||||||
|
PROTO(void, lang_add_output_format,(CONST char *));
|
||||||
|
|
29
ld/ldlex.l
29
ld/ldlex.l
|
@ -47,7 +47,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
int debug;
|
int debug;
|
||||||
|
|
||||||
|
|
||||||
extern boolean ldgram_in_defsym;
|
static boolean ldgram_in_defsym;
|
||||||
static boolean ldgram_had_equals;
|
static boolean ldgram_had_equals;
|
||||||
extern boolean ldgram_in_script;
|
extern boolean ldgram_in_script;
|
||||||
static char *command_line;
|
static char *command_line;
|
||||||
|
@ -87,6 +87,7 @@ keyword_type keywords[] =
|
||||||
"FILL",FILL,
|
"FILL",FILL,
|
||||||
"STARTUP",STARTUP,
|
"STARTUP",STARTUP,
|
||||||
"OUTPUT_FORMAT",OUTPUT_FORMAT,
|
"OUTPUT_FORMAT",OUTPUT_FORMAT,
|
||||||
|
"OUTPUT_ARCH", OUTPUT_ARCH,
|
||||||
"HLL",HLL,
|
"HLL",HLL,
|
||||||
"SYSLIB",SYSLIB,
|
"SYSLIB",SYSLIB,
|
||||||
"FLOAT",FLOAT,
|
"FLOAT",FLOAT,
|
||||||
|
@ -125,7 +126,7 @@ lex_input()
|
||||||
ldlex_input_stack = (FILE *)NULL;
|
ldlex_input_stack = (FILE *)NULL;
|
||||||
ldfile_input_filename = (char *)NULL;
|
ldfile_input_filename = (char *)NULL;
|
||||||
/* First char after script eof is a @ so that we can tell the grammer
|
/* First char after script eof is a @ so that we can tell the grammer
|
||||||
that we've eft */
|
that we've left */
|
||||||
thischar = '@';
|
thischar = '@';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -269,12 +270,13 @@ WHITE [ \t]+
|
||||||
|
|
||||||
%%
|
%%
|
||||||
|
|
||||||
"@" { return ENDSCRIPT; }
|
"@" { return '}'; }
|
||||||
"\ -defsym\ " { return OPTION_defsym; }
|
"\ -defsym\ " { ldgram_in_defsym = true; return OPTION_defsym; }
|
||||||
"\ -noinhibit_exec\ " { return OPTION_noinhibit_exec; }
|
"\ -noinhibit_exec\ " { return OPTION_noinhibit_exec; }
|
||||||
"\ -format\ " { return OPTION_format; }
|
"\ -format\ " { return OPTION_format; }
|
||||||
"\ -n\ " { return OPTION_n; }
|
"\ -n\ " { return OPTION_n; }
|
||||||
"\ -r\ " { return OPTION_r; }
|
"\ -r\ " { return OPTION_r; }
|
||||||
|
"\ -i\ " { return OPTION_r; }
|
||||||
"\ -Ur\ " { return OPTION_Ur; }
|
"\ -Ur\ " { return OPTION_Ur; }
|
||||||
"\ -o\ " { return OPTION_o; }
|
"\ -o\ " { return OPTION_o; }
|
||||||
"\ -g\ " { return OPTION_g; }
|
"\ -g\ " { return OPTION_g; }
|
||||||
|
@ -293,6 +295,7 @@ WHITE [ \t]+
|
||||||
"\ -u\ " { return OPTION_u; }
|
"\ -u\ " { return OPTION_u; }
|
||||||
"\ -s\ " { return OPTION_s; }
|
"\ -s\ " { return OPTION_s; }
|
||||||
"\ -S\ " { return OPTION_S; }
|
"\ -S\ " { return OPTION_S; }
|
||||||
|
"\ -B{FILENAME}\ " { /* Ignored */ }
|
||||||
"\ -l"{FILENAME} {
|
"\ -l"{FILENAME} {
|
||||||
yylval.name = buystring(yytext+3);
|
yylval.name = buystring(yytext+3);
|
||||||
return OPTION_l;
|
return OPTION_l;
|
||||||
|
@ -335,7 +338,12 @@ WHITE [ \t]+
|
||||||
return OPTION_Aarch;
|
return OPTION_Aarch;
|
||||||
}
|
}
|
||||||
|
|
||||||
" " { if (ldgram_had_equals == true) ldgram_in_defsym = false; }
|
" " {
|
||||||
|
if (ldgram_had_equals == true) {
|
||||||
|
ldgram_in_defsym = false;
|
||||||
|
ldgram_had_equals = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
"<<=" { RTOKEN(LSHIFTEQ);}
|
"<<=" { RTOKEN(LSHIFTEQ);}
|
||||||
">>=" { RTOKEN(RSHIFTEQ);}
|
">>=" { RTOKEN(RSHIFTEQ);}
|
||||||
"||" { RTOKEN(OROR);}
|
"||" { RTOKEN(OROR);}
|
||||||
|
@ -471,6 +479,17 @@ WHITE [ \t]+
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
if(ldgram_in_script == true) {
|
||||||
|
switch (ch) {
|
||||||
|
case '*':
|
||||||
|
case '=':
|
||||||
|
case '+':
|
||||||
|
case '-':
|
||||||
|
case '!':
|
||||||
|
case '~':
|
||||||
|
goto quit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (isalpha(ch) || isdigit(ch) || ch == '.' || ch == '_' ||
|
if (isalpha(ch) || isdigit(ch) || ch == '.' || ch == '_' ||
|
||||||
ch == '/' || ch == '.' || ch == '+' || ch == '-' || ch =='=') {
|
ch == '/' || ch == '.' || ch == '+' || ch == '-' || ch =='=') {
|
||||||
|
|
|
@ -6,15 +6,20 @@ main()
|
||||||
int ch;
|
int ch;
|
||||||
ch = getchar();
|
ch = getchar();
|
||||||
printf("/* Generated through mkscript */\n");
|
printf("/* Generated through mkscript */\n");
|
||||||
printf("\"SCRIPT \\\n");
|
printf("\"{ \\\n");
|
||||||
while (ch != EOF) {
|
while (ch != EOF) {
|
||||||
if (ch == '\n') {
|
if (ch == '\"') {
|
||||||
|
putchar('\\');
|
||||||
|
putchar('\"');
|
||||||
|
}
|
||||||
|
else { if (ch == '\n') {
|
||||||
putchar(' ');
|
putchar(' ');
|
||||||
putchar('\\');
|
putchar('\\');
|
||||||
}
|
}
|
||||||
putchar(ch);
|
putchar(ch);
|
||||||
|
}
|
||||||
ch = getchar();
|
ch = getchar();
|
||||||
}
|
}
|
||||||
printf("ENDSCRIPT\"\n");
|
printf("}\"\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue