diff -rU10 virgin/yasm-r1818/modules/objfmts/macho/macho-objfmt.c yasm-r1818/modules/objfmts/macho/macho-objfmt.c
|
old
|
new
|
|
| 1404 | 1404 | |
| 1405 | 1405 | sectname = vp->val; |
| 1406 | 1406 | |
| 1407 | 1407 | /* translate .text,.data,.bss to __text,__data,__bss... */ |
| 1408 | 1408 | for (i=0; i<NELEMS(section_name_translation); i++) { |
| 1409 | 1409 | if (yasm__strcasecmp(sectname, section_name_translation[i].in) == 0) |
| 1410 | 1410 | break; |
| 1411 | 1411 | } |
| 1412 | 1412 | |
| 1413 | 1413 | if (i == NELEMS(section_name_translation)) { |
| 1414 | | yasm_warn_set(YASM_WARN_GENERAL, |
| 1415 | | N_("Unknown section type, defaulting to .text")); |
| 1416 | | i = 0; |
| | 1414 | if (strlen(sectname) >= 16) { |
| | 1415 | yasm_error_set(YASM_ERROR_VALUE, |
| | 1416 | N_("The section name `%s' is too long, max 16 chars"), |
| | 1417 | sectname); |
| | 1418 | return NULL; |
| | 1419 | } |
| | 1420 | f_segname = "__TEXT"; |
| | 1421 | f_sectname = yasm__xstrdup(sectname); |
| | 1422 | flags = S_ATTR_SOME_INSTRUCTIONS; |
| | 1423 | align = 0; |
| | 1424 | i = -1; /* can be used as indicator further down */ |
| | 1425 | } else { |
| | 1426 | f_segname = section_name_translation[i].seg; |
| | 1427 | f_sectname = section_name_translation[i].sect; |
| | 1428 | flags = section_name_translation[i].flags; |
| | 1429 | align = section_name_translation[i].align; |
| 1417 | 1430 | } |
| 1418 | 1431 | |
| 1419 | | f_segname = section_name_translation[i].seg; |
| 1420 | | f_sectname = section_name_translation[i].sect; |
| 1421 | | flags = section_name_translation[i].flags; |
| 1422 | | align = section_name_translation[i].align; |
| 1423 | | |
| 1424 | 1432 | while ((vp = yasm_vps_next(vp))) { |
| 1425 | 1433 | if (!vp->val) { |
| 1426 | 1434 | yasm_warn_set(YASM_WARN_GENERAL, |
| 1427 | 1435 | N_("Unrecognized numeric qualifier")); |
| 1428 | 1436 | continue; |
| 1429 | 1437 | } |
| 1430 | 1438 | |
| 1431 | 1439 | flags_override = 1; |
| 1432 | 1440 | if (yasm__strcasecmp(vp->val, "align") == 0 && vp->param) { |
| 1433 | 1441 | /*@dependent@ *//*@null@ */ const yasm_intnum *align_expr; |
| … |
… |
|
| 1448 | 1456 | vp->val); |
| 1449 | 1457 | return NULL; |
| 1450 | 1458 | } |
| 1451 | 1459 | |
| 1452 | 1460 | /* Check to see if alignment is supported size */ |
| 1453 | 1461 | if (align > 16384) { |
| 1454 | 1462 | yasm_error_set(YASM_ERROR_VALUE, |
| 1455 | 1463 | N_("macho implementation does not support alignments > 16384")); |
| 1456 | 1464 | return NULL; |
| 1457 | 1465 | } |
| 1458 | | } else |
| 1459 | | yasm_warn_set(YASM_WARN_GENERAL, |
| 1460 | | N_("Unrecognized qualifier `%s'"), vp->val); |
| | 1466 | } else if (yasm__strcasecmp(vp->val, "segname") == 0) { |
| | 1467 | if (vp->param) { |
| | 1468 | yasm_error_set(YASM_ERROR_VALUE, |
| | 1469 | N_("The `segname' attribute for section `%s' has a parameter. " |
| | 1470 | "Try drop any `=' or similar between the `segname' and the name."), |
| | 1471 | sectname); |
| | 1472 | return NULL; |
| | 1473 | } |
| | 1474 | vp = yasm_vps_next(vp); |
| | 1475 | if (!vp) { |
| | 1476 | yasm_error_set(YASM_ERROR_VALUE, |
| | 1477 | N_("The `segname' attribute for section `%s' is missing the name"), |
| | 1478 | sectname); |
| | 1479 | return NULL; |
| | 1480 | } |
| | 1481 | if (strlen(vp->val) >= 16) { |
| | 1482 | yasm_error_set(YASM_ERROR_VALUE, |
| | 1483 | N_("The segment name `%s' for section `%s' is too long, max 16 chars"), |
| | 1484 | sectname, vp->val); |
| | 1485 | return NULL; |
| | 1486 | } |
| | 1487 | f_segname = yasm__xstrdup(vp->val); |
| | 1488 | } else { |
| | 1489 | yasm_error_set(YASM_ERROR_VALUE, |
| | 1490 | N_("Unrecognized qualifier `%s' or missing parameter in the section defintion of `%s'"), |
| | 1491 | vp->val, sectname); |
| | 1492 | return NULL; |
| | 1493 | } |
| 1461 | 1494 | } |
| 1462 | 1495 | |
| 1463 | 1496 | retval = yasm_object_get_general(object, sectname, 0, align, 1, resonly, |
| 1464 | 1497 | &isnew, line); |
| 1465 | 1498 | |
| 1466 | 1499 | if (isnew) |
| 1467 | 1500 | msd = macho_objfmt_init_new_section(object, retval, sectname, line); |
| 1468 | 1501 | else |
| 1469 | 1502 | msd = yasm_section_get_data(retval, &macho_section_data_cb); |
| 1470 | 1503 | |