Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(147)

Side by Side Diff: third_party/yasm/patched-yasm/modules/objfmts/xdf/xdf-objfmt.c

Issue 6170009: Update our yasm copy to yasm 1.1.0 (Part 1: yasm side)... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/
Patch Set: Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Extended Dynamic Object format 2 * Extended Dynamic Object format
3 * 3 *
4 * Copyright (C) 2004-2007 Peter Johnson 4 * Copyright (C) 2004-2007 Peter Johnson
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright 11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * 14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS'' 15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS''
16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE 18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE
19 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 19 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 * POSSIBILITY OF SUCH DAMAGE. 25 * POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 #include <util.h> 27 #include <util.h>
28 /*@unused@*/ RCSID("$Id: xdf-objfmt.c 2166 2009-01-02 08:33:21Z peter $"); 28 /*@unused@*/ RCSID("$Id: xdf-objfmt.c 2310 2010-03-28 19:28:54Z peter $");
29 29
30 #include <libyasm.h> 30 #include <libyasm.h>
31 31
32 32
33 #define REGULAR_OUTBUF_SIZE 1024 33 #define REGULAR_OUTBUF_SIZE 1024
34 34
35 #define XDF_MAGIC 0x87654322 35 #define XDF_MAGIC 0x87654322
36 36
37 #define XDF_SYM_EXTERN 1 37 #define XDF_SYM_EXTERN 1
38 #define XDF_SYM_GLOBAL 2 38 #define XDF_SYM_GLOBAL 2
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 597
598 yasm_xfree(info.buf); 598 yasm_xfree(info.buf);
599 } 599 }
600 600
601 static void 601 static void
602 xdf_objfmt_destroy(yasm_objfmt *objfmt) 602 xdf_objfmt_destroy(yasm_objfmt *objfmt)
603 { 603 {
604 yasm_xfree(objfmt); 604 yasm_xfree(objfmt);
605 } 605 }
606 606
607 static xdf_section_data * 607 static void
608 xdf_objfmt_init_new_section(yasm_object *object, yasm_section *sect, 608 xdf_objfmt_init_new_section(yasm_section *sect, unsigned long line)
609 const char *sectname, unsigned long line)
610 { 609 {
610 yasm_object *object = yasm_section_get_object(sect);
611 const char *sectname = yasm_section_get_name(sect);
611 yasm_objfmt_xdf *objfmt_xdf = (yasm_objfmt_xdf *)object->objfmt; 612 yasm_objfmt_xdf *objfmt_xdf = (yasm_objfmt_xdf *)object->objfmt;
612 xdf_section_data *data; 613 xdf_section_data *data;
613 yasm_symrec *sym; 614 yasm_symrec *sym;
614 615
615 data = yasm_xmalloc(sizeof(xdf_section_data)); 616 data = yasm_xmalloc(sizeof(xdf_section_data));
616 data->scnum = objfmt_xdf->parse_scnum++; 617 data->scnum = objfmt_xdf->parse_scnum++;
617 data->flags = 0; 618 data->flags = 0;
618 data->addr = NULL; 619 data->addr = NULL;
619 data->vaddr = NULL; 620 data->vaddr = NULL;
620 data->scnptr = 0; 621 data->scnptr = 0;
621 data->size = 0; 622 data->size = 0;
622 data->relptr = 0; 623 data->relptr = 0;
623 data->nreloc = 0; 624 data->nreloc = 0;
624 yasm_section_add_data(sect, &xdf_section_data_cb, data); 625 yasm_section_add_data(sect, &xdf_section_data_cb, data);
625 626
626 sym = yasm_symtab_define_label(object->symtab, sectname, 627 sym = yasm_symtab_define_label(object->symtab, sectname,
627 yasm_section_bcs_first(sect), 1, line); 628 yasm_section_bcs_first(sect), 1, line);
628 data->sym = sym; 629 data->sym = sym;
629 return data;
630 } 630 }
631 631
632 static yasm_section * 632 static yasm_section *
633 xdf_objfmt_add_default_section(yasm_object *object) 633 xdf_objfmt_add_default_section(yasm_object *object)
634 { 634 {
635 yasm_section *retval; 635 yasm_section *retval;
636 xdf_section_data *xsd;
637 int isnew; 636 int isnew;
638 637
639 retval = yasm_object_get_general(object, ".text", 0, 1, 0, &isnew, 0); 638 retval = yasm_object_get_general(object, ".text", 0, 1, 0, &isnew, 0);
640 if (isnew) { 639 if (isnew)
641 xsd = xdf_objfmt_init_new_section(object, retval, ".text", 0);
642 yasm_section_set_default(retval, 1); 640 yasm_section_set_default(retval, 1);
643 }
644 return retval; 641 return retval;
645 } 642 }
646 643
647 static int 644 static int
648 xdf_helper_use(void *obj, yasm_valparam *vp, unsigned long line, void *d, 645 xdf_helper_use(void *obj, yasm_valparam *vp, unsigned long line, void *d,
649 uintptr_t bits) 646 uintptr_t bits)
650 { 647 {
651 yasm_object *object = (yasm_object *)obj; 648 yasm_object *object = (yasm_object *)obj;
652 unsigned long *flags = (unsigned long *)d; 649 unsigned long *flags = (unsigned long *)d;
653 *flags &= ~(XDF_SECT_USE_16|XDF_SECT_USE_32|XDF_SECT_USE_64); 650 *flags &= ~(XDF_SECT_USE_16|XDF_SECT_USE_32|XDF_SECT_USE_64);
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 yasm_intnum_destroy(data.vaddr); 740 yasm_intnum_destroy(data.vaddr);
744 if (data.absaddr) 741 if (data.absaddr)
745 yasm_intnum_destroy(data.absaddr); 742 yasm_intnum_destroy(data.absaddr);
746 return NULL; 743 return NULL;
747 } 744 }
748 } 745 }
749 746
750 retval = yasm_object_get_general(object, sectname, align, 1, resonly, 747 retval = yasm_object_get_general(object, sectname, align, 1, resonly,
751 &isnew, line); 748 &isnew, line);
752 749
753 if (isnew) 750 xsd = yasm_section_get_data(retval, &xdf_section_data_cb);
754 xsd = xdf_objfmt_init_new_section(object, retval, sectname, line);
755 else
756 xsd = yasm_section_get_data(retval, &xdf_section_data_cb);
757 751
758 if (isnew || yasm_section_is_default(retval)) { 752 if (isnew || yasm_section_is_default(retval)) {
759 yasm_section_set_default(retval, 0); 753 yasm_section_set_default(retval, 0);
760 xsd->flags = data.flags; 754 xsd->flags = data.flags;
761 if (data.absaddr) { 755 if (data.absaddr) {
762 if (xsd->addr) 756 if (xsd->addr)
763 yasm_intnum_destroy(xsd->addr); 757 yasm_intnum_destroy(xsd->addr);
764 xsd->addr = data.absaddr; 758 xsd->addr = data.absaddr;
765 } 759 }
766 if (data.vaddr) { 760 if (data.vaddr) {
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
840 32, 834 32,
841 0, 835 0,
842 xdf_objfmt_dbgfmt_keywords, 836 xdf_objfmt_dbgfmt_keywords,
843 "null", 837 "null",
844 NULL, /* no directives */ 838 NULL, /* no directives */
845 NULL, /* no standard macros */ 839 NULL, /* no standard macros */
846 xdf_objfmt_create, 840 xdf_objfmt_create,
847 xdf_objfmt_output, 841 xdf_objfmt_output,
848 xdf_objfmt_destroy, 842 xdf_objfmt_destroy,
849 xdf_objfmt_add_default_section, 843 xdf_objfmt_add_default_section,
844 xdf_objfmt_init_new_section,
850 xdf_objfmt_section_switch, 845 xdf_objfmt_section_switch,
851 xdf_objfmt_get_special_sym 846 xdf_objfmt_get_special_sym
852 }; 847 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698