Commit Graph

114 Commits

Author SHA1 Message Date
Nikolay Nikolov
cdf1ceca76 * emit a weak symbol for the exception tag, since that's what the LLVM linker
wants to treat them as shared between .o files
2021-09-28 02:52:40 +03:00
Nikolay Nikolov
82b6450f19 + introduced the AT_WASM_EXCEPTION_TAG asm symbol type, use that for specifying
the parameter to the 'throw' and 'catch' instructions
2021-09-27 17:49:30 +03:00
Nikolay Nikolov
812732cb6a + introduced the AT_WASM_GLOBAL asm symbol type 2021-09-27 02:52:29 +03:00
Nikolay Nikolov
83f2f7bf37 + introduced TObjData.SymbolPairDefine, to allow custom handling of symbol
pairs in the internal object writer
2021-09-26 03:56:56 +03:00
florian
637976e83f * patch by Marģers to unify internal error numbers, resolves #37888
git-svn-id: trunk@47103 -
2020-10-13 19:59:01 +00:00
pierre
64da07da48 Add conversion from "$" to "." for i386-watcom target and avoid iteration if no char modification is wanted in ApplyAsmSymbolRestrictions function
git-svn-id: trunk@47012 -
2020-09-30 12:16:21 +00:00
nickysn
3d81dd0b00 * ReplaceForbiddenAsmSymbolChars renamed ApplyAsmSymbolRestrictions, because now it also applies the
label length limit

git-svn-id: branches/z80@45085 -
2020-04-26 10:42:07 +00:00
nickysn
a8fe46c0f5 + introduced labelmaxlen in tasminfo and added code in ReplaceForbiddenAsmSymbolChars that limits the
output label to that length

git-svn-id: branches/z80@45066 -
2020-04-25 12:59:25 +00:00
florian
245b58c249 + support for arm attributes
* abi notes fixed

git-svn-id: trunk@43157 -
2019-10-09 17:45:40 +00:00
Jonas Maebe
dcf4e4cb2c * support taking the address of labels defined in assembler blocks in the
LLVM code genrator (for the rtti unit's thunk hacking)

git-svn-id: trunk@42969 -
2019-09-09 18:33:33 +00:00
Jonas Maebe
3fee990218 * on Mach-O, PECOFF and ELF platforms, write local symbols as hidden/
private_extern (or plain global in case of PECOFF, as the effect is
    the same there): visible across object files, but they become local
    when linked into a binary/library. This enables cross-unit inlining
    of functions accessig implementation-only symbols.

git-svn-id: trunk@42340 -
2019-07-07 21:33:43 +00:00
Jonas Maebe
3a1fb45315 * synchronised with trunk till r41976
git-svn-id: branches/debug_eh@41977 -
2019-05-02 19:44:41 +00:00
Jonas Maebe
8d19bb12a2 * moved sleb/uleb128 helpers to cutils and use SarInt64() intrinsic (based on
patch by J. Gareth Moreton, mantis #35327)

git-svn-id: trunk@41917 -
2019-04-21 10:07:42 +00:00
florian
27ab140dd9 + gcc_except_table section
+ support exception related sections in the default LD linker script

git-svn-id: branches/debug_eh@41285 -
2019-02-10 17:57:48 +00:00
nickysn
29558a74cd + support exporting labels from asm blocks in intel syntax asm blocks via the
'public' directive

git-svn-id: trunk@37530 -
2017-10-30 16:44:13 +00:00
svenbarth
c1db48c8c6 * add ability to disable the generation of an indirect symbol if needed (useful if that's done by the constant builder)
Note: I'm not yet really happy with both AT_DATA_FORCEINDIRECT and AT_DATA_NOINDIRECT; maybe I should replace them with flags or something like that...

git-svn-id: trunk@35366 -
2017-01-29 17:42:00 +00:00
Jonas Maebe
a0efde8167 * automatically generate necessary indirect symbols when a new assembler
symbol is defined
   o removed all places where AB_INDIRECT symbols were explicitly generated
   o only generate AB_INDIRECT symbols for AT_DATA on systems_indirect_var_imports
   o for some symbols an indirect symbol is always required (because they are
     dereferenced by code in RTL units) -> use new AT_DATA_FORCEINDIRECT type

git-svn-id: trunk@34165 -
2016-07-20 20:53:03 +00:00
Jonas Maebe
5ac99f62e9 + AT_METADATA symbol type for data that is unrelated to the program
exectuion (such as debug information). It's handled the same as
    AT_DATA by assemblers/assembler writers.

git-svn-id: trunk@34149 -
2016-07-19 11:57:31 +00:00
florian
90b284e169 + generate .debug_aranges sections for dwarf debug info: enables faster address to debug info translation
git-svn-id: trunk@33454 -
2016-04-08 20:19:59 +00:00
svenbarth
3971ba7898 Provide basic facilities to handle indirect symbols that are needed for proper dynamic packages support.
symconst.pas:
  + new constant suffix_indirect which will be used to denote indirect symbols
aasmbase.pas:
  * TAsmsymbind: extend by AB_INDIRECT (which is used to define an indirect symbol) and AB_EXTERNAL_INDIRECT (which is used when an unknown indirect symbol is requested)
  * asmsymbindname: adjust for TAsmsymbind changes
  + new constant asmsymbindindirect which is a set of both indirect asm symbol binds
aasmdata.pas, TAsmData:
  * DefineAsmSymbolByClass: adjust to correctly declare an indirect symbol (with suffix_indirect) if one of the indirect asm symbol binds is used
  * RefAsmSymbol: extend by a boolean parameter which is used to request an indirect symbol (usually AB_EXTERNAL_INDIRECT instead of AB_EXTERNAL)

git-svn-id: trunk@33278 -
2016-03-18 21:34:17 +00:00
Jonas Maebe
3aba28deb7 * factored out the generation of the Objective-C section names, so we can
reuse them for llvm too

git-svn-id: trunk@32885 -
2016-01-07 22:06:21 +00:00
Jonas Maebe
be2f63aa97 + tasmlabel.createstatic() constructor for creating static data labels
(object-local, but not starting with (.)L, so they're still treated as
    the start of a subsection by Darwin's linker when dead-stripping)
  + tasmdata.getstaticdatalabel() that uses the above

git-svn-id: branches/hlcgllvm@30338 -
2015-03-27 21:25:40 +00:00
Jonas Maebe
67b8aceaee * synchronized with privatetrunk till r30095
git-svn-id: branches/hlcgllvm@30101 -
2015-03-05 20:32:15 +00:00
pierre
ea3bc10fd1 Change ReplaceForbiddenAsmSymbolChars to use ansistrings to avoid shortstring overflow
git-svn-id: trunk@29471 -
2015-01-14 13:43:14 +00:00
pierre
831a876ec5 Added asmsymbindname array name for TAsmSymBind type
for use in new messages commits 29444-29445

git-svn-id: trunk@29446 -
2015-01-12 10:15:17 +00:00
Jonas Maebe
7949bebb8d * synchronised with r28168 of trunk
git-svn-id: branches/hlcgllvm@28169 -
2014-07-05 21:30:28 +00:00
Jonas Maebe
39074edf10 - removed the globalsymbolmangleprefix/suffix constants that were added for
llvm
  * instead, add LLVM-specific name mangling based on the asmsymbol's bind
    and typ whenever we write out its name

git-svn-id: branches/hlcgllvm@28166 -
2014-07-05 15:44:16 +00:00
nickysn
7cfd7a66cd + create a special 'heap' segment with reserved space equal to heapsize (i.e.
the value set by -Ch or the second parameter to the $M directive). This is
  equivalent to the heapmin value in Turbo Pascal 7 and ensures that the program
  has at least this amount of heap space available (otherwise DOS will show a
  'not enough memory' error and will refuse to load the program).

git-svn-id: trunk@28002 -
2014-06-19 14:14:01 +00:00
nickysn
3cc8ff11e3 + generate the stack segment for i8086 far data memory models from within fpc
itself (instead of having a fixed 16k stack in the startup code). This allows
  setting the stack size in these models with the -Cs option.

git-svn-id: trunk@27820 -
2014-05-27 23:29:50 +00:00
Jonas Maebe
b82053ef40 * reworked handling of defined/declared symbols in llvm: we now automatically
generate declarations when external symbols are referred in a taillvm
    instruction
  * added "declared" field to tasmsymbol for llvm to make avoid declaring a
    symbol multiple times (harmless, but unnecessary)
  * all kinds of declarations/definitions are now handled using the new
    taillvmdecl, the old separate types have been removed

git-svn-id: branches/hlcgllvm@27010 -
2014-03-06 21:42:03 +00:00
Jonas Maebe
6b7ed0234c + new globalsymbolmangleprefix/suffix constant set to '@"\01' resp. '"'
for llvm, and empty for other targets:
   o the '@' is required to mark a global/static symbol identifier in llvm
   o the double quotes are required in case special characters are involved
   o the \01 means that the name should not be mangled by llvm (e.g., by
     default it still adds the C-prefix to all symbol names, and replaces
     some special characters with alternatives)
  * apply this prefix/suffix in all name mangling routines

git-svn-id: branches/hlcgllvm@26995 -
2014-03-06 21:41:09 +00:00
florian
1f8192b6da * indention fixes
* detabbed

git-svn-id: trunk@24412 -
2013-05-03 20:41:55 +00:00
florian
ca5fabda6d * cleanup some unused units from uses clauses
git-svn-id: trunk@22433 -
2012-09-21 18:53:46 +00:00
sergei
fde944bf5d + Declare AT_TLS and AT_GNU_IFUNC symbol types, these are needed to handle object files created by gcc in ELF internal linker.
* TExeOutput.FixupSymbols:
  + Collect AT_GNU_IFUNC symbols in IndirectObjSymbols list for further processing by ELF back-end.
  * Do not overwrite bind and size while fixing AB_COMMON symbols, this removes need in storing symbol size in every relocation and dedicated handling of oso_common section.
  * Remove symbols with objsection<>nil from lists, so calling FixupSymbols several times skips already processed symbols.

git-svn-id: trunk@22393 -
2012-09-14 17:22:48 +00:00
pierre
68d7e943c8 + Add global_used callback procedure
git-svn-id: trunk@21778 -
2012-07-04 16:31:20 +00:00
Jonas Maebe
aee5380ae0 * merged trunk up to r20882
o support for the new codepage-aware ansistrings in the jvm branch
   o empty ansistrings are now always represented by a nil pointer rather than
     by an empty string, because an empty string also has a code page which
     can confuse code (although this will make ansistrings harder to use
     in Java code)
   o more string helpers code shared between the general and jvm rtl
   o support for indexbyte/word in the jvm rtl (warning: first parameter
     is an open array rather than an untyped parameter there, so
     indexchar(pcharvar^,10,0) will be equivalent to
     indexchar[pcharvar^],10,0) there, which is different from what is
     intended; changing it to an untyped parameter wouldn't help though)
   o default() support is not yet complete
   o calling fpcres is currently broken due to limitations in
     sysutils.executeprocess() regarding handling unix quoting and
     the compiler using the same command lines for scripts and directly
     calling external programs
   o compiling the Java compiler currently requires adding ALLOW_WARNINGS=1
     to the make command line

git-svn-id: branches/jvmbackend@20887 -
2012-04-15 15:54:10 +00:00
Jonas Maebe
ac43eb9b70 + generic implementation of ReplaceForbiddenAsmSymbolChars() instead
of the AVR-specific ifdef'ed variant
   o since the only special character we use in mangled names on all platforms
     is $, added a new field to tasminfo called "dollarsign" that holds the
     character $'s should be replaced with (if it doesn't have to be replaced,
     leave it at $)

git-svn-id: trunk@20801 -
2012-04-11 18:01:57 +00:00
florian
cf0d808708 + avr assemblers do not convert automatically cond. branches with too large jump distances into an unconditional branch and a reverse condition branch, so fpc does this now
git-svn-id: trunk@18837 -
2011-08-24 22:29:50 +00:00
Jonas Maebe
ce88df680b + symansistr conditional define that, when activated, makes the symbol/
mangled name handling ansistring rather than pshortstring based (required
    for JVM target; little effect on speed, some extra memory usage)

git-svn-id: branches/jvmbackend@18597 -
2011-08-20 08:13:50 +00:00
florian
c97869bd89 * merge user sections support branch
git-svn-id: trunk@17285 -
2011-04-10 18:08:59 +00:00
armin
7eace122dc internal linker support for creating novell netware loadable modules
git-svn-id: trunk@17192 -
2011-03-27 14:47:25 +00:00
florian
f328b6d635 + user section type
+ parsing of section directive for variables
  + section test
  + write section names in the assembler/binary writers correctly
  * allow section only after ; and for embedded targets

git-svn-id: branches/usersections@17154 -
2011-03-20 15:42:28 +00:00
mazen
b127fc154a * Fixed spell error revealed by lintian.
git-svn-id: trunk@16094 -
2010-10-06 20:33:57 +00:00
Jonas Maebe
28cd8271c9 * initial version of internal Mach-O/i386 assembler by Dmitry Boyarintsev
(mantis #15163)

git-svn-id: trunk@14628 -
2010-01-12 19:52:55 +00:00
Jonas Maebe
edacea82be * changed assembler directives for darwin lazy/non-lazy symbol pointers
and init/fini routines into their section equivalents (based on patch
    by Dmitry Boyarintsev, mantis #15037)

git-svn-id: trunk@14128 -
2009-11-09 22:20:01 +00:00
Jonas Maebe
0c675a4039 * the objc1 unit has been renamed to objc
* the objc unit links against the Foundation instead of against the Cocoa
    framework, and inludes an interface to either the fragile or non-fragile
    obj-c run time depending on the target platform
  + support for the non-fragile Objective-C runtime/ABI, as used on Mac OS X
    for ARM (iPhone) 64 bit (PowerPC/64, x86_64) -- all these targets now
    are now also supported for the objectivec1 modeswitch
  + support for private_extern symbol bindings, required for the above
  * mark objcclasses that are declared in the implementation section of a
    unit as "hidden" (not sure what the effect is, since the Objective-C
    runtime does not seem to do anything with this flag)
  * enabled all obj-c tests for the newly supported platforms

git-svn-id: branches/objc@13763 -
2009-09-27 15:24:50 +00:00
Jonas Maebe
ec8fee45fe * do not access local data via the GOT on x86_64, because
a) it's unnecessary
   b) it's slower than "direct" RIP-relative accessing
   c) it's not supported on darwin/x86_64 in certain cases
  * never use absolute addressing on darwin/x86_64 (like on win64)
  * when not generating PIC, make sure that a_loadaddr_ref_reg on x86_64
    also uses RIP-relative addressing for darwin/x86_64 and win64

git-svn-id: trunk@13760 -
2009-09-27 13:43:56 +00:00
Jonas Maebe
6165536b5e + added {$modeswitch objectivec1}/-Mobjectivec1 mode switch to enable
the use of Objective-C 1.0 constructs. Because it is a mode switch, it
    can be used cumulatively with every syntax mode. Note that a {$mode xxx}
    statement resets all mode switches as well, so you cannot use the
    -Mobjectivec1 variant if you have such a statement in a unit. This
    modeswitch is currently only enabled for Darwin/PowerPC and Darwin/i386,
    as the backend support is not yet implemented for other platforms.
  + implemented selector() statement that can be used to create an Objective-C
    selector for the message with the specified *constant* name (in the future,
    it will also work for Objective-C method identifiers)
  + added SEL type to the system unit (the selector() statement returns it)
  + added all Objective-C segments to the assembler writers
  + (currently mostly dummy) objc1 unit that is automatically included if the
    {$modeswitch objectivec1} statement is used
  + some tests for the selector() statement

git-svn-id: trunk@12870 -
2009-03-08 18:40:32 +00:00
Jonas Maebe
a23630260b + "weakexternal" support for imported procedures and variables.
the syntax is exactly the same as for "external", except for
    the keyword. It is currently only active for Darwin targets.
    It should also work at least for Linux targets, but only with
    the GNU assembler (which is why it is not activated there)
  + test for this functionality

git-svn-id: trunk@12009 -
2008-11-01 18:38:32 +00:00
peter
9f0ca44c94 * new tf_smartlink_library flag
* use create_smartlink[_sections|_library] to check what to 
    do for smartlinking

git-svn-id: trunk@8715 -
2007-10-01 16:55:08 +00:00