The Oxford English Dictionary (TOED) defines 'etymology' as (quote): "the process of tracing out and describing the elements of a word with their modifications of form and sense."
Here we have the basic word 'hang'...around for the past 1000 years...with the suffix modification 'er' changing the meaning to something dangling...since the 1400s...with the hyphenated '-on'...since the 1500s.
All of these elements/modifications - root, suffix, hyphenation - are parts of the etymology of the word 'hanger-on'.
As to its meaning, I was a tad over-enthusiastic when I said it had never meant anything else other than what we now use it to mean...for which I apologise.
The original and current meaning...which is what I was getting at...are the same. I'm sure we can both agree on what that is, but apart from that it has over the centuries meant two other things. Firstly, an adjunct or appendage, for example an additional phrase in a document and, secondly, a worker who loaded tubs of coal into the cage in a mine-shaft.
TOED has no record of its ever having meant someone clinging to a condemned person's legs on the gallows. Given that a key task the lexicographers at Oxford have had over the many decades of the dictionary's development has been finding all of a word's usages, it is - if it were true - quite startling that they have never found any such reference.
Re 'posh' and 'square meal', post a question of your own and I'll provide the evidence that neither has anything whatever to do with ships. I don't want to take up any more of Lyn's thread here. (My apologies, Lyn, for space already hijacked!)