Skip to content

Commit

Permalink
wlink: add new global file format definition
Browse files Browse the repository at this point in the history
  • Loading branch information
jmalak committed Jun 3, 2024
1 parent e040f56 commit 10d56d6
Show file tree
Hide file tree
Showing 6 changed files with 137 additions and 106 deletions.
36 changes: 31 additions & 5 deletions bld/wl/c/loadphar.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
*
* Open Watcom Project
*
* Copyright (c) 2002-2023 The Open Watcom Contributors. All Rights Reserved.
* Copyright (c) 2002-2024 The Open Watcom Contributors. All Rights Reserved.
* Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
*
* ========================================================================
Expand Down Expand Up @@ -302,26 +302,52 @@ static void WritePharExtended( unsigned_32 start )
SeekLoad( start + HEAD_SIZE );
file_size = HEAD_SIZE;
if( FmtData.type & MK_PHAR_MULTISEG ) {
/*
* write sit info
*/
_HostU32toTarg( file_size, header.sit_offset );
temp = WriteSIT();
_HostU32toTarg( temp, header.sit_size );
file_size += temp;
_HostU16toTarg( sizeof( seg_info_table ), header.sit_entry_size );
/*
* write reloc info
*/
_HostU32toTarg( file_size, header.reloc_offset );
temp = WritePharRelocs();
_HostU32toTarg( temp, header.reloc_size );
file_size += temp;
/*
* write rtp block
*/
_HostU32toTarg( file_size, header.rtp_offset );
temp = WriteRTPBlock();
_HostU32toTarg( temp, header.rtp_size );
file_size += temp;
} else {
/*
* write sit info
*/
_HostU32toTarg( 0, header.sit_offset );
_HostU32toTarg( 0, header.sit_size );
_HostU16toTarg( 0, header.sit_entry_size );
/*
* write rtp block
*/
_HostU32toTarg( file_size, header.rtp_offset );
temp = WriteRTPBlock();
_HostU32toTarg( temp, header.rtp_size );
file_size += temp;
/*
* write reloc info
*/
_HostU32toTarg( file_size, header.reloc_offset );
_HostU32toTarg( 0, header.reloc_size );
// file_size += 0;
}
_HostU32toTarg( file_size, header.rtp_offset );
temp = WriteRTPBlock();
_HostU32toTarg( temp, header.rtp_size );
file_size += temp;
/*
* write image data
*/
image_offset = file_size;
if( FmtData.type & MK_PHAR_MULTISEG ) {
file_size += WritePharSegData();
Expand Down
55 changes: 55 additions & 0 deletions bld/wl/h/_formats.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/****************************************************************************
*
* Open Watcom Project
*
* Copyright (c) 2002-2024 The Open Watcom Contributors. All Rights Reserved.
* Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
*
* ========================================================================
*
* This file contains Original Code and/or Modifications of Original
* Code as defined in and that are subject to the Sybase Open Watcom
* Public License version 1.0 (the 'License'). You may not use this file
* except in compliance with the License. BY USING THIS FILE YOU AGREE TO
* ALL TERMS AND CONDITIONS OF THE LICENSE. A copy of the License is
* provided with the Original Code and Modifications, and is also
* available at www.sybase.com/developer/opensource.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND SYBASE AND ALL CONTRIBUTORS HEREBY DISCLAIM
* ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR
* NON-INFRINGEMENT. Please see the License for the specific language
* governing rights and limitations under the License.
*
* ========================================================================
*
* Description: Declararions for linker message output machinery.
*
****************************************************************************/


#define FORMATS() \
pick1( 0, MK_OS2_NE, "OS/2", "OS/2" ) \
pick1( 1, MK_OS2_LE, "OS/2 linear", "OS/2 リニア" ) \
pick1( 2, MK_OS2_LX, "OS/2 linear extended", "OS/2 リニア拡張" ) \
pick1( 3, MK_WIN_NE, "Windows", "Windows" ) \
pick1( 4, MK_PE, "PE", "PE" ) \
pick1( 5, MK_DOS_EXE, "DOS", "DOS" ) \
pick1( 6, MK_COM, "DOS .COM", "DOS .COM" ) \
pick1( 7, MK_OVERLAYS, "DOS overlayed", "DOS オーバレイ" ) \
pick1( 8, MK_NOVELL, "Novell Netware", "Novell Netware" ) \
pick1( 9, MK_QNX_16, "QNX", "QNX" ) \
pick1( 10, MK_PHAR_SIMPLE, "Phar Lap simple", "Phar Lap シンプル" ) \
pick1( 11, MK_PHAR_FLAT, "Phar Lap extended", "Phar Lap 拡張" ) \
pick1( 12, MK_PHAR_REX, "Phar Lap relocatable", "Phar Lap リロケータブル" ) \
pick1( 13, MK_PHAR_MULTISEG, "Phar Lap segmented", "Phar Lap セグメント" ) \
pick1( 14, MK_QNX_FLAT, "QNX 386", "QNX 386" ) \
pick1( 15, MK_ELF, "ELF", "ELF" ) \
pick1( 16, MK_WIN_VXD, "Windows VxD", "Windows VxD" ) \
pick1( 17, MK_DOS16M, "DOS/16M", "DOS/16M" ) \
pick1( 18, MK_ZDOS, "ZDOS", "ZDOS" ) \
pick1( 19, MK_RAW, "RAW Binary Image", "Raw" ) \
pick1( 20, MK_RDOS_32, "RDOS", "RDOS" ) \
pick1( 21, MK_RDOS_16, "RDOS 16-bit", "RDOS 16-bit" )
30 changes: 6 additions & 24 deletions bld/wl/h/formats.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
*
* Open Watcom Project
*
* Copyright (c) 2002-2023 The Open Watcom Contributors. All Rights Reserved.
* Copyright (c) 2002-2024 The Open Watcom Contributors. All Rights Reserved.
* Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
*
* ========================================================================
Expand Down Expand Up @@ -30,31 +30,13 @@
****************************************************************************/


#include "_formats.h"

typedef enum { // there is a corresp. table in MSG.C
MK_OS2_NE = CONSTU32( 0x00000001 ),
MK_OS2_LE = CONSTU32( 0x00000002 ),
MK_OS2_LX = CONSTU32( 0x00000004 ),
MK_WIN_NE = CONSTU32( 0x00000008 ),
MK_PE = CONSTU32( 0x00000010 ),
MK_DOS_EXE = CONSTU32( 0x00000020 ),
MK_COM = CONSTU32( 0x00000040 ),
MK_OVERLAYS = CONSTU32( 0x00000080 ),
MK_NOVELL = CONSTU32( 0x00000100 ),
MK_QNX_16 = CONSTU32( 0x00000200 ), // POSIX QNX, not ICON QNX
MK_PHAR_SIMPLE = CONSTU32( 0x00000400 ),
MK_PHAR_FLAT = CONSTU32( 0x00000800 ),
MK_PHAR_REX = CONSTU32( 0x00001000 ),
MK_PHAR_MULTISEG = CONSTU32( 0x00002000 ),
MK_QNX_FLAT = CONSTU32( 0x00004000 ),
MK_ELF = CONSTU32( 0x00008000 ),
MK_WIN_VXD = CONSTU32( 0x00010000 ),
MK_DOS16M = CONSTU32( 0x00020000 ),
MK_ZDOS = CONSTU32( 0x00040000 ),
MK_RAW = CONSTU32( 0x00080000 ),
MK_RDOS_32 = CONSTU32( 0x00100000 ),
MK_RDOS_16 = CONSTU32( 0x00200000 ),
MK_ALL = CONSTU32( 0x003FFFFF ),
#define pick1(a,b,c,d) b = CONSTU32( 1 << a ),
FORMATS()
#undef pick1
MK_ALL = CONSTU32( (1 << 22) - 1 ),
} exe_format;

#define MK_DOS (MK_OVERLAYS | MK_DOS_EXE | MK_COM)
Expand Down
70 changes: 37 additions & 33 deletions bld/wl/h/wlmsgs.rh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
*
* Open Watcom Project
*
* Copyright (c) 2002-2022 The Open Watcom Contributors. All Rights Reserved.
* Copyright (c) 2002-2024 The Open Watcom Contributors. All Rights Reserved.
* Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
*
* ========================================================================
Expand Down Expand Up @@ -233,38 +233,42 @@
#define MSG_IOERRLIST_7 249 + MSG_BASE
#define MSG_PRESS_KEY 250 + MSG_BASE

#define MSG_FILE_TYPES_0 251 + MSG_BASE /* OS/2 NE */
#define MSG_FILE_TYPES_1 252 + MSG_BASE /* OS/2 LE */
#define MSG_FILE_TYPES_2 253 + MSG_BASE /* OS/2 LX */
#define MSG_FILE_TYPES_3 254 + MSG_BASE /* Windows NE */
#define MSG_FILE_TYPES_4 255 + MSG_BASE /* NT PE */
#define MSG_FILE_TYPES_5 256 + MSG_BASE /* DOS EXE */
#define MSG_FILE_TYPES_6 257 + MSG_BASE /* DOS COM */
#define MSG_FILE_TYPES_7 258 + MSG_BASE /* DOS Overlay */
#define MSG_FILE_TYPES_8 259 + MSG_BASE /* Netware */
#define MSG_FILE_TYPES_9 260 + MSG_BASE /* QNX 16-bit */
#define MSG_FILE_TYPES_10 261 + MSG_BASE /* Pharlap */
#define MSG_FILE_TYPES_11 262 + MSG_BASE /* Pharlap */
#define MSG_FILE_TYPES_12 263 + MSG_BASE /* Pharlap */
#define MSG_FILE_TYPES_13 264 + MSG_BASE /* Pharlap */
#define MSG_FILE_TYPES_14 265 + MSG_BASE /* QNX 32-bit */
#define MSG_FILE_TYPES_15 266 + MSG_BASE /* ELF */
#define MSG_FILE_TYPES_16 267 + MSG_BASE /* Windows VXD */
#define MSG_FILE_TYPES_17 268 + MSG_BASE /* DOS 16m */
#define MSG_FILE_TYPES_18 269 + MSG_BASE /* ZDOS */
#define MSG_FILE_TYPES_19 270 + MSG_BASE /* RAW */
#define MSG_FILE_TYPES_20 271 + MSG_BASE /* RDOS flat */
#define MSG_FILE_TYPES_21 272 + MSG_BASE /* RDOS 16-bit */
#define MSG_FILE_TYPES_22 273 + MSG_BASE /* unused bit 22 */
#define MSG_FILE_TYPES_23 274 + MSG_BASE /* unused bit 23 */
#define MSG_FILE_TYPES_24 275 + MSG_BASE /* unused bit 24 */
#define MSG_FILE_TYPES_25 276 + MSG_BASE /* unused bit 25 */
#define MSG_FILE_TYPES_26 277 + MSG_BASE /* unused bit 26 */
#define MSG_FILE_TYPES_27 278 + MSG_BASE /* unused bit 27 */
#define MSG_FILE_TYPES_28 279 + MSG_BASE /* unused bit 28 */
#define MSG_FILE_TYPES_29 280 + MSG_BASE /* unused bit 29 */
#define MSG_FILE_TYPES_30 281 + MSG_BASE /* unused bit 30 */
#define MSG_FILE_TYPES_31 282 + MSG_BASE /* unused bit 31 */
/*
* executable formats reserved range 0-31 (see wlnkmsg.rh)
*/
#define MSG_FILE_TYPES_0 251 + MSG_BASE
#define MSG_FILE_TYPES_1 252 + MSG_BASE
#define MSG_FILE_TYPES_2 253 + MSG_BASE
#define MSG_FILE_TYPES_3 254 + MSG_BASE
#define MSG_FILE_TYPES_4 255 + MSG_BASE
#define MSG_FILE_TYPES_5 256 + MSG_BASE
#define MSG_FILE_TYPES_6 257 + MSG_BASE
#define MSG_FILE_TYPES_7 258 + MSG_BASE
#define MSG_FILE_TYPES_8 259 + MSG_BASE
#define MSG_FILE_TYPES_9 260 + MSG_BASE
#define MSG_FILE_TYPES_10 261 + MSG_BASE
#define MSG_FILE_TYPES_11 262 + MSG_BASE
#define MSG_FILE_TYPES_12 263 + MSG_BASE
#define MSG_FILE_TYPES_13 264 + MSG_BASE
#define MSG_FILE_TYPES_14 265 + MSG_BASE
#define MSG_FILE_TYPES_15 266 + MSG_BASE
#define MSG_FILE_TYPES_16 267 + MSG_BASE
#define MSG_FILE_TYPES_17 268 + MSG_BASE
#define MSG_FILE_TYPES_18 269 + MSG_BASE
#define MSG_FILE_TYPES_19 270 + MSG_BASE
#define MSG_FILE_TYPES_20 271 + MSG_BASE
#define MSG_FILE_TYPES_21 272 + MSG_BASE
#define MSG_FILE_TYPES_22 273 + MSG_BASE
#define MSG_FILE_TYPES_23 274 + MSG_BASE
#define MSG_FILE_TYPES_24 275 + MSG_BASE
#define MSG_FILE_TYPES_25 276 + MSG_BASE
#define MSG_FILE_TYPES_26 277 + MSG_BASE
#define MSG_FILE_TYPES_27 278 + MSG_BASE
#define MSG_FILE_TYPES_28 279 + MSG_BASE
#define MSG_FILE_TYPES_29 280 + MSG_BASE
#define MSG_FILE_TYPES_30 281 + MSG_BASE
#define MSG_FILE_TYPES_31 282 + MSG_BASE

#define MSG_CREATE_TYPE_DLL 283 + MSG_BASE
#define MSG_CREATE_TYPE_EXE 284 + MSG_BASE
#define MSG_IS_A_EXE 285 + MSG_BASE
Expand Down
51 changes: 7 additions & 44 deletions bld/wl/res/wlink.msg
Original file line number Diff line number Diff line change
Expand Up @@ -46,50 +46,13 @@ pick( MSG_IOERRLIST_7, "disk full" ,
"ディスクが一杯です" )
pick( MSG_PRESS_KEY, "press any key to continue" ,
"続行するために何かキーを押して下さい" )
pick( MSG_FILE_TYPES_0, "OS/2" ,
"OS/2" )
pick( MSG_FILE_TYPES_1, "OS/2 linear" ,
"OS/2 リニア" )
pick( MSG_FILE_TYPES_2, "OS/2 linear extended" ,
"OS/2 リニア拡張" )
pick( MSG_FILE_TYPES_3, "Windows" ,
"Windows" )
pick( MSG_FILE_TYPES_4, "PE" ,
"PE" )
pick( MSG_FILE_TYPES_5, "DOS" ,
"DOS" )
pick( MSG_FILE_TYPES_6, "DOS .COM" ,
"DOS .COM" )
pick( MSG_FILE_TYPES_7, "DOS overlayed" ,
"DOS オーバレイ" )
pick( MSG_FILE_TYPES_8, "Novell Netware" ,
"Novell Netware" )
pick( MSG_FILE_TYPES_9, "QNX" ,
"QNX" )
pick( MSG_FILE_TYPES_10, "Phar Lap simple" ,
"Phar Lap シンプル" )
pick( MSG_FILE_TYPES_11, "Phar Lap extended" ,
"Phar Lap 拡張" )
pick( MSG_FILE_TYPES_12, "Phar Lap relocatable" ,
"Phar Lap リロケータブル" )
pick( MSG_FILE_TYPES_13, "Phar Lap segmented" ,
"Phar Lap セグメント" )
pick( MSG_FILE_TYPES_14, "QNX 386" ,
"QNX 386" )
pick( MSG_FILE_TYPES_15, "ELF" ,
"ELF" )
pick( MSG_FILE_TYPES_16, "Windows VxD" ,
"Windows VxD" )
pick( MSG_FILE_TYPES_17, "DOS/16M" ,
"DOS/16M" )
pick( MSG_FILE_TYPES_18, "ZDOS" ,
"ZDOS" )
pick( MSG_FILE_TYPES_19, "RAW Binary Image" ,
"Raw" )
pick( MSG_FILE_TYPES_20, "RDOS" ,
"RDOS" )
pick( MSG_FILE_TYPES_21, "RDOS 16-bit" ,
"RDOS 16-bit" )


#define pick1(a,b,c,d) pick( MSG_FILE_TYPES_##a, c, d )
FORMATS()
#undef pick1


pick( MSG_CREATE_TYPE_DLL, "dynamic link library" ,
"ダイナミック・リンク・ライブラリ" )
pick( MSG_CREATE_TYPE_EXE, "executable" ,
Expand Down
1 change: 1 addition & 0 deletions bld/wl/res/wlink.rc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
/* WLINK RESOURCE FILE */
/*************************************************************************/

#include "_formats.h"
#include "wlnkmsg.rh"
#include "wreslang.rh"

Expand Down

0 comments on commit 10d56d6

Please sign in to comment.